From 0200fb885ff82f4960f401169d728b48c9d900cf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:50:13 +0000 Subject: [PATCH 01/32] chore: sync repo --- .github/workflows/ci.yml | 48 + .github/workflows/gempush.yml | 33 - .github/workflows/test.yml | 30 - .gitignore | 33 +- .rubocop.yml | 292 +++ .ruby-version | 1 + .solargraph.yml | 11 + .stats.yml | 4 + .yardopts | 6 + CONTRIBUTING.md | 125 ++ DEVELOPMENT.md | 20 - Gemfile | 48 +- Gemfile.lock | 226 +++ LICENSE | 222 ++- README.md | 957 ++-------- Rakefile | 169 +- SECURITY.md | 27 + Steepfile | 15 + bin/publish-gem | 9 + bin/test | 5 - codecov.yml | 22 - examples/.keep | 4 + imagekit.gemspec | 28 + imagekitio.gemspec | 34 - lib/active_storage/active_storage.rb | 7 - lib/active_storage/service/ik_file.rb | 115 -- .../service/image_kit_io_service.rb | 188 -- lib/carrierwave/carrierwave.rb | 83 - lib/carrierwave/storage/ik_file.rb | 51 - lib/carrierwave/storage/imagekit_store.rb | 68 - lib/carrierwave/support/uri_filename.rb | 12 - lib/imagekit.rb | 174 ++ lib/imagekit/client.rb | 126 ++ lib/imagekit/errors.rb | 214 +++ lib/imagekit/file_part.rb | 55 + lib/imagekit/internal.rb | 20 + .../internal/transport/base_client.rb | 563 ++++++ .../transport/pooled_net_requester.rb | 201 +++ lib/imagekit/internal/type/array_of.rb | 168 ++ lib/imagekit/internal/type/base_model.rb | 530 ++++++ lib/imagekit/internal/type/base_page.rb | 55 + lib/imagekit/internal/type/boolean.rb | 77 + lib/imagekit/internal/type/converter.rb | 327 ++++ lib/imagekit/internal/type/enum.rb | 156 ++ lib/imagekit/internal/type/file_input.rb | 108 ++ lib/imagekit/internal/type/hash_of.rb | 188 ++ .../internal/type/request_parameters.rb | 42 + lib/imagekit/internal/type/union.rb | 250 +++ lib/imagekit/internal/type/unknown.rb | 81 + lib/imagekit/internal/util.rb | 914 ++++++++++ lib/imagekit/models.rb | 147 ++ .../models/accounts/origin_create_params.rb | 16 + .../models/accounts/origin_delete_params.rb | 16 + .../models/accounts/origin_get_params.rb | 16 + .../models/accounts/origin_list_params.rb | 16 + .../models/accounts/origin_list_response.rb | 10 + .../models/accounts/origin_request.rb | 547 ++++++ .../models/accounts/origin_response.rb | 567 ++++++ .../models/accounts/origin_update_params.rb | 16 + .../accounts/url_endpoint_create_params.rb | 16 + .../accounts/url_endpoint_delete_params.rb | 16 + .../accounts/url_endpoint_get_params.rb | 16 + .../accounts/url_endpoint_list_params.rb | 16 + .../accounts/url_endpoint_list_response.rb | 11 + .../models/accounts/url_endpoint_request.rb | 110 ++ .../models/accounts/url_endpoint_response.rb | 123 ++ .../accounts/url_endpoint_update_params.rb | 16 + .../models/accounts/usage_get_params.rb | 37 + .../models/accounts/usage_get_response.rb | 51 + lib/imagekit/models/asset_list_params.rb | 158 ++ lib/imagekit/models/asset_list_response.rb | 24 + lib/imagekit/models/base_overlay.rb | 21 + .../models/beta/v2/file_upload_params.rb | 574 ++++++ .../models/beta/v2/file_upload_response.rb | 397 ++++ .../cache/invalidation_create_params.rb | 27 + .../cache/invalidation_create_response.rb | 23 + .../models/cache/invalidation_get_params.rb | 16 + .../models/cache/invalidation_get_response.rb | 35 + lib/imagekit/models/custom_metadata_field.rb | 243 +++ .../custom_metadata_field_create_params.rb | 238 +++ .../custom_metadata_field_delete_params.rb | 14 + .../custom_metadata_field_delete_response.rb | 10 + .../custom_metadata_field_list_params.rb | 25 + .../custom_metadata_field_list_response.rb | 8 + .../custom_metadata_field_update_params.rb | 212 +++ lib/imagekit/models/file.rb | 269 +++ lib/imagekit/models/file_copy_params.rb | 43 + lib/imagekit/models/file_copy_response.rb | 10 + lib/imagekit/models/file_delete_params.rb | 14 + lib/imagekit/models/file_get_params.rb | 14 + lib/imagekit/models/file_move_params.rb | 33 + lib/imagekit/models/file_move_response.rb | 10 + lib/imagekit/models/file_rename_params.rb | 61 + lib/imagekit/models/file_rename_response.rb | 21 + lib/imagekit/models/file_update_params.rb | 312 ++++ lib/imagekit/models/file_update_response.rb | 104 ++ lib/imagekit/models/file_upload_params.rb | 607 +++++++ lib/imagekit/models/file_upload_response.rb | 391 ++++ .../models/files/bulk_add_tags_params.rb | 35 + .../models/files/bulk_add_tags_response.rb | 24 + .../models/files/bulk_delete_params.rb | 27 + .../models/files/bulk_delete_response.rb | 24 + .../files/bulk_remove_ai_tags_params.rb | 35 + .../files/bulk_remove_ai_tags_response.rb | 24 + .../models/files/bulk_remove_tags_params.rb | 35 + .../models/files/bulk_remove_tags_response.rb | 24 + .../files/metadata_get_from_url_params.rb | 28 + .../models/files/metadata_get_params.rb | 16 + .../models/files/version_delete_params.rb | 22 + .../models/files/version_delete_response.rb | 12 + .../models/files/version_get_params.rb | 22 + .../models/files/version_list_params.rb | 16 + .../models/files/version_list_response.rb | 10 + .../models/files/version_restore_params.rb | 22 + lib/imagekit/models/folder.rb | 76 + lib/imagekit/models/folder_copy_params.rb | 44 + lib/imagekit/models/folder_copy_response.rb | 23 + lib/imagekit/models/folder_create_params.rb | 43 + lib/imagekit/models/folder_create_response.rb | 10 + lib/imagekit/models/folder_delete_params.rb | 25 + lib/imagekit/models/folder_delete_response.rb | 10 + lib/imagekit/models/folder_move_params.rb | 34 + lib/imagekit/models/folder_move_response.rb | 23 + lib/imagekit/models/folder_rename_params.rb | 59 + lib/imagekit/models/folder_rename_response.rb | 23 + lib/imagekit/models/folders/job_get_params.rb | 16 + .../models/folders/job_get_response.rb | 74 + lib/imagekit/models/image_overlay.rb | 66 + lib/imagekit/models/metadata.rb | 483 +++++ lib/imagekit/models/overlay.rb | 28 + lib/imagekit/models/overlay_position.rb | 101 ++ lib/imagekit/models/overlay_timing.rb | 97 + lib/imagekit/models/solid_color_overlay.rb | 42 + .../solid_color_overlay_transformation.rb | 135 ++ lib/imagekit/models/src_options.rb | 96 + lib/imagekit/models/streaming_resolution.rb | 22 + lib/imagekit/models/subtitle_overlay.rb | 64 + .../models/subtitle_overlay_transformation.rb | 113 ++ lib/imagekit/models/text_overlay.rb | 64 + .../models/text_overlay_transformation.rb | 267 +++ lib/imagekit/models/transformation.rb | 1096 +++++++++++ .../models/transformation_position.rb | 19 + .../models/unsafe_unwrap_webhook_event.rb | 36 + lib/imagekit/models/unwrap_webhook_event.rb | 36 + .../upload_post_transform_error_event.rb | 190 ++ .../upload_post_transform_success_event.rb | 153 ++ .../upload_pre_transform_error_event.rb | 118 ++ .../upload_pre_transform_success_event.rb | 467 +++++ lib/imagekit/models/video_overlay.rb | 64 + .../video_transformation_accepted_event.rb | 289 +++ .../video_transformation_error_event.rb | 336 ++++ .../video_transformation_ready_event.rb | 390 ++++ .../models/webhook_unsafe_unwrap_params.rb | 14 + lib/imagekit/models/webhook_unwrap_params.rb | 14 + lib/imagekit/request_options.rb | 77 + lib/imagekit/resources/accounts.rb | 26 + lib/imagekit/resources/accounts/origins.rb | 135 ++ .../resources/accounts/url_endpoints.rb | 151 ++ lib/imagekit/resources/accounts/usage.rb | 46 + lib/imagekit/resources/assets.rb | 54 + lib/imagekit/resources/beta.rb | 18 + lib/imagekit/resources/beta/v2.rb | 20 + lib/imagekit/resources/beta/v2/files.rb | 110 ++ lib/imagekit/resources/cache.rb | 18 + lib/imagekit/resources/cache/invalidation.rb | 66 + .../resources/custom_metadata_fields.rb | 126 ++ lib/imagekit/resources/files.rb | 300 ++++ lib/imagekit/resources/files/bulk.rb | 131 ++ lib/imagekit/resources/files/metadata.rb | 69 + lib/imagekit/resources/files/versions.rb | 132 ++ lib/imagekit/resources/folders.rb | 166 ++ lib/imagekit/resources/folders/job.rb | 39 + lib/imagekit/resources/webhooks.rb | 30 + lib/imagekit/version.rb | 5 + lib/imagekitio.rb | 13 - lib/imagekitio/api_service/bulk.rb | 58 - .../api_service/custom_metadata_field.rb | 52 - lib/imagekitio/api_service/file.rb | 221 --- lib/imagekitio/api_service/folder.rb | 49 - lib/imagekitio/base.rb | 12 - lib/imagekitio/client.rb | 202 --- lib/imagekitio/configurable.rb | 43 - lib/imagekitio/constant.rb | 36 - lib/imagekitio/constants/default.rb | 22 - lib/imagekitio/constants/error.rb | 69 - lib/imagekitio/constants/file.rb | 11 - .../constants/supported_transformation.rb | 39 - lib/imagekitio/constants/url.rb | 14 - lib/imagekitio/errors.rb | 4 - lib/imagekitio/railtie.rb | 4 - lib/imagekitio/request.rb | 98 - lib/imagekitio/sdk/version.rb | 5 - lib/imagekitio/url.rb | 216 --- lib/imagekitio/utils/calculation.rb | 45 - lib/imagekitio/utils/formatter.rb | 48 - lib/imagekitio/utils/option_validator.rb | 36 - lib/tasks/imagekitio/imagekitio_tasks.rake | 4 - manifest.yaml | 15 + rbi/imagekit/client.rbi | 90 + rbi/imagekit/errors.rbi | 178 ++ rbi/imagekit/file_part.rbi | 37 + rbi/imagekit/internal.rbi | 16 + .../internal/transport/base_client.rbi | 293 +++ .../transport/pooled_net_requester.rbi | 79 + rbi/imagekit/internal/type/array_of.rbi | 104 ++ rbi/imagekit/internal/type/base_model.rbi | 302 ++++ rbi/imagekit/internal/type/base_page.rbi | 42 + rbi/imagekit/internal/type/boolean.rbi | 58 + rbi/imagekit/internal/type/converter.rbi | 216 +++ rbi/imagekit/internal/type/enum.rbi | 82 + rbi/imagekit/internal/type/file_input.rbi | 59 + rbi/imagekit/internal/type/hash_of.rbi | 104 ++ .../internal/type/request_parameters.rbi | 29 + rbi/imagekit/internal/type/union.rbi | 128 ++ rbi/imagekit/internal/type/unknown.rbi | 58 + rbi/imagekit/internal/util.rbi | 487 +++++ rbi/imagekit/models.rbi | 121 ++ .../models/accounts/origin_create_params.rbi | 32 + .../models/accounts/origin_delete_params.rbi | 32 + .../models/accounts/origin_get_params.rbi | 32 + .../models/accounts/origin_list_params.rbi | 32 + .../models/accounts/origin_list_response.rbi | 15 + .../models/accounts/origin_request.rbi | 775 ++++++++ .../models/accounts/origin_response.rbi | 718 ++++++++ .../models/accounts/origin_update_params.rbi | 32 + .../accounts/url_endpoint_create_params.rbi | 32 + .../accounts/url_endpoint_delete_params.rbi | 32 + .../accounts/url_endpoint_get_params.rbi | 32 + .../accounts/url_endpoint_list_params.rbi | 32 + .../accounts/url_endpoint_list_response.rbi | 15 + .../models/accounts/url_endpoint_request.rbi | 218 +++ .../models/accounts/url_endpoint_response.rbi | 213 +++ .../accounts/url_endpoint_update_params.rbi | 32 + .../models/accounts/usage_get_params.rbi | 60 + .../models/accounts/usage_get_response.rbi | 89 + rbi/imagekit/models/asset_list_params.rbi | 269 +++ rbi/imagekit/models/asset_list_response.rbi | 28 + rbi/imagekit/models/base_overlay.rbi | 44 + .../models/beta/v2/file_upload_params.rbi | 1134 ++++++++++++ .../models/beta/v2/file_upload_response.rbi | 764 ++++++++ .../cache/invalidation_create_params.rbi | 45 + .../cache/invalidation_create_response.rbi | 37 + .../models/cache/invalidation_get_params.rbi | 32 + .../cache/invalidation_get_response.rbi | 93 + rbi/imagekit/models/custom_metadata_field.rbi | 414 +++++ .../custom_metadata_field_create_params.rbi | 443 +++++ .../custom_metadata_field_delete_params.rbi | 30 + .../custom_metadata_field_delete_response.rbi | 23 + .../custom_metadata_field_list_params.rbi | 49 + .../custom_metadata_field_list_response.rbi | 11 + .../custom_metadata_field_update_params.rbi | 376 ++++ rbi/imagekit/models/file.rbi | 379 ++++ rbi/imagekit/models/file_copy_params.rbi | 66 + rbi/imagekit/models/file_copy_response.rbi | 20 + rbi/imagekit/models/file_delete_params.rbi | 27 + rbi/imagekit/models/file_get_params.rbi | 27 + rbi/imagekit/models/file_move_params.rbi | 51 + rbi/imagekit/models/file_move_response.rbi | 20 + rbi/imagekit/models/file_rename_params.rbi | 102 ++ rbi/imagekit/models/file_rename_response.rbi | 35 + rbi/imagekit/models/file_update_params.rbi | 656 +++++++ rbi/imagekit/models/file_update_response.rbi | 322 ++++ rbi/imagekit/models/file_upload_params.rbi | 1165 ++++++++++++ rbi/imagekit/models/file_upload_response.rbi | 743 ++++++++ .../models/files/bulk_add_tags_params.rbi | 56 + .../models/files/bulk_add_tags_response.rbi | 41 + .../models/files/bulk_delete_params.rbi | 48 + .../models/files/bulk_delete_response.rbi | 41 + .../files/bulk_remove_ai_tags_params.rbi | 56 + .../files/bulk_remove_ai_tags_response.rbi | 41 + .../models/files/bulk_remove_tags_params.rbi | 56 + .../files/bulk_remove_tags_response.rbi | 41 + .../files/metadata_get_from_url_params.rbi | 47 + .../models/files/metadata_get_params.rbi | 32 + .../models/files/version_delete_params.rbi | 40 + .../models/files/version_delete_response.rbi | 25 + .../models/files/version_get_params.rbi | 40 + .../models/files/version_list_params.rbi | 32 + .../models/files/version_list_response.rbi | 13 + .../models/files/version_restore_params.rbi | 40 + rbi/imagekit/models/folder.rbi | 117 ++ rbi/imagekit/models/folder_copy_params.rbi | 68 + rbi/imagekit/models/folder_copy_response.rbi | 33 + rbi/imagekit/models/folder_create_params.rbi | 71 + .../models/folder_create_response.rbi | 23 + rbi/imagekit/models/folder_delete_params.rbi | 40 + .../models/folder_delete_response.rbi | 23 + rbi/imagekit/models/folder_move_params.rbi | 53 + rbi/imagekit/models/folder_move_response.rbi | 33 + rbi/imagekit/models/folder_rename_params.rbi | 98 + .../models/folder_rename_response.rbi | 33 + .../models/folders/job_get_params.rbi | 29 + .../models/folders/job_get_response.rbi | 171 ++ rbi/imagekit/models/image_overlay.rbi | 106 ++ rbi/imagekit/models/metadata.rbi | 804 +++++++++ rbi/imagekit/models/overlay.rbi | 28 + rbi/imagekit/models/overlay_position.rbi | 146 ++ rbi/imagekit/models/overlay_timing.rbi | 133 ++ rbi/imagekit/models/solid_color_overlay.rbi | 76 + .../solid_color_overlay_transformation.rbi | 211 +++ rbi/imagekit/models/src_options.rbi | 156 ++ rbi/imagekit/models/streaming_resolution.rbi | 36 + rbi/imagekit/models/subtitle_overlay.rbi | 111 ++ .../subtitle_overlay_transformation.rbi | 215 +++ rbi/imagekit/models/text_overlay.rbi | 106 ++ .../models/text_overlay_transformation.rbi | 441 +++++ rbi/imagekit/models/transformation.rbi | 1600 +++++++++++++++++ .../models/transformation_position.rbi | 28 + .../models/unsafe_unwrap_webhook_event.rbi | 31 + rbi/imagekit/models/unwrap_webhook_event.rbi | 29 + .../upload_post_transform_error_event.rbi | 438 +++++ .../upload_post_transform_success_event.rbi | 335 ++++ .../upload_pre_transform_error_event.rbi | 248 +++ .../upload_pre_transform_success_event.rbi | 877 +++++++++ rbi/imagekit/models/video_overlay.rbi | 102 ++ .../video_transformation_accepted_event.rbi | 664 +++++++ .../video_transformation_error_event.rbi | 774 ++++++++ .../video_transformation_ready_event.rbi | 866 +++++++++ .../models/webhook_unsafe_unwrap_params.rbi | 30 + rbi/imagekit/models/webhook_unwrap_params.rbi | 27 + rbi/imagekit/request_options.rbi | 59 + rbi/imagekit/resources/accounts.rbi | 21 + rbi/imagekit/resources/accounts/origins.rbi | 111 ++ .../resources/accounts/url_endpoints.rbi | 129 ++ rbi/imagekit/resources/accounts/usage.rbi | 36 + rbi/imagekit/resources/assets.rbi | 74 + rbi/imagekit/resources/beta.rbi | 15 + rbi/imagekit/resources/beta/v2.rbi | 17 + rbi/imagekit/resources/beta/v2/files.rbi | 193 ++ rbi/imagekit/resources/cache.rbi | 15 + rbi/imagekit/resources/cache/invalidation.rbi | 44 + .../resources/custom_metadata_fields.rbi | 95 + rbi/imagekit/resources/files.rbi | 367 ++++ rbi/imagekit/resources/files/bulk.rbi | 88 + rbi/imagekit/resources/files/metadata.rbi | 49 + rbi/imagekit/resources/files/versions.rbi | 89 + rbi/imagekit/resources/folders.rbi | 146 ++ rbi/imagekit/resources/folders/job.rbi | 29 + rbi/imagekit/resources/webhooks.rbi | 50 + rbi/imagekit/version.rbi | 5 + scripts/bootstrap | 16 + scripts/format | 9 + scripts/lint | 9 + scripts/mock | 41 + scripts/test | 56 + sig/imagekit/client.rbs | 45 + sig/imagekit/errors.rbs | 110 ++ sig/imagekit/file_part.rbs | 21 + sig/imagekit/internal.rbs | 9 + .../internal/transport/base_client.rbs | 131 ++ .../transport/pooled_net_requester.rbs | 45 + sig/imagekit/internal/type/array_of.rbs | 48 + sig/imagekit/internal/type/base_model.rbs | 102 ++ sig/imagekit/internal/type/base_page.rbs | 24 + sig/imagekit/internal/type/boolean.rbs | 26 + sig/imagekit/internal/type/converter.rbs | 79 + sig/imagekit/internal/type/enum.rbs | 32 + sig/imagekit/internal/type/file_input.rbs | 25 + sig/imagekit/internal/type/hash_of.rbs | 48 + .../internal/type/request_parameters.rbs | 17 + sig/imagekit/internal/type/union.rbs | 52 + sig/imagekit/internal/type/unknown.rbs | 26 + sig/imagekit/internal/util.rbs | 185 ++ sig/imagekit/models.rbs | 107 ++ .../models/accounts/origin_create_params.rbs | 17 + .../models/accounts/origin_delete_params.rbs | 17 + .../models/accounts/origin_get_params.rbs | 17 + .../models/accounts/origin_list_params.rbs | 17 + .../models/accounts/origin_list_response.rbs | 10 + .../models/accounts/origin_request.rbs | 468 +++++ .../models/accounts/origin_response.rbs | 418 +++++ .../models/accounts/origin_update_params.rbs | 17 + .../accounts/url_endpoint_create_params.rbs | 17 + .../accounts/url_endpoint_delete_params.rbs | 17 + .../accounts/url_endpoint_get_params.rbs | 17 + .../accounts/url_endpoint_list_params.rbs | 17 + .../accounts/url_endpoint_list_response.rbs | 10 + .../models/accounts/url_endpoint_request.rbs | 97 + .../models/accounts/url_endpoint_response.rbs | 96 + .../accounts/url_endpoint_update_params.rbs | 17 + .../models/accounts/usage_get_params.rbs | 30 + .../models/accounts/usage_get_response.rbs | 52 + sig/imagekit/models/asset_list_params.rbs | 138 ++ sig/imagekit/models/asset_list_response.rbs | 16 + sig/imagekit/models/base_overlay.rbs | 26 + .../models/beta/v2/file_upload_params.rbs | 433 +++++ .../models/beta/v2/file_upload_response.rbs | 321 ++++ .../cache/invalidation_create_params.rbs | 25 + .../cache/invalidation_create_response.rbs | 17 + .../models/cache/invalidation_get_params.rbs | 17 + .../cache/invalidation_get_response.rbs | 35 + sig/imagekit/models/custom_metadata_field.rbs | 178 ++ .../custom_metadata_field_create_params.rbs | 179 ++ .../custom_metadata_field_delete_params.rbs | 15 + .../custom_metadata_field_delete_response.rbs | 11 + .../custom_metadata_field_list_params.rbs | 25 + .../custom_metadata_field_list_response.rbs | 8 + .../custom_metadata_field_update_params.rbs | 152 ++ sig/imagekit/models/file.rbs | 218 +++ sig/imagekit/models/file_copy_params.rbs | 38 + sig/imagekit/models/file_copy_response.rbs | 11 + sig/imagekit/models/file_delete_params.rbs | 15 + sig/imagekit/models/file_get_params.rbs | 14 + sig/imagekit/models/file_move_params.rbs | 28 + sig/imagekit/models/file_move_response.rbs | 11 + sig/imagekit/models/file_rename_params.rbs | 34 + sig/imagekit/models/file_rename_response.rbs | 15 + sig/imagekit/models/file_update_params.rbs | 272 +++ sig/imagekit/models/file_update_response.rbs | 120 ++ sig/imagekit/models/file_upload_params.rbs | 450 +++++ sig/imagekit/models/file_upload_response.rbs | 317 ++++ .../models/files/bulk_add_tags_params.rbs | 30 + .../models/files/bulk_add_tags_response.rbs | 20 + .../models/files/bulk_delete_params.rbs | 26 + .../models/files/bulk_delete_response.rbs | 20 + .../files/bulk_remove_ai_tags_params.rbs | 30 + .../files/bulk_remove_ai_tags_response.rbs | 20 + .../models/files/bulk_remove_tags_params.rbs | 30 + .../files/bulk_remove_tags_response.rbs | 20 + .../files/metadata_get_from_url_params.rbs | 25 + .../models/files/metadata_get_params.rbs | 17 + .../models/files/version_delete_params.rbs | 25 + .../models/files/version_delete_response.rbs | 13 + .../models/files/version_get_params.rbs | 25 + .../models/files/version_list_params.rbs | 17 + .../models/files/version_list_response.rbs | 9 + .../models/files/version_restore_params.rbs | 25 + sig/imagekit/models/folder.rbs | 69 + sig/imagekit/models/folder_copy_params.rbs | 38 + sig/imagekit/models/folder_copy_response.rbs | 13 + sig/imagekit/models/folder_create_params.rbs | 28 + .../models/folder_create_response.rbs | 11 + sig/imagekit/models/folder_delete_params.rbs | 23 + .../models/folder_delete_response.rbs | 11 + sig/imagekit/models/folder_move_params.rbs | 28 + sig/imagekit/models/folder_move_response.rbs | 13 + sig/imagekit/models/folder_rename_params.rbs | 34 + .../models/folder_rename_response.rbs | 13 + .../models/folders/job_get_params.rbs | 16 + .../models/folders/job_get_response.rbs | 72 + sig/imagekit/models/image_overlay.rbs | 59 + sig/imagekit/models/metadata.rbs | 546 ++++++ sig/imagekit/models/overlay.rbs | 16 + sig/imagekit/models/overlay_position.rbs | 85 + sig/imagekit/models/overlay_timing.rbs | 66 + sig/imagekit/models/solid_color_overlay.rbs | 38 + .../solid_color_overlay_transformation.rbs | 97 + sig/imagekit/models/src_options.rbs | 64 + sig/imagekit/models/streaming_resolution.rbs | 20 + sig/imagekit/models/subtitle_overlay.rbs | 59 + .../subtitle_overlay_transformation.rbs | 78 + sig/imagekit/models/text_overlay.rbs | 59 + .../models/text_overlay_transformation.rbs | 195 ++ sig/imagekit/models/transformation.rbs | 763 ++++++++ .../models/transformation_position.rbs | 14 + .../models/unsafe_unwrap_webhook_event.rbs | 18 + sig/imagekit/models/unwrap_webhook_event.rbs | 18 + .../upload_post_transform_error_event.rbs | 183 ++ .../upload_post_transform_success_event.rbs | 133 ++ .../upload_pre_transform_error_event.rbs | 106 ++ .../upload_pre_transform_success_event.rbs | 366 ++++ sig/imagekit/models/video_overlay.rbs | 59 + .../video_transformation_accepted_event.rbs | 252 +++ .../video_transformation_error_event.rbs | 291 +++ .../video_transformation_ready_event.rbs | 350 ++++ .../models/webhook_unsafe_unwrap_params.rbs | 15 + sig/imagekit/models/webhook_unwrap_params.rbs | 15 + sig/imagekit/request_options.rbs | 34 + sig/imagekit/resources/accounts.rbs | 13 + sig/imagekit/resources/accounts/origins.rbs | 31 + .../resources/accounts/url_endpoints.rbs | 37 + sig/imagekit/resources/accounts/usage.rbs | 15 + sig/imagekit/resources/assets.rbs | 18 + sig/imagekit/resources/beta.rbs | 9 + sig/imagekit/resources/beta/v2.rbs | 11 + sig/imagekit/resources/beta/v2/files.rbs | 35 + sig/imagekit/resources/cache.rbs | 9 + sig/imagekit/resources/cache/invalidation.rbs | 19 + .../resources/custom_metadata_fields.rbs | 31 + sig/imagekit/resources/files.rbs | 76 + sig/imagekit/resources/files/bulk.rbs | 32 + sig/imagekit/resources/files/metadata.rbs | 19 + sig/imagekit/resources/files/versions.rbs | 32 + sig/imagekit/resources/folders.rbs | 40 + sig/imagekit/resources/folders/job.rbs | 14 + sig/imagekit/resources/webhooks.rbs | 27 + sig/imagekit/version.rbs | 3 + sorbet/config | 2 + sorbet/rbi/.gitignore | 2 + test/imagekit/api_service/bulk_test.rb | 185 -- .../api_service/custom_metadata_field_test.rb | 101 -- test/imagekit/api_service/file_test.rb | 1196 ------------ test/imagekit/api_service/folder_test.rb | 127 -- test/imagekit/client_test.rb | 678 ++++--- test/imagekit/configuration_test.rb | 64 - test/imagekit/constant_test.rb | 17 - test/imagekit/dummy_data/data.rb | 5 - test/imagekit/dummy_data/file.rb | 60 - test/imagekit/dummy_data/sample.jpg | Bin 102117 -> 0 bytes test/imagekit/file_part_test.rb | 13 + .../internal/sorbet_runtime_support_test.rb | 52 + .../imagekit/internal/type/base_model_test.rb | 727 ++++++++ test/imagekit/internal/util_test.rb | 594 ++++++ test/imagekit/request_test.rb | 110 -- test/imagekit/resource_namespaces.rb | 27 + .../resources/accounts/origins_test.rb | 347 ++++ .../resources/accounts/url_endpoints_test.rb | 85 + .../imagekit/resources/accounts/usage_test.rb | 25 + test/imagekit/resources/accounts_test.rb | 6 + test/imagekit/resources/assets_test.rb | 15 + test/imagekit/resources/beta/v2/files_test.rb | 44 + test/imagekit/resources/beta/v2_test.rb | 6 + test/imagekit/resources/beta_test.rb | 6 + .../resources/cache/invalidation_test.rb | 38 + test/imagekit/resources/cache_test.rb | 6 + .../resources/custom_metadata_fields_test.rb | 70 + test/imagekit/resources/files/bulk_test.rb | 82 + .../imagekit/resources/files/metadata_test.rb | 63 + .../imagekit/resources/files/versions_test.rb | 105 ++ test/imagekit/resources/files_test.rb | 151 ++ test/imagekit/resources/folders/job_test.rb | 24 + test/imagekit/resources/folders_test.rb | 93 + test/imagekit/resources/shared_test.rb | 6 + test/imagekit/resources/webhooks_test.rb | 6 + test/imagekit/spec_helper.rb | 15 - test/imagekit/test_helper.rb | 91 + test/imagekit/url_test.rb | 444 ----- test/imagekit/utils/calculation_test.rb | 68 - test/imagekit/utils/formatter_test.rb | 21 - test/test_helper.rb | 20 - 530 files changed, 56610 insertions(+), 5623 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/gempush.yml delete mode 100644 .github/workflows/test.yml create mode 100644 .rubocop.yml create mode 100644 .ruby-version create mode 100644 .solargraph.yml create mode 100644 .stats.yml create mode 100644 .yardopts create mode 100644 CONTRIBUTING.md delete mode 100644 DEVELOPMENT.md create mode 100644 Gemfile.lock create mode 100644 SECURITY.md create mode 100644 Steepfile create mode 100644 bin/publish-gem delete mode 100755 bin/test delete mode 100644 codecov.yml create mode 100644 examples/.keep create mode 100644 imagekit.gemspec delete mode 100644 imagekitio.gemspec delete mode 100644 lib/active_storage/active_storage.rb delete mode 100644 lib/active_storage/service/ik_file.rb delete mode 100644 lib/active_storage/service/image_kit_io_service.rb delete mode 100644 lib/carrierwave/carrierwave.rb delete mode 100644 lib/carrierwave/storage/ik_file.rb delete mode 100644 lib/carrierwave/storage/imagekit_store.rb delete mode 100644 lib/carrierwave/support/uri_filename.rb create mode 100644 lib/imagekit.rb create mode 100644 lib/imagekit/client.rb create mode 100644 lib/imagekit/errors.rb create mode 100644 lib/imagekit/file_part.rb create mode 100644 lib/imagekit/internal.rb create mode 100644 lib/imagekit/internal/transport/base_client.rb create mode 100644 lib/imagekit/internal/transport/pooled_net_requester.rb create mode 100644 lib/imagekit/internal/type/array_of.rb create mode 100644 lib/imagekit/internal/type/base_model.rb create mode 100644 lib/imagekit/internal/type/base_page.rb create mode 100644 lib/imagekit/internal/type/boolean.rb create mode 100644 lib/imagekit/internal/type/converter.rb create mode 100644 lib/imagekit/internal/type/enum.rb create mode 100644 lib/imagekit/internal/type/file_input.rb create mode 100644 lib/imagekit/internal/type/hash_of.rb create mode 100644 lib/imagekit/internal/type/request_parameters.rb create mode 100644 lib/imagekit/internal/type/union.rb create mode 100644 lib/imagekit/internal/type/unknown.rb create mode 100644 lib/imagekit/internal/util.rb create mode 100644 lib/imagekit/models.rb create mode 100644 lib/imagekit/models/accounts/origin_create_params.rb create mode 100644 lib/imagekit/models/accounts/origin_delete_params.rb create mode 100644 lib/imagekit/models/accounts/origin_get_params.rb create mode 100644 lib/imagekit/models/accounts/origin_list_params.rb create mode 100644 lib/imagekit/models/accounts/origin_list_response.rb create mode 100644 lib/imagekit/models/accounts/origin_request.rb create mode 100644 lib/imagekit/models/accounts/origin_response.rb create mode 100644 lib/imagekit/models/accounts/origin_update_params.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_create_params.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_delete_params.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_get_params.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_list_params.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_list_response.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_request.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_response.rb create mode 100644 lib/imagekit/models/accounts/url_endpoint_update_params.rb create mode 100644 lib/imagekit/models/accounts/usage_get_params.rb create mode 100644 lib/imagekit/models/accounts/usage_get_response.rb create mode 100644 lib/imagekit/models/asset_list_params.rb create mode 100644 lib/imagekit/models/asset_list_response.rb create mode 100644 lib/imagekit/models/base_overlay.rb create mode 100644 lib/imagekit/models/beta/v2/file_upload_params.rb create mode 100644 lib/imagekit/models/beta/v2/file_upload_response.rb create mode 100644 lib/imagekit/models/cache/invalidation_create_params.rb create mode 100644 lib/imagekit/models/cache/invalidation_create_response.rb create mode 100644 lib/imagekit/models/cache/invalidation_get_params.rb create mode 100644 lib/imagekit/models/cache/invalidation_get_response.rb create mode 100644 lib/imagekit/models/custom_metadata_field.rb create mode 100644 lib/imagekit/models/custom_metadata_field_create_params.rb create mode 100644 lib/imagekit/models/custom_metadata_field_delete_params.rb create mode 100644 lib/imagekit/models/custom_metadata_field_delete_response.rb create mode 100644 lib/imagekit/models/custom_metadata_field_list_params.rb create mode 100644 lib/imagekit/models/custom_metadata_field_list_response.rb create mode 100644 lib/imagekit/models/custom_metadata_field_update_params.rb create mode 100644 lib/imagekit/models/file.rb create mode 100644 lib/imagekit/models/file_copy_params.rb create mode 100644 lib/imagekit/models/file_copy_response.rb create mode 100644 lib/imagekit/models/file_delete_params.rb create mode 100644 lib/imagekit/models/file_get_params.rb create mode 100644 lib/imagekit/models/file_move_params.rb create mode 100644 lib/imagekit/models/file_move_response.rb create mode 100644 lib/imagekit/models/file_rename_params.rb create mode 100644 lib/imagekit/models/file_rename_response.rb create mode 100644 lib/imagekit/models/file_update_params.rb create mode 100644 lib/imagekit/models/file_update_response.rb create mode 100644 lib/imagekit/models/file_upload_params.rb create mode 100644 lib/imagekit/models/file_upload_response.rb create mode 100644 lib/imagekit/models/files/bulk_add_tags_params.rb create mode 100644 lib/imagekit/models/files/bulk_add_tags_response.rb create mode 100644 lib/imagekit/models/files/bulk_delete_params.rb create mode 100644 lib/imagekit/models/files/bulk_delete_response.rb create mode 100644 lib/imagekit/models/files/bulk_remove_ai_tags_params.rb create mode 100644 lib/imagekit/models/files/bulk_remove_ai_tags_response.rb create mode 100644 lib/imagekit/models/files/bulk_remove_tags_params.rb create mode 100644 lib/imagekit/models/files/bulk_remove_tags_response.rb create mode 100644 lib/imagekit/models/files/metadata_get_from_url_params.rb create mode 100644 lib/imagekit/models/files/metadata_get_params.rb create mode 100644 lib/imagekit/models/files/version_delete_params.rb create mode 100644 lib/imagekit/models/files/version_delete_response.rb create mode 100644 lib/imagekit/models/files/version_get_params.rb create mode 100644 lib/imagekit/models/files/version_list_params.rb create mode 100644 lib/imagekit/models/files/version_list_response.rb create mode 100644 lib/imagekit/models/files/version_restore_params.rb create mode 100644 lib/imagekit/models/folder.rb create mode 100644 lib/imagekit/models/folder_copy_params.rb create mode 100644 lib/imagekit/models/folder_copy_response.rb create mode 100644 lib/imagekit/models/folder_create_params.rb create mode 100644 lib/imagekit/models/folder_create_response.rb create mode 100644 lib/imagekit/models/folder_delete_params.rb create mode 100644 lib/imagekit/models/folder_delete_response.rb create mode 100644 lib/imagekit/models/folder_move_params.rb create mode 100644 lib/imagekit/models/folder_move_response.rb create mode 100644 lib/imagekit/models/folder_rename_params.rb create mode 100644 lib/imagekit/models/folder_rename_response.rb create mode 100644 lib/imagekit/models/folders/job_get_params.rb create mode 100644 lib/imagekit/models/folders/job_get_response.rb create mode 100644 lib/imagekit/models/image_overlay.rb create mode 100644 lib/imagekit/models/metadata.rb create mode 100644 lib/imagekit/models/overlay.rb create mode 100644 lib/imagekit/models/overlay_position.rb create mode 100644 lib/imagekit/models/overlay_timing.rb create mode 100644 lib/imagekit/models/solid_color_overlay.rb create mode 100644 lib/imagekit/models/solid_color_overlay_transformation.rb create mode 100644 lib/imagekit/models/src_options.rb create mode 100644 lib/imagekit/models/streaming_resolution.rb create mode 100644 lib/imagekit/models/subtitle_overlay.rb create mode 100644 lib/imagekit/models/subtitle_overlay_transformation.rb create mode 100644 lib/imagekit/models/text_overlay.rb create mode 100644 lib/imagekit/models/text_overlay_transformation.rb create mode 100644 lib/imagekit/models/transformation.rb create mode 100644 lib/imagekit/models/transformation_position.rb create mode 100644 lib/imagekit/models/unsafe_unwrap_webhook_event.rb create mode 100644 lib/imagekit/models/unwrap_webhook_event.rb create mode 100644 lib/imagekit/models/upload_post_transform_error_event.rb create mode 100644 lib/imagekit/models/upload_post_transform_success_event.rb create mode 100644 lib/imagekit/models/upload_pre_transform_error_event.rb create mode 100644 lib/imagekit/models/upload_pre_transform_success_event.rb create mode 100644 lib/imagekit/models/video_overlay.rb create mode 100644 lib/imagekit/models/video_transformation_accepted_event.rb create mode 100644 lib/imagekit/models/video_transformation_error_event.rb create mode 100644 lib/imagekit/models/video_transformation_ready_event.rb create mode 100644 lib/imagekit/models/webhook_unsafe_unwrap_params.rb create mode 100644 lib/imagekit/models/webhook_unwrap_params.rb create mode 100644 lib/imagekit/request_options.rb create mode 100644 lib/imagekit/resources/accounts.rb create mode 100644 lib/imagekit/resources/accounts/origins.rb create mode 100644 lib/imagekit/resources/accounts/url_endpoints.rb create mode 100644 lib/imagekit/resources/accounts/usage.rb create mode 100644 lib/imagekit/resources/assets.rb create mode 100644 lib/imagekit/resources/beta.rb create mode 100644 lib/imagekit/resources/beta/v2.rb create mode 100644 lib/imagekit/resources/beta/v2/files.rb create mode 100644 lib/imagekit/resources/cache.rb create mode 100644 lib/imagekit/resources/cache/invalidation.rb create mode 100644 lib/imagekit/resources/custom_metadata_fields.rb create mode 100644 lib/imagekit/resources/files.rb create mode 100644 lib/imagekit/resources/files/bulk.rb create mode 100644 lib/imagekit/resources/files/metadata.rb create mode 100644 lib/imagekit/resources/files/versions.rb create mode 100644 lib/imagekit/resources/folders.rb create mode 100644 lib/imagekit/resources/folders/job.rb create mode 100644 lib/imagekit/resources/webhooks.rb create mode 100644 lib/imagekit/version.rb delete mode 100644 lib/imagekitio.rb delete mode 100644 lib/imagekitio/api_service/bulk.rb delete mode 100644 lib/imagekitio/api_service/custom_metadata_field.rb delete mode 100644 lib/imagekitio/api_service/file.rb delete mode 100644 lib/imagekitio/api_service/folder.rb delete mode 100644 lib/imagekitio/base.rb delete mode 100644 lib/imagekitio/client.rb delete mode 100644 lib/imagekitio/configurable.rb delete mode 100644 lib/imagekitio/constant.rb delete mode 100644 lib/imagekitio/constants/default.rb delete mode 100644 lib/imagekitio/constants/error.rb delete mode 100644 lib/imagekitio/constants/file.rb delete mode 100644 lib/imagekitio/constants/supported_transformation.rb delete mode 100644 lib/imagekitio/constants/url.rb delete mode 100644 lib/imagekitio/errors.rb delete mode 100644 lib/imagekitio/railtie.rb delete mode 100644 lib/imagekitio/request.rb delete mode 100644 lib/imagekitio/sdk/version.rb delete mode 100644 lib/imagekitio/url.rb delete mode 100644 lib/imagekitio/utils/calculation.rb delete mode 100644 lib/imagekitio/utils/formatter.rb delete mode 100644 lib/imagekitio/utils/option_validator.rb delete mode 100644 lib/tasks/imagekitio/imagekitio_tasks.rake create mode 100644 manifest.yaml create mode 100644 rbi/imagekit/client.rbi create mode 100644 rbi/imagekit/errors.rbi create mode 100644 rbi/imagekit/file_part.rbi create mode 100644 rbi/imagekit/internal.rbi create mode 100644 rbi/imagekit/internal/transport/base_client.rbi create mode 100644 rbi/imagekit/internal/transport/pooled_net_requester.rbi create mode 100644 rbi/imagekit/internal/type/array_of.rbi create mode 100644 rbi/imagekit/internal/type/base_model.rbi create mode 100644 rbi/imagekit/internal/type/base_page.rbi create mode 100644 rbi/imagekit/internal/type/boolean.rbi create mode 100644 rbi/imagekit/internal/type/converter.rbi create mode 100644 rbi/imagekit/internal/type/enum.rbi create mode 100644 rbi/imagekit/internal/type/file_input.rbi create mode 100644 rbi/imagekit/internal/type/hash_of.rbi create mode 100644 rbi/imagekit/internal/type/request_parameters.rbi create mode 100644 rbi/imagekit/internal/type/union.rbi create mode 100644 rbi/imagekit/internal/type/unknown.rbi create mode 100644 rbi/imagekit/internal/util.rbi create mode 100644 rbi/imagekit/models.rbi create mode 100644 rbi/imagekit/models/accounts/origin_create_params.rbi create mode 100644 rbi/imagekit/models/accounts/origin_delete_params.rbi create mode 100644 rbi/imagekit/models/accounts/origin_get_params.rbi create mode 100644 rbi/imagekit/models/accounts/origin_list_params.rbi create mode 100644 rbi/imagekit/models/accounts/origin_list_response.rbi create mode 100644 rbi/imagekit/models/accounts/origin_request.rbi create mode 100644 rbi/imagekit/models/accounts/origin_response.rbi create mode 100644 rbi/imagekit/models/accounts/origin_update_params.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_create_params.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_delete_params.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_get_params.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_list_params.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_list_response.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_request.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_response.rbi create mode 100644 rbi/imagekit/models/accounts/url_endpoint_update_params.rbi create mode 100644 rbi/imagekit/models/accounts/usage_get_params.rbi create mode 100644 rbi/imagekit/models/accounts/usage_get_response.rbi create mode 100644 rbi/imagekit/models/asset_list_params.rbi create mode 100644 rbi/imagekit/models/asset_list_response.rbi create mode 100644 rbi/imagekit/models/base_overlay.rbi create mode 100644 rbi/imagekit/models/beta/v2/file_upload_params.rbi create mode 100644 rbi/imagekit/models/beta/v2/file_upload_response.rbi create mode 100644 rbi/imagekit/models/cache/invalidation_create_params.rbi create mode 100644 rbi/imagekit/models/cache/invalidation_create_response.rbi create mode 100644 rbi/imagekit/models/cache/invalidation_get_params.rbi create mode 100644 rbi/imagekit/models/cache/invalidation_get_response.rbi create mode 100644 rbi/imagekit/models/custom_metadata_field.rbi create mode 100644 rbi/imagekit/models/custom_metadata_field_create_params.rbi create mode 100644 rbi/imagekit/models/custom_metadata_field_delete_params.rbi create mode 100644 rbi/imagekit/models/custom_metadata_field_delete_response.rbi create mode 100644 rbi/imagekit/models/custom_metadata_field_list_params.rbi create mode 100644 rbi/imagekit/models/custom_metadata_field_list_response.rbi create mode 100644 rbi/imagekit/models/custom_metadata_field_update_params.rbi create mode 100644 rbi/imagekit/models/file.rbi create mode 100644 rbi/imagekit/models/file_copy_params.rbi create mode 100644 rbi/imagekit/models/file_copy_response.rbi create mode 100644 rbi/imagekit/models/file_delete_params.rbi create mode 100644 rbi/imagekit/models/file_get_params.rbi create mode 100644 rbi/imagekit/models/file_move_params.rbi create mode 100644 rbi/imagekit/models/file_move_response.rbi create mode 100644 rbi/imagekit/models/file_rename_params.rbi create mode 100644 rbi/imagekit/models/file_rename_response.rbi create mode 100644 rbi/imagekit/models/file_update_params.rbi create mode 100644 rbi/imagekit/models/file_update_response.rbi create mode 100644 rbi/imagekit/models/file_upload_params.rbi create mode 100644 rbi/imagekit/models/file_upload_response.rbi create mode 100644 rbi/imagekit/models/files/bulk_add_tags_params.rbi create mode 100644 rbi/imagekit/models/files/bulk_add_tags_response.rbi create mode 100644 rbi/imagekit/models/files/bulk_delete_params.rbi create mode 100644 rbi/imagekit/models/files/bulk_delete_response.rbi create mode 100644 rbi/imagekit/models/files/bulk_remove_ai_tags_params.rbi create mode 100644 rbi/imagekit/models/files/bulk_remove_ai_tags_response.rbi create mode 100644 rbi/imagekit/models/files/bulk_remove_tags_params.rbi create mode 100644 rbi/imagekit/models/files/bulk_remove_tags_response.rbi create mode 100644 rbi/imagekit/models/files/metadata_get_from_url_params.rbi create mode 100644 rbi/imagekit/models/files/metadata_get_params.rbi create mode 100644 rbi/imagekit/models/files/version_delete_params.rbi create mode 100644 rbi/imagekit/models/files/version_delete_response.rbi create mode 100644 rbi/imagekit/models/files/version_get_params.rbi create mode 100644 rbi/imagekit/models/files/version_list_params.rbi create mode 100644 rbi/imagekit/models/files/version_list_response.rbi create mode 100644 rbi/imagekit/models/files/version_restore_params.rbi create mode 100644 rbi/imagekit/models/folder.rbi create mode 100644 rbi/imagekit/models/folder_copy_params.rbi create mode 100644 rbi/imagekit/models/folder_copy_response.rbi create mode 100644 rbi/imagekit/models/folder_create_params.rbi create mode 100644 rbi/imagekit/models/folder_create_response.rbi create mode 100644 rbi/imagekit/models/folder_delete_params.rbi create mode 100644 rbi/imagekit/models/folder_delete_response.rbi create mode 100644 rbi/imagekit/models/folder_move_params.rbi create mode 100644 rbi/imagekit/models/folder_move_response.rbi create mode 100644 rbi/imagekit/models/folder_rename_params.rbi create mode 100644 rbi/imagekit/models/folder_rename_response.rbi create mode 100644 rbi/imagekit/models/folders/job_get_params.rbi create mode 100644 rbi/imagekit/models/folders/job_get_response.rbi create mode 100644 rbi/imagekit/models/image_overlay.rbi create mode 100644 rbi/imagekit/models/metadata.rbi create mode 100644 rbi/imagekit/models/overlay.rbi create mode 100644 rbi/imagekit/models/overlay_position.rbi create mode 100644 rbi/imagekit/models/overlay_timing.rbi create mode 100644 rbi/imagekit/models/solid_color_overlay.rbi create mode 100644 rbi/imagekit/models/solid_color_overlay_transformation.rbi create mode 100644 rbi/imagekit/models/src_options.rbi create mode 100644 rbi/imagekit/models/streaming_resolution.rbi create mode 100644 rbi/imagekit/models/subtitle_overlay.rbi create mode 100644 rbi/imagekit/models/subtitle_overlay_transformation.rbi create mode 100644 rbi/imagekit/models/text_overlay.rbi create mode 100644 rbi/imagekit/models/text_overlay_transformation.rbi create mode 100644 rbi/imagekit/models/transformation.rbi create mode 100644 rbi/imagekit/models/transformation_position.rbi create mode 100644 rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi create mode 100644 rbi/imagekit/models/unwrap_webhook_event.rbi create mode 100644 rbi/imagekit/models/upload_post_transform_error_event.rbi create mode 100644 rbi/imagekit/models/upload_post_transform_success_event.rbi create mode 100644 rbi/imagekit/models/upload_pre_transform_error_event.rbi create mode 100644 rbi/imagekit/models/upload_pre_transform_success_event.rbi create mode 100644 rbi/imagekit/models/video_overlay.rbi create mode 100644 rbi/imagekit/models/video_transformation_accepted_event.rbi create mode 100644 rbi/imagekit/models/video_transformation_error_event.rbi create mode 100644 rbi/imagekit/models/video_transformation_ready_event.rbi create mode 100644 rbi/imagekit/models/webhook_unsafe_unwrap_params.rbi create mode 100644 rbi/imagekit/models/webhook_unwrap_params.rbi create mode 100644 rbi/imagekit/request_options.rbi create mode 100644 rbi/imagekit/resources/accounts.rbi create mode 100644 rbi/imagekit/resources/accounts/origins.rbi create mode 100644 rbi/imagekit/resources/accounts/url_endpoints.rbi create mode 100644 rbi/imagekit/resources/accounts/usage.rbi create mode 100644 rbi/imagekit/resources/assets.rbi create mode 100644 rbi/imagekit/resources/beta.rbi create mode 100644 rbi/imagekit/resources/beta/v2.rbi create mode 100644 rbi/imagekit/resources/beta/v2/files.rbi create mode 100644 rbi/imagekit/resources/cache.rbi create mode 100644 rbi/imagekit/resources/cache/invalidation.rbi create mode 100644 rbi/imagekit/resources/custom_metadata_fields.rbi create mode 100644 rbi/imagekit/resources/files.rbi create mode 100644 rbi/imagekit/resources/files/bulk.rbi create mode 100644 rbi/imagekit/resources/files/metadata.rbi create mode 100644 rbi/imagekit/resources/files/versions.rbi create mode 100644 rbi/imagekit/resources/folders.rbi create mode 100644 rbi/imagekit/resources/folders/job.rbi create mode 100644 rbi/imagekit/resources/webhooks.rbi create mode 100644 rbi/imagekit/version.rbi create mode 100755 scripts/bootstrap create mode 100755 scripts/format create mode 100755 scripts/lint create mode 100755 scripts/mock create mode 100755 scripts/test create mode 100644 sig/imagekit/client.rbs create mode 100644 sig/imagekit/errors.rbs create mode 100644 sig/imagekit/file_part.rbs create mode 100644 sig/imagekit/internal.rbs create mode 100644 sig/imagekit/internal/transport/base_client.rbs create mode 100644 sig/imagekit/internal/transport/pooled_net_requester.rbs create mode 100644 sig/imagekit/internal/type/array_of.rbs create mode 100644 sig/imagekit/internal/type/base_model.rbs create mode 100644 sig/imagekit/internal/type/base_page.rbs create mode 100644 sig/imagekit/internal/type/boolean.rbs create mode 100644 sig/imagekit/internal/type/converter.rbs create mode 100644 sig/imagekit/internal/type/enum.rbs create mode 100644 sig/imagekit/internal/type/file_input.rbs create mode 100644 sig/imagekit/internal/type/hash_of.rbs create mode 100644 sig/imagekit/internal/type/request_parameters.rbs create mode 100644 sig/imagekit/internal/type/union.rbs create mode 100644 sig/imagekit/internal/type/unknown.rbs create mode 100644 sig/imagekit/internal/util.rbs create mode 100644 sig/imagekit/models.rbs create mode 100644 sig/imagekit/models/accounts/origin_create_params.rbs create mode 100644 sig/imagekit/models/accounts/origin_delete_params.rbs create mode 100644 sig/imagekit/models/accounts/origin_get_params.rbs create mode 100644 sig/imagekit/models/accounts/origin_list_params.rbs create mode 100644 sig/imagekit/models/accounts/origin_list_response.rbs create mode 100644 sig/imagekit/models/accounts/origin_request.rbs create mode 100644 sig/imagekit/models/accounts/origin_response.rbs create mode 100644 sig/imagekit/models/accounts/origin_update_params.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_create_params.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_delete_params.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_get_params.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_list_params.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_list_response.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_request.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_response.rbs create mode 100644 sig/imagekit/models/accounts/url_endpoint_update_params.rbs create mode 100644 sig/imagekit/models/accounts/usage_get_params.rbs create mode 100644 sig/imagekit/models/accounts/usage_get_response.rbs create mode 100644 sig/imagekit/models/asset_list_params.rbs create mode 100644 sig/imagekit/models/asset_list_response.rbs create mode 100644 sig/imagekit/models/base_overlay.rbs create mode 100644 sig/imagekit/models/beta/v2/file_upload_params.rbs create mode 100644 sig/imagekit/models/beta/v2/file_upload_response.rbs create mode 100644 sig/imagekit/models/cache/invalidation_create_params.rbs create mode 100644 sig/imagekit/models/cache/invalidation_create_response.rbs create mode 100644 sig/imagekit/models/cache/invalidation_get_params.rbs create mode 100644 sig/imagekit/models/cache/invalidation_get_response.rbs create mode 100644 sig/imagekit/models/custom_metadata_field.rbs create mode 100644 sig/imagekit/models/custom_metadata_field_create_params.rbs create mode 100644 sig/imagekit/models/custom_metadata_field_delete_params.rbs create mode 100644 sig/imagekit/models/custom_metadata_field_delete_response.rbs create mode 100644 sig/imagekit/models/custom_metadata_field_list_params.rbs create mode 100644 sig/imagekit/models/custom_metadata_field_list_response.rbs create mode 100644 sig/imagekit/models/custom_metadata_field_update_params.rbs create mode 100644 sig/imagekit/models/file.rbs create mode 100644 sig/imagekit/models/file_copy_params.rbs create mode 100644 sig/imagekit/models/file_copy_response.rbs create mode 100644 sig/imagekit/models/file_delete_params.rbs create mode 100644 sig/imagekit/models/file_get_params.rbs create mode 100644 sig/imagekit/models/file_move_params.rbs create mode 100644 sig/imagekit/models/file_move_response.rbs create mode 100644 sig/imagekit/models/file_rename_params.rbs create mode 100644 sig/imagekit/models/file_rename_response.rbs create mode 100644 sig/imagekit/models/file_update_params.rbs create mode 100644 sig/imagekit/models/file_update_response.rbs create mode 100644 sig/imagekit/models/file_upload_params.rbs create mode 100644 sig/imagekit/models/file_upload_response.rbs create mode 100644 sig/imagekit/models/files/bulk_add_tags_params.rbs create mode 100644 sig/imagekit/models/files/bulk_add_tags_response.rbs create mode 100644 sig/imagekit/models/files/bulk_delete_params.rbs create mode 100644 sig/imagekit/models/files/bulk_delete_response.rbs create mode 100644 sig/imagekit/models/files/bulk_remove_ai_tags_params.rbs create mode 100644 sig/imagekit/models/files/bulk_remove_ai_tags_response.rbs create mode 100644 sig/imagekit/models/files/bulk_remove_tags_params.rbs create mode 100644 sig/imagekit/models/files/bulk_remove_tags_response.rbs create mode 100644 sig/imagekit/models/files/metadata_get_from_url_params.rbs create mode 100644 sig/imagekit/models/files/metadata_get_params.rbs create mode 100644 sig/imagekit/models/files/version_delete_params.rbs create mode 100644 sig/imagekit/models/files/version_delete_response.rbs create mode 100644 sig/imagekit/models/files/version_get_params.rbs create mode 100644 sig/imagekit/models/files/version_list_params.rbs create mode 100644 sig/imagekit/models/files/version_list_response.rbs create mode 100644 sig/imagekit/models/files/version_restore_params.rbs create mode 100644 sig/imagekit/models/folder.rbs create mode 100644 sig/imagekit/models/folder_copy_params.rbs create mode 100644 sig/imagekit/models/folder_copy_response.rbs create mode 100644 sig/imagekit/models/folder_create_params.rbs create mode 100644 sig/imagekit/models/folder_create_response.rbs create mode 100644 sig/imagekit/models/folder_delete_params.rbs create mode 100644 sig/imagekit/models/folder_delete_response.rbs create mode 100644 sig/imagekit/models/folder_move_params.rbs create mode 100644 sig/imagekit/models/folder_move_response.rbs create mode 100644 sig/imagekit/models/folder_rename_params.rbs create mode 100644 sig/imagekit/models/folder_rename_response.rbs create mode 100644 sig/imagekit/models/folders/job_get_params.rbs create mode 100644 sig/imagekit/models/folders/job_get_response.rbs create mode 100644 sig/imagekit/models/image_overlay.rbs create mode 100644 sig/imagekit/models/metadata.rbs create mode 100644 sig/imagekit/models/overlay.rbs create mode 100644 sig/imagekit/models/overlay_position.rbs create mode 100644 sig/imagekit/models/overlay_timing.rbs create mode 100644 sig/imagekit/models/solid_color_overlay.rbs create mode 100644 sig/imagekit/models/solid_color_overlay_transformation.rbs create mode 100644 sig/imagekit/models/src_options.rbs create mode 100644 sig/imagekit/models/streaming_resolution.rbs create mode 100644 sig/imagekit/models/subtitle_overlay.rbs create mode 100644 sig/imagekit/models/subtitle_overlay_transformation.rbs create mode 100644 sig/imagekit/models/text_overlay.rbs create mode 100644 sig/imagekit/models/text_overlay_transformation.rbs create mode 100644 sig/imagekit/models/transformation.rbs create mode 100644 sig/imagekit/models/transformation_position.rbs create mode 100644 sig/imagekit/models/unsafe_unwrap_webhook_event.rbs create mode 100644 sig/imagekit/models/unwrap_webhook_event.rbs create mode 100644 sig/imagekit/models/upload_post_transform_error_event.rbs create mode 100644 sig/imagekit/models/upload_post_transform_success_event.rbs create mode 100644 sig/imagekit/models/upload_pre_transform_error_event.rbs create mode 100644 sig/imagekit/models/upload_pre_transform_success_event.rbs create mode 100644 sig/imagekit/models/video_overlay.rbs create mode 100644 sig/imagekit/models/video_transformation_accepted_event.rbs create mode 100644 sig/imagekit/models/video_transformation_error_event.rbs create mode 100644 sig/imagekit/models/video_transformation_ready_event.rbs create mode 100644 sig/imagekit/models/webhook_unsafe_unwrap_params.rbs create mode 100644 sig/imagekit/models/webhook_unwrap_params.rbs create mode 100644 sig/imagekit/request_options.rbs create mode 100644 sig/imagekit/resources/accounts.rbs create mode 100644 sig/imagekit/resources/accounts/origins.rbs create mode 100644 sig/imagekit/resources/accounts/url_endpoints.rbs create mode 100644 sig/imagekit/resources/accounts/usage.rbs create mode 100644 sig/imagekit/resources/assets.rbs create mode 100644 sig/imagekit/resources/beta.rbs create mode 100644 sig/imagekit/resources/beta/v2.rbs create mode 100644 sig/imagekit/resources/beta/v2/files.rbs create mode 100644 sig/imagekit/resources/cache.rbs create mode 100644 sig/imagekit/resources/cache/invalidation.rbs create mode 100644 sig/imagekit/resources/custom_metadata_fields.rbs create mode 100644 sig/imagekit/resources/files.rbs create mode 100644 sig/imagekit/resources/files/bulk.rbs create mode 100644 sig/imagekit/resources/files/metadata.rbs create mode 100644 sig/imagekit/resources/files/versions.rbs create mode 100644 sig/imagekit/resources/folders.rbs create mode 100644 sig/imagekit/resources/folders/job.rbs create mode 100644 sig/imagekit/resources/webhooks.rbs create mode 100644 sig/imagekit/version.rbs create mode 100644 sorbet/config create mode 100644 sorbet/rbi/.gitignore delete mode 100644 test/imagekit/api_service/bulk_test.rb delete mode 100644 test/imagekit/api_service/custom_metadata_field_test.rb delete mode 100644 test/imagekit/api_service/file_test.rb delete mode 100644 test/imagekit/api_service/folder_test.rb delete mode 100644 test/imagekit/configuration_test.rb delete mode 100644 test/imagekit/constant_test.rb delete mode 100644 test/imagekit/dummy_data/data.rb delete mode 100644 test/imagekit/dummy_data/file.rb delete mode 100644 test/imagekit/dummy_data/sample.jpg create mode 100644 test/imagekit/file_part_test.rb create mode 100644 test/imagekit/internal/sorbet_runtime_support_test.rb create mode 100644 test/imagekit/internal/type/base_model_test.rb create mode 100644 test/imagekit/internal/util_test.rb delete mode 100644 test/imagekit/request_test.rb create mode 100644 test/imagekit/resource_namespaces.rb create mode 100644 test/imagekit/resources/accounts/origins_test.rb create mode 100644 test/imagekit/resources/accounts/url_endpoints_test.rb create mode 100644 test/imagekit/resources/accounts/usage_test.rb create mode 100644 test/imagekit/resources/accounts_test.rb create mode 100644 test/imagekit/resources/assets_test.rb create mode 100644 test/imagekit/resources/beta/v2/files_test.rb create mode 100644 test/imagekit/resources/beta/v2_test.rb create mode 100644 test/imagekit/resources/beta_test.rb create mode 100644 test/imagekit/resources/cache/invalidation_test.rb create mode 100644 test/imagekit/resources/cache_test.rb create mode 100644 test/imagekit/resources/custom_metadata_fields_test.rb create mode 100644 test/imagekit/resources/files/bulk_test.rb create mode 100644 test/imagekit/resources/files/metadata_test.rb create mode 100644 test/imagekit/resources/files/versions_test.rb create mode 100644 test/imagekit/resources/files_test.rb create mode 100644 test/imagekit/resources/folders/job_test.rb create mode 100644 test/imagekit/resources/folders_test.rb create mode 100644 test/imagekit/resources/shared_test.rb create mode 100644 test/imagekit/resources/webhooks_test.rb delete mode 100644 test/imagekit/spec_helper.rb create mode 100644 test/imagekit/test_helper.rb delete mode 100644 test/imagekit/url_test.rb delete mode 100644 test/imagekit/utils/calculation_test.rb delete mode 100644 test/imagekit/utils/formatter_test.rb delete mode 100644 test/test_helper.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..adb71c87 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI +on: + push: + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' + +jobs: + lint: + timeout-minutes: 10 + name: lint + runs-on: ${{ github.repository == 'stainless-sdks/imagekit-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Run lints + run: ./scripts/lint + test: + timeout-minutes: 10 + name: test + runs-on: ${{ github.repository == 'stainless-sdks/imagekit-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Run tests + run: ./scripts/test diff --git a/.github/workflows/gempush.yml b/.github/workflows/gempush.yml deleted file mode 100644 index 6a3223fd..00000000 --- a/.github/workflows/gempush.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Ruby Gem -on: - release: - types: [published] - -jobs: - build: - name: Build + Publish - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Ruby 2.6 - uses: ruby/setup-ruby@v1.126.0 - with: - ruby-version: 2.6.5 - bundler: 2.4.22 - - name: Run Test Cases - run: | - gem install bundler -v 2.4.22 - bundle install --jobs 4 --retry 3 - bundle exec rake - - - name: Publish to RubyGems - run: | - mkdir -p $HOME/.gem - touch $HOME/.gem/credentials - chmod 0600 $HOME/.gem/credentials - printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials - gem build *.gemspec - gem push *.gem - env: - GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 8c68db1a..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Ruby Test - -on: [ push, pull_request ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Ruby 2.6 - uses: ruby/setup-ruby@v1.126.0 - with: - ruby-version: 2.6.5 - bundler: 2.4.22 - - name: Build and test with Rake - run: | - gem install bundler -v 2.4.22 - bundle install --jobs 4 --retry 3 - bundle exec rake - # - name: Upload code coverage reports to codecov - # uses: codecov/codecov-action@v1 - # with: - # token: 58fd7bff-e88e-4f23-b940-811b12f20dcf # not required for public repos - # # file: ./coverage.xml # optional - # # files: ./coverage1.xml,./coverage2.xml # optional - # # flags: unittests # optional - # # name: codecov-umbrella # optional - # # fail_ci_if_error: true # optional (default = false) diff --git a/.gitignore b/.gitignore index 7500a4aa..3d26ceed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,10 @@ -.bundle/ -log/*.log -pkg/ -coverage/ -test/dummy/db/*.sqlite3 -test/dummy/db/*.sqlite3-journal -test/dummy/db/*.sqlite3-* -test/dummy/log/*.log -test/dummy/storage/ -test/dummy/tmp/ -.vscode -public/uploads/ -config/master.key -.DS_Store -Gemfile.lock -**/Gemfile.lock -.idea/* -.rakeTasks -.idea/.gitignore -.idea/imagekit-ruby.iml -.idea/misc.xml -.idea/modules.xml -.idea/vcs.xml +*.gem +.idea/ +.ignore +.prism.log +.ruby-lsp/ +.yardoc/ +bin/tapioca +Brewfile.lock.json +doc/ +sorbet/tapioca/* diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..f79bc9ed --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,292 @@ +# yaml-language-server: $schema=https://www.rubyschema.org/rubocop.json +--- +# Explicitly disable pending cops for now. This is the default behaviour but +# this avoids a large warning every time we run it. +# Stop RuboCop nagging about rubocop-rake. +# Ensure that RuboCop validates according to the lowest version of Ruby that we support. +AllCops: + Exclude: + - "bin/*" + NewCops: enable + SuggestExtensions: false + TargetRubyVersion: 3.2 + +# Whether MFA is required or not should be left to the token configuration. +Gemspec/RequireMFA: + Enabled: false + +# Don't require this extra line break, it can be excessive. +Layout/EmptyLineAfterGuardClause: + Enabled: false + +# Don't leave complex assignment values hanging off to the right. +Layout/EndAlignment: + EnforcedStyleAlignWith: variable + +Layout/FirstArrayElementLineBreak: + Enabled: true + +Layout/FirstHashElementLineBreak: + Enabled: true + +Layout/FirstMethodArgumentLineBreak: + Enabled: true + +Layout/FirstMethodParameterLineBreak: + Enabled: true + +# Set a reasonable line length; rely on other cops to correct long lines. +Layout/LineLength: + AllowedPatterns: + - "^\\s*#.*$" + - ^require(_relative)? + - "Imagekit::Internal::Type::BaseModel$" + - "^\\s*[A-Z0-9_]+ = :" + - "Imagekit::(Models|Resources|Test)::" + Max: 110 + +Layout/MultilineArrayLineBreaks: + Enabled: true + +# Start the assignment on the same line variable is mentioned. +Layout/MultilineAssignmentLayout: + EnforcedStyle: same_line + +Layout/MultilineHashKeyLineBreaks: + Enabled: true + +Layout/MultilineMethodArgumentLineBreaks: + Enabled: true + +Layout/MultilineMethodParameterLineBreaks: + Enabled: true + +# Prefer compact hash literals. +Layout/SpaceInsideHashLiteralBraces: + EnforcedStyle: no_space + Exclude: + - "**/*.rbi" + +Lint/BooleanSymbol: + Enabled: false + +# This option occasionally mangles identifier names +Lint/DeprecatedConstants: + Exclude: + - "**/*.rbi" + +# We use pattern assertion in tests to ensure correctness. +Lint/DuplicateMatchPattern: + Exclude: + - "test/**/*" + +# Fairly useful in tests for pattern assertions. +Lint/EmptyInPattern: + Exclude: + - "test/**/*" + +Lint/MissingCopEnableDirective: + Exclude: + - "examples/**/*.rb" + +Lint/MissingSuper: + Exclude: + - "**/*.rbi" + +Lint/SymbolConversion: + Exclude: + - "**/*.rbi" + +# Disabled for safety reasons, this option changes code semantics. +Lint/UnusedMethodArgument: + AutoCorrect: false + +# This option is prone to causing accidental bugs. +Lint/UselessAssignment: + AutoCorrect: false + Exclude: + - "examples/**/*.rb" + +Metrics/AbcSize: + Enabled: false + +Metrics/BlockLength: + AllowedPatterns: + - assert_pattern + - type_alias + - define_sorbet_constant! + Exclude: + - "**/*.rbi" + +Metrics/ClassLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + Enabled: false + +Metrics/ParameterLists: + Enabled: false + +Metrics/PerceivedComplexity: + Enabled: false + +Naming/AccessorMethodName: + Enabled: false + +# Need to preserve block identifier for documentation. +Naming/BlockForwarding: + Enabled: false + +# Underscores are generally useful for disambiguation. +Naming/ClassAndModuleCamelCase: + Enabled: false + +Naming/MethodParameterName: + Enabled: false + +Naming/PredicatePrefix: + Exclude: + - "**/*.rbi" + +Naming/VariableNumber: + Enabled: false + +# Nothing wrong with inline private methods. +Style/AccessModifierDeclarations: + Enabled: false + +Style/AccessorGrouping: + Exclude: + - "**/*.rbi" + +# Behaviour of alias_method is more predictable. +Style/Alias: + EnforcedStyle: prefer_alias_method + +# And/or have confusing precedence, avoid them. +Style/AndOr: + EnforcedStyle: always + +Style/ArgumentsForwarding: + Enabled: false + +Style/BisectedAttrAccessor: + Exclude: + - "**/*.rbi" + +# We prefer nested modules in lib/, but are currently using compact style for tests. +Style/ClassAndModuleChildren: + Exclude: + - "test/**/*" + +Style/CommentAnnotation: + Enabled: false + +# We should go back and add these docs, but ignore for now. +Style/Documentation: + Enabled: false + +# Allow explicit empty elses, for clarity. +Style/EmptyElse: + Enabled: false + +Style/EmptyMethod: + Exclude: + - "**/*.rbi" + +# We commonly use ENV['KEY'], it's OK. +Style/FetchEnvVar: + Enabled: false + +# Just to be safe, ensure nobody is mutating our internal strings. +Style/FrozenStringLiteralComment: + EnforcedStyle: always + Exclude: + - "**/*.rbi" + +# Nothing wrong with clear if statements. +Style/IfUnlessModifier: + Enabled: false + +# Rubocop is pretty bad about mangling single line lambdas. +Style/Lambda: + Enabled: false + +# Prefer consistency in method calling syntax. +Style/MethodCallWithArgsParentheses: + AllowedMethods: + - raise + Enabled: true + Exclude: + - "**/*.gemspec" + +Style/MultilineBlockChain: + Enabled: false + +# Perfectly fine. +Style/MultipleComparison: + Enabled: false + +Style/MutableConstant: + Exclude: + - "**/*.rbi" + +# Not all parameters should be named. +Style/NumberedParameters: + Enabled: false + +Style/NumberedParametersLimit: + Max: 2 + +# Reasonable to use brackets for errors with long messages. +Style/RaiseArgs: + Enabled: false + +# Be explicit about `RuntimeError`s. +Style/RedundantException: + Enabled: false + +Style/RedundantInitialize: + Exclude: + - "**/*.rbi" + +Style/RedundantParentheses: + Exclude: + - "**/*.rbi" + +# Prefer slashes for regex literals. +Style/RegexpLiteral: + EnforcedStyle: slashes + +# Allow explicit ifs, especially for imperative use. +Style/SafeNavigation: + Enabled: false + +Style/SignalException: + Exclude: + - Rakefile + - "**/*.rake" + +# We use these sparingly, where we anticipate future branches for the +# inner conditional. +Style/SoleNestedConditional: + Enabled: false + +# Prefer double quotes so that interpolation can be easily added. +Style/StringLiterals: + EnforcedStyle: double_quotes + +# Prefer explicit symbols for clarity; you can search for `:the_symbol`. +Style/SymbolArray: + EnforcedStyle: brackets + +# This option makes examples harder to read for ruby novices. +Style/SymbolProc: + Exclude: + - "examples/**/*.rb" diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..944880fa --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.0 diff --git a/.solargraph.yml b/.solargraph.yml new file mode 100644 index 00000000..b100d90f --- /dev/null +++ b/.solargraph.yml @@ -0,0 +1,11 @@ +--- +max_files: 0 +include: + - '*.gemspec' + - 'Rakefile' + - 'examples/**/*.rb' + - 'lib/**/*.rb' + - 'test/imagekit/resource_namespaces.rb' + - 'test/imagekit/test_helper.rb' +exclude: + - 'rbi/**/*' diff --git a/.stats.yml b/.stats.yml new file mode 100644 index 00000000..ad85869b --- /dev/null +++ b/.stats.yml @@ -0,0 +1,4 @@ +configured_endpoints: 42 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-3d7da4b8ef2ed30aa32c4fb3e98e498e67402e91aaa5fd4c628fc080bfe82ea1.yml +openapi_spec_hash: aaa50fcbccec6f2cf1165f34bc6ac886 +config_hash: cf9d50fe62973f4e91ef65c147aabcc1 diff --git a/.yardopts b/.yardopts new file mode 100644 index 00000000..84c12f2a --- /dev/null +++ b/.yardopts @@ -0,0 +1,6 @@ +--type-name-tag generic:Generic +--default-return void +--markup markdown +--markup-provider redcarpet +--exclude /rbi +--exclude /sig diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..ff57412c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,125 @@ +## Setting up the environment + +This repository contains a `.ruby-version` file, which should work with either [rbenv](https://github.com/rbenv/rbenv) or [asdf](https://github.com/asdf-vm/asdf) with the [ruby plugin](https://github.com/asdf-vm/asdf-ruby). + +Please follow the instructions for your preferred version manager to install the Ruby version specified in the `.ruby-version` file. + +To set up the repository, run: + +```bash +$ ./scripts/bootstrap +``` + +This will install all the required dependencies. + +## Modifying/Adding code + +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may result in merge conflicts between manual patches and changes from the generator. The generator will never modify the contents of `lib/imagekit/helpers/` and `examples/` directory. + +## Adding and running examples + +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. + +```ruby +#!/usr/bin/env ruby +# frozen_string_literal: true + +require_relative "../lib/imagekit" + +# ... +``` + +```bash +$ chmod +x './examples/.rb' + +# run the example against your api +$ ruby './examples/.rb' +``` + +## Using the repository from source + +If you’d like to use the repository from source, you can either install from git or reference a cloned repository: + +To install via git in your `Gemfile`: + +```ruby +gem "imagekit", git: "https://www.github.com/stainless-sdks/imagekit-ruby" +``` + +Alternatively, reference local copy of the repo: + +```bash +$ git clone -- 'https://www.github.com/stainless-sdks/imagekit-ruby' '' +``` + +```ruby +gem "imagekit", path: "" +``` + +## Running commands + +Running `rake` by itself will show all runnable commands. + +```bash +$ bundle exec rake +``` + +## Running tests + +Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. + +```bash +$ npx prism mock path/to/your/openapi.yml +``` + +```bash +$ bundle exec rake test +``` + +## Linting and formatting + +This repository uses [rubocop](https://github.com/rubocop/rubocop) for linting and formatting of `*.rb` files; And [syntax_tree](https://github.com/ruby-syntax-tree/syntax_tree) is used for formatting of both `*.rbi` and `*.rbs` files. + +There are two separate type checkers supported by this library: [sorbet](https://github.com/sorbet/sorbet) and [steep](https://github.com/soutaro/steep) are used for verifying `*.rbi` and `*.rbs` files respectively. + +To lint and typecheck: + +```bash +$ bundle exec rake lint +``` + +To format and fix all lint issues automatically: + +```bash +$ bundle exec rake format +``` + +## Editor Support + +### Ruby LSP + +[Ruby LSP](https://github.com/Shopify/ruby-lsp) has quite good support for go to definition, but not auto-completion. + +This can be installed along side Solargraph. + +### Solargraph + +[Solargraph](https://solargraph.org) has quite good support for auto-completion, but not go to definition. + +This can be installed along side Ruby LSP. + +### Sorbet + +[Sorbet](https://sorbet.org) should mostly work out of the box when editing this library directly. However, there are a some caveats due to the colocation of `*.rb` and `*.rbi` files in the same project. These issues should not otherwise manifest when this library is used as a dependency. + +1. For go to definition usages, sorbet might get confused and may not always navigate to the correct location. + +2. For each generic type in `*.rbi` files, a spurious "Duplicate type member" error is present. + +## Documentation Preview + +To preview the documentation, run: + +```bash +$ bundle exec rake docs:preview [PORT=8808] +``` diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md deleted file mode 100644 index 47e24cd9..00000000 --- a/DEVELOPMENT.md +++ /dev/null @@ -1,20 +0,0 @@ -# Development Guide - - -**1. To modify version open `lib/imagekit/sdk/version.rb` and change value of `VERSION`.** - -**2. Setup dependency for projects** -```shell -gem install bundler -bundle install -``` - -**2. Run test cases** -```shell -bundle exec rake -``` - -**3. To build gem** -```shell -gem build imagekitio.gemspec -``` diff --git a/Gemfile b/Gemfile index c5777000..0d76364b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,27 +1,33 @@ -source 'https://rubygems.org' -git_source(:github) { |repo| "https://github.com/#{repo}.git" } +# frozen_string_literal: true + +source "https://rubygems.org" -# Declare your gem's dependencies in imagekit-sdk.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. gemspec -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. +group :development do + gem "rake" + gem "rbs" + gem "rubocop" + gem "sorbet" + gem "steep" + gem "syntax_tree" + # TODO: using a fork for now, the prettier below has a bug + gem "syntax_tree-rbs", github: "stainless-api/syntax_tree-rbs", branch: "main" + gem "tapioca" +end -# To use a debugger -# gem 'byebug', group: [:development, :test] -# gem 'carrierwave', '~> 2.0' -# gem "rake", "~> 12.0" -# gem "rest-client", "~>2.1" +group :development, :test do + gem "async" + gem "minitest" + gem "minitest-focus" + gem "minitest-hooks" + gem "minitest-proveit" + gem "minitest-rg" + gem "webmock" +end -group :test do - gem "minitest", "~> 5.0" - gem "rspec" - gem 'simplecov' - # gem 'codecov' - gem 'webmock' - gem 'byebug' +group :development, :docs do + gem "redcarpet" + gem "webrick" + gem "yard" end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..2c4ef551 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,226 @@ +GIT + remote: https://github.com/stainless-api/syntax_tree-rbs.git + revision: c30b50219918be7cfe3ef803a00b59d1e77fcada + branch: main + specs: + syntax_tree-rbs (1.0.0) + prettier_print + rbs + syntax_tree (>= 2.0.1) + +PATH + remote: . + specs: + imagekit (0.0.1) + connection_pool + +GEM + remote: https://rubygems.org/ + specs: + activesupport (8.0.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + ast (2.4.3) + async (2.27.3) + console (~> 1.29) + fiber-annotation + io-event (~> 1.11) + metrics (~> 0.12) + traces (~> 0.15) + base64 (0.3.0) + benchmark (0.4.1) + bigdecimal (3.2.2) + concurrent-ruby (1.3.5) + connection_pool (2.5.3) + console (1.33.0) + fiber-annotation + fiber-local (~> 1.1) + json + crack (1.0.0) + bigdecimal + rexml + csv (3.3.5) + drb (2.2.3) + erubi (1.13.1) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) + fiber-annotation (0.2.0) + fiber-local (1.1.0) + fiber-storage + fiber-storage (1.0.1) + fileutils (1.7.3) + hashdiff (1.2.0) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-event (1.11.2) + json (2.13.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) + metrics (0.13.0) + minitest (5.25.5) + minitest-focus (1.4.0) + minitest (>= 4, < 6) + minitest-hooks (1.5.2) + minitest (> 5.3) + minitest-proveit (1.0.0) + minitest (> 5, < 7) + minitest-rg (5.3.0) + minitest (~> 5.0) + mutex_m (0.3.0) + netrc (0.11.0) + parallel (1.27.0) + parser (3.3.9.0) + ast (~> 2.4.1) + racc + prettier_print (1.2.1) + prism (1.4.0) + public_suffix (6.0.2) + racc (1.8.1) + rainbow (3.1.1) + rake (13.3.0) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rbi (0.3.6) + prism (~> 1.0) + rbs (>= 3.4.4) + rbs (3.9.4) + logger + redcarpet (3.6.1) + regexp_parser (2.11.2) + rexml (3.4.1) + rubocop (1.79.2) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.46.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.46.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + ruby-progressbar (1.13.0) + securerandom (0.4.1) + sorbet (0.5.12424) + sorbet-static (= 0.5.12424) + sorbet-runtime (0.5.12424) + sorbet-static (0.5.12424-aarch64-linux) + sorbet-static (0.5.12424-universal-darwin) + sorbet-static (0.5.12424-x86_64-linux) + sorbet-static-and-runtime (0.5.12424) + sorbet (= 0.5.12424) + sorbet-runtime (= 0.5.12424) + spoom (1.6.3) + erubi (>= 1.10.0) + prism (>= 0.28.0) + rbi (>= 0.3.3) + rexml (>= 3.2.6) + sorbet-static-and-runtime (>= 0.5.10187) + thor (>= 0.19.2) + steep (1.10.0) + activesupport (>= 5.1) + concurrent-ruby (>= 1.1.10) + csv (>= 3.0.9) + fileutils (>= 1.1.0) + json (>= 2.1.0) + language_server-protocol (>= 3.17.0.4, < 4.0) + listen (~> 3.0) + logger (>= 1.3.0) + mutex_m (>= 0.3.0) + parser (>= 3.1) + rainbow (>= 2.2.2, < 4.0) + rbs (~> 3.9) + securerandom (>= 0.1) + strscan (>= 1.0.0) + terminal-table (>= 2, < 5) + uri (>= 0.12.0) + strscan (3.1.5) + syntax_tree (6.3.0) + prettier_print (>= 1.2.0) + tapioca (0.16.11) + benchmark + bundler (>= 2.2.25) + netrc (>= 0.11.0) + parallel (>= 1.21.0) + rbi (~> 0.2) + sorbet-static-and-runtime (>= 0.5.11087) + spoom (>= 1.2.0) + thor (>= 1.2.0) + yard-sorbet + terminal-table (4.0.0) + unicode-display_width (>= 1.1.1, < 4) + thor (1.4.0) + traces (0.17.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (3.1.5) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.3) + webmock (3.25.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.1) + yard (0.9.37) + yard-sorbet (0.9.0) + sorbet-runtime + yard + +PLATFORMS + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm64-darwin + universal-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + async + imagekit! + minitest + minitest-focus + minitest-hooks + minitest-proveit + minitest-rg + rake + rbs + redcarpet + rubocop + sorbet + steep + syntax_tree + syntax_tree-rbs! + tapioca + webmock + webrick + yard + +BUNDLED WITH + 2.4.1 diff --git a/LICENSE b/LICENSE index b767e540..e7a4d160 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,201 @@ -MIT License - -Copyright (c) 2020 Imagekit - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2025 Image Kit + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 20a7791d..8d9c1b92 100644 --- a/README.md +++ b/README.md @@ -1,915 +1,278 @@ -[ImageKit.io](https://imagekit.io) - -# Imagekit Ruby and Rails SDK - -[![Ruby Test](https://github.com/imagekit-developer/imagekit-ruby/workflows/Ruby%20Test/badge.svg)](https://github.com/imagekit-developer/imagekit-ruby) -[![Gem Version](https://badge.fury.io/rb/imagekitio.svg)](https://badge.fury.io/rb/imagekitio) -[![codecov](https://codecov.io/gh/imagekit-developer/imagekit-ruby/branch/master/graph/badge.svg)](https://codecov.io/gh/imagekit-developer/imagekit-ruby) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Twitter Follow](https://img.shields.io/twitter/follow/imagekitio?label=Follow&style=social)](https://twitter.com/ImagekitIo) - -Ruby on Rails gem for [ImageKit](https://imagekit.io/) implements the new APIs and interface for different file operations. - -ImageKit is complete media storage, optimization, and transformation solution that comes with an [image and video CDN](https://imagekit.io/features/imagekit-infrastructure). It can be integrated with your existing infrastructure - storage like AWS S3, web servers, your CDN, and custom domain names, allowing you to deliver optimized images in minutes with minimal code changes. - -Table of contents - - * [Changelog](#changelog) - * [Installation](#installation) - * [Initialization](#initialization) - - [CarrierWave](#carrierwave) - - [ActiveStorage](#activestorage) - * [URL Generation](#url-generation) - * [File Upload](#file-upload) - * [File Management](#file-management) - * [Utility Functions](#utility-functions) - * [Sample applications](#sample-application) - * [Upgrade to 2.x](#upgrade-to-2x) - * [Support](#support) - * [Links](#links) - - -# Quick start guide -Get started with [official quick start guide](https://docs.imagekit.io/getting-started/quickstart-guides/ruby-guides) for integrating ImageKit in Ruby on Rails. - -## Changelog -### SDK Version 3.0.0 -#### Breaking changes -**1. Overlay syntax update** -* In version 3.0.0, we've removed the old overlay syntax parameters for transformations, such as `oi`, `ot`, `obg`, and [more](https://docs.imagekit.io/features/image-transformations/overlay). These parameters are deprecated and will start returning errors when used in URLs. Please migrate to the new layers syntax that supports overlay nesting, provides better positional control, and allows more transformations at the layer level. You can start with [examples](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#examples) to learn quickly. -* You can migrate to the new layers syntax using the `raw` transformation parameter. +# Image Kit Ruby API library -## Installation - -Add `imagekitio` dependency to your application's Gemfile: - -```ruby -gem 'imagekitio' -``` - -And then execute: -``` -$ bundle install -``` - -Or install it yourself: -``` -$ gem install imagekitio -``` - -## Initialization - -Create a new file `config/initializers/imagekitio.rb` then add the configuration. -```ruby -ImageKitIo.configure do |config| - if Rails.env.development? - config.public_key = 'your_public_api_key' - config.private_key = 'your_private_api_key' - config.url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/' - end - config.service = :carrierwave - #config.service = :active_storage - #config.constants.MISSING_PRIVATE_KEY = 'custom error message' -end -``` -#### CarrierWave -You can create a CarrierWave uploader to attach pictures to your database objects as their attributes. Skip to [this section](https://github.com/imagekit-developer/imagekit-ruby#file-upload) to upload images without designating them as database attributes. Make sure to add service `:carrierwave` as shown in [initialization section](#initialization). - -```bash -rails g uploader -# For example, if you want to create an uploader for Avatar attribute, then use -rails g uploader Avatar -# Generated uploader's path will be app/uploaders/avatar_uploader.rb -``` - -After that, you need to edit your generated uploader and make the following changes: -```ruby -# include this module inside the top of the uploader class -include ImageKitIo::CarrierWave - -# If you want to add uploading options, then create this method inside the uploader file as an example - -def options - options={ - response_fields: 'isPrivateFile, tags', - tags: %w[abc def], - use_unique_file_name: false, - folder: "your_directory/" - } -end - -# If you want to set upload dir, then you can use the following method, or you can also use the options method. -# This method should return a string -def store_dir - "your_directory/" -end -``` - -Then you need to modify your model. for example- if your model name is employee, then do these changes. - -```ruby -class Employee < ApplicationRecord - attr_accessor :avatar - mount_uploader :avatar, AvatarUploader -end -``` +The Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/stainless-sdks/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem. -Get image url: -```ruby -# If @employee is an object of your model that has data. - -# To get the original image url, use -@employee.avatar.url - -# To get the file metadata -@employee.avatar.metadata - - -# And to get transformed url use -# options is a transformation options -@employee.avatar.url_with(options) -``` - -#### ActiveStorage - -Once you [install](https://guides.rubyonrails.org/active_storage_overview.html#setup) the active_storage gem, then any model can have the attachment using `has_one_attached` or `has_many_attached` like below: +It is generated with [Stainless](https://www.stainless.com/). -```ruby -class Employee < ApplicationRecord - has_one_attached :avatar -end -``` - -Get image url: -```ruby -# If @employee is an object of your model that has data. - -# To get the original image url, use -@employee.avatar.url -``` +## Documentation -Now, let's configure active_storage as a service for the imagekitio. +Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekit). -First add `:active_storage` in initializer file. +The REST API documentation can be found on [imagekit.io](https://imagekit.io/docs). -```ruby -config.service = :active_storage -``` +## Installation -Then add the imagekitio service in the `storage.yml` file: +To use this gem, install via Bundler by adding the following to your application's `Gemfile`: ```ruby -imagekitio: - service: ImageKitIo +gem "imagekit", "~> 0.0.1" ``` - ## Usage -You can use this Ruby SDK for three different methods - URL generation, file upload, and media management operations. The usage of the SDK has been explained below. - -* `URL Generation` -* `File Upload` -* `File Management` - -## URL generation - -**1. Using Image path and image hostname or endpoint** - -This method allows you to create an URL to access a file using the relative file path and the ImageKit URL endpoint (`urlEndpoint`). The file can be an image, video or any other static file supported by ImageKit. - -```ruby -imagekitio = ImageKitIo.client -image_url = imagekitio.url({ - path: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{height: "300", width: "400", raw: "ar-4-3,q-40"}] -}) -``` - -The result in a URL like -``` -https://ik.imagekit.io/your_imagekit_id/endpoint/tr:h-300,w-400,ar-4-3,q-40/default-image.jpg -``` - -**2.Using full image URL** -This method allows you to add transformation parameters to an absolute URL. For example, if you have configured a custom CNAME and have absolute asset URLs in your database or CMS, you will often need this. - - -```ruby -image_url = imagekitio.url({ - src: "https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg", - transformation: [{height: "300", width: "400"}], -}) -``` - -The results in a URL like - -``` -https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=h-300%2Cw-400 -``` - - -The `.url()` method accepts the following parameters - -| Option | Description | -| :---------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| url_endpoint | Optional. The base URL to be appended before the path of the image. If not specified, the URL Endpoint specified at the time of SDK initialization is used. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/ | -| path | Conditional. This is the path at which the image exists. For example, `/path/to/image.jpg`. Either the `path` or `src` parameter needs to be specified for URL generation. | -| src | Conditional. This is the complete URL of an image already mapped to ImageKit. For example, `https://ik.imagekit.io/your_imagekit_id/endpoint/path/to/image.jpg`. Either the `path` or `src` parameter needs to be specified for URL generation. | -| transformation | Optional. An array of objects specifying the transformation to be applied in the URL. The transformation name and the value should be specified as a key-value pair in the object. Different steps of a [chained transformation](https://docs.imagekit.io/features/image-transformations/chained-transformations) can be specified as different objects of the array. The complete list of supported transformations in the SDK and some examples of using them are given later. If you use a transformation name that is not specified in the SDK, it gets applied as it is in the URL. | -| transformation_position | Optional. The default value is `path` that places the transformation string as a path parameter in the URL. It can also be specified as `query`, which adds the transformation string as the query parameter `tr` in the URL. If you use `src` parameter to create the URL, then the transformation string is always added as a query parameter. | -| query_parameters | Optional. These are the other query parameters that you want to add to the final URL. These can be any query parameters and not necessarily related to ImageKit. Especially useful if you want to add some versioning parameters to your URLs. | -| signed | Optional. Boolean. Default is `false`. If set to `true`, the SDK generates a signed image URL adding the image signature to the image URL. This can only be used if you are creating the URL with the `url_endpoint` and `path` parameters and not with the `src` parameter. | -| expire_seconds | Optional. Integer. Meant to be used along with the `signed` parameter to specify the time in seconds from now when the URL should expire. If specified, the URL contains the expiry timestamp in the URL, and the image signature is modified accordingly. | - - -## Examples of generating URLs -**1. Chained Transformations as a query parameter** - -```ruby -image_url = imagekitio.url({ - path: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{ - height: "300", - width: "400" - },{ - rotation: 90 - }], - transformation_position: "query" -}) -``` -Sample Result URL - -``` -https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=h-300%2Cw-400%3Art-90 -``` - -**2. Sharpening and contrast transforms and a progressive JPG image** - -There are some transforms like [Sharpening](https://docs.imagekit.io/features/image-transformations/image-enhancement-and-color-manipulation) -that can be added to the URL with or without any other value. To use such transforms without specifying a value, specify -the value as "-" in the transformation object. Otherwise, specify the value that you want to be -added to this transformation. - - -```ruby -image_url = imagekitio.url({ - src: "https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg", - transformation: [{ - format: "jpg", - progressive: "true", - effect_sharpen: "-", - effect_contrast: "1" - }] -}) -``` - -``` -//Note that because `src` parameter was used, the transformation string gets added as a query parameter `tr` -https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=f-jpg%2Cpr-true%2Ce-sharpen%2Ce-contrast-1 -``` - -**3. Signed URL that expires in 300 seconds with the default URL endpoint and other query parameters** - -```ruby -image_url = imagekit.url({ - path: "/default-image", - query_parameters: { - "v": "123" - }, - transformation: [{ - height: "300", - width: "400" - }], - signed: True, - expire_seconds: 300 -}) -``` -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400/default-image.jpg?v=123&ik-t=1567358667&ik-s=f2c7cdacbe7707b71a83d49cf1c6110e3d701054 -``` - -**4. Adding overlays** - -ImageKit.io enables you to apply overlays to [images](https://docs.imagekit.io/features/image-transformations/overlay-using-layers) and [videos](https://docs.imagekit.io/features/video-transformation/overlay) using the raw parameter with the concept of [layers](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#layers). The raw parameter facilitates incorporating transformations directly in the URL. A layer is a distinct type of transformation that allows you to define an asset to serve as an overlay, along with its positioning and additional transformations. - -**Text as overlays** - -You can add any text string over a base video or image using a text layer (l-text). - -For example: - -```ruby -image_url = imagekit.url({ - path: "/default-image", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{ - height: "300", - width: "400", - raw: "l-text,i-Imagekit,fs-50,l-end" - }], -}) -``` -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg -``` - -**Image as overlays** - -You can add an image over a base video or image using an image layer (l-image). - -For example: - -```ruby -image_url = imagekit.url({ - path: "/default-image", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{ - height: "300", - width: "400", - raw: "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end" - }], -}) -``` -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end/default-image.jpg -``` - -**Solid color blocks as overlays** - -You can add solid color blocks over a base video or image using an image layer (l-image). - -For example: - -```ruby -image_url = imagekit.url({ - path: "/img/sample-video", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{ - height: "300", - width: "400", - raw: "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end" - }], -}) -``` -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end/img/sample-video.mp4 -``` - -**5. Arithmetic expressions in transformations** - -ImageKit allows use of [arithmetic expressions](https://docs.imagekit.io/features/arithmetic-expressions-in-transformations) in certain dimension and position-related parameters, making media transformations more flexible and dynamic. - -For example: - ```ruby -image_url = imagekit.url({ - path: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{ - width: "iw_div_4", - height: "ih_div_2", - border: "cw_mul_0.05_yellow" - }] -}); -``` - -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/default-image.jpg?tr=w-iw_div_4,h-ih_div_2,b-cw_mul_0.05_yellow -``` +require "bundler/setup" +require "imagekit" -**List of transformations** - -The complete list of transformations supported and their usage in ImageKit can be found [here](https://docs.imagekit.io/features/image-transformations/resize-crop-and-other-transformations). The SDK gives a name to each transformation parameter, making the code simpler, making the code simpler, and readable. - -If a transformation is supported in ImageKit, but a name for it cannot be found in the table below, then use the transformation code from ImageKit docs as the name when using the `url` function. - -If you want to generate transformations in your application and add them to the URL as it is, use the `raw` parameter. - -| Supported Transformation Name | Translates to parameter | -|-------------------------------|-------------------------| -| height | h | -| width | w | -| aspect_ratio | ar | -| quality | q | -| crop | c | -| crop_mode | cm | -| x | x | -| y | y | -| focus | fo | -| format | f | -| radius | r | -| background | bg | -| border | b | -| rotation | rt | -| blur | bl | -| named | n | -| progressive | pr | -| lossless | lo | -| trim | t | -| metadata | md | -| color_profile | cp | -| default_image | di | -| dpr | dpr | -| effect_sharpen | e-sharpen | -| effect_usm | e-usm | -| effect_contrast | e-contrast | -| effect_gray | e-grayscale | -| effect_shadow | e-shadow | -| effect_gradient | e-gradient | -| original | orig | -| raw | `replaced by the parameter value` | - -## File Upload -This method can be used to directly upload images to your ImageKit Media Library without giving it the designation of an attribute of any database object. - -The SDK provides a simple interface using the `.upload()` method to upload files to the ImageKit Media library. It -accepts all the parameters supported by the [ImageKit Upload API](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload). - -The `upload()` method requires at least the `file` and the `file_name` parameter to upload a file and returns -a callback with the `error` and `result` as arguments. You can pass other parameters supported by the -ImageKit upload API using the same parameter name as specified in the upload API documentation. For example, to specify tags for a file at the time of upload, use the `tags` parameter as specified in the [documentation here](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload). - -Simple usage +image_kit = Imagekit::Client.new( + private_api_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], # This is the default and can be omitted + password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted +) -```ruby -imagekitio.upload_file( - file: "", # required - file_name: "my_file_name.jpg", # required - response_fields: 'isPrivateFile, tags', - tags: %w[abc def], - use_unique_file_name: true, - transformation: { - pre: 'l-text,i-Imagekit,fs-50,l-end', - post: [ - { - type: 'transformation', - value: 'w-100' - } - ] - }, - checks: "'request.folder' : '/'" # To run server side checks before uploading files. Notice the quotes around file.size and 1mb. - is_published: true +response = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" ) +puts(response.videoCodec) ``` -If the upload is succeeded, `error` will be `None`, and the result will be the same as what is received from ImageKit's -servers. If the upload fails, `error` will be the same as what is received from ImageKit's servers, and the result will -be `None`. - -## File Management - -The SDK provides a simple interface for all the [media APIs mentioned here](https://docs.imagekit.io/api-reference/media-api) -to manage your files. This also returns `error` and `result`. The `error` will be `None` if API succeeds. +### File uploads -**List & Search Files** - -Accepts an object specifying the parameters to be used to list and search files. All parameters specified -in the [documentation here](https://docs.imagekit.io/api-reference/media-api/list-and-search-files#list-and-search-file-api) can be passed with the -correct values to get the results. +Request parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more. ```ruby -imagekitio.list_files( - skip: 0, - limit: 5 -) -``` -**Get File Details** +require "pathname" -Accepts the file ID and fetches the details as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-details) +# Use `Pathname` to send the filename and/or avoid paging a large file into memory: +response = image_kit.files.upload(file: Pathname("/path/to/file")) -```ruby -imagekitio.get_file_details( - file_id: '598821f949c0a938d57563bd' -) -``` +# Alternatively, pass file contents or a `StringIO` directly: +response = image_kit.files.upload(file: File.read("/path/to/file")) -**Get File Metadata** +# Or, to control the filename and/or content type: +file = Imagekit::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…") +response = image_kit.files.upload(file: file) -Accepts the file ID and fetches the metadata as per the [API documentation here](https://docs.imagekit.io/api-reference/metadata-api/get-image-metadata-for-uploaded-media-files) -```ruby -imagekit.get_file_metadata( - file_id: '598821f949c0a938d57563bd' -) +puts(response.videoCodec) ``` -**Get File Metadata from remote url** +Note that you can also pass a raw `IO` descriptor, but this disables retries, as the library can't be sure if the descriptor is a file or pipe (which cannot be rewound). -Accepts the remote file url and fetches the metadata as per the [API documentation here](https://docs.imagekit.io/api-reference/metadata-api/get-image-metadata-from-remote-url) +### Handling errors -```ruby -imagekit.get_remote_file_url_metadata( - remote_file_url: "https://ik.imagekit.io/demo/tr:w-100/default-image.jpg" -) -``` - -**Update File Details** - -Update parameters associated with the file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/update-file-details). -The first argument to the `update_field_details` method is the file ID, and a second argument is an object with the -parameters to be updated. +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 `Imagekit::Errors::APIError` will be thrown: ```ruby -imagekitio.update_file_details( - file_id: '598821f949c0a938d57563bd', - tags: ["image_tag"], - custom_coordinates: "10,10,100, 100" -) +begin + file = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" + ) +rescue Imagekit::Errors::APIConnectionError => e + puts("The server could not be reached") + puts(e.cause) # an underlying Exception, likely raised within `net/http` +rescue Imagekit::Errors::RateLimitError => e + puts("A 429 status code was received; we should back off a bit.") +rescue Imagekit::Errors::APIStatusError => e + puts("Another non-200-range status code was received") + puts(e.status) +end ``` +Error codes are as follows: -**Update publish status** +| Cause | Error Type | +| ---------------- | -------------------------- | +| HTTP 400 | `BadRequestError` | +| HTTP 401 | `AuthenticationError` | +| HTTP 403 | `PermissionDeniedError` | +| HTTP 404 | `NotFoundError` | +| HTTP 409 | `ConflictError` | +| HTTP 422 | `UnprocessableEntityError` | +| HTTP 429 | `RateLimitError` | +| HTTP >= 500 | `InternalServerError` | +| Other HTTP error | `APIStatusError` | +| Timeout | `APITimeoutError` | +| Network error | `APIConnectionError` | -If `publish` is included in the update options, no other parameters are allowed. If any are present, an error will be returned: `Your request cannot contain any other parameters when publish is present`. +### Retries -```ruby -imagekitio.update_file_details( - file_id: '598821f949c0a938d57563bd', - publish:{ - isPublished: true, - includeFileVersions: true - } -) -``` - -**Copy File** - -Copy file from one path to another path using the source file path and the destination path as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-file) - -```ruby -imagekitio.copy_file( - source_file_path: '/path/to/file.jpg', - destination_path: '/folder/to/copy/into', - include_file_versions: true #default false -) -``` +Certain errors will be automatically retried 2 times by default, with a short exponential backoff. -**Move File** +Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default. -Move file from one folder to another folder using the source file path and destination path as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/move-file) +You can use the `max_retries` option to configure or disable this: ```ruby -imagekitio.move_file( - source_file_path: '/path/to/file.jpg', - destination_path: '/folder/to/move/into/' +# Configure the default for all requests: +image_kit = Imagekit::Client.new( + max_retries: 0 # default is 2 ) -``` - -**Rename File** -Rename file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/rename-file) - -```ruby -imagekitio.rename_file( - file_path: '/path/to/old-file-name.jpg', - new_file_name: 'new-file-name.jpg', - purge_cache: true #optional +# Or, configure per-request: +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg", + request_options: {max_retries: 5} ) ``` -**Delete File** +### Timeouts -Delete a file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-file). The method accepts the file ID of the file that has to be deleted. +By default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this: ```ruby -imagekitio.delete_file( - file_id: '598821f949c0a938d57563bd' +# Configure the default for all requests: +image_kit = Imagekit::Client.new( + timeout: nil # default is 60 ) -``` -**File versions** - -Get all file versions as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-versions). The method accepts the file ID of the file. -```ruby -imagekitio.file_versions( - file_id: '598821f949c0a938d57563bd' +# Or, configure per-request: +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg", + request_options: {timeout: 5} ) ``` -**File version details** -Get all file version detail as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-version-details). The method accepts the file ID and version ID of the file. +On timeout, `Imagekit::Errors::APITimeoutError` is raised. -```ruby -imagekitio.file_version_detail( - file_id: '598821f949c0a938d57563bd', - version_id: '846321f949c0a938d57567ty' -) -``` +Note that requests that time out are retried by default. -**Delete file version** +## Advanced concepts -Delete file version as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-file-version). The method accepts the file ID and version ID of the file. +### BaseModel -```ruby -imagekitio.delete_file_version( - file_id: '598821f949c0a938d57563bd', - version_id: '846321f949c0a938d57567ty' -) -``` +All parameter and response objects inherit from `Imagekit::Internal::Type::BaseModel`, which provides several conveniences, including: -**Restore file version** +1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax. -Restore deleted file version as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/restore-file-version). The method accepts the file ID and version ID of the file. +2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true. -```ruby -imagekitio.restore_file_version( - file_id: '598821f949c0a938d57563bd', - version_id: '846321f949c0a938d57567ty' -) -``` - -**Bulk File Delete by IDs** - -Delete a file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-files-bulk). The method accepts a list of file IDs of files that has to be -deleted. +3. Both instances and the classes themselves can be pretty-printed. -```ruby -imagekitio.delete_bulk_files( - file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57543bd"] -) -``` +4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`. -**Purge Cache** -Programmatically issue a clear cache request as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/purge-cache). -Accepts the full URL of the file for which the cache has to be cleared. +### Making custom or undocumented requests -```ruby -imagekitio.purge_file_cache( - file_url: 'https://ik.imagekit.io/demo/logo-white_SJwqB4Nfe.png' -) -``` -**Purge Cache Status** - -Get the purge cache request status using the request ID returned when a purge cache request gets submitted as per the -[API documentation here](https://docs.imagekit.io/api-reference/media-api/purge-cache-status) - -```ruby -imagekitio.purge_file_cache_status( - request_id: '598821f949c0a938d57543bd' -) -``` +#### Undocumented properties -**Add Bulk Tags** +You can send undocumented parameters to any endpoint, and read undocumented response properties, like so: -Add multiple tags on multiple files using an array of file ids and an array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/add-tags-bulk) +Note: the `extra_` parameters of the same name overrides the documented parameters. ```ruby -imagekitio.add_bulk_tags( - file_ids: ['598821f949c0a938d57543bd', '598921f949c0a938d57543bd'], - tags: ['custom_tags', 'image', 'favourite'] -) -``` - -**Delete Bulk Tags** - -Remove multiple tags from multiple files using an array of file ids and an array of tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-tags-bulk) +response = + image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg", + request_options: { + extra_query: {my_query_parameter: value}, + extra_body: {my_body_parameter: value}, + extra_headers: {"my-header": value} + } + ) -```ruby -imagekitio.delete_bulk_tags( - file_ids: ['598821f949c0a938d57543bd', '598921f949c0a938d57543bd'], - tags: ['custom_tags', 'image'] -) +puts(response[:my_undocumented_property]) ``` -**Delete Bulk AI Tags** +#### Undocumented request params -Delete bulk ai tags as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-aitags-bulk) - -```ruby -imagekitio.delete_bulk_ai_tags( - file_ids: ['598821f949c0a938d57543bd', '598921f949c0a938d57543bd'], - ai_tags: ['custom_ai_tags'] -) -``` +If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above. -**Create Folder** +#### Undocumented endpoints -Create folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/create-folder) +To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so: ```ruby -imagekitio.create_folder( - folder_name: 'new_folder', - parent_folder_path: 'source/folder/path' #optional +response = client.request( + method: :post, + path: '/undocumented/endpoint', + query: {"dog": "woof"}, + headers: {"useful-header": "interesting-value"}, + body: {"hello": "world"} ) ``` +### Concurrency & connection pooling -**Copy Folder** +The `Imagekit::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests. -Copy folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-folder) +Each instance of `Imagekit::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings. -```ruby -imagekitio.copy_folder( - source_folder_path: '/folder/to/copy', - destination_path: '/folder/to/copy/into', - include_file_versions: true #default false -) -``` +When all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout. -**Move Folder** +Unless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure. -Move folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/move-folder) +## Sorbet -```ruby -imagekitio.move_folder( - source_folder_path: '/folder/to/move', - destination_path: '/folder/to/move/into/' -) -``` +This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime. -**Delete Folder** - -Delete folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-folder) +You can provide typesafe request parameters like so: ```ruby -imagekitio.delete_folder( - folder_path: 'folder/to/delete' +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" ) ``` -**Bulk Job Status** - -Get the bulk job status as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-move-folder-status) +Or, equivalently: ```ruby -imagekitio.bulk_job_status( - job_id: '5e21880d5efe355febd4cccd' +# Hashes work, but are not typesafe: +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" ) -``` - -**Create a custom metadata field** -Create custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/create-custom-metadata-field) - -```ruby - -imagekitio.create_custom_metadata_field( - name: 'price', - label: 'price_label', - schema: { - 'type': 'Number', - 'minValue': 100, - 'maxValue': 300 - } +# You can also splat a full Params class: +params = Imagekit::FileUploadParams.new( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" ) +image_kit.files.upload(**params) ``` -**Get Custom Metadata Fields** +### Enums -Get the custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/get-custom-metadata-field) +Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime: ```ruby -imagekitio.get_custom_metadata_fields( - include_deleted: true #optional -) -``` - -**Update Custom Metadata Fields** - -Update custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/update-custom-metadata-field) +# :all +puts(Imagekit::AssetListParams::FileType::ALL) -```ruby -imagekitio.update_custom_metadata_field( - id: '5e21880d5efe355febd4bccd', #field_id - label: 'custom-price', #Either label or schema or both should be given - schema: nil -) +# Revealed type: `T.all(Imagekit::AssetListParams::FileType, Symbol)` +T.reveal_type(Imagekit::AssetListParams::FileType::ALL) ``` -**Delete Custom Metadata Fields** - -Delete custom metadata fields as per the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/delete-custom-metadata-field) +Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value: ```ruby -imagekitio.delete_custom_metadata_field( - id: '5e21880d5efe355febd4bccd' #field_id +# Using the enum constants preserves the tagged type information: +image_kit.assets.list( + file_type: Imagekit::AssetListParams::FileType::ALL, + # … ) -``` - -## Access request-id, other response headers and HTTP status code -Each media management function returns a hash with `response`, `error`, `status_code`, `headers`, `raw_body` keys with respective values. - -```ruby -upload = imagekitio.upload_file( - file: file, - file_name: "default.jpg", - folder: '/test', - response_fields: 'tags,customCoordinates,isPrivateFile,metadata', - tags: %w[abc def], - use_unique_file_name: false, - is_private_file: true +# Literal values are also permissible: +image_kit.assets.list( + file_type: :all, + # … ) -puts upload[:status_code] # 200 -puts upload[:headers] - -# { -# "access-control-allow-origin"=>["*"], -# "x-ik-requestid"=>["6963194e-014f-8945-b05a-bdb0e088f1bd"], -# "content-type"=>["application/json; charset=utf-8"], -# "content-length"=>["611"], -# "etag"=>["W/\"859-GOeZiRFGOZERjHBgRUhG0EGcODs\""], -# "date"=>["Wed, 29 Jun 2022 07:04:33 GMT"], -# "x-request-id"=>["6963194e-014f-8945-b05a-bdb0e088f1bd"], -# "connection"=>["close"] -# } - - -puts upload[:raw_body] -# "{\"fileId\":\"62bjf980rb886bd691b86760\",\"name\":\"default.jpg\",\"size\":102117,\"versionInfo\":{\"id\":\"62bjf980rb886bd691b86760\",\"name\":\"Version 1\"},\"filePath\":\"/test/default.jpg\",\"url\":\"https://ik.imagekit.io/46865sdf6sdf/test/default.jpg\",\"fileType\":\"image\",\"height\":700,\"width\":1050,\"thumbnailUrl\":\"https://ik.imagekit.io/46865sdf6sdf/tr:n-ik_ml_thumbnail/test/default.jpg\",\"tags\":[\"abc\",\"def\"],\"AITags\":null,\"isPrivateFile\":true,\"customCoordinates\":null,\"metadata\":{\"height\":700,\"width\":1050,\"size\":102117,\"format\":\"jpg\",\"hasColorProfile\":true,\"quality\":0,\"density\":72,\"hasTransparency\":false,\"exif\":{},\"pHash\":\"90249d9b1fc74367\"}}" -``` - -## Utility functions - -We have included the following commonly used utility functions in this package. - -**Authentication parameter generation** - -If you are looking to implement client-side file upload, you will need a `token`, `expiry` timestamp, and a valid `signature` for that upload. The SDK provides a simple method that you can use in your code to generate these authentication parameters for you. - -_Note: The Private API Key should never be exposed in any client-side code. You must always generate these authentication parameters on the server-side_ - -`authentication_parameters = imagekit.get_authentication_parameters(token, expire)` - -Returns - -```ruby -{ - "token": "unique_token", - "expire": "valid_expiry_timestamp", - "signature": "generated_signature" -} -``` - -Both the `token` and `expire` parameters are optional. If not specified, the SDK uses the uuid to generate a random token and also generates a valid expiry timestamp internally. The value of the `token` and `expire` used to generate the signature is always returned in the response, no matter if they are provided as an input to this method or not. - -**Distance calculation between two pHash values** - -Perceptual hashing allows you to construct a hash value that uniquely identifies an input image based on the contents -of an image. [imagekit.io metadata API](https://docs.imagekit.io/api-reference/metadata-api) returns the pHash -value of an image in the response. You can use this value to find a duplicate near the duplicate(similar) image by calculating -the distance between the two images. - - -This SDK exposes the `phash_distance` function to calculate the distance between two pHash values. It accepts two pHash hexadecimal -strings and returns a numeric value indicative of the level of difference between the two images. - -```ruby -def calculate_distance(): - # fetch metadata of two uploaded image files - ... - # extract pHash strings from both: say 'first_hash' and 'second_hash.' - ... - # calculate the distance between them: - - distance = imagekitio.phash_distance(first_hash, second_hash) - return distance ``` -**Distance calculation examples** - -```ruby -imagekitio.phash_distance('f06830ca9f1e3e90', 'f06830ca9f1e3e90') -# output: 0 (ame image) - -imagekitio.phash_distance('2d5ad3936d2e015b', '2d6ed293db36a4fb') -# output: 17 (similar images) - -imagekitio.phash_distance('a4a65595ac94518b', '7838873e791f8400') -# output: 37 (dissimilar images) -``` - -## Sample Application -There are three sample apps: - -* Rails application using Carrierwave -* Rails application using ActiveStorage -* Plain ruby application - -Please see the sample applications in [here](https://github.com/imagekit-samples/quickstart). +## Versioning -## Upgrade to 2.x +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. -If you are upgrading to 2.x from version 1.x, make the following changes in your application: +This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes. -- Remove config from environment file to initializer file as described [here](#Initialization). -- Include `ImageKitIo::CarrierWave` in uploader class(for Carrierwave). -- Remove `storage :imagekit_store` config from uploader. -- Rename class `ImageKit::ImageKitClient` to `ImageKitIo::Client` -- Rename class `ImageKitIo::ImageKitRequest` to `ImageKitIo::Request` +## Requirements -## Support -For any feedback or to report any issues or general implementation support, please reach out to [support@imagekit.io](mailto:support@imagekit.io) +Ruby 3.2.0 or higher. -## Links -- [Documentation](https://docs.imagekit.io) -- [Main website](https://imagekit.io) +## Contributing -## License -Released under the MIT license. +See [the contributing documentation](https://github.com/stainless-sdks/imagekit-ruby/tree/main/CONTRIBUTING.md). diff --git a/Rakefile b/Rakefile index 7457939a..6b5be685 100644 --- a/Rakefile +++ b/Rakefile @@ -1,27 +1,160 @@ -begin - require 'bundler/setup' -rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +# frozen_string_literal: true + +require "pathname" +require "securerandom" +require "shellwords" + +require "minitest/test_task" +require "rake/clean" +require "rubocop/rake_task" + +tapioca = "sorbet/tapioca" +examples = "examples" +ignore_file = ".ignore" + +CLEAN.push(*%w[.idea/ .ruby-lsp/ .yardoc/ doc/], *FileList["*.gem"], ignore_file) + +CLOBBER.push(*%w[sorbet/rbi/annotations/ sorbet/rbi/gems/], tapioca) + +multitask(:default) do + sh(*%w[rake --tasks]) +end + +desc("Preview docs; use `PORT=` to change the port") +multitask(:"docs:preview") do + sh(*%w[yard server --reload --quiet --bind [::] --port], ENV.fetch("PORT", "8808")) +end + +desc("Run test suites; use `TEST=path/to/test.rb` to run a specific test file") +multitask(:test) do + rb = + FileList[ENV.fetch("TEST", "./test/**/*_test.rb")] + .map { "require_relative(#{_1.dump});" } + .join + + ruby(*%w[-w -e], rb, verbose: false) { fail unless _1 } +end + +xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --] +ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")} + +desc("Lint `*.rb(i)`") +multitask(:"lint:rubocop") do + find = %w[find ./lib ./test ./rbi ./examples -type f -and ( -name *.rb -or -name *.rbi ) -print0] + + rubocop = %w[rubocop] + rubocop += %w[--format github] if ENV.key?("CI") + + # some lines cannot be shortened + rubocop += %w[--except Lint/RedundantCopDisableDirective,Layout/LineLength] + + lint = xargs + rubocop + sh("#{find.shelljoin} | #{lint.shelljoin}") +end + +desc("Format `*.rb`") +multitask(:"format:rb") do + # while `syntax_tree` is much faster than `rubocop`, `rubocop` is the only formatter with full syntax support + find = %w[find ./lib ./test ./examples -type f -and -name *.rb -print0] + fmt = xargs + %w[rubocop --fail-level F --autocorrect --format simple --] + sh("#{find.shelljoin} | #{fmt.shelljoin}") end -require 'rdoc/task' +desc("Format `*.rbi`") +multitask(:"format:rbi") do + find = %w[find ./rbi -type f -and -name *.rbi -print0] + fmt = xargs + %w[stree write --] + sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") +end + +desc("Format `*.rbs`") +multitask(:"format:rbs") do + find = %w[find ./sig -type f -name *.rbs -print0] + inplace = /darwin|bsd/ =~ RUBY_PLATFORM ? ["-i", ""] : %w[-i] + uuid = SecureRandom.uuid + + # `syntax_tree` has trouble with `rbs`'s class & module aliases + + sed_bin = /darwin/ =~ RUBY_PLATFORM ? "/usr/bin/sed" : "sed" + sed = xargs + [sed_bin, "-E", *inplace, "-e"] + # annotate unprocessable aliases with a unique comment + pre = sed + ["s/(class|module) ([^ ]+) = (.+$)/# \\1 #{uuid}\\n\\2: \\3/", "--"] + fmt = xargs + %w[stree write --plugin=rbs --] + # remove the unique comment and unprocessable aliases to type aliases + subst = <<~SED + s/# (class|module) #{uuid}/\\1/ + t l1 + b + + : l1 + N + s/\\n *([^:]+): (.+)$/ \\1 = \\2/ + SED + # for each line: + # 1. try transform the unique comment into `class | module`, if successful, branch to label `l1`. + # 2. at label `l1`, join previously annotated line with `class | module` information. + pst = sed + [subst, "--"] -RDoc::Task.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'ImageKitIo::Sdk' - rdoc.options << '--line-numbers' - rdoc.rdoc_files.include('README.md') - rdoc.rdoc_files.include('lib/**/*.rb') + success = false + + # transform class aliases to type aliases, which syntax tree has no trouble with + sh("#{find.shelljoin} | #{pre.shelljoin}") + # run syntax tree to format `*.rbs` files + sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") do + success = _1 + end + # transform type aliases back to class aliases + sh("#{find.shelljoin} | #{pst.shelljoin}") + + # always run post-processing to remove comment marker + fail unless success end -require 'bundler/gem_tasks' +desc("Format everything") +multitask(format: [:"format:rb", :"format:rbi", :"format:rbs"]) -require 'rake/testtask' +desc("Typecheck `*.rbs`") +multitask(:"typecheck:steep") do + sh(*%w[steep check]) +end -Rake::TestTask.new(:test) do |t| - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' - t.verbose = false +directory(examples) + +desc("Typecheck `*.rbi`") +multitask("typecheck:sorbet": examples) do + sh(*%w[srb typecheck --dir], examples) end -task default: :test +directory(tapioca) do + sh(*%w[tapioca init]) +end + +desc("Typecheck everything") +multitask(typecheck: [:"typecheck:steep", :"typecheck:sorbet"]) + +desc("Lint and typecheck") +multitask(lint: [:"lint:rubocop", :typecheck]) + +desc("Build yard docs") +multitask(:"build:docs") do + sh(*%w[yard]) +end + +desc("Build ruby gem") +multitask(:"build:gem") do + # optimizing for grepping through the gem bundle: many tools honour `.ignore` files, including VSCode + # + # both `rbi` and `sig` directories are navigable by their respective tool chains and therefore can be ignored by tools such as `rg` + Pathname(ignore_file).write(<<~GLOB) + rbi/* + sig/* + GLOB + + sh(*%w[gem build -- imagekit.gemspec]) + rm_rf(ignore_file) +end + +desc("Release ruby gem") +multitask(release: [:"build:gem"]) do + sh(*%w[gem push], *FileList["*.gem"]) +end diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..8e64327a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainless.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +before making any information public. + +## Reporting Non-SDK Related Security Issues + +If you encounter security issues that are not directly related to SDKs but pertain to the services +or products provided by Image Kit, please follow the respective company's security reporting guidelines. + +### Image Kit Terms and Policies + +Please contact developer@imagekit.io for any questions or concerns regarding the security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/Steepfile b/Steepfile new file mode 100644 index 00000000..528b48c3 --- /dev/null +++ b/Steepfile @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "yaml" + +target(:lib) do + configure_code_diagnostics(Steep::Diagnostic::Ruby.strict) + + signature("sig") + + YAML.safe_load_file("./manifest.yaml", symbolize_names: true) => {dependencies:} + # currently these libraries lack the `*.rbs` annotations required by `steep` + stdlibs = dependencies - %w[English etc net/http rbconfig set stringio] + + stdlibs.each { library(_1) } +end diff --git a/bin/publish-gem b/bin/publish-gem new file mode 100644 index 00000000..8444af20 --- /dev/null +++ b/bin/publish-gem @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +cd -- "$(dirname -- "$0")/.." + +bundle +find . -maxdepth 1 -type f -name "*.gem" -delete +rake release \ No newline at end of file diff --git a/bin/test b/bin/test deleted file mode 100755 index 5516a12b..00000000 --- a/bin/test +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env ruby -$: << File.expand_path("../test", __dir__) - -require "bundler/setup" -require "rails/plugin/test" diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 6e19fffc..00000000 --- a/codecov.yml +++ /dev/null @@ -1,22 +0,0 @@ -codecov: - require_ci_to_pass: yes - -coverage: - status: - patch: off - precision: 2 - round: down - range: "70...100" - -parsers: - gcov: - branch_detection: - conditional: yes - loop: yes - method: no - macro: no - -comment: - layout: "reach,diff,flags,tree" - behavior: default - require_changes: no diff --git a/examples/.keep b/examples/.keep new file mode 100644 index 00000000..d8c73e93 --- /dev/null +++ b/examples/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store example files demonstrating usage of this SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/imagekit.gemspec b/imagekit.gemspec new file mode 100644 index 00000000..a29c6731 --- /dev/null +++ b/imagekit.gemspec @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require_relative "lib/imagekit/version" + +Gem::Specification.new do |s| + s.name = "imagekit" + s.version = Imagekit::VERSION + s.summary = "Ruby library to access the Image Kit API" + s.authors = ["Image Kit"] + s.email = "developer@imagekit.io" + s.homepage = "https://gemdocs.org/gems/imagekit" + s.metadata["homepage_uri"] = s.homepage + s.metadata["source_code_uri"] = "https://github.com/stainless-sdks/imagekit-ruby" + s.metadata["rubygems_mfa_required"] = false.to_s + s.required_ruby_version = ">= 3.2.0" + + s.files = Dir[ + "lib/**/*.rb", + "rbi/**/*.rbi", + "sig/**/*.rbs", + "manifest.yaml", + "SECURITY.md", + "CHANGELOG.md", + ".ignore" + ] + s.extra_rdoc_files = ["README.md"] + s.add_dependency "connection_pool" +end diff --git a/imagekitio.gemspec b/imagekitio.gemspec deleted file mode 100644 index e44548d9..00000000 --- a/imagekitio.gemspec +++ /dev/null @@ -1,34 +0,0 @@ -$:.push File.expand_path("lib", __dir__) - -# Maintain your gem's version: -require "imagekitio/sdk/version" - -# Describe your gem and declare its dependencies: -Gem::Specification.new do |spec| - spec.name = "imagekitio" - spec.version = ImageKitIo::Sdk::VERSION - spec.authors = ["ImageKit.io team"] - spec.email = ["developer@imagekit.io"] - spec.homepage = "https://imagekit.io" - spec.summary = "Automate image optimization on rails platforms." - spec.description = "Automate image optimization on rails platforms." - spec.license = "MIT" - - # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' - # to allow pushing to a single host or delete this section to allow pushing to any host. - if spec.respond_to?(:metadata) - spec.metadata["allowed_push_host"] = "https://rubygems.org" - else - raise "RubyGems 2.0 or newer is required to protect against " \ - "public gem pushes." - end - - spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - - spec.add_dependency "addressable", "~> 2.8" - spec.add_dependency "multipart-post", ">= 2.1.0" - spec.add_dependency "rest-client", "~> 2.1", ">=2.1" - spec.add_development_dependency "activestorage", ">= 5.2.0" - spec.add_development_dependency "carrierwave", ">= 0.7", "<= 2.2.1" - spec.add_development_dependency "rails", "~> 5.2.0", ">= 5.2.0" -end diff --git a/lib/active_storage/active_storage.rb b/lib/active_storage/active_storage.rb deleted file mode 100644 index 67565d12..00000000 --- a/lib/active_storage/active_storage.rb +++ /dev/null @@ -1,7 +0,0 @@ -begin - require 'active_storage' - rescue LoadError - puts "Add gem 'activestorage' to use this service" - end - require_relative './service/ik_file' - require_relative './service/image_kit_io_service' diff --git a/lib/active_storage/service/ik_file.rb b/lib/active_storage/service/ik_file.rb deleted file mode 100644 index 9b2b8f08..00000000 --- a/lib/active_storage/service/ik_file.rb +++ /dev/null @@ -1,115 +0,0 @@ -module ImageKiIo - module ActiveStorage - class IKFile - attr_accessor :identifier - - def initialize(identifier) - @identifier = identifier - @imagekit = ImageKitIo.client - end - - def url - identifier['url'] - end - - def delete - begin - @imagekit.delete_file(file_id: file_id) - rescue - file_id - end - end - - def file_type - identifier['fileType'] - end - - def thumbnail_url - identifier['thumbnail'] - end - - def filename - identifier['name'] - end - - def size - identifier['size'] - end - - def path - identifier['filePath'] - end - - def height - identifier['height'] - end - - def width - identifier['width'] - end - - def file_id - identifier['fileId'] - end - - def exist? - details = @imagekit.get_file_details(file_id: file_id) - return false if details[:error].present? - - true - end - - def type - identifier['type'] - end - - def tags - identifier['tags'] - end - - def ai_tags - identifier['AITags'] - end - - def is_private? - identifier['isPrivateFile'] - end - - def custom_coordinates - identifier['customCoordinates'] - end - - def mime - identifier['mime'] - end - - def alpha? - identifier['hasAlpha'] - end - - def custom_metadata - identifier['customMetadata'] - end - - def embedded_metadata - identifier['embeddedMetadata'] - end - - def created_at - identifier['createdAt'] - end - - def updated_at - identifier['updatedAt'] - end - - def extension_status - identifier['extensionStatus'] - end - - def transformation - identifier['transformation'] - end - end - end -end diff --git a/lib/active_storage/service/image_kit_io_service.rb b/lib/active_storage/service/image_kit_io_service.rb deleted file mode 100644 index 41a6390b..00000000 --- a/lib/active_storage/service/image_kit_io_service.rb +++ /dev/null @@ -1,188 +0,0 @@ -require_relative './ik_file' - -if defined? Rails - # Overwrite the ActiveStorage::Downloader's open method and remove the file integrity check constraint method verify_integrity_of - class DownloaderExtension < ::ActiveStorage::Downloader - def open(key, checksum:, name: "ActiveStorage-", tmpdir: nil, **options) - open_tempfile(name, tmpdir) do |file| - download key, file - # verify_integrity_of file, checksum: checksum - yield file - end - end - end - - module ActiveStorageBlobExtension - def self.included(base) - base.class_eval do - before_update :check_metadata - before_destroy :remove_imagekit_file - # ActiveRecord::Blob class first destroy the record data and then calls the service.delete method with key - # as an argument. But the imagekit.io needs fileId to destroy the file which can be get from the metadata. - # So first destroy the remote file and then destroy the local blob record. - def remove_imagekit_file - service.class.delete_ik_file(self) - end - - def remote_file_exist? - service.exist?(self.key) - end - - def remote_file - return false unless remote_file_exist? - - service.class.remote_file(self) - end - - # Needs to reload the record to reflect updated remote meta data. - def check_metadata - self.reload - end - end - end - end - - Rails.application.config.to_prepare do - ActiveStorage::Blob.send :include, ::ActiveStorageBlobExtension - end - - module ActiveStorage - class Service::ImageKitIoService < Service - include ImageKitIo::Constantable - - class << self - def delete_ik_file(blob) - ik_file(blob).delete - end - - def remote_file(blob) - ik_file(blob) - end - - def ik_file(blob) - self.new.send(:ik_file).new(blob.metadata) - end - end - - def initialize(**options) - @options = options - end - - def upload(key, io, checksum: nil, **options) - instrument :upload, key: key, checksum: checksum do - blob = storage_blob(key) - response = client.upload_file(file: io, file_name: blob.filename.to_s, content_type: blob.content_type) - if response[:error].nil? - blob.update_columns(metadata: response[:response].transform_keys(&:to_sym)) - else - raise Exception.new response[:error] - end - end - end - - def download(key, &block) - if block_given? - instrument :stream_file, key: key do - stream_file(key, &block) - end - else - instrument :download, key: key do - image_kit_file(key) - end - end - end - - def download_chunk(key, range) - puts 'Not implemented download_chunk' - end - - def delete(key) - instrument :delete, key: key do - # image kit file is already deleted on before blob destroy callback - key - end - end - - def delete_prefixed(prefix) - # delete the variants files - puts 'Not implemented delete_prefixed' - end - - def exist?(key) - image_kit_file(key).exist? - end - - def url_for_direct_upload(key, **options) - instrument :url, key: key do |payload| - options.delete(:content_length) - options.delete(:checksum) - url = "#{constants.BASE_URL}#{constants.UPLOAD}" - generated_url = client.url(src: url) - payload[:url] = generated_url - generated_url - end - end - - def headers_for_direct_upload(key, content_type:, checksum:, **options) - { - 'Content-Type' => content_type - } - end - - def path_for(key) - image_kit_file(key).path - end - - def url(key, filename: nil, content_type: '', **options) - generate_url(key, filename: filename, content_type: content_type, path: image_kit_file(key).path, **options) - end - - def open(*args, **options, &block) - DownloaderExtension.new(self).open(*args, **options, &block) - end - - private - - def private_url(key, expires_in:, filename:, disposition:, content_type:, **options) - generate_url(key, expires_in: expires_in, filename: filename, disposition: disposition, content_type: content_type, path: image_kit_file(key).path, **options) - end - - def generate_url(key, expires_in:, filename:, content_type:, disposition:, **options) - # filename = filename.to_s if filename.is_a? ActiveStorage::Filename - # options[:filename] = filename if filename - client.url(url_endpoint: config.url_endpoint, **options) - end - - def client - ImageKitIo.client - end - - def config - ImageKitIo.config - end - - def storage_blob(key) - ActiveStorage::Blob.find_by_key(key) - end - - def image_kit_file(key) - blob = storage_blob(key) - ik_file.new(blob.metadata) - end - - def ik_file - ImageKiIo::ActiveStorage::IKFile - end - - def stream_file(key, &download_block) - file_obj = image_kit_file(key) - block = proc { |response| - response.read_body do |chunk| - download_block.call(chunk) if download_block.present? - end - } - client.stream_file(file_url: file_obj.url, &block) - end - end - end -end diff --git a/lib/carrierwave/carrierwave.rb b/lib/carrierwave/carrierwave.rb deleted file mode 100644 index 1c589da4..00000000 --- a/lib/carrierwave/carrierwave.rb +++ /dev/null @@ -1,83 +0,0 @@ -begin - require 'carrierwave' -rescue LoadError - puts "Add gem 'carrierwave' to use this service" -end -require_relative './storage/imagekit_store' -require_relative './storage/ik_file' -require_relative './support/uri_filename' - -module ImageKitIo - module CarrierWave - def self.included(base) - base.include InstanceMethods - base.class_eval do - configure do |config| - config.storage_engines[:imagekit_store] = 'ImageKitIo::CarrierWave::Storage::ImageKitStore' - end - end - base.storage :imagekit_store - end - - module InstanceMethods - def initialize(*) - @imagekit = ImageKitIo.client - @options = {} - end - - def filename - if options != nil - @options = options - end - folder = nil - begin - folder = store_dir - rescue - end - - if folder != nil - @options[:folder] = folder - end - - if self.file != nil - resp = @imagekit.upload_file(file: open(self.file.file, 'rb'), file_name: self.file.filename, **@options) - # ::File.delete(self.file.file) - res = resp[:response].to_json - if res != "null" - res - else - "{\"filePath\":\"\",\"url\":\"\",\"name\":\"\"}" - end - else - "{\"filePath\":\"\",\"url\":\"\",\"name\":\"\"}" - end - end - - def fileId - JSON.parse(self.identifier)['fileId'] - end - - def blob - JSON.parse(self.identifier) - end - - def url_with(opt) - path = JSON.parse(self.identifier)['filePath'] - opt[:path] = path - url = @imagekit.url(opt) - end - - def url - JSON.parse(self.identifier)['url'] - end - - def options - options = {} - end - - def store_dir - store_dir = nil - end - end - end -end diff --git a/lib/carrierwave/storage/ik_file.rb b/lib/carrierwave/storage/ik_file.rb deleted file mode 100644 index f76811bf..00000000 --- a/lib/carrierwave/storage/ik_file.rb +++ /dev/null @@ -1,51 +0,0 @@ -module ImageKitIo - module CarrierWave - module Storage - class IKFile - # Initialize as required. - - def initialize(identifier) - @identifier=JSON.parse(identifier) - @imagekit = ImageKitIo.client - end - - # Duck-type methods for CarrierWave::SanitizedFile. - def content_type - "image/jpg" - end - def public_url - @identifier['url'] - end - def url(options = {}) - @identifier['url'] - end - - def fileId - @identifier['fileId'] - end - def filename(options = {}) - @identifier['name'] - end - def read - end - def size - end - def delete - # file_id=@identifier['fileId'] - begin - @imagekit.delete_file(file_id: fileId) - rescue - fileId - end - # binding.pry - # return nil - end - def exists? - end - # Others... ? - end - - end - - end -end diff --git a/lib/carrierwave/storage/imagekit_store.rb b/lib/carrierwave/storage/imagekit_store.rb deleted file mode 100644 index 5d00c74b..00000000 --- a/lib/carrierwave/storage/imagekit_store.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'uri' -require 'net/http' -require 'base64' - -module ImageKitIo - module CarrierWave - module Storage - class ImageKitStore < ::CarrierWave::Storage::Abstract - - def initialize(*) - super - @cache_called = nil - end - - def store!(file) - file.delete - end - - def retrieve!(identifier) - - IKFile.new(identifier) - end - - def cache!(new_file) - new_file.move_to(::File.expand_path(uploader.cache_path, uploader.root), uploader.permissions, uploader.directory_permissions, true) - rescue Errno::EMLINK, Errno::ENOSPC => e - raise(e) if @cache_called - @cache_called = true - - # NOTE: Remove cached files older than 10 minutes - clean_cache!(600) - - cache!(new_file) - end - - def retrieve_from_cache!(identifier) - CarrierWave::SanitizedFile.new(::File.expand_path(uploader.cache_path(identifier), uploader.root)) - end - - def delete_dir!(path) - if path - begin - Dir.rmdir(::File.expand_path(path, uploader.root)) - rescue Errno::ENOENT - # Ignore: path does not exist - rescue Errno::ENOTDIR - # Ignore: path is not a dir - rescue Errno::ENOTEMPTY, Errno::EEXIST - # Ignore: dir is not empty - end - end - end - - def clean_cache!(seconds) - Dir.glob(::File.expand_path(::File.join(uploader.cache_dir, '*'), CarrierWave.root)).each do |dir| - # generate_cache_id returns key formated TIMEINT-PID(-COUNTER)-RND - time = dir.scan(/(\d+)-\d+-\d+(?:-\d+)?/).first.map(&:to_i) - time = Time.at(*time) - if time < (Time.now.utc - seconds) - FileUtils.rm_rf(dir) - end - end - end - - end - end - end -end diff --git a/lib/carrierwave/support/uri_filename.rb b/lib/carrierwave/support/uri_filename.rb deleted file mode 100644 index f5d45430..00000000 --- a/lib/carrierwave/support/uri_filename.rb +++ /dev/null @@ -1,12 +0,0 @@ -module ImageKitIo - module CarrierWave - module Support - module UriFilename - def self.filename(url) - path = url.split('?').first - URI.decode(path).gsub(%r{.*/(.*?$)}, '\1') - end - end - end - end -end diff --git a/lib/imagekit.rb b/lib/imagekit.rb new file mode 100644 index 00000000..4d38be1e --- /dev/null +++ b/lib/imagekit.rb @@ -0,0 +1,174 @@ +# frozen_string_literal: true + +# Standard libraries. +# rubocop:disable Lint/RedundantRequireStatement +require "English" +require "cgi" +require "date" +require "erb" +require "etc" +require "json" +require "net/http" +require "pathname" +require "rbconfig" +require "securerandom" +require "set" +require "stringio" +require "time" +require "uri" +# rubocop:enable Lint/RedundantRequireStatement + +# We already ship the preferred sorbet manifests in the package itself. +# `tapioca` currently does not offer us a way to opt out of unnecessary compilation. +if Object.const_defined?(:Tapioca) && + caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) && + ARGV.none?(/dsl/) + return +end + +# Gems. +require "connection_pool" + +# Package files. +require_relative "imagekit/version" +require_relative "imagekit/internal/util" +require_relative "imagekit/internal/type/converter" +require_relative "imagekit/internal/type/unknown" +require_relative "imagekit/internal/type/boolean" +require_relative "imagekit/internal/type/file_input" +require_relative "imagekit/internal/type/enum" +require_relative "imagekit/internal/type/union" +require_relative "imagekit/internal/type/array_of" +require_relative "imagekit/internal/type/hash_of" +require_relative "imagekit/internal/type/base_model" +require_relative "imagekit/internal/type/base_page" +require_relative "imagekit/internal/type/request_parameters" +require_relative "imagekit/internal" +require_relative "imagekit/request_options" +require_relative "imagekit/file_part" +require_relative "imagekit/errors" +require_relative "imagekit/internal/transport/base_client" +require_relative "imagekit/internal/transport/pooled_net_requester" +require_relative "imagekit/client" +require_relative "imagekit/models/accounts/origin_request" +require_relative "imagekit/models/accounts/url_endpoint_request" +require_relative "imagekit/models/file" +require_relative "imagekit/models/base_overlay" +require_relative "imagekit/models/accounts/origin_create_params" +require_relative "imagekit/models/accounts/origin_delete_params" +require_relative "imagekit/models/accounts/origin_get_params" +require_relative "imagekit/models/accounts/origin_list_params" +require_relative "imagekit/models/accounts/origin_list_response" +require_relative "imagekit/models/accounts/origin_response" +require_relative "imagekit/models/accounts/origin_update_params" +require_relative "imagekit/models/accounts/url_endpoint_create_params" +require_relative "imagekit/models/accounts/url_endpoint_delete_params" +require_relative "imagekit/models/accounts/url_endpoint_get_params" +require_relative "imagekit/models/accounts/url_endpoint_list_params" +require_relative "imagekit/models/accounts/url_endpoint_list_response" +require_relative "imagekit/models/accounts/url_endpoint_response" +require_relative "imagekit/models/accounts/url_endpoint_update_params" +require_relative "imagekit/models/accounts/usage_get_params" +require_relative "imagekit/models/accounts/usage_get_response" +require_relative "imagekit/models/asset_list_params" +require_relative "imagekit/models/asset_list_response" +require_relative "imagekit/models/beta/v2/file_upload_params" +require_relative "imagekit/models/beta/v2/file_upload_response" +require_relative "imagekit/models/cache/invalidation_create_params" +require_relative "imagekit/models/cache/invalidation_create_response" +require_relative "imagekit/models/cache/invalidation_get_params" +require_relative "imagekit/models/cache/invalidation_get_response" +require_relative "imagekit/models/custom_metadata_field" +require_relative "imagekit/models/custom_metadata_field_create_params" +require_relative "imagekit/models/custom_metadata_field_delete_params" +require_relative "imagekit/models/custom_metadata_field_delete_response" +require_relative "imagekit/models/custom_metadata_field_list_params" +require_relative "imagekit/models/custom_metadata_field_list_response" +require_relative "imagekit/models/custom_metadata_field_update_params" +require_relative "imagekit/models/file_copy_params" +require_relative "imagekit/models/file_copy_response" +require_relative "imagekit/models/file_delete_params" +require_relative "imagekit/models/file_get_params" +require_relative "imagekit/models/file_move_params" +require_relative "imagekit/models/file_move_response" +require_relative "imagekit/models/file_rename_params" +require_relative "imagekit/models/file_rename_response" +require_relative "imagekit/models/files/bulk_add_tags_params" +require_relative "imagekit/models/files/bulk_add_tags_response" +require_relative "imagekit/models/files/bulk_delete_params" +require_relative "imagekit/models/files/bulk_delete_response" +require_relative "imagekit/models/files/bulk_remove_ai_tags_params" +require_relative "imagekit/models/files/bulk_remove_ai_tags_response" +require_relative "imagekit/models/files/bulk_remove_tags_params" +require_relative "imagekit/models/files/bulk_remove_tags_response" +require_relative "imagekit/models/files/metadata_get_from_url_params" +require_relative "imagekit/models/files/metadata_get_params" +require_relative "imagekit/models/files/version_delete_params" +require_relative "imagekit/models/files/version_delete_response" +require_relative "imagekit/models/files/version_get_params" +require_relative "imagekit/models/files/version_list_params" +require_relative "imagekit/models/files/version_list_response" +require_relative "imagekit/models/files/version_restore_params" +require_relative "imagekit/models/file_update_params" +require_relative "imagekit/models/file_update_response" +require_relative "imagekit/models/file_upload_params" +require_relative "imagekit/models/file_upload_response" +require_relative "imagekit/models/folder" +require_relative "imagekit/models/folder_copy_params" +require_relative "imagekit/models/folder_copy_response" +require_relative "imagekit/models/folder_create_params" +require_relative "imagekit/models/folder_create_response" +require_relative "imagekit/models/folder_delete_params" +require_relative "imagekit/models/folder_delete_response" +require_relative "imagekit/models/folder_move_params" +require_relative "imagekit/models/folder_move_response" +require_relative "imagekit/models/folder_rename_params" +require_relative "imagekit/models/folder_rename_response" +require_relative "imagekit/models/folders/job_get_params" +require_relative "imagekit/models/folders/job_get_response" +require_relative "imagekit/models/image_overlay" +require_relative "imagekit/models/metadata" +require_relative "imagekit/models/overlay" +require_relative "imagekit/models/overlay_position" +require_relative "imagekit/models/overlay_timing" +require_relative "imagekit/models/solid_color_overlay" +require_relative "imagekit/models/solid_color_overlay_transformation" +require_relative "imagekit/models/src_options" +require_relative "imagekit/models/streaming_resolution" +require_relative "imagekit/models/subtitle_overlay" +require_relative "imagekit/models/subtitle_overlay_transformation" +require_relative "imagekit/models/text_overlay" +require_relative "imagekit/models/text_overlay_transformation" +require_relative "imagekit/models/transformation" +require_relative "imagekit/models/transformation_position" +require_relative "imagekit/models/unsafe_unwrap_webhook_event" +require_relative "imagekit/models/unwrap_webhook_event" +require_relative "imagekit/models/upload_post_transform_error_event" +require_relative "imagekit/models/upload_post_transform_success_event" +require_relative "imagekit/models/upload_pre_transform_error_event" +require_relative "imagekit/models/upload_pre_transform_success_event" +require_relative "imagekit/models/video_overlay" +require_relative "imagekit/models/video_transformation_accepted_event" +require_relative "imagekit/models/video_transformation_error_event" +require_relative "imagekit/models/video_transformation_ready_event" +require_relative "imagekit/models/webhook_unsafe_unwrap_params" +require_relative "imagekit/models/webhook_unwrap_params" +require_relative "imagekit/models" +require_relative "imagekit/resources/accounts" +require_relative "imagekit/resources/accounts/origins" +require_relative "imagekit/resources/accounts/url_endpoints" +require_relative "imagekit/resources/accounts/usage" +require_relative "imagekit/resources/assets" +require_relative "imagekit/resources/beta" +require_relative "imagekit/resources/beta/v2" +require_relative "imagekit/resources/beta/v2/files" +require_relative "imagekit/resources/cache" +require_relative "imagekit/resources/cache/invalidation" +require_relative "imagekit/resources/custom_metadata_fields" +require_relative "imagekit/resources/files" +require_relative "imagekit/resources/files/bulk" +require_relative "imagekit/resources/files/metadata" +require_relative "imagekit/resources/files/versions" +require_relative "imagekit/resources/folders" +require_relative "imagekit/resources/folders/job" +require_relative "imagekit/resources/webhooks" diff --git a/lib/imagekit/client.rb b/lib/imagekit/client.rb new file mode 100644 index 00000000..fd57748a --- /dev/null +++ b/lib/imagekit/client.rb @@ -0,0 +1,126 @@ +# frozen_string_literal: true + +module Imagekit + class Client < Imagekit::Internal::Transport::BaseClient + # Default max number of retries to attempt after a failed retryable request. + DEFAULT_MAX_RETRIES = 2 + + # Default per-request timeout. + DEFAULT_TIMEOUT_IN_SECONDS = 60.0 + + # Default initial retry delay in seconds. + # Overall delay is calculated using exponential backoff + jitter. + DEFAULT_INITIAL_RETRY_DELAY = 0.5 + + # Default max retry delay in seconds. + DEFAULT_MAX_RETRY_DELAY = 8.0 + + # Your ImageKit private API key (it starts with `private_`). You can view and + # manage API keys in the + # [dashboard](https://imagekit.io/dashboard/developer/api-keys). + # @return [String] + attr_reader :private_api_key + + # ImageKit Basic Auth only uses the username field and ignores the password. This + # field is unused. + # @return [String, nil] + attr_reader :password + + # @return [Imagekit::Resources::CustomMetadataFields] + attr_reader :custom_metadata_fields + + # @return [Imagekit::Resources::Files] + attr_reader :files + + # @return [Imagekit::Resources::Assets] + attr_reader :assets + + # @return [Imagekit::Resources::Cache] + attr_reader :cache + + # @return [Imagekit::Resources::Folders] + attr_reader :folders + + # @return [Imagekit::Resources::Accounts] + attr_reader :accounts + + # @return [Imagekit::Resources::Beta] + attr_reader :beta + + # @return [Imagekit::Resources::Webhooks] + attr_reader :webhooks + + # @api private + # + # @return [Hash{String=>String}] + private def auth_headers + return {} if @private_api_key.nil? || @password.nil? + + base64_credentials = ["#{@private_api_key}:#{@password}"].pack("m0") + {"authorization" => "Basic #{base64_credentials}"} + end + + # @api private + # + # @return [Boolean] + def base_url_overridden? = @base_url_overridden + + # Creates and returns a new client for interacting with the API. + # + # @param private_api_key [String, nil] Your ImageKit private API key (it starts with `private_`). You can view and + # manage API keys in the + # [dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults to + # `ENV["IMAGEKIT_PRIVATE_API_KEY"]` + # + # @param password [String, nil] ImageKit Basic Auth only uses the username field and ignores the password. This + # field is unused. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` + # + # @param base_url [String, nil] Override the default base URL for the API, e.g., + # `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]` + # + # @param max_retries [Integer] Max number of retries to attempt after a failed retryable request. + # + # @param timeout [Float] + # + # @param initial_retry_delay [Float] + # + # @param max_retry_delay [Float] + def initialize( + private_api_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], + password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"), + base_url: ENV["IMAGE_KIT_BASE_URL"], + max_retries: self.class::DEFAULT_MAX_RETRIES, + timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS, + initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY, + max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY + ) + @base_url_overridden = !base_url.nil? + + base_url ||= "https://api.imagekit.io" + + if private_api_key.nil? + raise ArgumentError.new("private_api_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_API_KEY\"") + end + + @private_api_key = private_api_key.to_s + @password = password.to_s + + super( + base_url: base_url, + timeout: timeout, + max_retries: max_retries, + initial_retry_delay: initial_retry_delay, + max_retry_delay: max_retry_delay + ) + + @custom_metadata_fields = Imagekit::Resources::CustomMetadataFields.new(client: self) + @files = Imagekit::Resources::Files.new(client: self) + @assets = Imagekit::Resources::Assets.new(client: self) + @cache = Imagekit::Resources::Cache.new(client: self) + @folders = Imagekit::Resources::Folders.new(client: self) + @accounts = Imagekit::Resources::Accounts.new(client: self) + @beta = Imagekit::Resources::Beta.new(client: self) + @webhooks = Imagekit::Resources::Webhooks.new(client: self) + end + end +end diff --git a/lib/imagekit/errors.rb b/lib/imagekit/errors.rb new file mode 100644 index 00000000..b61fb677 --- /dev/null +++ b/lib/imagekit/errors.rb @@ -0,0 +1,214 @@ +# frozen_string_literal: true + +module Imagekit + module Errors + class Error < StandardError + # @!attribute cause + # + # @return [StandardError, nil] + end + + class ConversionError < Imagekit::Errors::Error + # @return [StandardError, nil] + def cause = @cause.nil? ? super : @cause + + # @api private + # + # @param on [Class] + # @param method [Symbol] + # @param target [Object] + # @param value [Object] + # @param cause [StandardError, nil] + def initialize(on:, method:, target:, value:, cause: nil) + cls = on.name.split("::").last + + message = [ + "Failed to parse #{cls}.#{method} from #{value.class} to #{target.inspect}.", + "To get the unparsed API response, use #{cls}[#{method.inspect}].", + cause && "Cause: #{cause.message}" + ].filter(&:itself).join(" ") + + @cause = cause + super(message) + end + end + + class APIError < Imagekit::Errors::Error + # @return [URI::Generic] + attr_accessor :url + + # @return [Integer, nil] + attr_accessor :status + + # @return [Object, nil] + attr_accessor :body + + # @api private + # + # @param url [URI::Generic] + # @param status [Integer, nil] + # @param body [Object, nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil) + @url = url + @status = status + @body = body + @request = request + @response = response + super(message) + end + end + + class APIConnectionError < Imagekit::Errors::APIError + # @!attribute status + # + # @return [nil] + + # @!attribute body + # + # @return [nil] + + # @api private + # + # @param url [URI::Generic] + # @param status [nil] + # @param body [nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize( + url:, + status: nil, + body: nil, + request: nil, + response: nil, + message: "Connection error." + ) + super + end + end + + class APITimeoutError < Imagekit::Errors::APIConnectionError + # @api private + # + # @param url [URI::Generic] + # @param status [nil] + # @param body [nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize( + url:, + status: nil, + body: nil, + request: nil, + response: nil, + message: "Request timed out." + ) + super + end + end + + class APIStatusError < Imagekit::Errors::APIError + # @api private + # + # @param url [URI::Generic] + # @param status [Integer] + # @param body [Object, nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + # + # @return [self] + def self.for(url:, status:, body:, request:, response:, message: nil) + kwargs = { + url: url, + status: status, + body: body, + request: request, + response: response, + message: message + } + + case status + in 400 + Imagekit::Errors::BadRequestError.new(**kwargs) + in 401 + Imagekit::Errors::AuthenticationError.new(**kwargs) + in 403 + Imagekit::Errors::PermissionDeniedError.new(**kwargs) + in 404 + Imagekit::Errors::NotFoundError.new(**kwargs) + in 409 + Imagekit::Errors::ConflictError.new(**kwargs) + in 422 + Imagekit::Errors::UnprocessableEntityError.new(**kwargs) + in 429 + Imagekit::Errors::RateLimitError.new(**kwargs) + in (500..) + Imagekit::Errors::InternalServerError.new(**kwargs) + else + Imagekit::Errors::APIStatusError.new(**kwargs) + end + end + + # @!parse + # # @return [Integer] + # attr_accessor :status + + # @api private + # + # @param url [URI::Generic] + # @param status [Integer] + # @param body [Object, nil] + # @param request [nil] + # @param response [nil] + # @param message [String, nil] + def initialize(url:, status:, body:, request:, response:, message: nil) + message ||= {url: url.to_s, status: status, body: body} + super( + url: url, + status: status, + body: body, + request: request, + response: response, + message: message&.to_s + ) + end + end + + class BadRequestError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 400 + end + + class AuthenticationError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 401 + end + + class PermissionDeniedError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 403 + end + + class NotFoundError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 404 + end + + class ConflictError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 409 + end + + class UnprocessableEntityError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 422 + end + + class RateLimitError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 429 + end + + class InternalServerError < Imagekit::Errors::APIStatusError + HTTP_STATUS = (500..) + end + end +end diff --git a/lib/imagekit/file_part.rb b/lib/imagekit/file_part.rb new file mode 100644 index 00000000..7676aada --- /dev/null +++ b/lib/imagekit/file_part.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Imagekit + class FilePart + # @return [Pathname, StringIO, IO, String] + attr_reader :content + + # @return [String, nil] + attr_reader :content_type + + # @return [String, nil] + attr_reader :filename + + # @api private + # + # @return [String] + private def read + case content + in Pathname + content.read(binmode: true) + in StringIO + content.string + in IO + content.read + in String + content + end + end + + # @param a [Object] + # + # @return [String] + def to_json(*a) = read.to_json(*a) + + # @param a [Object] + # + # @return [String] + def to_yaml(*a) = read.to_yaml(*a) + + # @param content [Pathname, StringIO, IO, String] + # @param filename [String, nil] + # @param content_type [String, nil] + def initialize(content, filename: nil, content_type: nil) + @content = content + @filename = + case content + in Pathname + filename.nil? ? content.basename.to_path : ::File.basename(filename) + else + filename.nil? ? nil : ::File.basename(filename) + end + @content_type = content_type + end + end +end diff --git a/lib/imagekit/internal.rb b/lib/imagekit/internal.rb new file mode 100644 index 00000000..450d18b1 --- /dev/null +++ b/lib/imagekit/internal.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + OMIT = + Object.new.tap do + _1.define_singleton_method(:inspect) { "#<#{Imagekit::Internal}::OMIT>" } + end + .freeze + + define_sorbet_constant!(:AnyHash) do + T.type_alias { T::Hash[Symbol, T.anything] } + end + define_sorbet_constant!(:FileInput) do + T.type_alias { T.any(Pathname, StringIO, IO, String, Imagekit::FilePart) } + end + end +end diff --git a/lib/imagekit/internal/transport/base_client.rb b/lib/imagekit/internal/transport/base_client.rb new file mode 100644 index 00000000..3bab4fc6 --- /dev/null +++ b/lib/imagekit/internal/transport/base_client.rb @@ -0,0 +1,563 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Transport + # @api private + # + # @abstract + class BaseClient + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + # from whatwg fetch spec + MAX_REDIRECTS = 20 + + # rubocop:disable Style/MutableConstant + PLATFORM_HEADERS = + { + "x-stainless-arch" => Imagekit::Internal::Util.arch, + "x-stainless-lang" => "ruby", + "x-stainless-os" => Imagekit::Internal::Util.os, + "x-stainless-package-version" => Imagekit::VERSION, + "x-stainless-runtime" => ::RUBY_ENGINE, + "x-stainless-runtime-version" => ::RUBY_ENGINE_VERSION + } + # rubocop:enable Style/MutableConstant + + class << self + # @api private + # + # @param req [Hash{Symbol=>Object}] + # + # @raise [ArgumentError] + def validate!(req) + keys = [:method, :path, :query, :headers, :body, :unwrap, :page, :stream, :model, :options] + case req + in Hash + req.each_key do |k| + unless keys.include?(k) + raise ArgumentError.new("Request `req` keys must be one of #{keys}, got #{k.inspect}") + end + end + else + raise ArgumentError.new("Request `req` must be a Hash or RequestOptions, got #{req.inspect}") + end + end + + # @api private + # + # @param status [Integer] + # @param headers [Hash{String=>String}, Net::HTTPHeader] + # + # @return [Boolean] + def should_retry?(status, headers:) + coerced = Imagekit::Internal::Util.coerce_boolean(headers["x-should-retry"]) + case [coerced, status] + in [true | false, _] + coerced + in [_, 408 | 409 | 429 | (500..)] + # retry on: + # 408: timeouts + # 409: locks + # 429: rate limits + # 500+: unknown errors + true + else + false + end + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @option request [Object] :body + # + # @option request [Integer] :max_retries + # + # @option request [Float] :timeout + # + # @param status [Integer] + # + # @param response_headers [Hash{String=>String}, Net::HTTPHeader] + # + # @return [Hash{Symbol=>Object}] + def follow_redirect(request, status:, response_headers:) + method, url, headers = request.fetch_values(:method, :url, :headers) + location = + Kernel.then do + URI.join(url, response_headers["location"]) + rescue ArgumentError + message = "Server responded with status #{status} but no valid location header." + raise Imagekit::Errors::APIConnectionError.new( + url: url, + response: response_headers, + message: message + ) + end + + request = {**request, url: location} + + case [url.scheme, location.scheme] + in ["https", "http"] + message = "Tried to redirect to a insecure URL" + raise Imagekit::Errors::APIConnectionError.new( + url: url, + response: response_headers, + message: message + ) + else + nil + end + + # from whatwg fetch spec + case [status, method] + in [301 | 302, :post] | [303, _] + drop = %w[content-encoding content-language content-length content-location content-type] + request = { + **request, + method: method == :head ? :head : :get, + headers: headers.except(*drop), + body: nil + } + else + end + + # from undici + if Imagekit::Internal::Util.uri_origin(url) != Imagekit::Internal::Util.uri_origin(location) + drop = %w[authorization cookie host proxy-authorization] + request = {**request, headers: request.fetch(:headers).except(*drop)} + end + + request + end + + # @api private + # + # @param status [Integer, Imagekit::Errors::APIConnectionError] + # @param stream [Enumerable, nil] + def reap_connection!(status, stream:) + case status + in (..199) | (300..499) + stream&.each { next } + in Imagekit::Errors::APIConnectionError | (500..) + Imagekit::Internal::Util.close_fused!(stream) + else + end + end + end + + # @return [URI::Generic] + attr_reader :base_url + + # @return [Float] + attr_reader :timeout + + # @return [Integer] + attr_reader :max_retries + + # @return [Float] + attr_reader :initial_retry_delay + + # @return [Float] + attr_reader :max_retry_delay + + # @return [Hash{String=>String}] + attr_reader :headers + + # @return [String, nil] + attr_reader :idempotency_header + + # @api private + # @return [Imagekit::Internal::Transport::PooledNetRequester] + attr_reader :requester + + # @api private + # + # @param base_url [String] + # @param timeout [Float] + # @param max_retries [Integer] + # @param initial_retry_delay [Float] + # @param max_retry_delay [Float] + # @param headers [Hash{String=>String, Integer, Array, nil}] + # @param idempotency_header [String, nil] + def initialize( + base_url:, + timeout: 0.0, + max_retries: 0, + initial_retry_delay: 0.0, + max_retry_delay: 0.0, + headers: {}, + idempotency_header: nil + ) + @requester = Imagekit::Internal::Transport::PooledNetRequester.new + @headers = Imagekit::Internal::Util.normalized_headers( + self.class::PLATFORM_HEADERS, + { + "accept" => "application/json", + "content-type" => "application/json" + }, + headers + ) + @base_url_components = Imagekit::Internal::Util.parse_uri(base_url) + @base_url = Imagekit::Internal::Util.unparse_uri(@base_url_components) + @idempotency_header = idempotency_header&.to_s&.downcase + @timeout = timeout + @max_retries = max_retries + @initial_retry_delay = initial_retry_delay + @max_retry_delay = max_retry_delay + end + + # @api private + # + # @return [Hash{String=>String}] + private def auth_headers = {} + + # @api private + # + # @return [String] + private def generate_idempotency_key = "stainless-ruby-retry-#{SecureRandom.uuid}" + + # @api private + # + # @param req [Hash{Symbol=>Object}] . + # + # @option req [Symbol] :method + # + # @option req [String, Array] :path + # + # @option req [Hash{String=>Array, String, nil}, nil] :query + # + # @option req [Hash{String=>String, Integer, Array, nil}, nil] :headers + # + # @option req [Object, nil] :body + # + # @option req [Symbol, Integer, Array, Proc, nil] :unwrap + # + # @option req [Class, nil] :page + # + # @option req [Class, nil] :stream + # + # @option req [Imagekit::Internal::Type::Converter, Class, nil] :model + # + # @param opts [Hash{Symbol=>Object}] . + # + # @option opts [String, nil] :idempotency_key + # + # @option opts [Hash{String=>Array, String, nil}, nil] :extra_query + # + # @option opts [Hash{String=>String, nil}, nil] :extra_headers + # + # @option opts [Object, nil] :extra_body + # + # @option opts [Integer, nil] :max_retries + # + # @option opts [Float, nil] :timeout + # + # @return [Hash{Symbol=>Object}] + private def build_request(req, opts) + method, uninterpolated_path = req.fetch_values(:method, :path) + + path = Imagekit::Internal::Util.interpolate_path(uninterpolated_path) + + query = Imagekit::Internal::Util.deep_merge(req[:query].to_h, opts[:extra_query].to_h) + + headers = Imagekit::Internal::Util.normalized_headers( + @headers, + auth_headers, + req[:headers].to_h, + opts[:extra_headers].to_h + ) + + if @idempotency_header && + !headers.key?(@idempotency_header) && + (!Net::HTTP::IDEMPOTENT_METHODS_.include?(method.to_s.upcase) || opts.key?(:idempotency_key)) + headers[@idempotency_header] = opts.fetch(:idempotency_key) { generate_idempotency_key } + end + + unless headers.key?("x-stainless-retry-count") + headers["x-stainless-retry-count"] = "0" + end + + timeout = opts.fetch(:timeout, @timeout).to_f.clamp(0..) + unless headers.key?("x-stainless-timeout") || timeout.zero? + headers["x-stainless-timeout"] = timeout.to_s + end + + headers.reject! { |_, v| v.to_s.empty? } + + body = + case method + in :get | :head | :options | :trace + nil + else + Imagekit::Internal::Util.deep_merge(*[req[:body], opts[:extra_body]].compact) + end + + url = Imagekit::Internal::Util.join_parsed_uri( + @base_url_components, + {**req, path: path, query: query} + ) + headers, encoded = Imagekit::Internal::Util.encode_content(headers, body) + { + method: method, + url: url, + headers: headers, + body: encoded, + max_retries: opts.fetch(:max_retries, @max_retries), + timeout: timeout + } + end + + # @api private + # + # @param headers [Hash{String=>String}] + # @param retry_count [Integer] + # + # @return [Float] + private def retry_delay(headers, retry_count:) + # Non-standard extension + span = Float(headers["retry-after-ms"], exception: false)&.then { _1 / 1000 } + return span if span + + retry_header = headers["retry-after"] + return span if (span = Float(retry_header, exception: false)) + + span = retry_header&.then do + Time.httpdate(_1) - Time.now + rescue ArgumentError + nil + end + return span if span + + scale = retry_count**2 + jitter = 1 - (0.25 * rand) + (@initial_retry_delay * scale * jitter).clamp(0, @max_retry_delay) + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @option request [Object] :body + # + # @option request [Integer] :max_retries + # + # @option request [Float] :timeout + # + # @param redirect_count [Integer] + # + # @param retry_count [Integer] + # + # @param send_retry_header [Boolean] + # + # @raise [Imagekit::Errors::APIError] + # @return [Array(Integer, Net::HTTPResponse, Enumerable)] + def send_request(request, redirect_count:, retry_count:, send_retry_header:) + url, headers, max_retries, timeout = request.fetch_values(:url, :headers, :max_retries, :timeout) + input = {**request.except(:timeout), deadline: Imagekit::Internal::Util.monotonic_secs + timeout} + + if send_retry_header + headers["x-stainless-retry-count"] = retry_count.to_s + end + + begin + status, response, stream = @requester.execute(input) + rescue Imagekit::Errors::APIConnectionError => e + status = e + end + + case status + in ..299 + [status, response, stream] + in 300..399 if redirect_count >= self.class::MAX_REDIRECTS + self.class.reap_connection!(status, stream: stream) + + message = "Failed to complete the request within #{self.class::MAX_REDIRECTS} redirects." + raise Imagekit::Errors::APIConnectionError.new(url: url, response: response, message: message) + in 300..399 + self.class.reap_connection!(status, stream: stream) + + request = self.class.follow_redirect(request, status: status, response_headers: response) + send_request( + request, + redirect_count: redirect_count + 1, + retry_count: retry_count, + send_retry_header: send_retry_header + ) + in Imagekit::Errors::APIConnectionError if retry_count >= max_retries + raise status + in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: response) + decoded = Kernel.then do + Imagekit::Internal::Util.decode_content(response, stream: stream, suppress_error: true) + ensure + self.class.reap_connection!(status, stream: stream) + end + + raise Imagekit::Errors::APIStatusError.for( + url: url, + status: status, + body: decoded, + request: nil, + response: response + ) + in (400..) | Imagekit::Errors::APIConnectionError + self.class.reap_connection!(status, stream: stream) + + delay = retry_delay(response || {}, retry_count: retry_count) + sleep(delay) + + send_request( + request, + redirect_count: redirect_count, + retry_count: retry_count + 1, + send_retry_header: send_retry_header + ) + end + end + + # Execute the request specified by `req`. This is the method that all resource + # methods call into. + # + # @overload request(method, path, query: {}, headers: {}, body: nil, unwrap: nil, page: nil, stream: nil, model: Imagekit::Internal::Type::Unknown, options: {}) + # + # @param method [Symbol] + # + # @param path [String, Array] + # + # @param query [Hash{String=>Array, String, nil}, nil] + # + # @param headers [Hash{String=>String, Integer, Array, nil}, nil] + # + # @param body [Object, nil] + # + # @param unwrap [Symbol, Integer, Array, Proc, nil] + # + # @param page [Class, nil] + # + # @param stream [Class, nil] + # + # @param model [Imagekit::Internal::Type::Converter, Class, nil] + # + # @param options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] . + # + # @option options [String, nil] :idempotency_key + # + # @option options [Hash{String=>Array, String, nil}, nil] :extra_query + # + # @option options [Hash{String=>String, nil}, nil] :extra_headers + # + # @option options [Object, nil] :extra_body + # + # @option options [Integer, nil] :max_retries + # + # @option options [Float, nil] :timeout + # + # @raise [Imagekit::Errors::APIError] + # @return [Object] + def request(req) + self.class.validate!(req) + model = req.fetch(:model) { Imagekit::Internal::Type::Unknown } + opts = req[:options].to_h + unwrap = req[:unwrap] + Imagekit::RequestOptions.validate!(opts) + request = build_request(req.except(:options), opts) + url = request.fetch(:url) + + # Don't send the current retry count in the headers if the caller modified the header defaults. + send_retry_header = request.fetch(:headers)["x-stainless-retry-count"] == "0" + status, response, stream = send_request( + request, + redirect_count: 0, + retry_count: 0, + send_retry_header: send_retry_header + ) + + decoded = Imagekit::Internal::Util.decode_content(response, stream: stream) + case req + in {stream: Class => st} + st.new( + model: model, + url: url, + status: status, + response: response, + unwrap: unwrap, + stream: decoded + ) + in {page: Class => page} + page.new(client: self, req: req, headers: response, page_data: decoded) + else + unwrapped = Imagekit::Internal::Util.dig(decoded, unwrap) + Imagekit::Internal::Type::Converter.coerce(model, unwrapped) + end + end + + # @api private + # + # @return [String] + def inspect + # rubocop:disable Layout/LineLength + "#<#{self.class.name}:0x#{object_id.to_s(16)} base_url=#{@base_url} max_retries=#{@max_retries} timeout=#{@timeout}>" + # rubocop:enable Layout/LineLength + end + + define_sorbet_constant!(:RequestComponents) do + T.type_alias do + { + method: Symbol, + path: T.any(String, T::Array[String]), + query: T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]), + headers: T.nilable( + T::Hash[String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + )] + ), + body: T.nilable(T.anything), + unwrap: T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + page: T.nilable(T::Class[Imagekit::Internal::Type::BasePage[Imagekit::Internal::Type::BaseModel]]), + stream: T.nilable(T::Class[T.anything]), + model: T.nilable(Imagekit::Internal::Type::Converter::Input), + options: T.nilable(Imagekit::RequestOptions::OrHash) + } + end + end + define_sorbet_constant!(:RequestInput) do + T.type_alias do + { + method: Symbol, + url: URI::Generic, + headers: T::Hash[String, String], + body: T.anything, + max_retries: Integer, + timeout: Float + } + end + end + end + end + end +end diff --git a/lib/imagekit/internal/transport/pooled_net_requester.rb b/lib/imagekit/internal/transport/pooled_net_requester.rb new file mode 100644 index 00000000..365d5689 --- /dev/null +++ b/lib/imagekit/internal/transport/pooled_net_requester.rb @@ -0,0 +1,201 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Transport + # @api private + class PooledNetRequester + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + # from the golang stdlib + # https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49 + KEEP_ALIVE_TIMEOUT = 30 + + DEFAULT_MAX_CONNECTIONS = [Etc.nprocessors, 99].max + + class << self + # @api private + # + # @param url [URI::Generic] + # + # @return [Net::HTTP] + def connect(url) + port = + case [url.port, url.scheme] + in [Integer, _] + url.port + in [nil, "http" | "ws"] + Net::HTTP.http_default_port + in [nil, "https" | "wss"] + Net::HTTP.https_default_port + end + + Net::HTTP.new(url.host, port).tap do + _1.use_ssl = %w[https wss].include?(url.scheme) + _1.max_retries = 0 + end + end + + # @api private + # + # @param conn [Net::HTTP] + # @param deadline [Float] + def calibrate_socket_timeout(conn, deadline) + timeout = deadline - Imagekit::Internal::Util.monotonic_secs + conn.open_timeout = conn.read_timeout = conn.write_timeout = conn.continue_timeout = timeout + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @param blk [Proc] + # + # @yieldparam [String] + # @return [Array(Net::HTTPGenericRequest, Proc)] + def build_request(request, &blk) + method, url, headers, body = request.fetch_values(:method, :url, :headers, :body) + req = Net::HTTPGenericRequest.new( + method.to_s.upcase, + !body.nil?, + method != :head, + URI(url.to_s) # ensure we construct a URI class of the right scheme + ) + + headers.each { req[_1] = _2 } + + case body + in nil + nil + in String + req["content-length"] ||= body.bytesize.to_s unless req["transfer-encoding"] + req.body_stream = Imagekit::Internal::Util::ReadIOAdapter.new(body, &blk) + in StringIO + req["content-length"] ||= body.size.to_s unless req["transfer-encoding"] + req.body_stream = Imagekit::Internal::Util::ReadIOAdapter.new(body, &blk) + in Pathname | IO | Enumerator + req["transfer-encoding"] ||= "chunked" unless req["content-length"] + req.body_stream = Imagekit::Internal::Util::ReadIOAdapter.new(body, &blk) + end + + [req, req.body_stream&.method(:close)] + end + end + + # @api private + # + # @param url [URI::Generic] + # @param deadline [Float] + # @param blk [Proc] + # + # @raise [Timeout::Error] + # @yieldparam [Net::HTTP] + private def with_pool(url, deadline:, &blk) + origin = Imagekit::Internal::Util.uri_origin(url) + timeout = deadline - Imagekit::Internal::Util.monotonic_secs + pool = + @mutex.synchronize do + @pools[origin] ||= ConnectionPool.new(size: @size) do + self.class.connect(url) + end + end + + pool.with(timeout: timeout, &blk) + end + + # @api private + # + # @param request [Hash{Symbol=>Object}] . + # + # @option request [Symbol] :method + # + # @option request [URI::Generic] :url + # + # @option request [Hash{String=>String}] :headers + # + # @option request [Object] :body + # + # @option request [Float] :deadline + # + # @return [Array(Integer, Net::HTTPResponse, Enumerable)] + def execute(request) + url, deadline = request.fetch_values(:url, :deadline) + + req = nil + eof = false + finished = false + closing = nil + + # rubocop:disable Metrics/BlockLength + enum = Enumerator.new do |y| + with_pool(url, deadline: deadline) do |conn| + next if finished + + req, closing = self.class.build_request(request) do + self.class.calibrate_socket_timeout(conn, deadline) + end + + self.class.calibrate_socket_timeout(conn, deadline) + unless conn.started? + conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT + conn.start + end + + self.class.calibrate_socket_timeout(conn, deadline) + conn.request(req) do |rsp| + y << [conn, req, rsp] + break if finished + + rsp.read_body do |bytes| + y << bytes.force_encoding(Encoding::BINARY) + break if finished + + self.class.calibrate_socket_timeout(conn, deadline) + end + eof = true + end + end + rescue Timeout::Error + raise Imagekit::Errors::APITimeoutError.new(url: url, request: req) + rescue StandardError + raise Imagekit::Errors::APIConnectionError.new(url: url, request: req) + end + # rubocop:enable Metrics/BlockLength + + conn, _, response = enum.next + body = Imagekit::Internal::Util.fused_enum(enum, external: true) do + finished = true + tap do + enum.next + rescue StopIteration + nil + end + ensure + conn.finish if !eof && conn&.started? + closing&.call + end + [Integer(response.code), response, body] + end + + # @api private + # + # @param size [Integer] + def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS) + @mutex = Mutex.new + @size = size + @pools = {} + end + + define_sorbet_constant!(:Request) do + T.type_alias { {method: Symbol, url: URI::Generic, headers: T::Hash[String, String], body: T.anything, deadline: Float} } + end + end + end + end +end diff --git a/lib/imagekit/internal/type/array_of.rb b/lib/imagekit/internal/type/array_of.rb new file mode 100644 index 00000000..7e21f934 --- /dev/null +++ b/lib/imagekit/internal/type/array_of.rb @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # @abstract + # + # @generic Elem + # + # Array of items of a given type. + class ArrayOf + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + private_class_method :new + + # @overload [](type_info, spec = {}) + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [self] + def self.[](...) = new(...) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) = other.is_a?(Array) && other.all?(item_type) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + # rubocop:disable Layout/LineLength + other.is_a?(Imagekit::Internal::Type::ArrayOf) && other.nilable? == nilable? && other.item_type == item_type + # rubocop:enable Layout/LineLength + end + + # @api public + # + # @return [Integer] + def hash = [self.class, item_type].hash + + # @api private + # + # @param value [Array, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Array, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + + unless value.is_a?(Array) + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{Array}") + return value + end + + target = item_type + exactness[:yes] += 1 + value + .map do |item| + case [nilable?, item] + in [true, nil] + exactness[:yes] += 1 + nil + else + Imagekit::Internal::Type::Converter.coerce(target, item, state: state) + end + end + end + + # @api private + # + # @param value [Array, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Array, Object] + def dump(value, state:) + target = item_type + if value.is_a?(Array) + value.map do + Imagekit::Internal::Type::Converter.dump(target, _1, state: state) + end + else + super + end + end + + # @api private + # + # @return [Object] + def to_sorbet_type + T::Array[Imagekit::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(item_type)] + end + + # @api private + # + # @return [generic] + protected def item_type = @item_type_fn.call + + # @api private + # + # @return [Boolean] + protected def nilable? = @nilable + + # @api private + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def initialize(type_info, spec = {}) + @item_type_fn = Imagekit::Internal::Type::Converter.type_info(type_info || spec) + @meta = Imagekit::Internal::Type::Converter.meta_info(type_info, spec) + @nilable = spec.fetch(:nil?, false) + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + items = Imagekit::Internal::Type::Converter.inspect(item_type, depth: depth.succ) + + "#{self.class}[#{[items, nilable? ? 'nil' : nil].compact.join(' | ')}]" + end + end + end + end +end diff --git a/lib/imagekit/internal/type/base_model.rb b/lib/imagekit/internal/type/base_model.rb new file mode 100644 index 00000000..10b423c5 --- /dev/null +++ b/lib/imagekit/internal/type/base_model.rb @@ -0,0 +1,530 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @abstract + class BaseModel + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + class << self + # @api private + # + # Assumes superclass fields are totally defined before fields are accessed / + # defined on subclasses. + # + # @param child [Class] + def inherited(child) + super + child.known_fields.replace(known_fields.dup) + end + + # @api private + # + # @return [Hash{Symbol=>Hash{Symbol=>Object}}] + def known_fields = @known_fields ||= {} + + # @api private + # + # @return [Hash{Symbol=>Hash{Symbol=>Object}}] + def fields + known_fields.transform_values do |field| + {**field.except(:type_fn), type: field.fetch(:type_fn).call} + end + end + + # @api private + # + # @param name_sym [Symbol] + # + # @param required [Boolean] + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + private def add_field(name_sym, required:, type_info:, spec:) + meta = Imagekit::Internal::Type::Converter.meta_info(type_info, spec) + type_fn, info = + case type_info + in Proc | Imagekit::Internal::Type::Converter | Class + [Imagekit::Internal::Type::Converter.type_info({**spec, union: type_info}), spec] + in Hash + [Imagekit::Internal::Type::Converter.type_info(type_info), type_info] + end + + setter = :"#{name_sym}=" + api_name = info.fetch(:api_name, name_sym) + nilable = info.fetch(:nil?, false) + const = required && !nilable ? info.fetch(:const, Imagekit::Internal::OMIT) : Imagekit::Internal::OMIT + + [name_sym, setter].each { undef_method(_1) } if known_fields.key?(name_sym) + + known_fields[name_sym] = + { + mode: @mode, + api_name: api_name, + required: required, + nilable: nilable, + const: const, + type_fn: type_fn, + meta: meta + } + + define_method(setter) do |value| + target = type_fn.call + state = Imagekit::Internal::Type::Converter.new_coerce_state(translate_names: false) + coerced = Imagekit::Internal::Type::Converter.coerce(target, value, state: state) + status = @coerced.store(name_sym, state.fetch(:error) || true) + stored = + case [target, status] + in [Imagekit::Internal::Type::Converter | Symbol, true] + coerced + else + value + end + @data.store(name_sym, stored) + end + + # rubocop:disable Style/CaseEquality + # rubocop:disable Metrics/BlockLength + define_method(name_sym) do + target = type_fn.call + + case @coerced[name_sym] + in true | false if Imagekit::Internal::Type::Converter === target + @data.fetch(name_sym) + in ::StandardError => e + raise Imagekit::Errors::ConversionError.new( + on: self.class, + method: __method__, + target: target, + value: @data.fetch(name_sym), + cause: e + ) + else + Kernel.then do + value = @data.fetch(name_sym) { const == Imagekit::Internal::OMIT ? nil : const } + state = Imagekit::Internal::Type::Converter.new_coerce_state(translate_names: false) + if (nilable || !required) && value.nil? + nil + else + Imagekit::Internal::Type::Converter.coerce( + target, value, state: state + ) + end + rescue StandardError => e + raise Imagekit::Errors::ConversionError.new( + on: self.class, + method: __method__, + target: target, + value: value, + cause: e + ) + end + end + end + # rubocop:enable Metrics/BlockLength + # rubocop:enable Style/CaseEquality + end + + # @api private + # + # @param name_sym [Symbol] + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def required(name_sym, type_info, spec = {}) + add_field(name_sym, required: true, type_info: type_info, spec: spec) + end + + # @api private + # + # @param name_sym [Symbol] + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def optional(name_sym, type_info, spec = {}) + add_field(name_sym, required: false, type_info: type_info, spec: spec) + end + + # @api private + # + # `request_only` attributes not excluded from `.#coerce` when receiving responses + # even if well behaved servers should not send them + # + # @param blk [Proc] + private def request_only(&blk) + @mode = :dump + blk.call + ensure + @mode = nil + end + + # @api private + # + # `response_only` attributes are omitted from `.#dump` when making requests + # + # @param blk [Proc] + private def response_only(&blk) + @mode = :coerce + blk.call + ensure + @mode = nil + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + other.is_a?(Class) && other <= Imagekit::Internal::Type::BaseModel && other.fields == fields + end + + # @api public + # + # @return [Integer] + def hash = fields.hash + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) = self.class == other.class && @data == other.to_h + + # @api public + # + # @return [Integer] + def hash = [self.class, @data].hash + + class << self + # @api private + # + # @param value [Imagekit::Internal::Type::BaseModel, Hash{Object=>Object}, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [self, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + + if value.is_a?(self) + exactness[:yes] += 1 + return value + end + + unless (val = Imagekit::Internal::Util.coerce_hash(value)).is_a?(Hash) + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{Hash}") + return value + end + exactness[:yes] += 1 + + keys = val.keys.to_set + instance = new + data = instance.to_h + status = instance.instance_variable_get(:@coerced) + + # rubocop:disable Metrics/BlockLength + fields.each do |name, field| + mode, required, target = field.fetch_values(:mode, :required, :type) + api_name, nilable, const = field.fetch_values(:api_name, :nilable, :const) + src_name = state.fetch(:translate_names) ? api_name : name + + unless val.key?(src_name) + if required && mode != :dump && const == Imagekit::Internal::OMIT + exactness[nilable ? :maybe : :no] += 1 + else + exactness[:yes] += 1 + end + next + end + + item = val.fetch(src_name) + keys.delete(src_name) + + state[:error] = nil + converted = + if item.nil? && (nilable || !required) + exactness[nilable ? :yes : :maybe] += 1 + nil + else + coerced = Imagekit::Internal::Type::Converter.coerce(target, item, state: state) + case target + in Imagekit::Internal::Type::Converter | Symbol + coerced + else + item + end + end + + status.store(name, state.fetch(:error) || true) + data.store(name, converted) + end + # rubocop:enable Metrics/BlockLength + + keys.each { data.store(_1, val.fetch(_1)) } + instance + end + + # @api private + # + # @param value [self, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Hash{Object=>Object}, Object] + def dump(value, state:) + unless (coerced = Imagekit::Internal::Util.coerce_hash(value)).is_a?(Hash) + return super + end + + acc = {} + + coerced.each do |key, val| + name = key.is_a?(String) ? key.to_sym : key + case (field = known_fields[name]) + in nil + acc.store(name, super(val, state: state)) + else + api_name, mode, type_fn = field.fetch_values(:api_name, :mode, :type_fn) + case mode + in :coerce + next + else + target = type_fn.call + acc.store(api_name, Imagekit::Internal::Type::Converter.dump(target, val, state: state)) + end + end + end + + known_fields.each_value do |field| + api_name, mode, const = field.fetch_values(:api_name, :mode, :const) + next if mode == :coerce || acc.key?(api_name) || const == Imagekit::Internal::OMIT + acc.store(api_name, const) + end + + acc + end + + # @api private + # + # @return [Object] + def to_sorbet_type + self + end + end + + class << self + # @api private + # + # @param model [Imagekit::Internal::Type::BaseModel] + # @param convert [Boolean] + # + # @return [Hash{Symbol=>Object}] + def recursively_to_h(model, convert:) + rec = ->(x) do + case x + in Imagekit::Internal::Type::BaseModel + if convert + fields = x.class.known_fields + x.to_h.to_h do |key, val| + [key, rec.call(fields.key?(key) ? x.public_send(key) : val)] + rescue Imagekit::Errors::ConversionError + [key, rec.call(val)] + end + else + rec.call(x.to_h) + end + in Hash + x.transform_values(&rec) + in Array + x.map(&rec) + else + x + end + end + rec.call(model) + end + end + + # @api public + # + # Returns the raw value associated with the given key, if found. Otherwise, nil is + # returned. + # + # It is valid to lookup keys that are not in the API spec, for example to access + # undocumented features. This method does not parse response data into + # higher-level types. Lookup by anything other than a Symbol is an ArgumentError. + # + # @param key [Symbol] + # + # @return [Object, nil] + def [](key) + unless key.instance_of?(Symbol) + raise ArgumentError.new("Expected symbol key for lookup, got #{key.inspect}") + end + + @data[key] + end + + # @api public + # + # Returns a Hash of the data underlying this object. O(1) + # + # Keys are Symbols and values are the raw values from the response. The return + # value indicates which values were ever set on the object. i.e. there will be a + # key in this hash if they ever were, even if the set value was nil. + # + # This method is not recursive. The returned value is shared by the object, so it + # should not be mutated. + # + # @return [Hash{Symbol=>Object}] + def to_h = @data + + alias_method :to_hash, :to_h + + # @api public + # + # In addition to the behaviour of `#to_h`, this method will recursively call + # `#to_h` on nested models. + # + # @return [Hash{Symbol=>Object}] + def deep_to_h = self.class.recursively_to_h(@data, convert: false) + + # @param keys [Array, nil] + # + # @return [Hash{Symbol=>Object}] + # + # @example + # # `base_overlay` is a `Imagekit::BaseOverlay` + # base_overlay => { + # position: position, + # timing: timing + # } + def deconstruct_keys(keys) + (keys || self.class.known_fields.keys) + .filter_map do |k| + unless self.class.known_fields.key?(k) + next + end + + [k, public_send(k)] + end + .to_h + end + + # @api public + # + # @param a [Object] + # + # @return [String] + def to_json(*a) = Imagekit::Internal::Type::Converter.dump(self.class, self).to_json(*a) + + # @api public + # + # @param a [Object] + # + # @return [String] + def to_yaml(*a) = Imagekit::Internal::Type::Converter.dump(self.class, self).to_yaml(*a) + + # Create a new instance of a model. + # + # @param data [Hash{Symbol=>Object}, self] + def initialize(data = {}) + @data = {} + @coerced = {} + Imagekit::Internal::Util.coerce_hash!(data).each do + if self.class.known_fields.key?(_1) + public_send(:"#{_1}=", _2) + else + @data.store(_1, _2) + @coerced.store(_1, false) + end + end + end + + class << self + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + return super() if depth.positive? + + depth = depth.succ + deferred = fields.transform_values do |field| + type, required, nilable = field.fetch_values(:type, :required, :nilable) + inspected = [ + Imagekit::Internal::Type::Converter.inspect(type, depth: depth), + !required || nilable ? "nil" : nil + ].compact.join(" | ") + -> { inspected }.tap { _1.define_singleton_method(:inspect) { call } } + end + + "#{name}[#{deferred.inspect}]" + end + end + + # @api public + # + # @return [String] + def to_s = deep_to_h.to_s + + # @api private + # + # @return [String] + def inspect + converted = self.class.recursively_to_h(self, convert: true) + "#<#{self.class}:0x#{object_id.to_s(16)} #{converted}>" + end + + define_sorbet_constant!(:KnownField) do + T.type_alias { {mode: T.nilable(Symbol), required: T::Boolean, nilable: T::Boolean} } + end + end + end + end +end diff --git a/lib/imagekit/internal/type/base_page.rb b/lib/imagekit/internal/type/base_page.rb new file mode 100644 index 00000000..f216334d --- /dev/null +++ b/lib/imagekit/internal/type/base_page.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # @generic Elem + # + # This module provides a base implementation for paginated responses in the SDK. + module BasePage + # rubocop:disable Lint/UnusedMethodArgument + + # @api public + # + # @return [Boolean] + def next_page? = (raise NotImplementedError) + + # @api public + # + # @raise [Imagekit::Errors::APIError] + # @return [self] + def next_page = (raise NotImplementedError) + + # @api public + # + # @param blk [Proc] + # + # @yieldparam [generic] + # @return [void] + def auto_paging_each(&blk) = (raise NotImplementedError) + + # @return [Enumerable>] + def to_enum = super(:auto_paging_each) + + alias_method :enum_for, :to_enum + + # @api private + # + # @param client [Imagekit::Internal::Transport::BaseClient] + # @param req [Hash{Symbol=>Object}] + # @param headers [Hash{String=>String}, Net::HTTPHeader] + # @param page_data [Object] + def initialize(client:, req:, headers:, page_data:) + @client = client + @req = req + @model = req.fetch(:model) + super() + end + + # rubocop:enable Lint/UnusedMethodArgument + end + end + end +end diff --git a/lib/imagekit/internal/type/boolean.rb b/lib/imagekit/internal/type/boolean.rb new file mode 100644 index 00000000..52ecc971 --- /dev/null +++ b/lib/imagekit/internal/type/boolean.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # @abstract + # + # Ruby has no Boolean class; this is something for models to refer to. + class Boolean + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + private_class_method :new + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.===(other) = other == true || other == false + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.==(other) = other.is_a?(Class) && other <= Imagekit::Internal::Type::Boolean + + class << self + # @api private + # + # Coerce value to Boolean if possible, otherwise return the original value. + # + # @param value [Boolean, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Boolean, Object] + def coerce(value, state:) + state.fetch(:exactness)[value == true || value == false ? :yes : :no] += 1 + value + end + + # @!method dump(value, state:) + # @api private + # + # @param value [Boolean, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Boolean, Object] + + # @api private + # + # @return [Object] + def to_sorbet_type + T::Boolean + end + end + end + end + end +end diff --git a/lib/imagekit/internal/type/converter.rb b/lib/imagekit/internal/type/converter.rb new file mode 100644 index 00000000..90a839c6 --- /dev/null +++ b/lib/imagekit/internal/type/converter.rb @@ -0,0 +1,327 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + module Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + # rubocop:disable Lint/UnusedMethodArgument + + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(value, state:) = (raise NotImplementedError) + + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + def dump(value, state:) + case value + in Array + value.map { Imagekit::Internal::Type::Unknown.dump(_1, state: state) } + in Hash + value.transform_values { Imagekit::Internal::Type::Unknown.dump(_1, state: state) } + in Imagekit::Internal::Type::BaseModel + value.class.dump(value, state: state) + in StringIO + value.string + in Pathname | IO + state[:can_retry] = false if value.is_a?(IO) + Imagekit::FilePart.new(value) + in Imagekit::FilePart + state[:can_retry] = false if value.content.is_a?(IO) + value + else + value + end + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + super() + end + + # rubocop:enable Lint/UnusedMethodArgument + + class << self + # @api private + # + # @param spec [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [Proc] + def type_info(spec) + case spec + in Proc + spec + in Hash + type_info(spec.slice(:const, :enum, :union).first&.last) + in true | false + -> { Imagekit::Internal::Type::Boolean } + in Imagekit::Internal::Type::Converter | Class | Symbol + -> { spec } + in NilClass | Integer | Float + -> { spec.class } + end + end + + # @api private + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] . + # + # @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option type_info [Proc] :enum + # + # @option type_info [Proc] :union + # + # @option type_info [Boolean] :"nil?" + # + # @param spec [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [Hash{Symbol=>Object}] + def meta_info(type_info, spec) + [spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?) + end + + # @api private + # + # @param translate_names [Boolean] + # + # @return [Hash{Symbol=>Object}] + def new_coerce_state(translate_names: true) + { + translate_names: translate_names, + strictness: true, + exactness: {yes: 0, no: 0, maybe: 0}, + error: nil, + branched: 0 + } + end + + # @api private + # + # Based on `target`, transform `value` into `target`, to the extent possible: + # + # 1. if the given `value` conforms to `target` already, return the given `value` + # 2. if it's possible and safe to convert the given `value` to `target`, then the + # converted value + # 3. otherwise, the given `value` unaltered + # + # The coercion process is subject to improvement between minor release versions. + # See https://docs.pydantic.dev/latest/concepts/unions/#smart-mode + # + # @param target [Imagekit::Internal::Type::Converter, Class] + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] The `strictness` is one of `true`, `false`. This informs the coercion strategy + # when we have to decide between multiple possible conversion targets: + # + # - `true`: the conversion must be exact, with minimum coercion. + # - `false`: the conversion can be approximate, with some coercion. + # + # The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For + # any given conversion attempt, the exactness will be updated based on how closely + # the value recursively matches the target type: + # + # - `yes`: the value can be converted to the target type with minimum coercion. + # - `maybe`: the value can be converted to the target type with some reasonable + # coercion. + # - `no`: the value cannot be converted to the target type. + # + # See implementation below for more details. + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(target, value, state: Imagekit::Internal::Type::Converter.new_coerce_state) + # rubocop:disable Metrics/BlockNesting + exactness = state.fetch(:exactness) + + case target + in Imagekit::Internal::Type::Converter + return target.coerce(value, state: state) + in Class + if value.is_a?(target) + exactness[:yes] += 1 + return value + end + + case target + in -> { _1 <= NilClass } + exactness[value.nil? ? :yes : :maybe] += 1 + return nil + in -> { _1 <= Integer } + case value + in Integer + exactness[:yes] += 1 + return value + else + Kernel.then do + return Integer(value).tap { exactness[:maybe] += 1 } + rescue ArgumentError, TypeError => e + state[:error] = e + end + end + in -> { _1 <= Float } + if value.is_a?(Numeric) + exactness[:yes] += 1 + return Float(value) + else + Kernel.then do + return Float(value).tap { exactness[:maybe] += 1 } + rescue ArgumentError, TypeError => e + state[:error] = e + end + end + in -> { _1 <= String } + case value + in String | Symbol | Numeric + exactness[value.is_a?(Numeric) ? :maybe : :yes] += 1 + return value.to_s + in StringIO + exactness[:yes] += 1 + return value.string + else + state[:error] = TypeError.new("#{value.class} can't be coerced into #{String}") + end + in -> { _1 <= Date || _1 <= Time } + Kernel.then do + return target.parse(value).tap { exactness[:yes] += 1 } + rescue ArgumentError, TypeError => e + state[:error] = e + end + in -> { _1 <= StringIO } if value.is_a?(String) + exactness[:yes] += 1 + return StringIO.new(value.b) + else + end + in Symbol + case value + in Symbol | String + if value.to_sym == target + exactness[:yes] += 1 + return target + else + exactness[:maybe] += 1 + return value + end + else + message = "cannot convert non-matching #{value.class} into #{target.inspect}" + state[:error] = ArgumentError.new(message) + end + else + end + + exactness[:no] += 1 + value + # rubocop:enable Metrics/BlockNesting + end + + # @api private + # + # @param target [Imagekit::Internal::Type::Converter, Class] + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + def dump(target, value, state: {can_retry: true}) + case target + in Imagekit::Internal::Type::Converter + target.dump(value, state: state) + else + Imagekit::Internal::Type::Unknown.dump(value, state: state) + end + end + + # @api private + # + # @param target [Object] + # @param depth [Integer] + # + # @return [String] + def inspect(target, depth:) + case target + in Imagekit::Internal::Type::Converter + target.inspect(depth: depth.succ) + else + target.inspect + end + end + end + + define_sorbet_constant!(:Input) do + T.type_alias { T.any(Imagekit::Internal::Type::Converter, T::Class[T.anything]) } + end + define_sorbet_constant!(:CoerceState) do + T.type_alias do + { + translate_names: T::Boolean, + strictness: T::Boolean, + exactness: {yes: Integer, no: Integer, maybe: Integer}, + error: T::Class[StandardError], + branched: Integer + } + end + end + define_sorbet_constant!(:DumpState) do + T.type_alias { {can_retry: T::Boolean} } + end + end + end + end +end diff --git a/lib/imagekit/internal/type/enum.rb b/lib/imagekit/internal/type/enum.rb new file mode 100644 index 00000000..f8cfca79 --- /dev/null +++ b/lib/imagekit/internal/type/enum.rb @@ -0,0 +1,156 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # A value from among a specified list of options. OpenAPI enum values map to Ruby + # values in the SDK as follows: + # + # 1. boolean => true | false + # 2. integer => Integer + # 3. float => Float + # 4. string => Symbol + # + # We can therefore convert string values to Symbols, but can't convert other + # values safely. + # + # @example + # # `streaming_resolution` is a `Imagekit::StreamingResolution` + # case streaming_resolution + # when Imagekit::StreamingResolution::STREAMING_RESOLUTION_240 + # # ... + # when Imagekit::StreamingResolution::STREAMING_RESOLUTION_360 + # # ... + # when Imagekit::StreamingResolution::STREAMING_RESOLUTION_480 + # # ... + # else + # puts(streaming_resolution) + # end + # + # @example + # case streaming_resolution + # in :"240" + # # ... + # in :"360" + # # ... + # in :"480" + # # ... + # else + # puts(streaming_resolution) + # end + module Enum + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + # All of the valid Symbol values for this enum. + # + # @return [Array] + def values = constants.map { const_get(_1) } + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) = values.include?(other) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + # rubocop:disable Style/CaseEquality + Imagekit::Internal::Type::Enum === other && other.values.to_set == values.to_set + # rubocop:enable Style/CaseEquality + end + + # @api public + # + # @return [Integer] + def hash = values.to_set.hash + + # @api private + # + # Unlike with primitives, `Enum` additionally validates that the value is a member + # of the enum. + # + # @param value [String, Symbol, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Symbol, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + val = value.is_a?(String) ? value.to_sym : value + + if values.include?(val) + exactness[:yes] += 1 + val + elsif values.first&.class == val.class + exactness[:maybe] += 1 + value + else + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{self}") + value + end + end + + # @!method dump(value, state:) + # @api private + # + # @param value [Symbol, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Symbol, Object] + + # @api private + # + # @return [Object] + def to_sorbet_type + types = values.map { Imagekit::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq + case types + in [] + T.noreturn + in [type] + type + else + T.any(*types) + end + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + if depth.positive? + return is_a?(Module) ? super() : self.class.name + end + + members = values.map { Imagekit::Internal::Type::Converter.inspect(_1, depth: depth.succ) } + prefix = is_a?(Module) ? name : self.class.name + + "#{prefix}[#{members.join(' | ')}]" + end + end + end + end +end diff --git a/lib/imagekit/internal/type/file_input.rb b/lib/imagekit/internal/type/file_input.rb new file mode 100644 index 00000000..125add8f --- /dev/null +++ b/lib/imagekit/internal/type/file_input.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # @abstract + # + # Either `Pathname` or `StringIO`, or `IO`, or + # `Imagekit::Internal::Type::FileInput`. + # + # Note: when `IO` is used, all retries are disabled, since many IO` streams are + # not rewindable. + class FileInput + extend Imagekit::Internal::Type::Converter + + private_class_method :new + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.===(other) + case other + in Pathname | StringIO | IO | String | Imagekit::FilePart + true + else + false + end + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.==(other) = other.is_a?(Class) && other <= Imagekit::Internal::Type::FileInput + + class << self + # @api private + # + # @param value [StringIO, String, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [StringIO, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + case value + in String + exactness[:yes] += 1 + StringIO.new(value) + in StringIO + exactness[:yes] += 1 + value + else + state[:error] = TypeError.new("#{value.class} can't be coerced into #{StringIO}") + exactness[:no] += 1 + value + end + end + + # @api private + # + # @param value [Pathname, StringIO, IO, String, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Pathname, StringIO, IO, String, Object] + def dump(value, state:) + # rubocop:disable Lint/DuplicateBranch + case value + in IO + state[:can_retry] = false + in Imagekit::FilePart if value.content.is_a?(IO) + state[:can_retry] = false + else + end + # rubocop:enable Lint/DuplicateBranch + + value + end + + # @api private + # + # @return [Object] + def to_sorbet_type + T.any(Pathname, StringIO, IO, String, Imagekit::FilePart) + end + end + end + end + end +end diff --git a/lib/imagekit/internal/type/hash_of.rb b/lib/imagekit/internal/type/hash_of.rb new file mode 100644 index 00000000..20a0aa22 --- /dev/null +++ b/lib/imagekit/internal/type/hash_of.rb @@ -0,0 +1,188 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # @abstract + # + # @generic Elem + # + # Hash of items of a given type. + class HashOf + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + private_class_method :new + + # @overload [](type_info, spec = {}) + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + # + # @return [self] + def self.[](...) = new(...) + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) + type = item_type + case other + in Hash + other.all? do |key, val| + case [key, val] + in [Symbol | String, ^type] + true + else + false + end + end + else + false + end + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + # rubocop:disable Layout/LineLength + other.is_a?(Imagekit::Internal::Type::HashOf) && other.nilable? == nilable? && other.item_type == item_type + # rubocop:enable Layout/LineLength + end + + # @api public + # + # @return [Integer] + def hash = [self.class, item_type].hash + + # @api private + # + # @param value [Hash{Object=>Object}, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Hash{Symbol=>Object}, Object] + def coerce(value, state:) + exactness = state.fetch(:exactness) + + unless value.is_a?(Hash) + exactness[:no] += 1 + state[:error] = TypeError.new("#{value.class} can't be coerced into #{Hash}") + return value + end + + target = item_type + exactness[:yes] += 1 + value + .to_h do |key, val| + k = key.is_a?(String) ? key.to_sym : key + v = + case [nilable?, val] + in [true, nil] + exactness[:yes] += 1 + nil + else + Imagekit::Internal::Type::Converter.coerce(target, val, state: state) + end + + exactness[:no] += 1 unless k.is_a?(Symbol) + [k, v] + end + end + + # @api private + # + # @param value [Hash{Object=>Object}, Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Hash{Symbol=>Object}, Object] + def dump(value, state:) + target = item_type + if value.is_a?(Hash) + value.transform_values do + Imagekit::Internal::Type::Converter.dump(target, _1, state: state) + end + else + super + end + end + + # @api private + # + # @return [Object] + def to_sorbet_type + T::Hash[Imagekit::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(item_type)] + end + + # @api private + # + # @return [generic] + protected def item_type = @item_type_fn.call + + # @api private + # + # @return [Boolean] + protected def nilable? = @nilable + + # @api private + # + # @param type_info [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + def initialize(type_info, spec = {}) + @item_type_fn = Imagekit::Internal::Type::Converter.type_info(type_info || spec) + @meta = Imagekit::Internal::Type::Converter.meta_info(type_info, spec) + @nilable = spec.fetch(:nil?, false) + end + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + items = Imagekit::Internal::Type::Converter.inspect(item_type, depth: depth.succ) + + "#{self.class}[#{[items, nilable? ? 'nil' : nil].compact.join(' | ')}]" + end + end + end + end +end diff --git a/lib/imagekit/internal/type/request_parameters.rb b/lib/imagekit/internal/type/request_parameters.rb new file mode 100644 index 00000000..73dff299 --- /dev/null +++ b/lib/imagekit/internal/type/request_parameters.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + module RequestParameters + # @!attribute request_options + # Options to specify HTTP behaviour for this request. + # + # @return [Imagekit::RequestOptions, Hash{Symbol=>Object}] + + # @param mod [Module] + def self.included(mod) + raise ArgumentError.new(mod) unless mod <= Imagekit::Internal::Type::BaseModel + + mod.optional(:request_options, Imagekit::RequestOptions) + end + + # @api private + module Converter + # @api private + # + # @param params [Object] + # + # @return [Array(Object, Hash{Symbol=>Object})] + def dump_request(params) + state = {can_retry: true} + case (dumped = dump(params, state: state)) + in Hash + options = Imagekit::Internal::Util.coerce_hash!(dumped[:request_options]).to_h + request_options = state.fetch(:can_retry) ? options : {**options, max_retries: 0} + [dumped.except(:request_options), request_options] + else + [dumped, nil] + end + end + end + end + end + end +end diff --git a/lib/imagekit/internal/type/union.rb b/lib/imagekit/internal/type/union.rb new file mode 100644 index 00000000..56cb34b1 --- /dev/null +++ b/lib/imagekit/internal/type/union.rb @@ -0,0 +1,250 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # @example + # # `overlay` is a `Imagekit::Overlay` + # case overlay + # when Imagekit::TextOverlay + # # ... + # when Imagekit::ImageOverlay + # # ... + # when Imagekit::VideoOverlay + # # ... + # else + # puts(overlay) + # end + module Union + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + # @api private + # + # All of the specified variant info for this union. + # + # @return [ArrayObject})>] + private def known_variants = (@known_variants ||= []) + + # @api private + # + # @return [ArrayObject})>] + protected def derefed_variants + known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] } + end + + # All of the specified variants for this union. + # + # @return [Array] + def variants = derefed_variants.map { _2 } + + # @api private + # + # @param property [Symbol] + private def discriminator(property) + case property + in Symbol + @discriminator = property + end + end + + # @api private + # + # @param key [Symbol, Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] + # + # @param spec [Hash{Symbol=>Object}, Proc, Imagekit::Internal::Type::Converter, Class] . + # + # @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const + # + # @option spec [Proc] :enum + # + # @option spec [Proc] :union + # + # @option spec [Boolean] :"nil?" + private def variant(key, spec = nil) + meta = Imagekit::Internal::Type::Converter.meta_info(nil, spec) + variant_info = + case key + in Symbol + [key, Imagekit::Internal::Type::Converter.type_info(spec), meta] + in Proc | Imagekit::Internal::Type::Converter | Class | Hash + [nil, Imagekit::Internal::Type::Converter.type_info(key), meta] + end + + known_variants << variant_info + end + + # @api private + # + # @param value [Object] + # + # @return [Imagekit::Internal::Type::Converter, Class, nil] + private def resolve_variant(value) + case [@discriminator, value] + in [_, Imagekit::Internal::Type::BaseModel] + value.class + in [Symbol, Hash] + key = value.fetch(@discriminator) do + value.fetch(@discriminator.to_s, Imagekit::Internal::OMIT) + end + + return nil if key == Imagekit::Internal::OMIT + + key = key.to_sym if key.is_a?(String) + _, found = known_variants.find { |k,| k == key } + found&.call + else + nil + end + end + + # rubocop:disable Style/HashEachMethods + # rubocop:disable Style/CaseEquality + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ===(other) + known_variants.any? do |_, variant_fn| + variant_fn.call === other + end + end + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def ==(other) + Imagekit::Internal::Type::Union === other && other.derefed_variants == derefed_variants + end + + # @api public + # + # @return [Integer] + def hash = variants.hash + + # @api private + # + # Tries to efficiently coerce the given value to one of the known variants. + # + # If the value cannot match any of the known variants, the coercion is considered + # non-viable and returns the original value. + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(value, state:) + if (target = resolve_variant(value)) + return Imagekit::Internal::Type::Converter.coerce(target, value, state: state) + end + + strictness = state.fetch(:strictness) + exactness = state.fetch(:exactness) + + alternatives = [] + known_variants.each do |_, variant_fn| + target = variant_fn.call + exact = state[:exactness] = {yes: 0, no: 0, maybe: 0} + state[:branched] += 1 + + coerced = Imagekit::Internal::Type::Converter.coerce(target, value, state: state) + yes, no, maybe = exact.values + if (no + maybe).zero? || (!strictness && yes.positive?) + exact.each { exactness[_1] += _2 } + state[:exactness] = exactness + return coerced + elsif maybe.positive? + alternatives << [[-yes, -maybe, no], exact, coerced] + end + end + + case alternatives.sort_by!(&:first) + in [] + exactness[:no] += 1 + state[:error] = ArgumentError.new("no matching variant for #{value.inspect}") + value + in [[_, exact, coerced], *] + exact.each { exactness[_1] += _2 } + coerced + end + .tap { state[:exactness] = exactness } + ensure + state[:strictness] = strictness + end + + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + def dump(value, state:) + if (target = resolve_variant(value)) + return Imagekit::Internal::Type::Converter.dump(target, value, state: state) + end + + known_variants.each do + target = _2.call + return Imagekit::Internal::Type::Converter.dump(target, value, state: state) if target === value + end + + super + end + + # @api private + # + # @return [Object] + def to_sorbet_type + types = variants.map { Imagekit::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq + case types + in [] + T.noreturn + in [type] + type + else + T.any(*types) + end + end + + # rubocop:enable Style/CaseEquality + # rubocop:enable Style/HashEachMethods + + # @api private + # + # @param depth [Integer] + # + # @return [String] + def inspect(depth: 0) + if depth.positive? + return is_a?(Module) ? super() : self.class.name + end + + members = variants.map { Imagekit::Internal::Type::Converter.inspect(_1, depth: depth.succ) } + prefix = is_a?(Module) ? name : self.class.name + + "#{prefix}[#{members.join(' | ')}]" + end + end + end + end +end diff --git a/lib/imagekit/internal/type/unknown.rb b/lib/imagekit/internal/type/unknown.rb new file mode 100644 index 00000000..43a4573a --- /dev/null +++ b/lib/imagekit/internal/type/unknown.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + module Type + # @api private + # + # @abstract + # + # When we don't know what to expect for the value. + class Unknown + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + # rubocop:disable Lint/UnusedMethodArgument + + private_class_method :new + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.===(other) = true + + # @api public + # + # @param other [Object] + # + # @return [Boolean] + def self.==(other) = other.is_a?(Class) && other <= Imagekit::Internal::Type::Unknown + + class << self + # @api private + # + # No coercion needed for Unknown type. + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :translate_names + # + # @option state [Boolean] :strictness + # + # @option state [Hash{Symbol=>Object}] :exactness + # + # @option state [Class] :error + # + # @option state [Integer] :branched + # + # @return [Object] + def coerce(value, state:) + state.fetch(:exactness)[:yes] += 1 + value + end + + # @!method dump(value, state:) + # @api private + # + # @param value [Object] + # + # @param state [Hash{Symbol=>Object}] . + # + # @option state [Boolean] :can_retry + # + # @return [Object] + + # @api private + # + # @return [Object] + def to_sorbet_type + T.anything + end + end + + # rubocop:enable Lint/UnusedMethodArgument + end + end + end +end diff --git a/lib/imagekit/internal/util.rb b/lib/imagekit/internal/util.rb new file mode 100644 index 00000000..e1561bc5 --- /dev/null +++ b/lib/imagekit/internal/util.rb @@ -0,0 +1,914 @@ +# frozen_string_literal: true + +module Imagekit + module Internal + # @api private + module Util + # @api private + # + # @return [Float] + def self.monotonic_secs = Process.clock_gettime(Process::CLOCK_MONOTONIC) + + # @api private + # + # @param ns [Module, Class] + # + # @return [Enumerable] + def self.walk_namespaces(ns) + ns.constants(false).lazy.flat_map do + case (c = ns.const_get(_1, false)) + in Module | Class + walk_namespaces(c) + else + [] + end + end + .chain([ns]) + end + + class << self + # @api private + # + # @return [String] + def arch + case (arch = RbConfig::CONFIG["arch"])&.downcase + in nil + "unknown" + in /aarch64|arm64/ + "arm64" + in /x86_64/ + "x64" + in /arm/ + "arm" + else + "other:#{arch}" + end + end + + # @api private + # + # @return [String] + def os + case (host = RbConfig::CONFIG["host_os"])&.downcase + in nil + "Unknown" + in /linux/ + "Linux" + in /darwin/ + "MacOS" + in /freebsd/ + "FreeBSD" + in /openbsd/ + "OpenBSD" + in /mswin|mingw|cygwin|ucrt/ + "Windows" + else + "Other:#{host}" + end + end + end + + class << self + # @api private + # + # @param input [Object] + # + # @return [Boolean] + def primitive?(input) + case input + in true | false | Numeric | Symbol | String + true + else + false + end + end + + # @api private + # + # @param input [String, Boolean] + # + # @return [Boolean, Object] + def coerce_boolean(input) + case input.is_a?(String) ? input.downcase : input + in "true" + true + in "false" + false + else + input + end + end + + # @api private + # + # @param input [String, Boolean] + # + # @raise [ArgumentError] + # @return [Boolean, nil] + def coerce_boolean!(input) + case coerce_boolean(input) + in true | false | nil => coerced + coerced + else + raise ArgumentError.new("Unable to coerce #{input.inspect} into boolean value") + end + end + + # @api private + # + # @param input [String, Integer] + # + # @return [Integer, Object] + def coerce_integer(input) + Integer(input, exception: false) || input + end + + # @api private + # + # @param input [String, Integer, Float] + # + # @return [Float, Object] + def coerce_float(input) + Float(input, exception: false) || input + end + + # @api private + # + # @param input [Object] + # + # @return [Hash{Object=>Object}, Object] + def coerce_hash(input) + case input + in NilClass | Array | Set | Enumerator | StringIO | IO + input + else + input.respond_to?(:to_h) ? input.to_h : input + end + end + + # @api private + # + # @param input [Object] + # + # @raise [ArgumentError] + # @return [Hash{Object=>Object}, nil] + def coerce_hash!(input) + case coerce_hash(input) + in Hash | nil => coerced + coerced + else + message = "Expected a #{Hash} or #{Imagekit::Internal::Type::BaseModel}, got #{data.inspect}" + raise ArgumentError.new(message) + end + end + end + + class << self + # @api private + # + # @param lhs [Object] + # @param rhs [Object] + # @param concat [Boolean] + # + # @return [Object] + private def deep_merge_lr(lhs, rhs, concat: false) + case [lhs, rhs, concat] + in [Hash, Hash, _] + lhs.merge(rhs) { deep_merge_lr(_2, _3, concat: concat) } + in [Array, Array, true] + lhs.concat(rhs) + else + rhs + end + end + + # @api private + # + # Recursively merge one hash with another. If the values at a given key are not + # both hashes, just take the new value. + # + # @param values [Array] + # + # @param sentinel [Object, nil] the value to return if no values are provided. + # + # @param concat [Boolean] whether to merge sequences by concatenation. + # + # @return [Object] + def deep_merge(*values, sentinel: nil, concat: false) + case values + in [value, *values] + values.reduce(value) do |acc, val| + deep_merge_lr(acc, val, concat: concat) + end + else + sentinel + end + end + + # @api private + # + # @param data [Hash{Symbol=>Object}, Array, Object] + # @param pick [Symbol, Integer, Array, Proc, nil] + # @param blk [Proc, nil] + # + # @return [Object, nil] + def dig(data, pick, &blk) + case [data, pick] + in [_, nil] + data + in [Hash, Symbol] | [Array, Integer] + data.fetch(pick) { blk&.call } + in [Hash | Array, Array] + pick.reduce(data) do |acc, key| + case acc + in Hash if acc.key?(key) + acc.fetch(key) + in Array if key.is_a?(Integer) && key < acc.length + acc[key] + else + return blk&.call + end + end + in [_, Proc] + pick.call(data) + else + blk&.call + end + end + end + + class << self + # @api private + # + # @param uri [URI::Generic] + # + # @return [String] + def uri_origin(uri) + "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}" + end + + # @api private + # + # @param path [String, Array] + # + # @return [String] + def interpolate_path(path) + case path + in String + path + in [] + "" + in [String => p, *interpolations] + encoded = interpolations.map { ERB::Util.url_encode(_1) } + format(p, *encoded) + end + end + end + + class << self + # @api private + # + # @param query [String, nil] + # + # @return [Hash{String=>Array}] + def decode_query(query) + CGI.parse(query.to_s) + end + + # @api private + # + # @param query [Hash{String=>Array, String, nil}, nil] + # + # @return [String, nil] + def encode_query(query) + query.to_h.empty? ? nil : URI.encode_www_form(query) + end + end + + class << self + # @api private + # + # @param url [URI::Generic, String] + # + # @return [Hash{Symbol=>String, Integer, nil}] + def parse_uri(url) + parsed = URI::Generic.component.zip(URI.split(url)).to_h + {**parsed, query: decode_query(parsed.fetch(:query))} + end + + # @api private + # + # @param parsed [Hash{Symbol=>String, Integer, nil}] . + # + # @option parsed [String, nil] :scheme + # + # @option parsed [String, nil] :host + # + # @option parsed [Integer, nil] :port + # + # @option parsed [String, nil] :path + # + # @option parsed [Hash{String=>Array}] :query + # + # @return [URI::Generic] + def unparse_uri(parsed) + URI::Generic.build(**parsed, query: encode_query(parsed.fetch(:query))) + end + + # @api private + # + # @param lhs [Hash{Symbol=>String, Integer, nil}] . + # + # @option lhs [String, nil] :scheme + # + # @option lhs [String, nil] :host + # + # @option lhs [Integer, nil] :port + # + # @option lhs [String, nil] :path + # + # @option lhs [Hash{String=>Array}] :query + # + # @param rhs [Hash{Symbol=>String, Integer, nil}] . + # + # @option rhs [String, nil] :scheme + # + # @option rhs [String, nil] :host + # + # @option rhs [Integer, nil] :port + # + # @option rhs [String, nil] :path + # + # @option rhs [Hash{String=>Array}] :query + # + # @return [URI::Generic] + def join_parsed_uri(lhs, rhs) + base_path, base_query = lhs.fetch_values(:path, :query) + slashed = base_path.end_with?("/") ? base_path : "#{base_path}/" + + parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query) + override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path) + + joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override) + query = deep_merge( + joined.path == base_path ? base_query : {}, + parsed_query, + rhs[:query].to_h, + concat: true + ) + + joined.query = encode_query(query) + joined + end + end + + class << self + # @api private + # + # @param headers [Hash{String=>String, Integer, Array, nil}] + # + # @return [Hash{String=>String}] + def normalized_headers(*headers) + {}.merge(*headers.compact).to_h do |key, val| + value = + case val + in Array + val.filter_map { _1&.to_s&.strip }.join(", ") + else + val&.to_s&.strip + end + [key.downcase, value] + end + end + end + + # @api private + # + # An adapter that satisfies the IO interface required by `::IO.copy_stream` + class ReadIOAdapter + # @api private + # + # @return [Boolean, nil] + def close? = @closing + + # @api private + def close + case @stream + in Enumerator + Imagekit::Internal::Util.close_fused!(@stream) + in IO if close? + @stream.close + else + end + end + + # @api private + # + # @param max_len [Integer, nil] + # + # @return [String] + private def read_enum(max_len) + case max_len + in nil + @stream.to_a.join + in Integer + @buf << @stream.next while @buf.length < max_len + @buf.slice!(..max_len) + end + rescue StopIteration + @stream = nil + @buf.slice!(0..) + end + + # @api private + # + # @param max_len [Integer, nil] + # @param out_string [String, nil] + # + # @return [String, nil] + def read(max_len = nil, out_string = nil) + case @stream + in nil + nil + in IO | StringIO + @stream.read(max_len, out_string) + in Enumerator + read = read_enum(max_len) + case out_string + in String + out_string.replace(read) + in nil + read + end + end + .tap(&@blk) + end + + # @api private + # + # @param src [String, Pathname, StringIO, Enumerable] + # @param blk [Proc] + # + # @yieldparam [String] + def initialize(src, &blk) + @stream = + case src + in String + StringIO.new(src) + in Pathname + @closing = true + src.open(binmode: true) + else + src + end + @buf = String.new + @blk = blk + end + end + + class << self + # @param blk [Proc] + # + # @yieldparam [Enumerator::Yielder] + # @return [Enumerable] + def writable_enum(&blk) + Enumerator.new do |y| + buf = String.new + y.define_singleton_method(:write) do + self << buf.replace(_1) + buf.bytesize + end + + blk.call(y) + end + end + end + + # @type [Regexp] + JSON_CONTENT = %r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)} + # @type [Regexp] + JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)} + + class << self + # @api private + # + # @param y [Enumerator::Yielder] + # @param val [Object] + # @param closing [Array] + # @param content_type [String, nil] + private def write_multipart_content(y, val:, closing:, content_type: nil) + content_line = "Content-Type: %s\r\n\r\n" + + case val + in Imagekit::FilePart + return write_multipart_content( + y, + val: val.content, + closing: closing, + content_type: val.content_type + ) + in Pathname + y << format(content_line, content_type || "application/octet-stream") + io = val.open(binmode: true) + closing << io.method(:close) + IO.copy_stream(io, y) + in IO + y << format(content_line, content_type || "application/octet-stream") + IO.copy_stream(val, y) + in StringIO + y << format(content_line, content_type || "application/octet-stream") + y << val.string + in -> { primitive?(_1) } + y << format(content_line, content_type || "text/plain") + y << val.to_s + else + y << format(content_line, content_type || "application/json") + y << JSON.generate(val) + end + y << "\r\n" + end + + # @api private + # + # @param y [Enumerator::Yielder] + # @param boundary [String] + # @param key [Symbol, String] + # @param val [Object] + # @param closing [Array] + private def write_multipart_chunk(y, boundary:, key:, val:, closing:) + y << "--#{boundary}\r\n" + y << "Content-Disposition: form-data" + + unless key.nil? + name = ERB::Util.url_encode(key.to_s) + y << "; name=\"#{name}\"" + end + + case val + in Imagekit::FilePart unless val.filename.nil? + filename = ERB::Util.url_encode(val.filename) + y << "; filename=\"#{filename}\"" + in Pathname | IO + filename = ERB::Util.url_encode(::File.basename(val.to_path)) + y << "; filename=\"#{filename}\"" + else + end + y << "\r\n" + + write_multipart_content(y, val: val, closing: closing) + end + + # @api private + # + # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content + # + # @param body [Object] + # + # @return [Array(String, Enumerable)] + private def encode_multipart_streaming(body) + boundary = SecureRandom.urlsafe_base64(60) + + closing = [] + strio = writable_enum do |y| + case body + in Hash + body.each do |key, val| + case val + in Array if val.all? { primitive?(_1) } + val.each do |v| + write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing) + end + else + write_multipart_chunk(y, boundary: boundary, key: key, val: val, closing: closing) + end + end + else + write_multipart_chunk(y, boundary: boundary, key: nil, val: body, closing: closing) + end + y << "--#{boundary}--\r\n" + end + + fused_io = fused_enum(strio) { closing.each(&:call) } + [boundary, fused_io] + end + + # @api private + # + # @param headers [Hash{String=>String}] + # @param body [Object] + # + # @return [Object] + def encode_content(headers, body) + # rubocop:disable Style/CaseEquality + # rubocop:disable Layout/LineLength + content_type = headers["content-type"] + case [content_type, body] + in [Imagekit::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }] + [headers, JSON.generate(body)] + in [Imagekit::Internal::Util::JSONL_CONTENT, Enumerable] unless Imagekit::Internal::Type::FileInput === body + [headers, body.lazy.map { JSON.generate(_1) }] + in [%r{^multipart/form-data}, Hash | Imagekit::Internal::Type::FileInput] + boundary, strio = encode_multipart_streaming(body) + headers = {**headers, "content-type" => "#{content_type}; boundary=#{boundary}"} + [headers, strio] + in [_, Symbol | Numeric] + [headers, body.to_s] + in [_, StringIO] + [headers, body.string] + in [_, Imagekit::FilePart] + [headers, body.content] + else + [headers, body] + end + # rubocop:enable Layout/LineLength + # rubocop:enable Style/CaseEquality + end + + # @api private + # + # https://www.iana.org/assignments/character-sets/character-sets.xhtml + # + # @param content_type [String] + # @param text [String] + def force_charset!(content_type, text:) + charset = /charset=([^;\s]+)/.match(content_type)&.captures&.first + + return unless charset + + begin + encoding = Encoding.find(charset) + text.force_encoding(encoding) + rescue ArgumentError + nil + end + end + + # @api private + # + # Assumes each chunk in stream has `Encoding::BINARY`. + # + # @param headers [Hash{String=>String}, Net::HTTPHeader] + # @param stream [Enumerable] + # @param suppress_error [Boolean] + # + # @raise [JSON::ParserError] + # @return [Object] + def decode_content(headers, stream:, suppress_error: false) + case (content_type = headers["content-type"]) + in Imagekit::Internal::Util::JSON_CONTENT + json = stream.to_a.join + begin + JSON.parse(json, symbolize_names: true) + rescue JSON::ParserError => e + raise e unless suppress_error + json + end + in Imagekit::Internal::Util::JSONL_CONTENT + lines = decode_lines(stream) + chain_fused(lines) do |y| + lines.each { y << JSON.parse(_1, symbolize_names: true) } + end + in %r{^text/event-stream} + lines = decode_lines(stream) + decode_sse(lines) + else + text = stream.to_a.join + force_charset!(content_type, text: text) + StringIO.new(text) + end + end + end + + class << self + # @api private + # + # https://doc.rust-lang.org/std/iter/trait.FusedIterator.html + # + # @param enum [Enumerable] + # @param external [Boolean] + # @param close [Proc] + # + # @return [Enumerable] + def fused_enum(enum, external: false, &close) + fused = false + iter = Enumerator.new do |y| + next if fused + + fused = true + if external + loop { y << enum.next } + else + enum.each(&y) + end + ensure + close&.call + close = nil + end + + iter.define_singleton_method(:rewind) do + fused = true + self + end + iter + end + + # @api private + # + # @param enum [Enumerable, nil] + def close_fused!(enum) + return unless enum.is_a?(Enumerator) + + # rubocop:disable Lint/UnreachableLoop + enum.rewind.each { break } + # rubocop:enable Lint/UnreachableLoop + end + + # @api private + # + # @param enum [Enumerable, nil] + # @param blk [Proc] + # + # @yieldparam [Enumerator::Yielder] + # @return [Enumerable] + def chain_fused(enum, &blk) + iter = Enumerator.new { blk.call(_1) } + fused_enum(iter) { close_fused!(enum) } + end + end + + class << self + # @api private + # + # Assumes Strings have been forced into having `Encoding::BINARY`. + # + # This decoder is responsible for reassembling lines split across multiple + # fragments. + # + # @param enum [Enumerable] + # + # @return [Enumerable] + def decode_lines(enum) + re = /(\r\n|\r|\n)/ + buffer = String.new + cr_seen = nil + + chain_fused(enum) do |y| + enum.each do |row| + offset = buffer.bytesize + buffer << row + while (match = re.match(buffer, cr_seen&.to_i || offset)) + case [match.captures.first, cr_seen] + in ["\r", nil] + cr_seen = match.end(1) + next + in ["\r" | "\r\n", Integer] + y << buffer.slice!(..(cr_seen.pred)) + else + y << buffer.slice!(..(match.end(1).pred)) + end + offset = 0 + cr_seen = nil + end + end + + y << buffer.slice!(..(cr_seen.pred)) unless cr_seen.nil? + y << buffer unless buffer.empty? + end + end + + # @api private + # + # https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream + # + # Assumes that `lines` has been decoded with `#decode_lines`. + # + # @param lines [Enumerable] + # + # @return [EnumerableObject}>] + def decode_sse(lines) + # rubocop:disable Metrics/BlockLength + chain_fused(lines) do |y| + blank = {event: nil, data: nil, id: nil, retry: nil} + current = {} + + lines.each do |line| + case line.sub(/\R$/, "") + in "" + next if current.empty? + y << {**blank, **current} + current = {} + in /^:/ + next + in /^([^:]+):\s?(.*)$/ + field, value = Regexp.last_match.captures + case field + in "event" + current.merge!(event: value) + in "data" + (current[:data] ||= String.new) << (value << "\n") + in "id" unless value.include?("\0") + current.merge!(id: value) + in "retry" if /^\d+$/ =~ value + current.merge!(retry: Integer(value)) + else + end + else + end + end + # rubocop:enable Metrics/BlockLength + + y << {**blank, **current} unless current.empty? + end + end + end + + # @api private + module SorbetRuntimeSupport + class MissingSorbetRuntimeError < ::RuntimeError + end + + # @api private + # + # @return [Hash{Symbol=>Object}] + private def sorbet_runtime_constants = @sorbet_runtime_constants ||= {} + + # @api private + # + # @param name [Symbol] + def const_missing(name) + super unless sorbet_runtime_constants.key?(name) + + unless Object.const_defined?(:T) + message = "Trying to access a Sorbet constant #{name.inspect} without `sorbet-runtime`." + raise MissingSorbetRuntimeError.new(message) + end + + sorbet_runtime_constants.fetch(name).call + end + + # @api private + # + # @param name [Symbol] + # + # @return [Boolean] + def sorbet_constant_defined?(name) = sorbet_runtime_constants.key?(name) + + # @api private + # + # @param name [Symbol] + # @param blk [Proc] + def define_sorbet_constant!(name, &blk) = sorbet_runtime_constants.store(name, blk) + + # @api private + # + # @return [Object] + def to_sorbet_type = raise NotImplementedError + + class << self + # @api private + # + # @param type [Imagekit::Internal::Util::SorbetRuntimeSupport, Object] + # + # @return [Object] + def to_sorbet_type(type) + case type + in Imagekit::Internal::Util::SorbetRuntimeSupport + type.to_sorbet_type + in Class | Module + type + in true | false + T::Boolean + else + type.class + end + end + end + end + + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + define_sorbet_constant!(:ParsedUri) do + T.type_alias do + { + scheme: T.nilable(String), + host: T.nilable(String), + port: T.nilable(Integer), + path: T.nilable(String), + query: T::Hash[String, T::Array[String]] + } + end + end + + define_sorbet_constant!(:ServerSentEvent) do + T.type_alias do + { + event: T.nilable(String), + data: T.nilable(String), + id: T.nilable(String), + retry: T.nilable(Integer) + } + end + end + end + end +end diff --git a/lib/imagekit/models.rb b/lib/imagekit/models.rb new file mode 100644 index 00000000..b8653a86 --- /dev/null +++ b/lib/imagekit/models.rb @@ -0,0 +1,147 @@ +# frozen_string_literal: true + +module Imagekit + [Imagekit::Internal::Type::BaseModel, *Imagekit::Internal::Type::BaseModel.subclasses].each do |cls| + cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, Imagekit::Internal::AnyHash) } } + end + + Imagekit::Internal::Util.walk_namespaces(Imagekit::Models).each do |mod| + case mod + in Imagekit::Internal::Type::Enum | Imagekit::Internal::Type::Union + mod.constants.each do |name| + case mod.const_get(name) + in true | false + mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } } + mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } } + in Integer + mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } } + mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } } + in Float + mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } } + mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } } + in Symbol + mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } } + mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } } + else + end + end + else + end + end + + Imagekit::Internal::Util.walk_namespaces(Imagekit::Models) + .lazy + .grep(Imagekit::Internal::Type::Union) + .each do |mod| + const = :Variants + next if mod.sorbet_constant_defined?(const) + + mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } } + end + + Accounts = Imagekit::Models::Accounts + + AssetListParams = Imagekit::Models::AssetListParams + + BaseOverlay = Imagekit::Models::BaseOverlay + + Beta = Imagekit::Models::Beta + + Cache = Imagekit::Models::Cache + + CustomMetadataField = Imagekit::Models::CustomMetadataField + + CustomMetadataFieldCreateParams = Imagekit::Models::CustomMetadataFieldCreateParams + + CustomMetadataFieldDeleteParams = Imagekit::Models::CustomMetadataFieldDeleteParams + + CustomMetadataFieldListParams = Imagekit::Models::CustomMetadataFieldListParams + + CustomMetadataFieldUpdateParams = Imagekit::Models::CustomMetadataFieldUpdateParams + + File = Imagekit::Models::File + + FileCopyParams = Imagekit::Models::FileCopyParams + + FileDeleteParams = Imagekit::Models::FileDeleteParams + + FileGetParams = Imagekit::Models::FileGetParams + + FileMoveParams = Imagekit::Models::FileMoveParams + + FileRenameParams = Imagekit::Models::FileRenameParams + + Files = Imagekit::Models::Files + + FileUpdateParams = Imagekit::Models::FileUpdateParams + + FileUploadParams = Imagekit::Models::FileUploadParams + + Folder = Imagekit::Models::Folder + + FolderCopyParams = Imagekit::Models::FolderCopyParams + + FolderCreateParams = Imagekit::Models::FolderCreateParams + + FolderDeleteParams = Imagekit::Models::FolderDeleteParams + + FolderMoveParams = Imagekit::Models::FolderMoveParams + + FolderRenameParams = Imagekit::Models::FolderRenameParams + + Folders = Imagekit::Models::Folders + + ImageOverlay = Imagekit::Models::ImageOverlay + + Metadata = Imagekit::Models::Metadata + + Overlay = Imagekit::Models::Overlay + + OverlayPosition = Imagekit::Models::OverlayPosition + + OverlayTiming = Imagekit::Models::OverlayTiming + + SolidColorOverlay = Imagekit::Models::SolidColorOverlay + + SolidColorOverlayTransformation = Imagekit::Models::SolidColorOverlayTransformation + + SrcOptions = Imagekit::Models::SrcOptions + + StreamingResolution = Imagekit::Models::StreamingResolution + + SubtitleOverlay = Imagekit::Models::SubtitleOverlay + + SubtitleOverlayTransformation = Imagekit::Models::SubtitleOverlayTransformation + + TextOverlay = Imagekit::Models::TextOverlay + + TextOverlayTransformation = Imagekit::Models::TextOverlayTransformation + + Transformation = Imagekit::Models::Transformation + + TransformationPosition = Imagekit::Models::TransformationPosition + + UnsafeUnwrapWebhookEvent = Imagekit::Models::UnsafeUnwrapWebhookEvent + + UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent + + UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent + + UploadPostTransformSuccessEvent = Imagekit::Models::UploadPostTransformSuccessEvent + + UploadPreTransformErrorEvent = Imagekit::Models::UploadPreTransformErrorEvent + + UploadPreTransformSuccessEvent = Imagekit::Models::UploadPreTransformSuccessEvent + + VideoOverlay = Imagekit::Models::VideoOverlay + + VideoTransformationAcceptedEvent = Imagekit::Models::VideoTransformationAcceptedEvent + + VideoTransformationErrorEvent = Imagekit::Models::VideoTransformationErrorEvent + + VideoTransformationReadyEvent = Imagekit::Models::VideoTransformationReadyEvent + + WebhookUnsafeUnwrapParams = Imagekit::Models::WebhookUnsafeUnwrapParams + + WebhookUnwrapParams = Imagekit::Models::WebhookUnwrapParams +end diff --git a/lib/imagekit/models/accounts/origin_create_params.rb b/lib/imagekit/models/accounts/origin_create_params.rb new file mode 100644 index 00000000..d3f005e4 --- /dev/null +++ b/lib/imagekit/models/accounts/origin_create_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::Origins#create + class OriginCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/origin_delete_params.rb b/lib/imagekit/models/accounts/origin_delete_params.rb new file mode 100644 index 00000000..013eedd5 --- /dev/null +++ b/lib/imagekit/models/accounts/origin_delete_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::Origins#delete + class OriginDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/origin_get_params.rb b/lib/imagekit/models/accounts/origin_get_params.rb new file mode 100644 index 00000000..97a63638 --- /dev/null +++ b/lib/imagekit/models/accounts/origin_get_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::Origins#get + class OriginGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/origin_list_params.rb b/lib/imagekit/models/accounts/origin_list_params.rb new file mode 100644 index 00000000..8435e2f8 --- /dev/null +++ b/lib/imagekit/models/accounts/origin_list_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::Origins#list + class OriginListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/origin_list_response.rb b/lib/imagekit/models/accounts/origin_list_response.rb new file mode 100644 index 00000000..8f9e9da8 --- /dev/null +++ b/lib/imagekit/models/accounts/origin_list_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @type [Imagekit::Internal::Type::Converter] + OriginListResponse = Imagekit::Internal::Type::ArrayOf[union: -> { Imagekit::Accounts::OriginResponse }] + end + end +end diff --git a/lib/imagekit/models/accounts/origin_request.rb b/lib/imagekit/models/accounts/origin_request.rb new file mode 100644 index 00000000..88b7782f --- /dev/null +++ b/lib/imagekit/models/accounts/origin_request.rb @@ -0,0 +1,547 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # Schema for origin request resources. + module OriginRequest + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :S3, -> { Imagekit::Accounts::OriginRequest::S3 } + + variant :S3_COMPATIBLE, -> { Imagekit::Accounts::OriginRequest::S3Compatible } + + variant :CLOUDINARY_BACKUP, -> { Imagekit::Accounts::OriginRequest::CloudinaryBackup } + + variant :WEB_FOLDER, -> { Imagekit::Accounts::OriginRequest::WebFolder } + + variant :WEB_PROXY, -> { Imagekit::Accounts::OriginRequest::WebProxy } + + variant :GCS, -> { Imagekit::Accounts::OriginRequest::Gcs } + + variant :AZURE_BLOB, -> { Imagekit::Accounts::OriginRequest::AzureBlob } + + variant :AKENEO_PIM, -> { Imagekit::Accounts::OriginRequest::AkeneoPim } + + class S3 < Imagekit::Internal::Type::BaseModel + # @!attribute access_key + # Access key for the bucket. + # + # @return [String] + required :access_key, String, api_name: :accessKey + + # @!attribute bucket + # S3 bucket name. + # + # @return [String] + required :bucket, String + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute secret_key + # Secret key for the bucket. + # + # @return [String] + required :secret_key, String, api_name: :secretKey + + # @!attribute type + # + # @return [Symbol, :S3] + required :type, const: :S3 + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute prefix + # Path prefix inside the bucket. + # + # @return [String, nil] + optional :prefix, String + + # @!method initialize(access_key:, bucket:, name:, secret_key:, base_url_for_canonical_header: nil, include_canonical_header: nil, prefix: nil, type: :S3) + # @param access_key [String] Access key for the bucket. + # + # @param bucket [String] S3 bucket name. + # + # @param name [String] Display name of the origin. + # + # @param secret_key [String] Secret key for the bucket. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param prefix [String] Path prefix inside the bucket. + # + # @param type [Symbol, :S3] + end + + class S3Compatible < Imagekit::Internal::Type::BaseModel + # @!attribute access_key + # Access key for the bucket. + # + # @return [String] + required :access_key, String, api_name: :accessKey + + # @!attribute bucket + # S3 bucket name. + # + # @return [String] + required :bucket, String + + # @!attribute endpoint + # Custom S3-compatible endpoint. + # + # @return [String] + required :endpoint, String + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute secret_key + # Secret key for the bucket. + # + # @return [String] + required :secret_key, String, api_name: :secretKey + + # @!attribute type + # + # @return [Symbol, :S3_COMPATIBLE] + required :type, const: :S3_COMPATIBLE + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute prefix + # Path prefix inside the bucket. + # + # @return [String, nil] + optional :prefix, String + + # @!attribute s3_force_path_style + # Use path-style S3 URLs? + # + # @return [Boolean, nil] + optional :s3_force_path_style, Imagekit::Internal::Type::Boolean, api_name: :s3ForcePathStyle + + # @!method initialize(access_key:, bucket:, endpoint:, name:, secret_key:, base_url_for_canonical_header: nil, include_canonical_header: nil, prefix: nil, s3_force_path_style: nil, type: :S3_COMPATIBLE) + # @param access_key [String] Access key for the bucket. + # + # @param bucket [String] S3 bucket name. + # + # @param endpoint [String] Custom S3-compatible endpoint. + # + # @param name [String] Display name of the origin. + # + # @param secret_key [String] Secret key for the bucket. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param prefix [String] Path prefix inside the bucket. + # + # @param s3_force_path_style [Boolean] Use path-style S3 URLs? + # + # @param type [Symbol, :S3_COMPATIBLE] + end + + class CloudinaryBackup < Imagekit::Internal::Type::BaseModel + # @!attribute access_key + # Access key for the bucket. + # + # @return [String] + required :access_key, String, api_name: :accessKey + + # @!attribute bucket + # S3 bucket name. + # + # @return [String] + required :bucket, String + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute secret_key + # Secret key for the bucket. + # + # @return [String] + required :secret_key, String, api_name: :secretKey + + # @!attribute type + # + # @return [Symbol, :CLOUDINARY_BACKUP] + required :type, const: :CLOUDINARY_BACKUP + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute prefix + # Path prefix inside the bucket. + # + # @return [String, nil] + optional :prefix, String + + # @!method initialize(access_key:, bucket:, name:, secret_key:, base_url_for_canonical_header: nil, include_canonical_header: nil, prefix: nil, type: :CLOUDINARY_BACKUP) + # @param access_key [String] Access key for the bucket. + # + # @param bucket [String] S3 bucket name. + # + # @param name [String] Display name of the origin. + # + # @param secret_key [String] Secret key for the bucket. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param prefix [String] Path prefix inside the bucket. + # + # @param type [Symbol, :CLOUDINARY_BACKUP] + end + + class WebFolder < Imagekit::Internal::Type::BaseModel + # @!attribute base_url + # Root URL for the web folder origin. + # + # @return [String] + required :base_url, String, api_name: :baseUrl + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :WEB_FOLDER] + required :type, const: :WEB_FOLDER + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute forward_host_header_to_origin + # Forward the Host header to origin? + # + # @return [Boolean, nil] + optional :forward_host_header_to_origin, + Imagekit::Internal::Type::Boolean, + api_name: :forwardHostHeaderToOrigin + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!method initialize(base_url:, name:, base_url_for_canonical_header: nil, forward_host_header_to_origin: nil, include_canonical_header: nil, type: :WEB_FOLDER) + # @param base_url [String] Root URL for the web folder origin. + # + # @param name [String] Display name of the origin. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param forward_host_header_to_origin [Boolean] Forward the Host header to origin? + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param type [Symbol, :WEB_FOLDER] + end + + class WebProxy < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :WEB_PROXY] + required :type, const: :WEB_PROXY + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!method initialize(name:, base_url_for_canonical_header: nil, include_canonical_header: nil, type: :WEB_PROXY) + # @param name [String] Display name of the origin. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param type [Symbol, :WEB_PROXY] + end + + class Gcs < Imagekit::Internal::Type::BaseModel + # @!attribute bucket + # + # @return [String] + required :bucket, String + + # @!attribute client_email + # + # @return [String] + required :client_email, String, api_name: :clientEmail + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute private_key + # + # @return [String] + required :private_key, String, api_name: :privateKey + + # @!attribute type + # + # @return [Symbol, :GCS] + required :type, const: :GCS + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute prefix + # + # @return [String, nil] + optional :prefix, String + + # @!method initialize(bucket:, client_email:, name:, private_key:, base_url_for_canonical_header: nil, include_canonical_header: nil, prefix: nil, type: :GCS) + # @param bucket [String] + # + # @param client_email [String] + # + # @param name [String] Display name of the origin. + # + # @param private_key [String] + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param prefix [String] + # + # @param type [Symbol, :GCS] + end + + class AzureBlob < Imagekit::Internal::Type::BaseModel + # @!attribute account_name + # + # @return [String] + required :account_name, String, api_name: :accountName + + # @!attribute container + # + # @return [String] + required :container, String + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute sas_token + # + # @return [String] + required :sas_token, String, api_name: :sasToken + + # @!attribute type + # + # @return [Symbol, :AZURE_BLOB] + required :type, const: :AZURE_BLOB + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute prefix + # + # @return [String, nil] + optional :prefix, String + + # @!method initialize(account_name:, container:, name:, sas_token:, base_url_for_canonical_header: nil, include_canonical_header: nil, prefix: nil, type: :AZURE_BLOB) + # @param account_name [String] + # + # @param container [String] + # + # @param name [String] Display name of the origin. + # + # @param sas_token [String] + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param prefix [String] + # + # @param type [Symbol, :AZURE_BLOB] + end + + class AkeneoPim < Imagekit::Internal::Type::BaseModel + # @!attribute base_url + # Akeneo instance base URL. + # + # @return [String] + required :base_url, String, api_name: :baseUrl + + # @!attribute client_id + # Akeneo API client ID. + # + # @return [String] + required :client_id, String, api_name: :clientId + + # @!attribute client_secret + # Akeneo API client secret. + # + # @return [String] + required :client_secret, String, api_name: :clientSecret + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute password + # Akeneo API password. + # + # @return [String] + required :password, String + + # @!attribute type + # + # @return [Symbol, :AKENEO_PIM] + required :type, const: :AKENEO_PIM + + # @!attribute username + # Akeneo API username. + # + # @return [String] + required :username, String + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean, nil] + optional :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!method initialize(base_url:, client_id:, client_secret:, name:, password:, username:, base_url_for_canonical_header: nil, include_canonical_header: nil, type: :AKENEO_PIM) + # @param base_url [String] Akeneo instance base URL. + # + # @param client_id [String] Akeneo API client ID. + # + # @param client_secret [String] Akeneo API client secret. + # + # @param name [String] Display name of the origin. + # + # @param password [String] Akeneo API password. + # + # @param username [String] Akeneo API username. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param type [Symbol, :AKENEO_PIM] + end + + # @!method self.variants + # @return [Array(Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim)] + end + end + end +end diff --git a/lib/imagekit/models/accounts/origin_response.rb b/lib/imagekit/models/accounts/origin_response.rb new file mode 100644 index 00000000..aa9aea71 --- /dev/null +++ b/lib/imagekit/models/accounts/origin_response.rb @@ -0,0 +1,567 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # Origin object as returned by the API (sensitive fields removed). + # + # @see Imagekit::Resources::Accounts::Origins#create + module OriginResponse + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :S3, -> { Imagekit::Accounts::OriginResponse::S3 } + + variant :S3_COMPATIBLE, -> { Imagekit::Accounts::OriginResponse::S3Compatible } + + variant :CLOUDINARY_BACKUP, -> { Imagekit::Accounts::OriginResponse::CloudinaryBackup } + + variant :WEB_FOLDER, -> { Imagekit::Accounts::OriginResponse::WebFolder } + + variant :WEB_PROXY, -> { Imagekit::Accounts::OriginResponse::WebProxy } + + variant :GCS, -> { Imagekit::Accounts::OriginResponse::Gcs } + + variant :AZURE_BLOB, -> { Imagekit::Accounts::OriginResponse::AzureBlob } + + variant :AKENEO_PIM, -> { Imagekit::Accounts::OriginResponse::AkeneoPim } + + class S3 < Imagekit::Internal::Type::BaseModel + # @!attribute bucket + # S3 bucket name. + # + # @return [String] + required :bucket, String + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute prefix + # Path prefix inside the bucket. + # + # @return [String] + required :prefix, String + + # @!attribute type + # + # @return [Symbol, :S3] + required :type, const: :S3 + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, bucket:, include_canonical_header:, name:, prefix:, base_url_for_canonical_header: nil, type: :S3) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::S3} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param bucket [String] S3 bucket name. + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param prefix [String] Path prefix inside the bucket. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :S3] + end + + class S3Compatible < Imagekit::Internal::Type::BaseModel + # @!attribute bucket + # S3 bucket name. + # + # @return [String] + required :bucket, String + + # @!attribute endpoint + # Custom S3-compatible endpoint. + # + # @return [String] + required :endpoint, String + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute prefix + # Path prefix inside the bucket. + # + # @return [String] + required :prefix, String + + # @!attribute s3_force_path_style + # Use path-style S3 URLs? + # + # @return [Boolean] + required :s3_force_path_style, Imagekit::Internal::Type::Boolean, api_name: :s3ForcePathStyle + + # @!attribute type + # + # @return [Symbol, :S3_COMPATIBLE] + required :type, const: :S3_COMPATIBLE + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, bucket:, endpoint:, include_canonical_header:, name:, prefix:, s3_force_path_style:, base_url_for_canonical_header: nil, type: :S3_COMPATIBLE) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::S3Compatible} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param bucket [String] S3 bucket name. + # + # @param endpoint [String] Custom S3-compatible endpoint. + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param prefix [String] Path prefix inside the bucket. + # + # @param s3_force_path_style [Boolean] Use path-style S3 URLs? + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :S3_COMPATIBLE] + end + + class CloudinaryBackup < Imagekit::Internal::Type::BaseModel + # @!attribute bucket + # S3 bucket name. + # + # @return [String] + required :bucket, String + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute prefix + # Path prefix inside the bucket. + # + # @return [String] + required :prefix, String + + # @!attribute type + # + # @return [Symbol, :CLOUDINARY_BACKUP] + required :type, const: :CLOUDINARY_BACKUP + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, bucket:, include_canonical_header:, name:, prefix:, base_url_for_canonical_header: nil, type: :CLOUDINARY_BACKUP) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::CloudinaryBackup} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param bucket [String] S3 bucket name. + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param prefix [String] Path prefix inside the bucket. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :CLOUDINARY_BACKUP] + end + + class WebFolder < Imagekit::Internal::Type::BaseModel + # @!attribute base_url + # Root URL for the web folder origin. + # + # @return [String] + required :base_url, String, api_name: :baseUrl + + # @!attribute forward_host_header_to_origin + # Forward the Host header to origin? + # + # @return [Boolean] + required :forward_host_header_to_origin, + Imagekit::Internal::Type::Boolean, + api_name: :forwardHostHeaderToOrigin + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :WEB_FOLDER] + required :type, const: :WEB_FOLDER + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, base_url:, forward_host_header_to_origin:, include_canonical_header:, name:, base_url_for_canonical_header: nil, type: :WEB_FOLDER) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::WebFolder} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param base_url [String] Root URL for the web folder origin. + # + # @param forward_host_header_to_origin [Boolean] Forward the Host header to origin? + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :WEB_FOLDER] + end + + class WebProxy < Imagekit::Internal::Type::BaseModel + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :WEB_PROXY] + required :type, const: :WEB_PROXY + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, include_canonical_header:, name:, base_url_for_canonical_header: nil, type: :WEB_PROXY) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::WebProxy} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :WEB_PROXY] + end + + class Gcs < Imagekit::Internal::Type::BaseModel + # @!attribute bucket + # + # @return [String] + required :bucket, String + + # @!attribute client_email + # + # @return [String] + required :client_email, String, api_name: :clientEmail + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute prefix + # + # @return [String] + required :prefix, String + + # @!attribute type + # + # @return [Symbol, :GCS] + required :type, const: :GCS + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, bucket:, client_email:, include_canonical_header:, name:, prefix:, base_url_for_canonical_header: nil, type: :GCS) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::Gcs} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param bucket [String] + # + # @param client_email [String] + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param prefix [String] + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :GCS] + end + + class AzureBlob < Imagekit::Internal::Type::BaseModel + # @!attribute account_name + # + # @return [String] + required :account_name, String, api_name: :accountName + + # @!attribute container + # + # @return [String] + required :container, String + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute prefix + # + # @return [String] + required :prefix, String + + # @!attribute type + # + # @return [Symbol, :AZURE_BLOB] + required :type, const: :AZURE_BLOB + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, account_name:, container:, include_canonical_header:, name:, prefix:, base_url_for_canonical_header: nil, type: :AZURE_BLOB) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::AzureBlob} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param account_name [String] + # + # @param container [String] + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param prefix [String] + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :AZURE_BLOB] + end + + class AkeneoPim < Imagekit::Internal::Type::BaseModel + # @!attribute base_url + # Akeneo instance base URL. + # + # @return [String] + required :base_url, String, api_name: :baseUrl + + # @!attribute include_canonical_header + # Whether to send a Canonical header. + # + # @return [Boolean] + required :include_canonical_header, + Imagekit::Internal::Type::Boolean, + api_name: :includeCanonicalHeader + + # @!attribute name + # Display name of the origin. + # + # @return [String] + required :name, String + + # @!attribute type + # + # @return [Symbol, :AKENEO_PIM] + required :type, const: :AKENEO_PIM + + # @!attribute base_url_for_canonical_header + # URL used in the Canonical header (if enabled). + # + # @return [String, nil] + optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader + + response_only do + # @!attribute id + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, base_url:, include_canonical_header:, name:, base_url_for_canonical_header: nil, type: :AKENEO_PIM) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginResponse::AkeneoPim} for more details. + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param base_url [String] Akeneo instance base URL. + # + # @param include_canonical_header [Boolean] Whether to send a Canonical header. + # + # @param name [String] Display name of the origin. + # + # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). + # + # @param type [Symbol, :AKENEO_PIM] + end + + # @!method self.variants + # @return [Array(Imagekit::Models::Accounts::OriginResponse::S3, Imagekit::Models::Accounts::OriginResponse::S3Compatible, Imagekit::Models::Accounts::OriginResponse::CloudinaryBackup, Imagekit::Models::Accounts::OriginResponse::WebFolder, Imagekit::Models::Accounts::OriginResponse::WebProxy, Imagekit::Models::Accounts::OriginResponse::Gcs, Imagekit::Models::Accounts::OriginResponse::AzureBlob, Imagekit::Models::Accounts::OriginResponse::AkeneoPim)] + end + end + end +end diff --git a/lib/imagekit/models/accounts/origin_update_params.rb b/lib/imagekit/models/accounts/origin_update_params.rb new file mode 100644 index 00000000..d97a3cc0 --- /dev/null +++ b/lib/imagekit/models/accounts/origin_update_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::Origins#update + class OriginUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_create_params.rb b/lib/imagekit/models/accounts/url_endpoint_create_params.rb new file mode 100644 index 00000000..5a065839 --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_create_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::URLEndpoints#create + class URLEndpointCreateParams < Imagekit::Models::Accounts::URLEndpointRequest + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_delete_params.rb b/lib/imagekit/models/accounts/url_endpoint_delete_params.rb new file mode 100644 index 00000000..484bea81 --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_delete_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::URLEndpoints#delete + class URLEndpointDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_get_params.rb b/lib/imagekit/models/accounts/url_endpoint_get_params.rb new file mode 100644 index 00000000..d5d4461b --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_get_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::URLEndpoints#get + class URLEndpointGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_list_params.rb b/lib/imagekit/models/accounts/url_endpoint_list_params.rb new file mode 100644 index 00000000..ec77107c --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_list_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::URLEndpoints#list + class URLEndpointListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_list_response.rb b/lib/imagekit/models/accounts/url_endpoint_list_response.rb new file mode 100644 index 00000000..054376a9 --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_list_response.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @type [Imagekit::Internal::Type::Converter] + URLEndpointListResponse = + Imagekit::Internal::Type::ArrayOf[-> { Imagekit::Accounts::URLEndpointResponse }] + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_request.rb b/lib/imagekit/models/accounts/url_endpoint_request.rb new file mode 100644 index 00000000..32c945fc --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_request.rb @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + class URLEndpointRequest < Imagekit::Internal::Type::BaseModel + # @!attribute description + # Description of the URL endpoint. + # + # @return [String] + required :description, String + + # @!attribute origins + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + # + # @return [Array, nil] + optional :origins, Imagekit::Internal::Type::ArrayOf[String] + + # @!attribute url_prefix + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + # + # @return [String, nil] + optional :url_prefix, String, api_name: :urlPrefix + + # @!attribute url_rewriter + # Configuration for third-party URL rewriting. + # + # @return [Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Akamai, nil] + optional :url_rewriter, + union: -> { Imagekit::Accounts::URLEndpointRequest::URLRewriter }, + api_name: :urlRewriter + + # @!method initialize(description:, origins: nil, url_prefix: nil, url_rewriter: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::URLEndpointRequest} for more details. + # + # Schema for URL endpoint resource. + # + # @param description [String] Description of the URL endpoint. + # + # @param origins [Array] Ordered list of origin IDs to try when the file isn’t in the Media Library; Imag + # + # @param url_prefix [String] Path segment appended to your base URL to form the endpoint (letters, digits, an + # + # @param url_rewriter [Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Akamai] Configuration for third-party URL rewriting. + + # Configuration for third-party URL rewriting. + # + # @see Imagekit::Models::Accounts::URLEndpointRequest#url_rewriter + module URLRewriter + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :CLOUDINARY, -> { Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary } + + variant :IMGIX, -> { Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix } + + variant :AKAMAI, -> { Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai } + + class Cloudinary < Imagekit::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, :CLOUDINARY] + required :type, const: :CLOUDINARY + + # @!attribute preserve_asset_delivery_types + # Whether to preserve `/` in the rewritten URL. + # + # @return [Boolean, nil] + optional :preserve_asset_delivery_types, + Imagekit::Internal::Type::Boolean, + api_name: :preserveAssetDeliveryTypes + + # @!method initialize(preserve_asset_delivery_types: nil, type: :CLOUDINARY) + # @param preserve_asset_delivery_types [Boolean] Whether to preserve `/` in the rewritten URL. + # + # @param type [Symbol, :CLOUDINARY] + end + + class Imgix < Imagekit::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, :IMGIX] + required :type, const: :IMGIX + + # @!method initialize(type: :IMGIX) + # @param type [Symbol, :IMGIX] + end + + class Akamai < Imagekit::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, :AKAMAI] + required :type, const: :AKAMAI + + # @!method initialize(type: :AKAMAI) + # @param type [Symbol, :AKAMAI] + end + + # @!method self.variants + # @return [Array(Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Akamai)] + end + end + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_response.rb b/lib/imagekit/models/accounts/url_endpoint_response.rb new file mode 100644 index 00000000..3ea557dc --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_response.rb @@ -0,0 +1,123 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::URLEndpoints#create + class URLEndpointResponse < Imagekit::Internal::Type::BaseModel + # @!attribute description + # Description of the URL endpoint. + # + # @return [String] + required :description, String + + # @!attribute origins + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + # + # @return [Array] + required :origins, Imagekit::Internal::Type::ArrayOf[String] + + # @!attribute url_prefix + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + # + # @return [String] + required :url_prefix, String, api_name: :urlPrefix + + # @!attribute url_rewriter + # Configuration for third-party URL rewriting. + # + # @return [Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Akamai, nil] + optional :url_rewriter, + union: -> { Imagekit::Accounts::URLEndpointResponse::URLRewriter }, + api_name: :urlRewriter + + response_only do + # @!attribute id + # Unique identifier for the URL-endpoint. This is generated by ImageKit when you + # create a new URL-endpoint. For the default URL-endpoint, this is always + # `default`. + # + # @return [String] + required :id, String + end + + # @!method initialize(id:, description:, origins:, url_prefix:, url_rewriter: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::URLEndpointResponse} for more details. + # + # URL‑endpoint object as returned by the API. + # + # @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c + # + # @param description [String] Description of the URL endpoint. + # + # @param origins [Array] Ordered list of origin IDs to try when the file isn’t in the Media Library; Imag + # + # @param url_prefix [String] Path segment appended to your base URL to form the endpoint (letters, digits, an + # + # @param url_rewriter [Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Akamai] Configuration for third-party URL rewriting. + + # Configuration for third-party URL rewriting. + # + # @see Imagekit::Models::Accounts::URLEndpointResponse#url_rewriter + module URLRewriter + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :CLOUDINARY, -> { Imagekit::Accounts::URLEndpointResponse::URLRewriter::Cloudinary } + + variant :IMGIX, -> { Imagekit::Accounts::URLEndpointResponse::URLRewriter::Imgix } + + variant :AKAMAI, -> { Imagekit::Accounts::URLEndpointResponse::URLRewriter::Akamai } + + class Cloudinary < Imagekit::Internal::Type::BaseModel + # @!attribute preserve_asset_delivery_types + # Whether to preserve `/` in the rewritten URL. + # + # @return [Boolean] + required :preserve_asset_delivery_types, + Imagekit::Internal::Type::Boolean, + api_name: :preserveAssetDeliveryTypes + + # @!attribute type + # + # @return [Symbol, :CLOUDINARY] + required :type, const: :CLOUDINARY + + # @!method initialize(preserve_asset_delivery_types:, type: :CLOUDINARY) + # @param preserve_asset_delivery_types [Boolean] Whether to preserve `/` in the rewritten URL. + # + # @param type [Symbol, :CLOUDINARY] + end + + class Imgix < Imagekit::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, :IMGIX] + required :type, const: :IMGIX + + # @!method initialize(type: :IMGIX) + # @param type [Symbol, :IMGIX] + end + + class Akamai < Imagekit::Internal::Type::BaseModel + # @!attribute type + # + # @return [Symbol, :AKAMAI] + required :type, const: :AKAMAI + + # @!method initialize(type: :AKAMAI) + # @param type [Symbol, :AKAMAI] + end + + # @!method self.variants + # @return [Array(Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointResponse::URLRewriter::Akamai)] + end + end + end + end +end diff --git a/lib/imagekit/models/accounts/url_endpoint_update_params.rb b/lib/imagekit/models/accounts/url_endpoint_update_params.rb new file mode 100644 index 00000000..cb1bca4f --- /dev/null +++ b/lib/imagekit/models/accounts/url_endpoint_update_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::URLEndpoints#update + class URLEndpointUpdateParams < Imagekit::Models::Accounts::URLEndpointRequest + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/usage_get_params.rb b/lib/imagekit/models/accounts/usage_get_params.rb new file mode 100644 index 00000000..61664b99 --- /dev/null +++ b/lib/imagekit/models/accounts/usage_get_params.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::Usage#get + class UsageGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute end_date + # Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + # + # @return [Date] + required :end_date, Date + + # @!attribute start_date + # Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + # + # @return [Date] + required :start_date, Date + + # @!method initialize(end_date:, start_date:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::UsageGetParams} for more details. + # + # @param end_date [Date] Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + # + # @param start_date [Date] Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/accounts/usage_get_response.rb b/lib/imagekit/models/accounts/usage_get_response.rb new file mode 100644 index 00000000..7ac95137 --- /dev/null +++ b/lib/imagekit/models/accounts/usage_get_response.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Accounts + # @see Imagekit::Resources::Accounts::Usage#get + class UsageGetResponse < Imagekit::Internal::Type::BaseModel + # @!attribute bandwidth_bytes + # Amount of bandwidth used in bytes. + # + # @return [Integer, nil] + optional :bandwidth_bytes, Integer, api_name: :bandwidthBytes + + # @!attribute extension_units_count + # Number of extension units used. + # + # @return [Integer, nil] + optional :extension_units_count, Integer, api_name: :extensionUnitsCount + + # @!attribute media_library_storage_bytes + # Storage used by media library in bytes. + # + # @return [Integer, nil] + optional :media_library_storage_bytes, Integer, api_name: :mediaLibraryStorageBytes + + # @!attribute original_cache_storage_bytes + # Storage used by the original cache in bytes. + # + # @return [Integer, nil] + optional :original_cache_storage_bytes, Integer, api_name: :originalCacheStorageBytes + + # @!attribute video_processing_units_count + # Number of video processing units used. + # + # @return [Integer, nil] + optional :video_processing_units_count, Integer, api_name: :videoProcessingUnitsCount + + # @!method initialize(bandwidth_bytes: nil, extension_units_count: nil, media_library_storage_bytes: nil, original_cache_storage_bytes: nil, video_processing_units_count: nil) + # @param bandwidth_bytes [Integer] Amount of bandwidth used in bytes. + # + # @param extension_units_count [Integer] Number of extension units used. + # + # @param media_library_storage_bytes [Integer] Storage used by media library in bytes. + # + # @param original_cache_storage_bytes [Integer] Storage used by the original cache in bytes. + # + # @param video_processing_units_count [Integer] Number of video processing units used. + end + end + end +end diff --git a/lib/imagekit/models/asset_list_params.rb b/lib/imagekit/models/asset_list_params.rb new file mode 100644 index 00000000..11eb0ea3 --- /dev/null +++ b/lib/imagekit/models/asset_list_params.rb @@ -0,0 +1,158 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Assets#list + class AssetListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_type + # Filter results by file type. + # + # - `all` — include all file types + # - `image` — include only image files + # - `non-image` — include only non-image files (e.g., JS, CSS, video) + # + # @return [Symbol, Imagekit::Models::AssetListParams::FileType, nil] + optional :file_type, enum: -> { Imagekit::AssetListParams::FileType } + + # @!attribute limit + # The maximum number of results to return in response. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute path + # Folder path if you want to limit the search within a specific folder. For + # example, `/sales-banner/` will only search in folder sales-banner. + # + # Note : If your use case involves searching within a folder as well as its + # subfolders, you can use `path` parameter in `searchQuery` with appropriate + # operator. Checkout + # [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) + # for more information. + # + # @return [String, nil] + optional :path, String + + # @!attribute search_query + # Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + # + # Note : When the searchQuery parameter is present, the following query parameters + # will have no effect on the result: + # + # 1. `tags` + # 2. `type` + # 3. `name` + # + # [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) + # from examples. + # + # @return [String, nil] + optional :search_query, String + + # @!attribute skip + # The number of results to skip before returning results. + # + # @return [Integer, nil] + optional :skip, Integer + + # @!attribute sort + # Sort the results by one of the supported fields in ascending or descending + # order. + # + # @return [Symbol, Imagekit::Models::AssetListParams::Sort, nil] + optional :sort, enum: -> { Imagekit::AssetListParams::Sort } + + # @!attribute type + # Filter results by asset type. + # + # - `file` — returns only files + # - `file-version` — returns specific file versions + # - `folder` — returns only folders + # - `all` — returns both files and folders (excludes `file-version`) + # + # @return [Symbol, Imagekit::Models::AssetListParams::Type, nil] + optional :type, enum: -> { Imagekit::AssetListParams::Type } + + # @!method initialize(file_type: nil, limit: nil, path: nil, search_query: nil, skip: nil, sort: nil, type: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::AssetListParams} for more details. + # + # @param file_type [Symbol, Imagekit::Models::AssetListParams::FileType] Filter results by file type. + # + # @param limit [Integer] The maximum number of results to return in response. + # + # @param path [String] Folder path if you want to limit the search within a specific folder. For exampl + # + # @param search_query [String] Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + # + # @param skip [Integer] The number of results to skip before returning results. + # + # @param sort [Symbol, Imagekit::Models::AssetListParams::Sort] Sort the results by one of the supported fields in ascending or descending order + # + # @param type [Symbol, Imagekit::Models::AssetListParams::Type] Filter results by asset type. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + + # Filter results by file type. + # + # - `all` — include all file types + # - `image` — include only image files + # - `non-image` — include only non-image files (e.g., JS, CSS, video) + module FileType + extend Imagekit::Internal::Type::Enum + + ALL = :all + IMAGE = :image + NON_IMAGE = :"non-image" + + # @!method self.values + # @return [Array] + end + + # Sort the results by one of the supported fields in ascending or descending + # order. + module Sort + extend Imagekit::Internal::Type::Enum + + ASC_NAME = :ASC_NAME + DESC_NAME = :DESC_NAME + ASC_CREATED = :ASC_CREATED + DESC_CREATED = :DESC_CREATED + ASC_UPDATED = :ASC_UPDATED + DESC_UPDATED = :DESC_UPDATED + ASC_HEIGHT = :ASC_HEIGHT + DESC_HEIGHT = :DESC_HEIGHT + ASC_WIDTH = :ASC_WIDTH + DESC_WIDTH = :DESC_WIDTH + ASC_SIZE = :ASC_SIZE + DESC_SIZE = :DESC_SIZE + ASC_RELEVANCE = :ASC_RELEVANCE + DESC_RELEVANCE = :DESC_RELEVANCE + + # @!method self.values + # @return [Array] + end + + # Filter results by asset type. + # + # - `file` — returns only files + # - `file-version` — returns specific file versions + # - `folder` — returns only folders + # - `all` — returns both files and folders (excludes `file-version`) + module Type + extend Imagekit::Internal::Type::Enum + + FILE = :file + FILE_VERSION = :"file-version" + FOLDER = :folder + ALL = :all + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/imagekit/models/asset_list_response.rb b/lib/imagekit/models/asset_list_response.rb new file mode 100644 index 00000000..6477fc20 --- /dev/null +++ b/lib/imagekit/models/asset_list_response.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # Object containing details of a file or file version. + module AssetListResponseItem + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :folder, -> { Imagekit::Folder } + + # Object containing details of a file or file version. + variant -> { Imagekit::File } + + # @!method self.variants + # @return [Array(Imagekit::Models::Folder, Imagekit::Models::File)] + end + + # @type [Imagekit::Internal::Type::Converter] + AssetListResponse = + Imagekit::Internal::Type::ArrayOf[union: -> { Imagekit::Models::AssetListResponseItem }] + end +end diff --git a/lib/imagekit/models/base_overlay.rb b/lib/imagekit/models/base_overlay.rb new file mode 100644 index 00000000..44a3c8a8 --- /dev/null +++ b/lib/imagekit/models/base_overlay.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class BaseOverlay < Imagekit::Internal::Type::BaseModel + # @!attribute position + # + # @return [Imagekit::Models::OverlayPosition, nil] + optional :position, -> { Imagekit::OverlayPosition } + + # @!attribute timing + # + # @return [Imagekit::Models::OverlayTiming, nil] + optional :timing, -> { Imagekit::OverlayTiming } + + # @!method initialize(position: nil, timing: nil) + # @param position [Imagekit::Models::OverlayPosition] + # @param timing [Imagekit::Models::OverlayTiming] + end + end +end diff --git a/lib/imagekit/models/beta/v2/file_upload_params.rb b/lib/imagekit/models/beta/v2/file_upload_params.rb new file mode 100644 index 00000000..044d0f30 --- /dev/null +++ b/lib/imagekit/models/beta/v2/file_upload_params.rb @@ -0,0 +1,574 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Beta + module V2 + # @see Imagekit::Resources::Beta::V2::Files#upload + class FileUploadParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + # + # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] + required :file, Imagekit::Internal::Type::FileInput + + # @!attribute file_name + # The name with which the file has to be uploaded. + # + # @return [String] + required :file_name, String, api_name: :fileName + + # @!attribute token + # This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses + # it to authenticate and check that the upload request parameters have not been + # tampered with after the token has been generated. Learn how to create the token + # on the page below. This field is only required for authentication when uploading + # a file from the client side. + # + # **Note**: Sending a JWT that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new token. + # + # **⚠️Warning**: JWT must be generated on the server-side because it is generated + # using your account's private API key. This field is required for authentication + # when uploading a file from the client-side. + # + # @return [String, nil] + optional :token, String + + # @!attribute checks + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks). + # + # @return [String, nil] + optional :checks, String + + # @!attribute custom_coordinates + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates + + # @!attribute custom_metadata + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. + # + # @return [String, nil] + optional :description, String + + # @!attribute extensions + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + # + # @return [Array, nil] + optional :extensions, + -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::Beta::V2::FileUploadParams::Extension] } + + # @!attribute folder + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. Using multiple `/` creates a nested + # folder. + # + # @return [String, nil] + optional :folder, String + + # @!attribute is_private_file + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + # + # @return [Boolean, nil] + optional :is_private_file, Imagekit::Internal::Type::Boolean, api_name: :isPrivateFile + + # @!attribute is_published + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + # + # @return [Boolean, nil] + optional :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute overwrite_ai_tags + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + # + # @return [Boolean, nil] + optional :overwrite_ai_tags, Imagekit::Internal::Type::Boolean, api_name: :overwriteAITags + + # @!attribute overwrite_custom_metadata + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + # + # @return [Boolean, nil] + optional :overwrite_custom_metadata, + Imagekit::Internal::Type::Boolean, + api_name: :overwriteCustomMetadata + + # @!attribute overwrite_file + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + # + # @return [Boolean, nil] + optional :overwrite_file, Imagekit::Internal::Type::Boolean, api_name: :overwriteFile + + # @!attribute overwrite_tags + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + # + # @return [Boolean, nil] + optional :overwrite_tags, Imagekit::Internal::Type::Boolean, api_name: :overwriteTags + + # @!attribute response_fields + # Array of response field keys to include in the API response body. + # + # @return [Array, nil] + optional :response_fields, + -> { + Imagekit::Internal::Type::ArrayOf[enum: Imagekit::Beta::V2::FileUploadParams::ResponseField] + }, + api_name: :responseFields + + # @!attribute tags + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String] + + # @!attribute transformation + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + # + # @return [Imagekit::Models::Beta::V2::FileUploadParams::Transformation, nil] + optional :transformation, -> { Imagekit::Beta::V2::FileUploadParams::Transformation } + + # @!attribute use_unique_file_name + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + # + # @return [Boolean, nil] + optional :use_unique_file_name, Imagekit::Internal::Type::Boolean, api_name: :useUniqueFileName + + # @!attribute webhook_url + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + # + # @return [String, nil] + optional :webhook_url, String, api_name: :webhookUrl + + # @!method initialize(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, response_fields: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams} for more details. + # + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # + # @param file_name [String] The name with which the file has to be uploaded. + # + # @param token [String] This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses i + # + # @param checks [String] Server-side checks to run on the asset. + # + # @param custom_coordinates [String] Define an important area in the image. This is only relevant for image type file + # + # @param custom_metadata [Hash{Symbol=>Object}] JSON key-value pairs to associate with the asset. Create the custom metadata fie + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # + # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e + # + # @param is_private_file [Boolean] Whether to mark the file as private or not. + # + # @param is_published [Boolean] Whether to upload file as published or not. + # + # @param overwrite_ai_tags [Boolean] If set to `true` and a file already exists at the exact location, its AITags wil + # + # @param overwrite_custom_metadata [Boolean] If the request does not have `customMetadata`, and a file already exists at the + # + # @param overwrite_file [Boolean] If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # + # @param overwrite_tags [Boolean] If the request does not have `tags`, and a file already exists at the exact loca + # + # @param response_fields [Array] Array of response field keys to include in the API response body. + # + # @param tags [Array] Set the tags while uploading the file. + # + # @param transformation [Imagekit::Models::Beta::V2::FileUploadParams::Transformation] Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # @param use_unique_file_name [Boolean] Whether to use a unique filename for this file or not. + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + + module Extension + extend Imagekit::Internal::Type::Union + + discriminator :name + + variant :"remove-bg", -> { Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg } + + variant :"ai-auto-description", -> { Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription } + + variant -> { Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the background removal extension. + # + # @return [Symbol, :"remove-bg"] + required :name, const: :"remove-bg" + + # @!attribute options + # + # @return [Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg::Options, nil] + optional :options, -> { Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options } + + # @!method initialize(options: nil, name: :"remove-bg") + # @param options [Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg::Options] + # + # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. + + # @see Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg#options + class Options < Imagekit::Internal::Type::BaseModel + # @!attribute add_shadow + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + # + # @return [Boolean, nil] + optional :add_shadow, Imagekit::Internal::Type::Boolean + + # @!attribute bg_color + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + # + # @return [String, nil] + optional :bg_color, String + + # @!attribute bg_image_url + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + # + # @return [String, nil] + optional :bg_image_url, String + + # @!attribute semitransparency + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + # + # @return [Boolean, nil] + optional :semitransparency, Imagekit::Internal::Type::Boolean + + # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg::Options} for + # more details. + # + # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin + # + # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col + # + # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be + # + # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + # @!attribute max_tags + # Maximum number of tags to attach to the asset. + # + # @return [Integer] + required :max_tags, Integer, api_name: :maxTags + + # @!attribute min_confidence + # Minimum confidence level for tags to be considered valid. + # + # @return [Integer] + required :min_confidence, Integer, api_name: :minConfidence + + # @!attribute name + # Specifies the auto-tagging extension used. + # + # @return [Symbol, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name] + required :name, enum: -> { Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name } + + # @!method initialize(max_tags:, min_confidence:, name:) + # @param max_tags [Integer] Maximum number of tags to attach to the asset. + # + # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. + # + # @param name [Symbol, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. + + # Specifies the auto-tagging extension used. + # + # @see Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension#name + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING = :"google-auto-tagging" + AWS_AUTO_TAGGING = :"aws-auto-tagging" + + # @!method self.values + # @return [Array] + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the auto description extension. + # + # @return [Symbol, :"ai-auto-description"] + required :name, const: :"ai-auto-description" + + # @!method initialize(name: :"ai-auto-description") + # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. + end + + # @!method self.variants + # @return [Array(Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AIAutoDescription, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension)] + end + + module ResponseField + extend Imagekit::Internal::Type::Enum + + TAGS = :tags + CUSTOM_COORDINATES = :customCoordinates + IS_PRIVATE_FILE = :isPrivateFile + EMBEDDED_METADATA = :embeddedMetadata + IS_PUBLISHED = :isPublished + CUSTOM_METADATA = :customMetadata + METADATA = :metadata + + # @!method self.values + # @return [Array] + end + + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute post + # List of transformations to apply _after_ the file is uploaded. + # Each item must match one of the following types: `transformation`, + # `gif-to-video`, `thumbnail`, `abs`. + # + # @return [Array, nil] + optional :post, + -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::Beta::V2::FileUploadParams::Transformation::Post] } + + # @!attribute pre + # Transformation string to apply before uploading the file to the Media Library. + # Useful for optimizing files at ingestion. + # + # @return [String, nil] + optional :pre, String + + # @!method initialize(post: nil, pre: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams::Transformation} for more details. + # + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + # + # @param post [Array] List of transformations to apply _after_ the file is uploaded. + # + # @param pre [String] Transformation string to apply before uploading the file to the Media Library. U + + module Post + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :transformation, -> { Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation } + + variant :"gif-to-video", -> { Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo } + + variant :thumbnail, -> { Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail } + + variant :abs, -> { Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs } + + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Transformation type. + # + # @return [Symbol, :transformation] + required :type, const: :transformation + + # @!attribute value + # Transformation string (e.g. `w-200,h-200`). + # Same syntax as ImageKit URL-based transformations. + # + # @return [String] + required :value, String + + # @!method initialize(value:, type: :transformation) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Transformation} + # for more details. + # + # @param value [String] Transformation string (e.g. `w-200,h-200`). + # + # @param type [Symbol, :transformation] Transformation type. + end + + class GifToVideo < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Converts an animated GIF into an MP4. + # + # @return [Symbol, :"gif-to-video"] + required :type, const: :"gif-to-video" + + # @!attribute value + # Optional transformation string to apply to the output video. + # **Example**: `q-80` + # + # @return [String, nil] + optional :value, String + + # @!method initialize(value: nil, type: :"gif-to-video") + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo} + # for more details. + # + # @param value [String] Optional transformation string to apply to the output video. + # + # @param type [Symbol, :"gif-to-video"] Converts an animated GIF into an MP4. + end + + class Thumbnail < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Generates a thumbnail image. + # + # @return [Symbol, :thumbnail] + required :type, const: :thumbnail + + # @!attribute value + # Optional transformation string. + # **Example**: `w-150,h-150` + # + # @return [String, nil] + optional :value, String + + # @!method initialize(value: nil, type: :thumbnail) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail} + # for more details. + # + # @param value [String] Optional transformation string. + # + # @param type [Symbol, :thumbnail] Generates a thumbnail image. + end + + class Abs < Imagekit::Internal::Type::BaseModel + # @!attribute protocol + # Streaming protocol to use (`hls` or `dash`). + # + # @return [Symbol, Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol] + required :protocol, enum: -> { Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol } + + # @!attribute type + # Adaptive Bitrate Streaming (ABS) setup. + # + # @return [Symbol, :abs] + required :type, const: :abs + + # @!attribute value + # List of different representations you want to create separated by an underscore. + # + # @return [String] + required :value, String + + # @!method initialize(protocol:, value:, type: :abs) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs} for + # more details. + # + # @param protocol [Symbol, Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol] Streaming protocol to use (`hls` or `dash`). + # + # @param value [String] List of different representations you want to create separated by an underscore. + # + # @param type [Symbol, :abs] Adaptive Bitrate Streaming (ABS) setup. + + # Streaming protocol to use (`hls` or `dash`). + # + # @see Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs#protocol + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS = :hls + DASH = :dash + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Transformation, Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo, Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail, Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs)] + end + end + end + end + end + end +end diff --git a/lib/imagekit/models/beta/v2/file_upload_response.rb b/lib/imagekit/models/beta/v2/file_upload_response.rb new file mode 100644 index 00000000..65cab1f9 --- /dev/null +++ b/lib/imagekit/models/beta/v2/file_upload_response.rb @@ -0,0 +1,397 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Beta + module V2 + # @see Imagekit::Resources::Beta::V2::Files#upload + class FileUploadResponse < Imagekit::Internal::Type::BaseModel + # @!attribute ai_tags + # An array of tags assigned to the uploaded file by auto tagging. + # + # @return [Array, nil] + optional :ai_tags, + -> { Imagekit::Internal::Type::ArrayOf[Imagekit::Models::Beta::V2::FileUploadResponse::AITag] }, + api_name: :AITags, + nil?: true + + # @!attribute audio_codec + # The audio codec used in the video (only for video). + # + # @return [String, nil] + optional :audio_codec, String, api_name: :audioCodec + + # @!attribute bit_rate + # The bit rate of the video in kbps (only for video). + # + # @return [Integer, nil] + optional :bit_rate, Integer, api_name: :bitRate + + # @!attribute custom_coordinates + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true + + # @!attribute custom_metadata + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + # + # @return [String, nil] + optional :description, String + + # @!attribute duration + # The duration of the video in seconds (only for video). + # + # @return [Integer, nil] + optional :duration, Integer + + # @!attribute embedded_metadata + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + # + # @return [Hash{Symbol=>Object}, nil] + optional :embedded_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :embeddedMetadata + + # @!attribute extension_status + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + # + # @return [Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus, nil] + optional :extension_status, + -> { Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus }, + api_name: :extensionStatus + + # @!attribute file_id + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + # + # @return [String, nil] + optional :file_id, String, api_name: :fileId + + # @!attribute file_path + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + # + # @return [String, nil] + optional :file_path, String, api_name: :filePath + + # @!attribute file_type + # Type of the uploaded file. Possible values are `image`, `non-image`. + # + # @return [String, nil] + optional :file_type, String, api_name: :fileType + + # @!attribute height + # Height of the image in pixels (Only for images) + # + # @return [Float, nil] + optional :height, Float + + # @!attribute is_private_file + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + # + # @return [Boolean, nil] + optional :is_private_file, Imagekit::Internal::Type::Boolean, api_name: :isPrivateFile + + # @!attribute is_published + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + # + # @return [Boolean, nil] + optional :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute metadata + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + # + # @return [Imagekit::Models::Metadata, nil] + optional :metadata, -> { Imagekit::Metadata } + + # @!attribute name + # Name of the asset. + # + # @return [String, nil] + optional :name, String + + # @!attribute size + # Size of the image file in Bytes. + # + # @return [Float, nil] + optional :size, Float + + # @!attribute tags + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute thumbnail_url + # In the case of an image, a small thumbnail URL. + # + # @return [String, nil] + optional :thumbnail_url, String, api_name: :thumbnailUrl + + # @!attribute url + # A publicly accessible URL of the file. + # + # @return [String, nil] + optional :url, String + + # @!attribute version_info + # An object containing the file or file version's `id` (versionId) and `name`. + # + # @return [Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo, nil] + optional :version_info, + -> { Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo }, + api_name: :versionInfo + + # @!attribute video_codec + # The video codec used in the video (only for video). + # + # @return [String, nil] + optional :video_codec, String, api_name: :videoCodec + + # @!attribute width + # Width of the image in pixels (Only for Images) + # + # @return [Float, nil] + optional :width, Float + + # @!method initialize(ai_tags: nil, audio_codec: nil, bit_rate: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, duration: nil, embedded_metadata: nil, extension_status: nil, file_id: nil, file_path: nil, file_type: nil, height: nil, is_private_file: nil, is_published: nil, metadata: nil, name: nil, size: nil, tags: nil, thumbnail_url: nil, url: nil, version_info: nil, video_codec: nil, width: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadResponse} for more details. + # + # 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 audio_codec [String] The audio codec used in the video (only for video). + # + # @param bit_rate [Integer] The bit rate of the video in kbps (only for video). + # + # @param custom_coordinates [String, nil] Value of custom coordinates associated with the image in the format `x,y,width,h + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data associated with the asset. Use `responseField` in API request t + # + # @param description [String] Optional text to describe the contents of the file. Can be set by the user or th + # + # @param duration [Integer] The duration of the video in seconds (only for video). + # + # @param embedded_metadata [Hash{Symbol=>Object}] Consolidated embedded metadata associated with the file. It includes exif, iptc, + # + # @param extension_status [Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus] Extension names with their processing status at the time of completion of the re + # + # @param file_id [String] Unique fileId. Store this fileld in your database, as this will be used to perfo + # + # @param file_path [String] The relative path of the file in the media library e.g. `/marketing-assets/new-b + # + # @param file_type [String] Type of the uploaded file. Possible values are `image`, `non-image`. + # + # @param height [Float] Height of the image in pixels (Only for images) + # + # @param is_private_file [Boolean] Is the file marked as private. It can be either `true` or `false`. Send `isPriva + # + # @param is_published [Boolean] Is the file published or in draft state. It can be either `true` or `false`. Sen + # + # @param metadata [Imagekit::Models::Metadata] Legacy metadata. Send `metadata` in `responseFields` in API request to get metad + # + # @param name [String] Name of the asset. + # + # @param size [Float] Size of the image file in Bytes. + # + # @param tags [Array, nil] The array of tags associated with the asset. If no tags are set, it will be `nul + # + # @param thumbnail_url [String] In the case of an image, a small thumbnail URL. + # + # @param url [String] A publicly accessible URL of the file. + # + # @param version_info [Imagekit::Models::Beta::V2::FileUploadResponse::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 < Imagekit::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 + # {Imagekit::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 Imagekit::Models::Beta::V2::FileUploadResponse#extension_status + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + # @!attribute ai_auto_description + # + # @return [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription, nil] + optional :ai_auto_description, + enum: -> { Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription }, + api_name: :"ai-auto-description" + + # @!attribute aws_auto_tagging + # + # @return [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging, nil] + optional :aws_auto_tagging, + enum: -> { Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging }, + api_name: :"aws-auto-tagging" + + # @!attribute google_auto_tagging + # + # @return [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging, nil] + optional :google_auto_tagging, + enum: -> { Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging }, + api_name: :"google-auto-tagging" + + # @!attribute remove_bg + # + # @return [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg, nil] + optional :remove_bg, + enum: -> { Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg }, + api_name: :"remove-bg" + + # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + # + # @param ai_auto_description [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription] + # @param aws_auto_tagging [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging] + # @param google_auto_tagging [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging] + # @param remove_bg [Symbol, Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg] + + # @see Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus#ai_auto_description + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus#aws_auto_tagging + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus#google_auto_tagging + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus#remove_bg + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + end + + # @see Imagekit::Models::Beta::V2::FileUploadResponse#version_info + class VersionInfo < Imagekit::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 + end +end diff --git a/lib/imagekit/models/cache/invalidation_create_params.rb b/lib/imagekit/models/cache/invalidation_create_params.rb new file mode 100644 index 00000000..47e252a8 --- /dev/null +++ b/lib/imagekit/models/cache/invalidation_create_params.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Cache + # @see Imagekit::Resources::Cache::Invalidation#create + class InvalidationCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute url + # The full URL of the file to be purged. + # + # @return [String] + required :url, String + + # @!method initialize(url:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Cache::InvalidationCreateParams} for more details. + # + # @param url [String] The full URL of the file to be purged. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/cache/invalidation_create_response.rb b/lib/imagekit/models/cache/invalidation_create_response.rb new file mode 100644 index 00000000..ceb1f1d0 --- /dev/null +++ b/lib/imagekit/models/cache/invalidation_create_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Cache + # @see Imagekit::Resources::Cache::Invalidation#create + class InvalidationCreateResponse < Imagekit::Internal::Type::BaseModel + # @!attribute request_id + # Unique identifier of the purge request. This can be used to check the status of + # the purge request. + # + # @return [String, nil] + optional :request_id, String, api_name: :requestId + + # @!method initialize(request_id: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Cache::InvalidationCreateResponse} for more details. + # + # @param request_id [String] Unique identifier of the purge request. This can be used to check the status of + end + end + end +end diff --git a/lib/imagekit/models/cache/invalidation_get_params.rb b/lib/imagekit/models/cache/invalidation_get_params.rb new file mode 100644 index 00000000..d25ae6f5 --- /dev/null +++ b/lib/imagekit/models/cache/invalidation_get_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Cache + # @see Imagekit::Resources::Cache::Invalidation#get + class InvalidationGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/cache/invalidation_get_response.rb b/lib/imagekit/models/cache/invalidation_get_response.rb new file mode 100644 index 00000000..0a5d99c0 --- /dev/null +++ b/lib/imagekit/models/cache/invalidation_get_response.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Cache + # @see Imagekit::Resources::Cache::Invalidation#get + class InvalidationGetResponse < Imagekit::Internal::Type::BaseModel + # @!attribute status + # Status of the purge request. + # + # @return [Symbol, Imagekit::Models::Cache::InvalidationGetResponse::Status, nil] + optional :status, enum: -> { Imagekit::Models::Cache::InvalidationGetResponse::Status } + + # @!method initialize(status: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Cache::InvalidationGetResponse} for more details. + # + # @param status [Symbol, Imagekit::Models::Cache::InvalidationGetResponse::Status] Status of the purge request. + + # Status of the purge request. + # + # @see Imagekit::Models::Cache::InvalidationGetResponse#status + module Status + extend Imagekit::Internal::Type::Enum + + PENDING = :Pending + COMPLETED = :Completed + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/imagekit/models/custom_metadata_field.rb b/lib/imagekit/models/custom_metadata_field.rb new file mode 100644 index 00000000..c82382bc --- /dev/null +++ b/lib/imagekit/models/custom_metadata_field.rb @@ -0,0 +1,243 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::CustomMetadataFields#create + class CustomMetadataField < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the custom metadata field. Use this to update the field. + # + # @return [String] + required :id, String + + # @!attribute label + # Human readable name of the custom metadata field. This name is displayed as form + # field label to the users while setting field value on the asset in the media + # library UI. + # + # @return [String] + required :label, String + + # @!attribute name + # API name of the custom metadata field. This becomes the key while setting + # `customMetadata` (key-value object) for an asset using upload or update API. + # + # @return [String] + required :name, String + + # @!attribute schema + # An object that describes the rules for the custom metadata field value. + # + # @return [Imagekit::Models::CustomMetadataField::Schema] + required :schema, -> { Imagekit::CustomMetadataField::Schema } + + # @!method initialize(id:, label:, name:, schema:) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataField} for more details. + # + # Object containing details of a custom metadata field. + # + # @param id [String] Unique identifier for the custom metadata field. Use this to update the field. + # + # @param label [String] Human readable name of the custom metadata field. This name is displayed as form + # + # @param name [String] API name of the custom metadata field. This becomes the key while setting `custo + # + # @param schema [Imagekit::Models::CustomMetadataField::Schema] An object that describes the rules for the custom metadata field value. + + # @see Imagekit::Models::CustomMetadataField#schema + class Schema < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Type of the custom metadata field. + # + # @return [Symbol, Imagekit::Models::CustomMetadataField::Schema::Type] + required :type, enum: -> { Imagekit::CustomMetadataField::Schema::Type } + + # @!attribute default_value + # The default value for this custom metadata field. Date type of default value + # depends on the field type. + # + # @return [String, Float, Boolean, Array, nil] + optional :default_value, + union: -> { Imagekit::CustomMetadataField::Schema::DefaultValue }, + api_name: :defaultValue + + # @!attribute is_value_required + # Specifies if the this custom metadata field is required or not. + # + # @return [Boolean, nil] + optional :is_value_required, Imagekit::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: -> { + Imagekit::CustomMetadataField::Schema::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: -> { + Imagekit::CustomMetadataField::Schema::MinValue + }, + api_name: :minValue + + # @!attribute select_options + # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + # + # @return [Array, nil] + optional :select_options, + -> { + Imagekit::Internal::Type::ArrayOf[union: Imagekit::CustomMetadataField::Schema::SelectOption] + }, + api_name: :selectOptions + + # @!method initialize(type:, default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, select_options: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataField::Schema} for more details. + # + # An object that describes the rules for the custom metadata field value. + # + # @param type [Symbol, Imagekit::Models::CustomMetadataField::Schema::Type] Type of the custom metadata field. + # + # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. Date type of default value dep + # + # @param is_value_required [Boolean] Specifies if the this 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 select_options [Array] An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + + # Type of the custom metadata field. + # + # @see Imagekit::Models::CustomMetadataField::Schema#type + module Type + extend Imagekit::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. Date type of default value + # depends on the field type. + # + # @see Imagekit::Models::CustomMetadataField::Schema#default_value + module DefaultValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # Default value should be of type array when custom metadata field type is set to `MultiSelect`. + variant -> { Imagekit::Models::CustomMetadataField::Schema::DefaultValue::MixedArray } + + module Mixed + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekit::Internal::Type::Converter] + MixedArray = + Imagekit::Internal::Type::ArrayOf[union: -> { + Imagekit::CustomMetadataField::Schema::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 Imagekit::Models::CustomMetadataField::Schema#max_value + module MaxValue + extend Imagekit::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 Imagekit::Models::CustomMetadataField::Schema#min_value + module MinValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + # @!method self.variants + # @return [Array(String, Float)] + end + + module SelectOption + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + end + end + end +end diff --git a/lib/imagekit/models/custom_metadata_field_create_params.rb b/lib/imagekit/models/custom_metadata_field_create_params.rb new file mode 100644 index 00000000..58a2f328 --- /dev/null +++ b/lib/imagekit/models/custom_metadata_field_create_params.rb @@ -0,0 +1,238 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::CustomMetadataFields#create + class CustomMetadataFieldCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute label + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. + # + # @return [String] + required :label, String + + # @!attribute name + # API name of the custom metadata field. This should be unique across all + # (including deleted) custom metadata fields. + # + # @return [String] + required :name, String + + # @!attribute schema + # + # @return [Imagekit::Models::CustomMetadataFieldCreateParams::Schema] + required :schema, -> { Imagekit::CustomMetadataFieldCreateParams::Schema } + + # @!method initialize(label:, name:, schema:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldCreateParams} for more details. + # + # @param label [String] Human readable name of the custom metadata field. This should be unique across a + # + # @param name [String] API name of the custom metadata field. This should be unique across all (includi + # + # @param schema [Imagekit::Models::CustomMetadataFieldCreateParams::Schema] + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + + class Schema < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Type of the custom metadata field. + # + # @return [Symbol, Imagekit::Models::CustomMetadataFieldCreateParams::Schema::Type] + required :type, enum: -> { Imagekit::CustomMetadataFieldCreateParams::Schema::Type } + + # @!attribute default_value + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + # + # @return [String, Float, Boolean, Array, nil] + optional :default_value, + union: -> { Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue }, + api_name: :defaultValue + + # @!attribute is_value_required + # Sets this custom metadata field as required. Setting custom metadata fields on + # an asset will throw error if the value for all required fields are not present + # in upload or update asset API request body. + # + # @return [Boolean, nil] + optional :is_value_required, Imagekit::Internal::Type::Boolean, api_name: :isValueRequired + + # @!attribute max_length + # Maximum length of string. Only set this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @return [String, Float, nil] + optional :max_value, + union: -> { Imagekit::CustomMetadataFieldCreateParams::Schema::MaxValue }, + api_name: :maxValue + + # @!attribute min_length + # Minimum length of string. Only set this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @return [String, Float, nil] + optional :min_value, + union: -> { Imagekit::CustomMetadataFieldCreateParams::Schema::MinValue }, + api_name: :minValue + + # @!attribute select_options + # An array of allowed values. This property is only required if `type` property is + # set to `SingleSelect` or `MultiSelect`. + # + # @return [Array, nil] + optional :select_options, + -> { + Imagekit::Internal::Type::ArrayOf[union: Imagekit::CustomMetadataFieldCreateParams::Schema::SelectOption] + }, + api_name: :selectOptions + + # @!method initialize(type:, default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, select_options: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldCreateParams::Schema} for more details. + # + # @param type [Symbol, Imagekit::Models::CustomMetadataFieldCreateParams::Schema::Type] Type of the custom metadata field. + # + # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. This property is only required + # + # @param is_value_required [Boolean] Sets this custom metadata field as required. Setting custom metadata fields on a + # + # @param max_length [Float] Maximum length of string. Only set this property if `type` is set to `Text` or ` + # + # @param max_value [String, Float] Maximum value of the field. Only set this property if field type is `Date` or `N + # + # @param min_length [Float] Minimum length of string. Only set this property if `type` is set to `Text` or ` + # + # @param min_value [String, Float] Minimum value of the field. Only set this property if field type is `Date` or `N + # + # @param select_options [Array] An array of allowed values. This property is only required if `type` property is + + # Type of the custom metadata field. + # + # @see Imagekit::Models::CustomMetadataFieldCreateParams::Schema#type + module Type + extend Imagekit::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. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + # + # @see Imagekit::Models::CustomMetadataFieldCreateParams::Schema#default_value + module DefaultValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # Default value should be of type array when custom metadata field type is set to `MultiSelect`. + variant -> { Imagekit::Models::CustomMetadataFieldCreateParams::Schema::DefaultValue::MixedArray } + + module Mixed + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekit::Internal::Type::Converter] + MixedArray = + Imagekit::Internal::Type::ArrayOf[union: -> { + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Mixed + }] + end + + # Maximum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @see Imagekit::Models::CustomMetadataFieldCreateParams::Schema#max_value + module MaxValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + # @!method self.variants + # @return [Array(String, Float)] + end + + # Minimum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @see Imagekit::Models::CustomMetadataFieldCreateParams::Schema#min_value + module MinValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + # @!method self.variants + # @return [Array(String, Float)] + end + + module SelectOption + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + end + end + end +end diff --git a/lib/imagekit/models/custom_metadata_field_delete_params.rb b/lib/imagekit/models/custom_metadata_field_delete_params.rb new file mode 100644 index 00000000..21af3d9c --- /dev/null +++ b/lib/imagekit/models/custom_metadata_field_delete_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::CustomMetadataFields#delete + class CustomMetadataFieldDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/custom_metadata_field_delete_response.rb b/lib/imagekit/models/custom_metadata_field_delete_response.rb new file mode 100644 index 00000000..ec5f93b1 --- /dev/null +++ b/lib/imagekit/models/custom_metadata_field_delete_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::CustomMetadataFields#delete + class CustomMetadataFieldDeleteResponse < Imagekit::Internal::Type::BaseModel + # @!method initialize + end + end +end diff --git a/lib/imagekit/models/custom_metadata_field_list_params.rb b/lib/imagekit/models/custom_metadata_field_list_params.rb new file mode 100644 index 00000000..f2c94cec --- /dev/null +++ b/lib/imagekit/models/custom_metadata_field_list_params.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::CustomMetadataFields#list + class CustomMetadataFieldListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute include_deleted + # Set it to `true` to include deleted field objects in the API response. + # + # @return [Boolean, nil] + optional :include_deleted, Imagekit::Internal::Type::Boolean + + # @!method initialize(include_deleted: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldListParams} for more details. + # + # @param include_deleted [Boolean] Set it to `true` to include deleted field objects in the API response. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/custom_metadata_field_list_response.rb b/lib/imagekit/models/custom_metadata_field_list_response.rb new file mode 100644 index 00000000..78a32292 --- /dev/null +++ b/lib/imagekit/models/custom_metadata_field_list_response.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @type [Imagekit::Internal::Type::Converter] + CustomMetadataFieldListResponse = Imagekit::Internal::Type::ArrayOf[-> { Imagekit::CustomMetadataField }] + end +end diff --git a/lib/imagekit/models/custom_metadata_field_update_params.rb b/lib/imagekit/models/custom_metadata_field_update_params.rb new file mode 100644 index 00000000..f991da44 --- /dev/null +++ b/lib/imagekit/models/custom_metadata_field_update_params.rb @@ -0,0 +1,212 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::CustomMetadataFields#update + class CustomMetadataFieldUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute label + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. This parameter is required if `schema` is not provided. + # + # @return [String, nil] + optional :label, String + + # @!attribute schema + # An object that describes the rules for the custom metadata key. This parameter + # is required if `label` is not provided. Note: `type` cannot be updated and will + # be ignored if sent with the `schema`. The schema will be validated as per the + # existing `type`. + # + # @return [Imagekit::Models::CustomMetadataFieldUpdateParams::Schema, nil] + optional :schema, -> { Imagekit::CustomMetadataFieldUpdateParams::Schema } + + # @!method initialize(label: nil, schema: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldUpdateParams} for more details. + # + # @param label [String] Human readable name of the custom metadata field. This should be unique across a + # + # @param schema [Imagekit::Models::CustomMetadataFieldUpdateParams::Schema] An object that describes the rules for the custom metadata key. This parameter i + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + + class Schema < Imagekit::Internal::Type::BaseModel + # @!attribute default_value + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + # + # @return [String, Float, Boolean, Array, nil] + optional :default_value, + union: -> { Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue }, + api_name: :defaultValue + + # @!attribute is_value_required + # Sets this custom metadata field as required. Setting custom metadata fields on + # an asset will throw error if the value for all required fields are not present + # in upload or update asset API request body. + # + # @return [Boolean, nil] + optional :is_value_required, Imagekit::Internal::Type::Boolean, api_name: :isValueRequired + + # @!attribute max_length + # Maximum length of string. Only set this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @return [String, Float, nil] + optional :max_value, + union: -> { Imagekit::CustomMetadataFieldUpdateParams::Schema::MaxValue }, + api_name: :maxValue + + # @!attribute min_length + # Minimum length of string. Only set this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @return [String, Float, nil] + optional :min_value, + union: -> { Imagekit::CustomMetadataFieldUpdateParams::Schema::MinValue }, + api_name: :minValue + + # @!attribute select_options + # An array of allowed values. This property is only required if `type` property is + # set to `SingleSelect` or `MultiSelect`. + # + # @return [Array, nil] + optional :select_options, + -> { + Imagekit::Internal::Type::ArrayOf[union: Imagekit::CustomMetadataFieldUpdateParams::Schema::SelectOption] + }, + api_name: :selectOptions + + # @!method initialize(default_value: nil, is_value_required: nil, max_length: nil, max_value: nil, min_length: nil, min_value: nil, select_options: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldUpdateParams::Schema} for more details. + # + # An object that describes the rules for the custom metadata key. This parameter + # is required if `label` is not provided. Note: `type` cannot be updated and will + # be ignored if sent with the `schema`. The schema will be validated as per the + # existing `type`. + # + # @param default_value [String, Float, Boolean, Array] The default value for this custom metadata field. This property is only required + # + # @param is_value_required [Boolean] Sets this custom metadata field as required. Setting custom metadata fields on a + # + # @param max_length [Float] Maximum length of string. Only set this property if `type` is set to `Text` or ` + # + # @param max_value [String, Float] Maximum value of the field. Only set this property if field type is `Date` or `N + # + # @param min_length [Float] Minimum length of string. Only set this property if `type` is set to `Text` or ` + # + # @param min_value [String, Float] Minimum value of the field. Only set this property if field type is `Date` or `N + # + # @param select_options [Array] An array of allowed values. This property is only required if `type` property is + + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + # + # @see Imagekit::Models::CustomMetadataFieldUpdateParams::Schema#default_value + module DefaultValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # Default value should be of type array when custom metadata field type is set to `MultiSelect`. + variant -> { Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::DefaultValue::MixedArray } + + module Mixed + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + + # @!method self.variants + # @return [Array(String, Float, Boolean, Array)] + + # @type [Imagekit::Internal::Type::Converter] + MixedArray = + Imagekit::Internal::Type::ArrayOf[union: -> { + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Mixed + }] + end + + # Maximum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @see Imagekit::Models::CustomMetadataFieldUpdateParams::Schema#max_value + module MaxValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + # @!method self.variants + # @return [Array(String, Float)] + end + + # Minimum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + # + # @see Imagekit::Models::CustomMetadataFieldUpdateParams::Schema#min_value + module MinValue + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + # @!method self.variants + # @return [Array(String, Float)] + end + + module SelectOption + extend Imagekit::Internal::Type::Union + + variant String + + variant Float + + variant Imagekit::Internal::Type::Boolean + + # @!method self.variants + # @return [Array(String, Float, Boolean)] + end + end + end + end +end diff --git a/lib/imagekit/models/file.rb b/lib/imagekit/models/file.rb new file mode 100644 index 00000000..d1c2aacb --- /dev/null +++ b/lib/imagekit/models/file.rb @@ -0,0 +1,269 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#get + class File < Imagekit::Internal::Type::BaseModel + # @!attribute ai_tags + # An array of tags assigned to the file by auto tagging. + # + # @return [Array, nil] + optional :ai_tags, + -> { Imagekit::Internal::Type::ArrayOf[Imagekit::File::AITag] }, + api_name: :AITags, + nil?: true + + # @!attribute created_at + # Date and time when the file was uploaded. The date and time is in ISO8601 + # format. + # + # @return [Time, nil] + optional :created_at, Time, api_name: :createdAt + + # @!attribute custom_coordinates + # An string with custom coordinates of the file. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true + + # @!attribute custom_metadata + # An object with custom metadata for the file. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + # + # @return [String, nil] + optional :description, String + + # @!attribute file_id + # Unique identifier of the asset. + # + # @return [String, nil] + optional :file_id, String, api_name: :fileId + + # @!attribute file_path + # Path of the file. This is the path you would use in the URL to access the file. + # For example, if the file is at the root of the media library, the path will be + # `/file.jpg`. If the file is inside a folder named `images`, the path will be + # `/images/file.jpg`. + # + # @return [String, nil] + optional :file_path, String, api_name: :filePath + + # @!attribute file_type + # Type of the file. Possible values are `image`, `non-image`. + # + # @return [String, nil] + optional :file_type, String, api_name: :fileType + + # @!attribute has_alpha + # Specifies if the image has an alpha channel. + # + # @return [Boolean, nil] + optional :has_alpha, Imagekit::Internal::Type::Boolean, api_name: :hasAlpha + + # @!attribute height + # Height of the file. + # + # @return [Float, nil] + optional :height, Float + + # @!attribute is_private_file + # Specifies if the file is private or not. + # + # @return [Boolean, nil] + optional :is_private_file, Imagekit::Internal::Type::Boolean, api_name: :isPrivateFile + + # @!attribute is_published + # Specifies if the file is published or not. + # + # @return [Boolean, nil] + optional :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute mime + # MIME type of the file. + # + # @return [String, nil] + optional :mime, String + + # @!attribute name + # Name of the asset. + # + # @return [String, nil] + optional :name, String + + # @!attribute size + # Size of the file in bytes. + # + # @return [Float, nil] + optional :size, Float + + # @!attribute tags + # An array of tags assigned to the file. Tags are used to search files in the + # media library. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute thumbnail + # URL of the thumbnail image. This URL is used to access the thumbnail image of + # the file in the media library. + # + # @return [String, nil] + optional :thumbnail, String + + # @!attribute type + # Type of the asset. + # + # @return [Symbol, Imagekit::Models::File::Type, nil] + optional :type, enum: -> { Imagekit::File::Type } + + # @!attribute updated_at + # Date and time when the file was last updated. The date and time is in ISO8601 + # format. + # + # @return [Time, nil] + optional :updated_at, Time, api_name: :updatedAt + + # @!attribute url + # URL of the file. + # + # @return [String, nil] + optional :url, String + + # @!attribute version_info + # An object with details of the file version. + # + # @return [Imagekit::Models::File::VersionInfo, nil] + optional :version_info, -> { Imagekit::File::VersionInfo }, api_name: :versionInfo + + # @!attribute width + # Width of the file. + # + # @return [Float, nil] + optional :width, Float + + # @!method initialize(ai_tags: nil, created_at: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, file_id: nil, file_path: nil, file_type: nil, has_alpha: nil, height: nil, is_private_file: nil, is_published: nil, mime: nil, name: nil, size: nil, tags: nil, thumbnail: nil, type: nil, updated_at: nil, url: nil, version_info: nil, width: nil) + # Some parameter documentations has been truncated, see {Imagekit::Models::File} + # for more details. + # + # 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 created_at [Time] Date and time when the file was uploaded. The date and time is in ISO8601 format + # + # @param custom_coordinates [String, nil] An string with custom coordinates of the file. + # + # @param custom_metadata [Hash{Symbol=>Object}] An object with custom metadata for the file. + # + # @param description [String] Optional text to describe the contents of the file. Can be set by the user or th + # + # @param file_id [String] Unique identifier of the asset. + # + # @param file_path [String] Path of the file. This is the path you would use in the URL to access the file. + # + # @param file_type [String] Type of the file. Possible values are `image`, `non-image`. + # + # @param has_alpha [Boolean] Specifies if the image has an alpha channel. + # + # @param height [Float] Height of the file. + # + # @param is_private_file [Boolean] Specifies if the file is private or not. + # + # @param is_published [Boolean] Specifies if the file is published or not. + # + # @param mime [String] MIME type of the file. + # + # @param name [String] Name of the asset. + # + # @param size [Float] Size of the file in bytes. + # + # @param tags [Array, nil] An array of tags assigned to the file. Tags are used to search files in the medi + # + # @param thumbnail [String] URL of the thumbnail image. This URL is used to access the thumbnail image of th + # + # @param type [Symbol, Imagekit::Models::File::Type] Type of the asset. + # + # @param updated_at [Time] Date and time when the file was last updated. The date and time is in ISO8601 fo + # + # @param url [String] URL of the file. + # + # @param version_info [Imagekit::Models::File::VersionInfo] An object with details of the file version. + # + # @param width [Float] Width of the file. + + class AITag < Imagekit::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 + # {Imagekit::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 + + # Type of the asset. + # + # @see Imagekit::Models::File#type + module Type + extend Imagekit::Internal::Type::Enum + + FILE = :file + FILE_VERSION = :"file-version" + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::File#version_info + class VersionInfo < Imagekit::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/imagekit/models/file_copy_params.rb b/lib/imagekit/models/file_copy_params.rb new file mode 100644 index 00000000..3a481b8d --- /dev/null +++ b/lib/imagekit/models/file_copy_params.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#copy + class FileCopyParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute destination_path + # Full path to the folder you want to copy the above file into. + # + # @return [String] + required :destination_path, String, api_name: :destinationPath + + # @!attribute source_file_path + # The full path of the file you want to copy. + # + # @return [String] + required :source_file_path, String, api_name: :sourceFilePath + + # @!attribute include_file_versions + # Option to copy all versions of a file. By default, only the current version of + # the file is copied. When set to true, all versions of the file will be copied. + # Default value - `false`. + # + # @return [Boolean, nil] + optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions + + # @!method initialize(destination_path:, source_file_path:, include_file_versions: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileCopyParams} for more details. + # + # @param destination_path [String] Full path to the folder you want to copy the above file into. + # + # @param source_file_path [String] The full path of the file you want to copy. + # + # @param include_file_versions [Boolean] Option to copy all versions of a file. By default, only the current version of t + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/file_copy_response.rb b/lib/imagekit/models/file_copy_response.rb new file mode 100644 index 00000000..b783f78a --- /dev/null +++ b/lib/imagekit/models/file_copy_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#copy + class FileCopyResponse < Imagekit::Internal::Type::BaseModel + # @!method initialize + end + end +end diff --git a/lib/imagekit/models/file_delete_params.rb b/lib/imagekit/models/file_delete_params.rb new file mode 100644 index 00000000..7de513c4 --- /dev/null +++ b/lib/imagekit/models/file_delete_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#delete + class FileDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/file_get_params.rb b/lib/imagekit/models/file_get_params.rb new file mode 100644 index 00000000..65525d6b --- /dev/null +++ b/lib/imagekit/models/file_get_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#get + class FileGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/file_move_params.rb b/lib/imagekit/models/file_move_params.rb new file mode 100644 index 00000000..7af578f1 --- /dev/null +++ b/lib/imagekit/models/file_move_params.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#move + class FileMoveParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute destination_path + # Full path to the folder you want to move the above file into. + # + # @return [String] + required :destination_path, String, api_name: :destinationPath + + # @!attribute source_file_path + # The full path of the file you want to move. + # + # @return [String] + required :source_file_path, String, api_name: :sourceFilePath + + # @!method initialize(destination_path:, source_file_path:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileMoveParams} for more details. + # + # @param destination_path [String] Full path to the folder you want to move the above file into. + # + # @param source_file_path [String] The full path of the file you want to move. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/file_move_response.rb b/lib/imagekit/models/file_move_response.rb new file mode 100644 index 00000000..69bb18b1 --- /dev/null +++ b/lib/imagekit/models/file_move_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#move + class FileMoveResponse < Imagekit::Internal::Type::BaseModel + # @!method initialize + end + end +end diff --git a/lib/imagekit/models/file_rename_params.rb b/lib/imagekit/models/file_rename_params.rb new file mode 100644 index 00000000..692440d6 --- /dev/null +++ b/lib/imagekit/models/file_rename_params.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#rename + class FileRenameParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_path + # The full path of the file you want to rename. + # + # @return [String] + required :file_path, String, api_name: :filePath + + # @!attribute new_file_name + # The new name of the file. A filename can contain: + # + # Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, + # and numerals in other languages). Special Characters: `.`, `_`, and `-`. + # + # Any other character, including space, will be replaced by `_`. + # + # @return [String] + required :new_file_name, String, api_name: :newFileName + + # @!attribute purge_cache + # Option to purge cache for the old file and its versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove cached content of old file and its versions. This purge request is + # counted against your monthly purge quota. + # + # Note: If the old file were accessible at + # `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be + # issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard + # at the end). It will remove the file and its versions' URLs and any + # transformations made using query parameters on this file or its versions. + # However, the cache for file transformations made using path parameters will + # persist. You can purge them using the purge API. For more details, refer to the + # purge API documentation. + # + # Default value - `false` + # + # @return [Boolean, nil] + optional :purge_cache, Imagekit::Internal::Type::Boolean, api_name: :purgeCache + + # @!method initialize(file_path:, new_file_name:, purge_cache: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileRenameParams} for more details. + # + # @param file_path [String] The full path of the file you want to rename. + # + # @param new_file_name [String] The new name of the file. A filename can contain: + # + # @param purge_cache [Boolean] Option to purge cache for the old file and its versions' URLs. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/file_rename_response.rb b/lib/imagekit/models/file_rename_response.rb new file mode 100644 index 00000000..96b9be0e --- /dev/null +++ b/lib/imagekit/models/file_rename_response.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#rename + class FileRenameResponse < Imagekit::Internal::Type::BaseModel + # @!attribute purge_request_id + # Unique identifier of the purge request. This can be used to check the status of + # the purge request. + # + # @return [String, nil] + optional :purge_request_id, String, api_name: :purgeRequestId + + # @!method initialize(purge_request_id: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileRenameResponse} for more details. + # + # @param purge_request_id [String] Unique identifier of the purge request. This can be used to check the status of + end + end +end diff --git a/lib/imagekit/models/file_update_params.rb b/lib/imagekit/models/file_update_params.rb new file mode 100644 index 00000000..7efbdd37 --- /dev/null +++ b/lib/imagekit/models/file_update_params.rb @@ -0,0 +1,312 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#update + class FileUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute update + # + # @return [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus, nil] + optional :update, union: -> { Imagekit::FileUpdateParams::Update } + + # @!method initialize(update: nil, request_options: {}) + # @param update [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus] + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + + module Update + extend Imagekit::Internal::Type::Union + + variant -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails } + + variant -> { Imagekit::FileUpdateParams::Update::ChangePublicationStatus } + + class UpdateFileDetails < Imagekit::Internal::Type::BaseModel + # @!attribute custom_coordinates + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true + + # @!attribute custom_metadata + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. + # + # @return [String, nil] + optional :description, String + + # @!attribute extensions + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + # + # @return [Array, nil] + optional :extensions, + -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension] } + + # @!attribute remove_ai_tags + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + # + # @return [Array, Symbol, :all, nil] + optional :remove_ai_tags, + union: -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::RemoveAITags }, + api_name: :removeAITags + + # @!attribute tags + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute webhook_url + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + # + # @return [String, nil] + optional :webhook_url, String, api_name: :webhookUrl + + # @!method initialize(custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails} for more + # details. + # + # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # + # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car + # + # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + + module Extension + extend Imagekit::Internal::Type::Union + + discriminator :name + + variant :"remove-bg", -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg } + + variant :"ai-auto-description", + -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription } + + variant -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the background removal extension. + # + # @return [Symbol, :"remove-bg"] + required :name, const: :"remove-bg" + + # @!attribute options + # + # @return [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options, nil] + optional :options, + -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options } + + # @!method initialize(options: nil, name: :"remove-bg") + # @param options [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options] + # + # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. + + # @see Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg#options + class Options < Imagekit::Internal::Type::BaseModel + # @!attribute add_shadow + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + # + # @return [Boolean, nil] + optional :add_shadow, Imagekit::Internal::Type::Boolean + + # @!attribute bg_color + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + # + # @return [String, nil] + optional :bg_color, String + + # @!attribute bg_image_url + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + # + # @return [String, nil] + optional :bg_image_url, String + + # @!attribute semitransparency + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + # + # @return [Boolean, nil] + optional :semitransparency, Imagekit::Internal::Type::Boolean + + # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options} + # for more details. + # + # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin + # + # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col + # + # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be + # + # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + # @!attribute max_tags + # Maximum number of tags to attach to the asset. + # + # @return [Integer] + required :max_tags, Integer, api_name: :maxTags + + # @!attribute min_confidence + # Minimum confidence level for tags to be considered valid. + # + # @return [Integer] + required :min_confidence, Integer, api_name: :minConfidence + + # @!attribute name + # Specifies the auto-tagging extension used. + # + # @return [Symbol, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name] + required :name, + enum: -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name } + + # @!method initialize(max_tags:, min_confidence:, name:) + # @param max_tags [Integer] Maximum number of tags to attach to the asset. + # + # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. + # + # @param name [Symbol, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. + + # Specifies the auto-tagging extension used. + # + # @see Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension#name + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING = :"google-auto-tagging" + AWS_AUTO_TAGGING = :"aws-auto-tagging" + + # @!method self.values + # @return [Array] + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the auto description extension. + # + # @return [Symbol, :"ai-auto-description"] + required :name, const: :"ai-auto-description" + + # @!method initialize(name: :"ai-auto-description") + # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. + end + + # @!method self.variants + # @return [Array(Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension)] + end + + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + # + # @see Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails#remove_ai_tags + module RemoveAITags + extend Imagekit::Internal::Type::Union + + variant -> { Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::RemoveAITags::StringArray } + + variant const: :all + + # @!method self.variants + # @return [Array(Array, Symbol, :all)] + + # @type [Imagekit::Internal::Type::Converter] + StringArray = Imagekit::Internal::Type::ArrayOf[String] + end + end + + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + # @!attribute publish + # Configure the publication status of a file and its versions. + # + # @return [Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus::Publish, nil] + optional :publish, -> { Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish } + + # @!method initialize(publish: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus} for more + # details. + # + # @param publish [Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus::Publish] Configure the publication status of a file and its versions. + + # @see Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus#publish + class Publish < Imagekit::Internal::Type::BaseModel + # @!attribute is_published + # Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @return [Boolean] + required :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute include_file_versions + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + # + # @return [Boolean, nil] + optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions + + # @!method initialize(is_published:, include_file_versions: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus::Publish} + # for more details. + # + # Configure the publication status of a file and its versions. + # + # @param is_published [Boolean] Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @param include_file_versions [Boolean] Set to `true` to publish/unpublish all versions of the file. Set to `false` to p + end + end + + # @!method self.variants + # @return [Array(Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus)] + end + end + end +end diff --git a/lib/imagekit/models/file_update_response.rb b/lib/imagekit/models/file_update_response.rb new file mode 100644 index 00000000..916adbcf --- /dev/null +++ b/lib/imagekit/models/file_update_response.rb @@ -0,0 +1,104 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#update + class FileUpdateResponse < Imagekit::Models::File + # @!attribute extension_status + # + # @return [Imagekit::Models::FileUpdateResponse::ExtensionStatus, nil] + optional :extension_status, + -> { Imagekit::Models::FileUpdateResponse::ExtensionStatus }, + api_name: :extensionStatus + + # @!method initialize(extension_status: nil) + # Object containing details of a file or file version. + # + # @param extension_status [Imagekit::Models::FileUpdateResponse::ExtensionStatus] + + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + # @!attribute ai_auto_description + # + # @return [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription, nil] + optional :ai_auto_description, + enum: -> { Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription }, + api_name: :"ai-auto-description" + + # @!attribute aws_auto_tagging + # + # @return [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging, nil] + optional :aws_auto_tagging, + enum: -> { Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging }, + api_name: :"aws-auto-tagging" + + # @!attribute google_auto_tagging + # + # @return [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging, nil] + optional :google_auto_tagging, + enum: -> { Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging }, + api_name: :"google-auto-tagging" + + # @!attribute remove_bg + # + # @return [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg, nil] + optional :remove_bg, + enum: -> { Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg }, + api_name: :"remove-bg" + + # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # @param ai_auto_description [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription] + # @param aws_auto_tagging [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging] + # @param google_auto_tagging [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging] + # @param remove_bg [Symbol, Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg] + + # @see Imagekit::Models::FileUpdateResponse::ExtensionStatus#ai_auto_description + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::FileUpdateResponse::ExtensionStatus#aws_auto_tagging + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::FileUpdateResponse::ExtensionStatus#google_auto_tagging + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::FileUpdateResponse::ExtensionStatus#remove_bg + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb new file mode 100644 index 00000000..f1a86697 --- /dev/null +++ b/lib/imagekit/models/file_upload_params.rb @@ -0,0 +1,607 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#upload + class FileUploadParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + # + # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] + required :file, Imagekit::Internal::Type::FileInput + + # @!attribute file_name + # The name with which the file has to be uploaded. The file name can contain: + # + # - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`. + # - Special Characters: `.`, `-` + # + # Any other character including space will be replaced by `_` + # + # @return [String] + required :file_name, String, api_name: :fileName + + # @!attribute token + # A unique value that the ImageKit.io server will use to recognize and prevent + # subsequent retries for the same request. We suggest using V4 UUIDs, or another + # random string with enough entropy to avoid collisions. This field is only + # required for authentication when uploading a file from the client side. + # + # **Note**: Sending a value that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new value for this field. + # + # @return [String, nil] + optional :token, String + + # @!attribute checks + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks). + # + # @return [String, nil] + optional :checks, String + + # @!attribute custom_coordinates + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates + + # @!attribute custom_metadata + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. + # + # @return [String, nil] + optional :description, String + + # @!attribute expire + # The time until your signature is valid. It must be a + # [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into + # the future. It should be in seconds. This field is only required for + # authentication when uploading a file from the client side. + # + # @return [Integer, nil] + optional :expire, Integer + + # @!attribute extensions + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + # + # @return [Array, nil] + optional :extensions, + -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::FileUploadParams::Extension] } + + # @!attribute folder + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. + # + # The folder name can contain: + # + # - Alphanumeric Characters: `a-z` , `A-Z` , `0-9` + # - Special Characters: `/` , `_` , `-` + # + # Using multiple `/` creates a nested folder. + # + # @return [String, nil] + optional :folder, String + + # @!attribute is_private_file + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + # + # @return [Boolean, nil] + optional :is_private_file, Imagekit::Internal::Type::Boolean, api_name: :isPrivateFile + + # @!attribute is_published + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + # + # @return [Boolean, nil] + optional :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute overwrite_ai_tags + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + # + # @return [Boolean, nil] + optional :overwrite_ai_tags, Imagekit::Internal::Type::Boolean, api_name: :overwriteAITags + + # @!attribute overwrite_custom_metadata + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + # + # @return [Boolean, nil] + optional :overwrite_custom_metadata, + Imagekit::Internal::Type::Boolean, + api_name: :overwriteCustomMetadata + + # @!attribute overwrite_file + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + # + # @return [Boolean, nil] + optional :overwrite_file, Imagekit::Internal::Type::Boolean, api_name: :overwriteFile + + # @!attribute overwrite_tags + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + # + # @return [Boolean, nil] + optional :overwrite_tags, Imagekit::Internal::Type::Boolean, api_name: :overwriteTags + + # @!attribute public_key + # Your ImageKit.io public key. This field is only required for authentication when + # uploading a file from the client side. + # + # @return [String, nil] + optional :public_key, String, api_name: :publicKey + + # @!attribute response_fields + # Array of response field keys to include in the API response body. + # + # @return [Array, nil] + optional :response_fields, + -> { Imagekit::Internal::Type::ArrayOf[enum: Imagekit::FileUploadParams::ResponseField] }, + api_name: :responseFields + + # @!attribute signature + # HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + # key. Learn how to create a signature on the page below. This should be in + # lowercase. + # + # Signature must be calculated on the server-side. This field is only required for + # authentication when uploading a file from the client side. + # + # @return [String, nil] + optional :signature, String + + # @!attribute tags + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String] + + # @!attribute transformation + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + # + # @return [Imagekit::Models::FileUploadParams::Transformation, nil] + optional :transformation, -> { Imagekit::FileUploadParams::Transformation } + + # @!attribute use_unique_file_name + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + # + # @return [Boolean, nil] + optional :use_unique_file_name, Imagekit::Internal::Type::Boolean, api_name: :useUniqueFileName + + # @!attribute webhook_url + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + # + # @return [String, nil] + optional :webhook_url, String, api_name: :webhookUrl + + # @!method initialize(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams} for more details. + # + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # + # @param file_name [String] The name with which the file has to be uploaded. + # + # @param token [String] A unique value that the ImageKit.io server will use to recognize and prevent sub + # + # @param checks [String] Server-side checks to run on the asset. + # + # @param custom_coordinates [String] Define an important area in the image. This is only relevant for image type file + # + # @param custom_metadata [Hash{Symbol=>Object}] JSON key-value pairs to associate with the asset. Create the custom metadata fie + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki + # + # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # + # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e + # + # @param is_private_file [Boolean] Whether to mark the file as private or not. + # + # @param is_published [Boolean] Whether to upload file as published or not. + # + # @param overwrite_ai_tags [Boolean] If set to `true` and a file already exists at the exact location, its AITags wil + # + # @param overwrite_custom_metadata [Boolean] If the request does not have `customMetadata`, and a file already exists at the + # + # @param overwrite_file [Boolean] If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # + # @param overwrite_tags [Boolean] If the request does not have `tags`, and a file already exists at the exact loca + # + # @param public_key [String] Your ImageKit.io public key. This field is only required for authentication when + # + # @param response_fields [Array] Array of response field keys to include in the API response body. + # + # @param signature [String] HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + # + # @param tags [Array] Set the tags while uploading the file. + # + # @param transformation [Imagekit::Models::FileUploadParams::Transformation] Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # @param use_unique_file_name [Boolean] Whether to use a unique filename for this file or not. + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + + module Extension + extend Imagekit::Internal::Type::Union + + discriminator :name + + variant :"remove-bg", -> { Imagekit::FileUploadParams::Extension::RemoveBg } + + variant :"ai-auto-description", -> { Imagekit::FileUploadParams::Extension::AIAutoDescription } + + variant -> { Imagekit::FileUploadParams::Extension::AutoTaggingExtension } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the background removal extension. + # + # @return [Symbol, :"remove-bg"] + required :name, const: :"remove-bg" + + # @!attribute options + # + # @return [Imagekit::Models::FileUploadParams::Extension::RemoveBg::Options, nil] + optional :options, -> { Imagekit::FileUploadParams::Extension::RemoveBg::Options } + + # @!method initialize(options: nil, name: :"remove-bg") + # @param options [Imagekit::Models::FileUploadParams::Extension::RemoveBg::Options] + # + # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. + + # @see Imagekit::Models::FileUploadParams::Extension::RemoveBg#options + class Options < Imagekit::Internal::Type::BaseModel + # @!attribute add_shadow + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + # + # @return [Boolean, nil] + optional :add_shadow, Imagekit::Internal::Type::Boolean + + # @!attribute bg_color + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + # + # @return [String, nil] + optional :bg_color, String + + # @!attribute bg_image_url + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + # + # @return [String, nil] + optional :bg_image_url, String + + # @!attribute semitransparency + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + # + # @return [Boolean, nil] + optional :semitransparency, Imagekit::Internal::Type::Boolean + + # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams::Extension::RemoveBg::Options} for more + # details. + # + # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin + # + # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col + # + # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be + # + # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + # @!attribute max_tags + # Maximum number of tags to attach to the asset. + # + # @return [Integer] + required :max_tags, Integer, api_name: :maxTags + + # @!attribute min_confidence + # Minimum confidence level for tags to be considered valid. + # + # @return [Integer] + required :min_confidence, Integer, api_name: :minConfidence + + # @!attribute name + # Specifies the auto-tagging extension used. + # + # @return [Symbol, Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::Name] + required :name, enum: -> { Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name } + + # @!method initialize(max_tags:, min_confidence:, name:) + # @param max_tags [Integer] Maximum number of tags to attach to the asset. + # + # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. + # + # @param name [Symbol, Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. + + # Specifies the auto-tagging extension used. + # + # @see Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension#name + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING = :"google-auto-tagging" + AWS_AUTO_TAGGING = :"aws-auto-tagging" + + # @!method self.values + # @return [Array] + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the auto description extension. + # + # @return [Symbol, :"ai-auto-description"] + required :name, const: :"ai-auto-description" + + # @!method initialize(name: :"ai-auto-description") + # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. + end + + # @!method self.variants + # @return [Array(Imagekit::Models::FileUploadParams::Extension::RemoveBg, Imagekit::Models::FileUploadParams::Extension::AIAutoDescription, Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension)] + end + + module ResponseField + extend Imagekit::Internal::Type::Enum + + TAGS = :tags + CUSTOM_COORDINATES = :customCoordinates + IS_PRIVATE_FILE = :isPrivateFile + EMBEDDED_METADATA = :embeddedMetadata + IS_PUBLISHED = :isPublished + CUSTOM_METADATA = :customMetadata + METADATA = :metadata + + # @!method self.values + # @return [Array] + end + + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute post + # List of transformations to apply _after_ the file is uploaded. + # Each item must match one of the following types: `transformation`, + # `gif-to-video`, `thumbnail`, `abs`. + # + # @return [Array, nil] + optional :post, + -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::FileUploadParams::Transformation::Post] } + + # @!attribute pre + # Transformation string to apply before uploading the file to the Media Library. + # Useful for optimizing files at ingestion. + # + # @return [String, nil] + optional :pre, String + + # @!method initialize(post: nil, pre: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams::Transformation} for more details. + # + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + # + # @param post [Array] List of transformations to apply _after_ the file is uploaded. + # + # @param pre [String] Transformation string to apply before uploading the file to the Media Library. U + + module Post + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :transformation, -> { Imagekit::FileUploadParams::Transformation::Post::Transformation } + + variant :"gif-to-video", -> { Imagekit::FileUploadParams::Transformation::Post::GifToVideo } + + variant :thumbnail, -> { Imagekit::FileUploadParams::Transformation::Post::Thumbnail } + + variant :abs, -> { Imagekit::FileUploadParams::Transformation::Post::Abs } + + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Transformation type. + # + # @return [Symbol, :transformation] + required :type, const: :transformation + + # @!attribute value + # Transformation string (e.g. `w-200,h-200`). + # Same syntax as ImageKit URL-based transformations. + # + # @return [String] + required :value, String + + # @!method initialize(value:, type: :transformation) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams::Transformation::Post::Transformation} for + # more details. + # + # @param value [String] Transformation string (e.g. `w-200,h-200`). + # + # @param type [Symbol, :transformation] Transformation type. + end + + class GifToVideo < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Converts an animated GIF into an MP4. + # + # @return [Symbol, :"gif-to-video"] + required :type, const: :"gif-to-video" + + # @!attribute value + # Optional transformation string to apply to the output video. + # **Example**: `q-80` + # + # @return [String, nil] + optional :value, String + + # @!method initialize(value: nil, type: :"gif-to-video") + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams::Transformation::Post::GifToVideo} for more + # details. + # + # @param value [String] Optional transformation string to apply to the output video. + # + # @param type [Symbol, :"gif-to-video"] Converts an animated GIF into an MP4. + end + + class Thumbnail < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Generates a thumbnail image. + # + # @return [Symbol, :thumbnail] + required :type, const: :thumbnail + + # @!attribute value + # Optional transformation string. + # **Example**: `w-150,h-150` + # + # @return [String, nil] + optional :value, String + + # @!method initialize(value: nil, type: :thumbnail) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams::Transformation::Post::Thumbnail} for more + # details. + # + # @param value [String] Optional transformation string. + # + # @param type [Symbol, :thumbnail] Generates a thumbnail image. + end + + class Abs < Imagekit::Internal::Type::BaseModel + # @!attribute protocol + # Streaming protocol to use (`hls` or `dash`). + # + # @return [Symbol, Imagekit::Models::FileUploadParams::Transformation::Post::Abs::Protocol] + required :protocol, enum: -> { Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol } + + # @!attribute type + # Adaptive Bitrate Streaming (ABS) setup. + # + # @return [Symbol, :abs] + required :type, const: :abs + + # @!attribute value + # List of different representations you want to create separated by an underscore. + # + # @return [String] + required :value, String + + # @!method initialize(protocol:, value:, type: :abs) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams::Transformation::Post::Abs} for more + # details. + # + # @param protocol [Symbol, Imagekit::Models::FileUploadParams::Transformation::Post::Abs::Protocol] Streaming protocol to use (`hls` or `dash`). + # + # @param value [String] List of different representations you want to create separated by an underscore. + # + # @param type [Symbol, :abs] Adaptive Bitrate Streaming (ABS) setup. + + # Streaming protocol to use (`hls` or `dash`). + # + # @see Imagekit::Models::FileUploadParams::Transformation::Post::Abs#protocol + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS = :hls + DASH = :dash + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(Imagekit::Models::FileUploadParams::Transformation::Post::Transformation, Imagekit::Models::FileUploadParams::Transformation::Post::GifToVideo, Imagekit::Models::FileUploadParams::Transformation::Post::Thumbnail, Imagekit::Models::FileUploadParams::Transformation::Post::Abs)] + end + end + end + end +end diff --git a/lib/imagekit/models/file_upload_response.rb b/lib/imagekit/models/file_upload_response.rb new file mode 100644 index 00000000..85ebf598 --- /dev/null +++ b/lib/imagekit/models/file_upload_response.rb @@ -0,0 +1,391 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Files#upload + class FileUploadResponse < Imagekit::Internal::Type::BaseModel + # @!attribute ai_tags + # An array of tags assigned to the uploaded file by auto tagging. + # + # @return [Array, nil] + optional :ai_tags, + -> { Imagekit::Internal::Type::ArrayOf[Imagekit::Models::FileUploadResponse::AITag] }, + api_name: :AITags, + nil?: true + + # @!attribute audio_codec + # The audio codec used in the video (only for video). + # + # @return [String, nil] + optional :audio_codec, String, api_name: :audioCodec + + # @!attribute bit_rate + # The bit rate of the video in kbps (only for video). + # + # @return [Integer, nil] + optional :bit_rate, Integer, api_name: :bitRate + + # @!attribute custom_coordinates + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true + + # @!attribute custom_metadata + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + # + # @return [String, nil] + optional :description, String + + # @!attribute duration + # The duration of the video in seconds (only for video). + # + # @return [Integer, nil] + optional :duration, Integer + + # @!attribute embedded_metadata + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + # + # @return [Hash{Symbol=>Object}, nil] + optional :embedded_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :embeddedMetadata + + # @!attribute extension_status + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + # + # @return [Imagekit::Models::FileUploadResponse::ExtensionStatus, nil] + optional :extension_status, + -> { Imagekit::Models::FileUploadResponse::ExtensionStatus }, + api_name: :extensionStatus + + # @!attribute file_id + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + # + # @return [String, nil] + optional :file_id, String, api_name: :fileId + + # @!attribute file_path + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + # + # @return [String, nil] + optional :file_path, String, api_name: :filePath + + # @!attribute file_type + # Type of the uploaded file. Possible values are `image`, `non-image`. + # + # @return [String, nil] + optional :file_type, String, api_name: :fileType + + # @!attribute height + # Height of the image in pixels (Only for images) + # + # @return [Float, nil] + optional :height, Float + + # @!attribute is_private_file + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + # + # @return [Boolean, nil] + optional :is_private_file, Imagekit::Internal::Type::Boolean, api_name: :isPrivateFile + + # @!attribute is_published + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + # + # @return [Boolean, nil] + optional :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute metadata + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + # + # @return [Imagekit::Models::Metadata, nil] + optional :metadata, -> { Imagekit::Metadata } + + # @!attribute name + # Name of the asset. + # + # @return [String, nil] + optional :name, String + + # @!attribute size + # Size of the image file in Bytes. + # + # @return [Float, nil] + optional :size, Float + + # @!attribute tags + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute thumbnail_url + # In the case of an image, a small thumbnail URL. + # + # @return [String, nil] + optional :thumbnail_url, String, api_name: :thumbnailUrl + + # @!attribute url + # A publicly accessible URL of the file. + # + # @return [String, nil] + optional :url, String + + # @!attribute version_info + # An object containing the file or file version's `id` (versionId) and `name`. + # + # @return [Imagekit::Models::FileUploadResponse::VersionInfo, nil] + optional :version_info, -> { Imagekit::Models::FileUploadResponse::VersionInfo }, api_name: :versionInfo + + # @!attribute video_codec + # The video codec used in the video (only for video). + # + # @return [String, nil] + optional :video_codec, String, api_name: :videoCodec + + # @!attribute width + # Width of the image in pixels (Only for Images) + # + # @return [Float, nil] + optional :width, Float + + # @!method initialize(ai_tags: nil, audio_codec: nil, bit_rate: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, duration: nil, embedded_metadata: nil, extension_status: nil, file_id: nil, file_path: nil, file_type: nil, height: nil, is_private_file: nil, is_published: nil, metadata: nil, name: nil, size: nil, tags: nil, thumbnail_url: nil, url: nil, version_info: nil, video_codec: nil, width: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadResponse} for more details. + # + # 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 audio_codec [String] The audio codec used in the video (only for video). + # + # @param bit_rate [Integer] The bit rate of the video in kbps (only for video). + # + # @param custom_coordinates [String, nil] Value of custom coordinates associated with the image in the format `x,y,width,h + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data associated with the asset. Use `responseField` in API request t + # + # @param description [String] Optional text to describe the contents of the file. Can be set by the user or th + # + # @param duration [Integer] The duration of the video in seconds (only for video). + # + # @param embedded_metadata [Hash{Symbol=>Object}] Consolidated embedded metadata associated with the file. It includes exif, iptc, + # + # @param extension_status [Imagekit::Models::FileUploadResponse::ExtensionStatus] Extension names with their processing status at the time of completion of the re + # + # @param file_id [String] Unique fileId. Store this fileld in your database, as this will be used to perfo + # + # @param file_path [String] The relative path of the file in the media library e.g. `/marketing-assets/new-b + # + # @param file_type [String] Type of the uploaded file. Possible values are `image`, `non-image`. + # + # @param height [Float] Height of the image in pixels (Only for images) + # + # @param is_private_file [Boolean] Is the file marked as private. It can be either `true` or `false`. Send `isPriva + # + # @param is_published [Boolean] Is the file published or in draft state. It can be either `true` or `false`. Sen + # + # @param metadata [Imagekit::Models::Metadata] Legacy metadata. Send `metadata` in `responseFields` in API request to get metad + # + # @param name [String] Name of the asset. + # + # @param size [Float] Size of the image file in Bytes. + # + # @param tags [Array, nil] The array of tags associated with the asset. If no tags are set, it will be `nul + # + # @param thumbnail_url [String] In the case of an image, a small thumbnail URL. + # + # @param url [String] A publicly accessible URL of the file. + # + # @param version_info [Imagekit::Models::FileUploadResponse::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 < Imagekit::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 + # {Imagekit::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 Imagekit::Models::FileUploadResponse#extension_status + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + # @!attribute ai_auto_description + # + # @return [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription, nil] + optional :ai_auto_description, + enum: -> { Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription }, + api_name: :"ai-auto-description" + + # @!attribute aws_auto_tagging + # + # @return [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging, nil] + optional :aws_auto_tagging, + enum: -> { Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging }, + api_name: :"aws-auto-tagging" + + # @!attribute google_auto_tagging + # + # @return [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging, nil] + optional :google_auto_tagging, + enum: -> { Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging }, + api_name: :"google-auto-tagging" + + # @!attribute remove_bg + # + # @return [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg, nil] + optional :remove_bg, + enum: -> { Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg }, + api_name: :"remove-bg" + + # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + # + # @param ai_auto_description [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription] + # @param aws_auto_tagging [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging] + # @param google_auto_tagging [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging] + # @param remove_bg [Symbol, Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg] + + # @see Imagekit::Models::FileUploadResponse::ExtensionStatus#ai_auto_description + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::FileUploadResponse::ExtensionStatus#aws_auto_tagging + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::FileUploadResponse::ExtensionStatus#google_auto_tagging + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::FileUploadResponse::ExtensionStatus#remove_bg + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + end + + # @see Imagekit::Models::FileUploadResponse#version_info + class VersionInfo < Imagekit::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/imagekit/models/files/bulk_add_tags_params.rb b/lib/imagekit/models/files/bulk_add_tags_params.rb new file mode 100644 index 00000000..9c85f747 --- /dev/null +++ b/lib/imagekit/models/files/bulk_add_tags_params.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#add_tags + class BulkAddTagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_ids + # An array of fileIds to which you want to add tags. + # + # @return [Array] + required :file_ids, Imagekit::Internal::Type::ArrayOf[String], api_name: :fileIds + + # @!attribute tags + # An array of tags that you want to add to the files. + # + # @return [Array] + required :tags, Imagekit::Internal::Type::ArrayOf[String] + + # @!method initialize(file_ids:, tags:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkAddTagsParams} for more details. + # + # @param file_ids [Array] An array of fileIds to which you want to add tags. + # + # @param tags [Array] An array of tags that you want to add to the files. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/bulk_add_tags_response.rb b/lib/imagekit/models/files/bulk_add_tags_response.rb new file mode 100644 index 00000000..6bd30f2c --- /dev/null +++ b/lib/imagekit/models/files/bulk_add_tags_response.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#add_tags + class BulkAddTagsResponse < Imagekit::Internal::Type::BaseModel + # @!attribute successfully_updated_file_ids + # An array of fileIds that in which tags were successfully added. + # + # @return [Array, nil] + optional :successfully_updated_file_ids, + Imagekit::Internal::Type::ArrayOf[String], + api_name: :successfullyUpdatedFileIds + + # @!method initialize(successfully_updated_file_ids: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkAddTagsResponse} for more details. + # + # @param successfully_updated_file_ids [Array] An array of fileIds that in which tags were successfully added. + end + end + end +end diff --git a/lib/imagekit/models/files/bulk_delete_params.rb b/lib/imagekit/models/files/bulk_delete_params.rb new file mode 100644 index 00000000..02bffc69 --- /dev/null +++ b/lib/imagekit/models/files/bulk_delete_params.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#delete + class BulkDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_ids + # An array of fileIds which you want to delete. + # + # @return [Array] + required :file_ids, Imagekit::Internal::Type::ArrayOf[String], api_name: :fileIds + + # @!method initialize(file_ids:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkDeleteParams} for more details. + # + # @param file_ids [Array] An array of fileIds which you want to delete. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/bulk_delete_response.rb b/lib/imagekit/models/files/bulk_delete_response.rb new file mode 100644 index 00000000..e2fabbfc --- /dev/null +++ b/lib/imagekit/models/files/bulk_delete_response.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#delete + class BulkDeleteResponse < Imagekit::Internal::Type::BaseModel + # @!attribute successfully_deleted_file_ids + # An array of fileIds that were successfully deleted. + # + # @return [Array, nil] + optional :successfully_deleted_file_ids, + Imagekit::Internal::Type::ArrayOf[String], + api_name: :successfullyDeletedFileIds + + # @!method initialize(successfully_deleted_file_ids: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkDeleteResponse} for more details. + # + # @param successfully_deleted_file_ids [Array] An array of fileIds that were successfully deleted. + end + end + end +end diff --git a/lib/imagekit/models/files/bulk_remove_ai_tags_params.rb b/lib/imagekit/models/files/bulk_remove_ai_tags_params.rb new file mode 100644 index 00000000..b050162f --- /dev/null +++ b/lib/imagekit/models/files/bulk_remove_ai_tags_params.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#remove_ai_tags + class BulkRemoveAITagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute ai_tags + # An array of AITags that you want to remove from the files. + # + # @return [Array] + required :ai_tags, Imagekit::Internal::Type::ArrayOf[String], api_name: :AITags + + # @!attribute file_ids + # An array of fileIds from which you want to remove AITags. + # + # @return [Array] + required :file_ids, Imagekit::Internal::Type::ArrayOf[String], api_name: :fileIds + + # @!method initialize(ai_tags:, file_ids:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkRemoveAITagsParams} for more details. + # + # @param ai_tags [Array] An array of AITags that you want to remove from the files. + # + # @param file_ids [Array] An array of fileIds from which you want to remove AITags. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/bulk_remove_ai_tags_response.rb b/lib/imagekit/models/files/bulk_remove_ai_tags_response.rb new file mode 100644 index 00000000..49fb07de --- /dev/null +++ b/lib/imagekit/models/files/bulk_remove_ai_tags_response.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#remove_ai_tags + class BulkRemoveAITagsResponse < Imagekit::Internal::Type::BaseModel + # @!attribute successfully_updated_file_ids + # An array of fileIds that in which AITags were successfully removed. + # + # @return [Array, nil] + optional :successfully_updated_file_ids, + Imagekit::Internal::Type::ArrayOf[String], + api_name: :successfullyUpdatedFileIds + + # @!method initialize(successfully_updated_file_ids: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkRemoveAITagsResponse} for more details. + # + # @param successfully_updated_file_ids [Array] An array of fileIds that in which AITags were successfully removed. + end + end + end +end diff --git a/lib/imagekit/models/files/bulk_remove_tags_params.rb b/lib/imagekit/models/files/bulk_remove_tags_params.rb new file mode 100644 index 00000000..e5a2bbea --- /dev/null +++ b/lib/imagekit/models/files/bulk_remove_tags_params.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#remove_tags + class BulkRemoveTagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_ids + # An array of fileIds from which you want to remove tags. + # + # @return [Array] + required :file_ids, Imagekit::Internal::Type::ArrayOf[String], api_name: :fileIds + + # @!attribute tags + # An array of tags that you want to remove from the files. + # + # @return [Array] + required :tags, Imagekit::Internal::Type::ArrayOf[String] + + # @!method initialize(file_ids:, tags:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkRemoveTagsParams} for more details. + # + # @param file_ids [Array] An array of fileIds from which you want to remove tags. + # + # @param tags [Array] An array of tags that you want to remove from the files. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/bulk_remove_tags_response.rb b/lib/imagekit/models/files/bulk_remove_tags_response.rb new file mode 100644 index 00000000..a36571e3 --- /dev/null +++ b/lib/imagekit/models/files/bulk_remove_tags_response.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Bulk#remove_tags + class BulkRemoveTagsResponse < Imagekit::Internal::Type::BaseModel + # @!attribute successfully_updated_file_ids + # An array of fileIds that in which tags were successfully removed. + # + # @return [Array, nil] + optional :successfully_updated_file_ids, + Imagekit::Internal::Type::ArrayOf[String], + api_name: :successfullyUpdatedFileIds + + # @!method initialize(successfully_updated_file_ids: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkRemoveTagsResponse} for more details. + # + # @param successfully_updated_file_ids [Array] An array of fileIds that in which tags were successfully removed. + end + end + end +end diff --git a/lib/imagekit/models/files/metadata_get_from_url_params.rb b/lib/imagekit/models/files/metadata_get_from_url_params.rb new file mode 100644 index 00000000..805ec5b6 --- /dev/null +++ b/lib/imagekit/models/files/metadata_get_from_url_params.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Metadata#get_from_url + class MetadataGetFromURLParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute url + # Should be a valid file URL. It should be accessible using your ImageKit.io + # account. + # + # @return [String] + required :url, String + + # @!method initialize(url:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::MetadataGetFromURLParams} for more details. + # + # @param url [String] Should be a valid file URL. It should be accessible using your ImageKit.io accou + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/metadata_get_params.rb b/lib/imagekit/models/files/metadata_get_params.rb new file mode 100644 index 00000000..c95a81e5 --- /dev/null +++ b/lib/imagekit/models/files/metadata_get_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Metadata#get + class MetadataGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/version_delete_params.rb b/lib/imagekit/models/files/version_delete_params.rb new file mode 100644 index 00000000..e17425f1 --- /dev/null +++ b/lib/imagekit/models/files/version_delete_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Versions#delete + class VersionDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_id + # + # @return [String] + required :file_id, String + + # @!method initialize(file_id:, request_options: {}) + # @param file_id [String] + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/version_delete_response.rb b/lib/imagekit/models/files/version_delete_response.rb new file mode 100644 index 00000000..7f044266 --- /dev/null +++ b/lib/imagekit/models/files/version_delete_response.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Versions#delete + class VersionDeleteResponse < Imagekit::Internal::Type::BaseModel + # @!method initialize + end + end + end +end diff --git a/lib/imagekit/models/files/version_get_params.rb b/lib/imagekit/models/files/version_get_params.rb new file mode 100644 index 00000000..b4c7ae98 --- /dev/null +++ b/lib/imagekit/models/files/version_get_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Versions#get + class VersionGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_id + # + # @return [String] + required :file_id, String + + # @!method initialize(file_id:, request_options: {}) + # @param file_id [String] + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/version_list_params.rb b/lib/imagekit/models/files/version_list_params.rb new file mode 100644 index 00000000..82bf2cc3 --- /dev/null +++ b/lib/imagekit/models/files/version_list_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Versions#list + class VersionListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/files/version_list_response.rb b/lib/imagekit/models/files/version_list_response.rb new file mode 100644 index 00000000..b74454e4 --- /dev/null +++ b/lib/imagekit/models/files/version_list_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @type [Imagekit::Internal::Type::Converter] + VersionListResponse = Imagekit::Internal::Type::ArrayOf[-> { Imagekit::File }] + end + end +end diff --git a/lib/imagekit/models/files/version_restore_params.rb b/lib/imagekit/models/files/version_restore_params.rb new file mode 100644 index 00000000..bf1e8c63 --- /dev/null +++ b/lib/imagekit/models/files/version_restore_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Files + # @see Imagekit::Resources::Files::Versions#restore + class VersionRestoreParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute file_id + # + # @return [String] + required :file_id, String + + # @!method initialize(file_id:, request_options: {}) + # @param file_id [String] + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/folder.rb b/lib/imagekit/models/folder.rb new file mode 100644 index 00000000..832ae2a1 --- /dev/null +++ b/lib/imagekit/models/folder.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class Folder < Imagekit::Internal::Type::BaseModel + # @!attribute created_at + # Date and time when the folder was created. The date and time is in ISO8601 + # format. + # + # @return [Time, nil] + optional :created_at, Time, api_name: :createdAt + + # @!attribute folder_id + # Unique identifier of the asset. + # + # @return [String, nil] + optional :folder_id, String, api_name: :folderId + + # @!attribute folder_path + # Path of the folder. This is the path you would use in the URL to access the + # folder. For example, if the folder is at the root of the media library, the path + # will be /folder. If the folder is inside another folder named images, the path + # will be /images/folder. + # + # @return [String, nil] + optional :folder_path, String, api_name: :folderPath + + # @!attribute name + # Name of the asset. + # + # @return [String, nil] + optional :name, String + + # @!attribute type + # Type of the asset. + # + # @return [Symbol, Imagekit::Models::Folder::Type, nil] + optional :type, enum: -> { Imagekit::Folder::Type } + + # @!attribute updated_at + # Date and time when the folder was last updated. The date and time is in ISO8601 + # format. + # + # @return [Time, nil] + optional :updated_at, Time, api_name: :updatedAt + + # @!method initialize(created_at: nil, folder_id: nil, folder_path: nil, name: nil, type: nil, updated_at: nil) + # Some parameter documentations has been truncated, see {Imagekit::Models::Folder} + # for more details. + # + # @param created_at [Time] Date and time when the folder was created. The date and time is in ISO8601 forma + # + # @param folder_id [String] Unique identifier of the asset. + # + # @param folder_path [String] Path of the folder. This is the path you would use in the URL to access the fold + # + # @param name [String] Name of the asset. + # + # @param type [Symbol, Imagekit::Models::Folder::Type] Type of the asset. + # + # @param updated_at [Time] Date and time when the folder was last updated. The date and time is in ISO8601 + + # Type of the asset. + # + # @see Imagekit::Models::Folder#type + module Type + extend Imagekit::Internal::Type::Enum + + FOLDER = :folder + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/imagekit/models/folder_copy_params.rb b/lib/imagekit/models/folder_copy_params.rb new file mode 100644 index 00000000..fabc4272 --- /dev/null +++ b/lib/imagekit/models/folder_copy_params.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#copy + class FolderCopyParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute destination_path + # Full path to the destination folder where you want to copy the source folder + # into. + # + # @return [String] + required :destination_path, String, api_name: :destinationPath + + # @!attribute source_folder_path + # The full path to the source folder you want to copy. + # + # @return [String] + required :source_folder_path, String, api_name: :sourceFolderPath + + # @!attribute include_versions + # Option to copy all versions of files that are nested inside the selected folder. + # By default, only the current version of each file will be copied. When set to + # true, all versions of each file will be copied. Default value - `false`. + # + # @return [Boolean, nil] + optional :include_versions, Imagekit::Internal::Type::Boolean, api_name: :includeVersions + + # @!method initialize(destination_path:, source_folder_path:, include_versions: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderCopyParams} for more details. + # + # @param destination_path [String] Full path to the destination folder where you want to copy the source folder int + # + # @param source_folder_path [String] The full path to the source folder you want to copy. + # + # @param include_versions [Boolean] Option to copy all versions of files that are nested inside the selected folder. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/folder_copy_response.rb b/lib/imagekit/models/folder_copy_response.rb new file mode 100644 index 00000000..a9deadc1 --- /dev/null +++ b/lib/imagekit/models/folder_copy_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#copy + class FolderCopyResponse < Imagekit::Internal::Type::BaseModel + # @!attribute job_id + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + # + # @return [String] + required :job_id, String, api_name: :jobId + + # @!method initialize(job_id:) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderCopyResponse} for more details. + # + # Job submitted successfully. A `jobId` will be returned. + # + # @param job_id [String] Unique identifier of the bulk job. This can be used to check the status of the b + end + end +end diff --git a/lib/imagekit/models/folder_create_params.rb b/lib/imagekit/models/folder_create_params.rb new file mode 100644 index 00000000..05138b5b --- /dev/null +++ b/lib/imagekit/models/folder_create_params.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#create + class FolderCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute folder_name + # The folder will be created with this name. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) will be replaced by an underscore i.e. + # `_`. + # + # @return [String] + required :folder_name, String, api_name: :folderName + + # @!attribute parent_folder_path + # The folder where the new folder should be created, for root use `/` else the + # path e.g. `containing/folder/`. + # + # Note: If any folder(s) is not present in the parentFolderPath parameter, it will + # be automatically created. For example, if you pass `/product/images/summer`, + # then `product`, `images`, and `summer` folders will be created if they don't + # already exist. + # + # @return [String] + required :parent_folder_path, String, api_name: :parentFolderPath + + # @!method initialize(folder_name:, parent_folder_path:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderCreateParams} for more details. + # + # @param folder_name [String] The folder will be created with this name. + # + # @param parent_folder_path [String] The folder where the new folder should be created, for root use `/` else the pat + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/folder_create_response.rb b/lib/imagekit/models/folder_create_response.rb new file mode 100644 index 00000000..6dab708e --- /dev/null +++ b/lib/imagekit/models/folder_create_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#create + class FolderCreateResponse < Imagekit::Internal::Type::BaseModel + # @!method initialize + end + end +end diff --git a/lib/imagekit/models/folder_delete_params.rb b/lib/imagekit/models/folder_delete_params.rb new file mode 100644 index 00000000..8f4480d7 --- /dev/null +++ b/lib/imagekit/models/folder_delete_params.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#delete + class FolderDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute folder_path + # Full path to the folder you want to delete. For example `/folder/to/delete/`. + # + # @return [String] + required :folder_path, String, api_name: :folderPath + + # @!method initialize(folder_path:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderDeleteParams} for more details. + # + # @param folder_path [String] Full path to the folder you want to delete. For example `/folder/to/delete/`. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/folder_delete_response.rb b/lib/imagekit/models/folder_delete_response.rb new file mode 100644 index 00000000..c92e4aa9 --- /dev/null +++ b/lib/imagekit/models/folder_delete_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#delete + class FolderDeleteResponse < Imagekit::Internal::Type::BaseModel + # @!method initialize + end + end +end diff --git a/lib/imagekit/models/folder_move_params.rb b/lib/imagekit/models/folder_move_params.rb new file mode 100644 index 00000000..86d6ccc9 --- /dev/null +++ b/lib/imagekit/models/folder_move_params.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#move + class FolderMoveParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute destination_path + # Full path to the destination folder where you want to move the source folder + # into. + # + # @return [String] + required :destination_path, String, api_name: :destinationPath + + # @!attribute source_folder_path + # The full path to the source folder you want to move. + # + # @return [String] + required :source_folder_path, String, api_name: :sourceFolderPath + + # @!method initialize(destination_path:, source_folder_path:, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderMoveParams} for more details. + # + # @param destination_path [String] Full path to the destination folder where you want to move the source folder int + # + # @param source_folder_path [String] The full path to the source folder you want to move. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/folder_move_response.rb b/lib/imagekit/models/folder_move_response.rb new file mode 100644 index 00000000..8fa4b3ef --- /dev/null +++ b/lib/imagekit/models/folder_move_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#move + class FolderMoveResponse < Imagekit::Internal::Type::BaseModel + # @!attribute job_id + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + # + # @return [String] + required :job_id, String, api_name: :jobId + + # @!method initialize(job_id:) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderMoveResponse} for more details. + # + # Job submitted successfully. A `jobId` will be returned. + # + # @param job_id [String] Unique identifier of the bulk job. This can be used to check the status of the b + end + end +end diff --git a/lib/imagekit/models/folder_rename_params.rb b/lib/imagekit/models/folder_rename_params.rb new file mode 100644 index 00000000..071d74c4 --- /dev/null +++ b/lib/imagekit/models/folder_rename_params.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#rename + class FolderRenameParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!attribute folder_path + # The full path to the folder you want to rename. + # + # @return [String] + required :folder_path, String, api_name: :folderPath + + # @!attribute new_folder_name + # The new name for the folder. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) and `-` will be replaced by an + # underscore i.e. `_`. + # + # @return [String] + required :new_folder_name, String, api_name: :newFolderName + + # @!attribute purge_cache + # Option to purge cache for the old nested files and their versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove the cached content of the old nested files and their versions. There will + # only be one purge request for all the nested files, which will be counted + # against your monthly purge quota. + # + # Note: A purge cache request will be issued against + # `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This + # will remove all nested files, their versions' URLs, and any transformations made + # using query parameters on these files or their versions. However, the cache for + # file transformations made using path parameters will persist. You can purge them + # using the purge API. For more details, refer to the purge API documentation. + # + # Default value - `false` + # + # @return [Boolean, nil] + optional :purge_cache, Imagekit::Internal::Type::Boolean, api_name: :purgeCache + + # @!method initialize(folder_path:, new_folder_name:, purge_cache: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderRenameParams} for more details. + # + # @param folder_path [String] The full path to the folder you want to rename. + # + # @param new_folder_name [String] The new name for the folder. + # + # @param purge_cache [Boolean] Option to purge cache for the old nested files and their versions' URLs. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/folder_rename_response.rb b/lib/imagekit/models/folder_rename_response.rb new file mode 100644 index 00000000..0ac8984b --- /dev/null +++ b/lib/imagekit/models/folder_rename_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Folders#rename + class FolderRenameResponse < Imagekit::Internal::Type::BaseModel + # @!attribute job_id + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + # + # @return [String] + required :job_id, String, api_name: :jobId + + # @!method initialize(job_id:) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderRenameResponse} for more details. + # + # Job submitted successfully. A `jobId` will be returned. + # + # @param job_id [String] Unique identifier of the bulk job. This can be used to check the status of the b + end + end +end diff --git a/lib/imagekit/models/folders/job_get_params.rb b/lib/imagekit/models/folders/job_get_params.rb new file mode 100644 index 00000000..916f9213 --- /dev/null +++ b/lib/imagekit/models/folders/job_get_params.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Folders + # @see Imagekit::Resources::Folders::Job#get + class JobGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/imagekit/models/folders/job_get_response.rb b/lib/imagekit/models/folders/job_get_response.rb new file mode 100644 index 00000000..efd0d528 --- /dev/null +++ b/lib/imagekit/models/folders/job_get_response.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module Folders + # @see Imagekit::Resources::Folders::Job#get + class JobGetResponse < Imagekit::Internal::Type::BaseModel + # @!attribute job_id + # Unique identifier of the bulk job. + # + # @return [String, nil] + optional :job_id, String, api_name: :jobId + + # @!attribute purge_request_id + # Unique identifier of the purge request. This will be present only if + # `purgeCache` is set to `true` in the rename folder API request. + # + # @return [String, nil] + optional :purge_request_id, String, api_name: :purgeRequestId + + # @!attribute status + # Status of the bulk job. + # + # @return [Symbol, Imagekit::Models::Folders::JobGetResponse::Status, nil] + optional :status, enum: -> { Imagekit::Models::Folders::JobGetResponse::Status } + + # @!attribute type + # Type of the bulk job. + # + # @return [Symbol, Imagekit::Models::Folders::JobGetResponse::Type, nil] + optional :type, enum: -> { Imagekit::Models::Folders::JobGetResponse::Type } + + # @!method initialize(job_id: nil, purge_request_id: nil, status: nil, type: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Folders::JobGetResponse} for more details. + # + # @param job_id [String] Unique identifier of the bulk job. + # + # @param purge_request_id [String] Unique identifier of the purge request. This will be present only if `purgeCache + # + # @param status [Symbol, Imagekit::Models::Folders::JobGetResponse::Status] Status of the bulk job. + # + # @param type [Symbol, Imagekit::Models::Folders::JobGetResponse::Type] Type of the bulk job. + + # Status of the bulk job. + # + # @see Imagekit::Models::Folders::JobGetResponse#status + module Status + extend Imagekit::Internal::Type::Enum + + PENDING = :Pending + COMPLETED = :Completed + + # @!method self.values + # @return [Array] + end + + # Type of the bulk job. + # + # @see Imagekit::Models::Folders::JobGetResponse#type + module Type + extend Imagekit::Internal::Type::Enum + + COPY_FOLDER = :COPY_FOLDER + MOVE_FOLDER = :MOVE_FOLDER + RENAME_FOLDER = :RENAME_FOLDER + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/imagekit/models/image_overlay.rb b/lib/imagekit/models/image_overlay.rb new file mode 100644 index 00000000..acd5bca8 --- /dev/null +++ b/lib/imagekit/models/image_overlay.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class ImageOverlay < Imagekit::Models::BaseOverlay + # @!attribute input + # Specifies the relative path to the image used as an overlay. + # + # @return [String] + required :input, String + + # @!attribute type + # + # @return [Symbol, :image] + required :type, const: :image + + # @!attribute encoding + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + # + # @return [Symbol, Imagekit::Models::ImageOverlay::Encoding, nil] + optional :encoding, enum: -> { Imagekit::ImageOverlay::Encoding } + + # @!attribute transformation + # Array of transformations to be applied to the overlay image. Supported + # transformations depends on the base/parent asset. See overlays on + # [Images](https://imagekit.io/docs/add-overlays-on-images#list-of-supported-image-transformations-in-image-layers) + # and + # [Videos](https://imagekit.io/docs/add-overlays-on-videos#list-of-transformations-supported-on-image-overlay). + # + # @return [Array, nil] + optional :transformation, -> { Imagekit::Internal::Type::ArrayOf[Imagekit::Transformation] } + + # @!method initialize(input:, encoding: nil, transformation: nil, type: :image) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::ImageOverlay} for more details. + # + # @param input [String] Specifies the relative path to the image used as an overlay. + # + # @param encoding [Symbol, Imagekit::Models::ImageOverlay::Encoding] The input path can be included in the layer as either `i-{input}` or `ie-{base64 + # + # @param transformation [Array] Array of transformations to be applied to the overlay image. Supported transform + # + # @param type [Symbol, :image] + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO = :auto + PLAIN = :plain + BASE64 = :base64 + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/imagekit/models/metadata.rb b/lib/imagekit/models/metadata.rb new file mode 100644 index 00000000..c02910dd --- /dev/null +++ b/lib/imagekit/models/metadata.rb @@ -0,0 +1,483 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class Metadata < Imagekit::Internal::Type::BaseModel + # @!attribute audio_codec + # The audio codec used in the video (only for video). + # + # @return [String, nil] + optional :audio_codec, String, api_name: :audioCodec + + # @!attribute bit_rate + # The bit rate of the video in kbps (only for video). + # + # @return [Integer, nil] + optional :bit_rate, Integer, api_name: :bitRate + + # @!attribute density + # The density of the image in DPI. + # + # @return [Integer, nil] + optional :density, Integer + + # @!attribute duration + # The duration of the video in seconds (only for video). + # + # @return [Integer, nil] + optional :duration, Integer + + # @!attribute exif + # + # @return [Imagekit::Models::Metadata::Exif, nil] + optional :exif, -> { Imagekit::Metadata::Exif } + + # @!attribute format_ + # The format of the file (e.g., 'jpg', 'mp4'). + # + # @return [String, nil] + optional :format_, String, api_name: :format + + # @!attribute has_color_profile + # Indicates if the image has a color profile. + # + # @return [Boolean, nil] + optional :has_color_profile, Imagekit::Internal::Type::Boolean, api_name: :hasColorProfile + + # @!attribute has_transparency + # Indicates if the image contains transparent areas. + # + # @return [Boolean, nil] + optional :has_transparency, Imagekit::Internal::Type::Boolean, api_name: :hasTransparency + + # @!attribute height + # The height of the image or video in pixels. + # + # @return [Integer, nil] + optional :height, Integer + + # @!attribute p_hash + # Perceptual hash of the image. + # + # @return [String, nil] + optional :p_hash, String, api_name: :pHash + + # @!attribute quality + # The quality indicator of the image. + # + # @return [Integer, nil] + optional :quality, Integer + + # @!attribute size + # The file size in bytes. + # + # @return [Integer, nil] + optional :size, Integer + + # @!attribute video_codec + # The video codec used in the video (only for video). + # + # @return [String, nil] + optional :video_codec, String, api_name: :videoCodec + + # @!attribute width + # The width of the image or video in pixels. + # + # @return [Integer, nil] + optional :width, Integer + + # @!method initialize(audio_codec: nil, bit_rate: nil, density: nil, duration: nil, exif: nil, format_: nil, has_color_profile: nil, has_transparency: nil, height: nil, p_hash: nil, quality: nil, size: nil, video_codec: nil, width: nil) + # JSON object containing metadata. + # + # @param audio_codec [String] The audio codec used in the video (only for video). + # + # @param bit_rate [Integer] The bit rate of the video in kbps (only for video). + # + # @param density [Integer] The density of the image in DPI. + # + # @param duration [Integer] The duration of the video in seconds (only for video). + # + # @param exif [Imagekit::Models::Metadata::Exif] + # + # @param format_ [String] The format of the file (e.g., 'jpg', 'mp4'). + # + # @param has_color_profile [Boolean] Indicates if the image has a color profile. + # + # @param has_transparency [Boolean] Indicates if the image contains transparent areas. + # + # @param height [Integer] The height of the image or video in pixels. + # + # @param p_hash [String] Perceptual hash of the image. + # + # @param quality [Integer] The quality indicator of the image. + # + # @param size [Integer] The file size in bytes. + # + # @param video_codec [String] The video codec used in the video (only for video). + # + # @param width [Integer] The width of the image or video in pixels. + + # @see Imagekit::Models::Metadata#exif + class Exif < Imagekit::Internal::Type::BaseModel + # @!attribute exif + # Object containing Exif details. + # + # @return [Imagekit::Models::Metadata::Exif::Exif, nil] + optional :exif, -> { Imagekit::Metadata::Exif::Exif } + + # @!attribute gps + # Object containing GPS information. + # + # @return [Imagekit::Models::Metadata::Exif::Gps, nil] + optional :gps, -> { Imagekit::Metadata::Exif::Gps } + + # @!attribute image + # Object containing EXIF image information. + # + # @return [Imagekit::Models::Metadata::Exif::Image, nil] + optional :image, -> { Imagekit::Metadata::Exif::Image } + + # @!attribute interoperability + # JSON object. + # + # @return [Imagekit::Models::Metadata::Exif::Interoperability, nil] + optional :interoperability, -> { Imagekit::Metadata::Exif::Interoperability } + + # @!attribute makernote + # + # @return [Hash{Symbol=>Object}, nil] + optional :makernote, Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown] + + # @!attribute thumbnail + # Object containing Thumbnail information. + # + # @return [Imagekit::Models::Metadata::Exif::Thumbnail, nil] + optional :thumbnail, -> { Imagekit::Metadata::Exif::Thumbnail } + + # @!method initialize(exif: nil, gps: nil, image: nil, interoperability: nil, makernote: nil, thumbnail: nil) + # @param exif [Imagekit::Models::Metadata::Exif::Exif] Object containing Exif details. + # + # @param gps [Imagekit::Models::Metadata::Exif::Gps] Object containing GPS information. + # + # @param image [Imagekit::Models::Metadata::Exif::Image] Object containing EXIF image information. + # + # @param interoperability [Imagekit::Models::Metadata::Exif::Interoperability] JSON object. + # + # @param makernote [Hash{Symbol=>Object}] + # + # @param thumbnail [Imagekit::Models::Metadata::Exif::Thumbnail] Object containing Thumbnail information. + + # @see Imagekit::Models::Metadata::Exif#exif + class Exif < Imagekit::Internal::Type::BaseModel + # @!attribute aperture_value + # + # @return [Float, nil] + optional :aperture_value, Float, api_name: :ApertureValue + + # @!attribute color_space + # + # @return [Integer, nil] + optional :color_space, Integer, api_name: :ColorSpace + + # @!attribute create_date + # + # @return [String, nil] + optional :create_date, String, api_name: :CreateDate + + # @!attribute custom_rendered + # + # @return [Integer, nil] + optional :custom_rendered, Integer, api_name: :CustomRendered + + # @!attribute date_time_original + # + # @return [String, nil] + optional :date_time_original, String, api_name: :DateTimeOriginal + + # @!attribute exif_image_height + # + # @return [Integer, nil] + optional :exif_image_height, Integer, api_name: :ExifImageHeight + + # @!attribute exif_image_width + # + # @return [Integer, nil] + optional :exif_image_width, Integer, api_name: :ExifImageWidth + + # @!attribute exif_version + # + # @return [String, nil] + optional :exif_version, String, api_name: :ExifVersion + + # @!attribute exposure_compensation + # + # @return [Float, nil] + optional :exposure_compensation, Float, api_name: :ExposureCompensation + + # @!attribute exposure_mode + # + # @return [Integer, nil] + optional :exposure_mode, Integer, api_name: :ExposureMode + + # @!attribute exposure_program + # + # @return [Integer, nil] + optional :exposure_program, Integer, api_name: :ExposureProgram + + # @!attribute exposure_time + # + # @return [Float, nil] + optional :exposure_time, Float, api_name: :ExposureTime + + # @!attribute flash + # + # @return [Integer, nil] + optional :flash, Integer, api_name: :Flash + + # @!attribute flashpix_version + # + # @return [String, nil] + optional :flashpix_version, String, api_name: :FlashpixVersion + + # @!attribute f_number + # + # @return [Float, nil] + optional :f_number, Float, api_name: :FNumber + + # @!attribute focal_length + # + # @return [Integer, nil] + optional :focal_length, Integer, api_name: :FocalLength + + # @!attribute focal_plane_resolution_unit + # + # @return [Integer, nil] + optional :focal_plane_resolution_unit, Integer, api_name: :FocalPlaneResolutionUnit + + # @!attribute focal_plane_x_resolution + # + # @return [Float, nil] + optional :focal_plane_x_resolution, Float, api_name: :FocalPlaneXResolution + + # @!attribute focal_plane_y_resolution + # + # @return [Float, nil] + optional :focal_plane_y_resolution, Float, api_name: :FocalPlaneYResolution + + # @!attribute interop_offset + # + # @return [Integer, nil] + optional :interop_offset, Integer, api_name: :InteropOffset + + # @!attribute iso + # + # @return [Integer, nil] + optional :iso, Integer, api_name: :ISO + + # @!attribute metering_mode + # + # @return [Integer, nil] + optional :metering_mode, Integer, api_name: :MeteringMode + + # @!attribute scene_capture_type + # + # @return [Integer, nil] + optional :scene_capture_type, Integer, api_name: :SceneCaptureType + + # @!attribute shutter_speed_value + # + # @return [Float, nil] + optional :shutter_speed_value, Float, api_name: :ShutterSpeedValue + + # @!attribute sub_sec_time + # + # @return [String, nil] + optional :sub_sec_time, String, api_name: :SubSecTime + + # @!attribute white_balance + # + # @return [Integer, nil] + optional :white_balance, Integer, api_name: :WhiteBalance + + # @!method initialize(aperture_value: nil, color_space: nil, create_date: nil, custom_rendered: nil, date_time_original: nil, exif_image_height: nil, exif_image_width: nil, exif_version: nil, exposure_compensation: nil, exposure_mode: nil, exposure_program: nil, exposure_time: nil, flash: nil, flashpix_version: nil, f_number: nil, focal_length: nil, focal_plane_resolution_unit: nil, focal_plane_x_resolution: nil, focal_plane_y_resolution: nil, interop_offset: nil, iso: nil, metering_mode: nil, scene_capture_type: nil, shutter_speed_value: nil, sub_sec_time: nil, white_balance: nil) + # Object containing Exif details. + # + # @param aperture_value [Float] + # @param color_space [Integer] + # @param create_date [String] + # @param custom_rendered [Integer] + # @param date_time_original [String] + # @param exif_image_height [Integer] + # @param exif_image_width [Integer] + # @param exif_version [String] + # @param exposure_compensation [Float] + # @param exposure_mode [Integer] + # @param exposure_program [Integer] + # @param exposure_time [Float] + # @param flash [Integer] + # @param flashpix_version [String] + # @param f_number [Float] + # @param focal_length [Integer] + # @param focal_plane_resolution_unit [Integer] + # @param focal_plane_x_resolution [Float] + # @param focal_plane_y_resolution [Float] + # @param interop_offset [Integer] + # @param iso [Integer] + # @param metering_mode [Integer] + # @param scene_capture_type [Integer] + # @param shutter_speed_value [Float] + # @param sub_sec_time [String] + # @param white_balance [Integer] + end + + # @see Imagekit::Models::Metadata::Exif#gps + class Gps < Imagekit::Internal::Type::BaseModel + # @!attribute gps_version_id + # + # @return [Array, nil] + optional :gps_version_id, Imagekit::Internal::Type::ArrayOf[Integer], api_name: :GPSVersionID + + # @!method initialize(gps_version_id: nil) + # Object containing GPS information. + # + # @param gps_version_id [Array] + end + + # @see Imagekit::Models::Metadata::Exif#image + class Image < Imagekit::Internal::Type::BaseModel + # @!attribute exif_offset + # + # @return [Integer, nil] + optional :exif_offset, Integer, api_name: :ExifOffset + + # @!attribute gps_info + # + # @return [Integer, nil] + optional :gps_info, Integer, api_name: :GPSInfo + + # @!attribute make + # + # @return [String, nil] + optional :make, String, api_name: :Make + + # @!attribute model + # + # @return [String, nil] + optional :model, String, api_name: :Model + + # @!attribute modify_date + # + # @return [String, nil] + optional :modify_date, String, api_name: :ModifyDate + + # @!attribute orientation + # + # @return [Integer, nil] + optional :orientation, Integer, api_name: :Orientation + + # @!attribute resolution_unit + # + # @return [Integer, nil] + optional :resolution_unit, Integer, api_name: :ResolutionUnit + + # @!attribute software + # + # @return [String, nil] + optional :software, String, api_name: :Software + + # @!attribute x_resolution + # + # @return [Integer, nil] + optional :x_resolution, Integer, api_name: :XResolution + + # @!attribute y_cb_cr_positioning + # + # @return [Integer, nil] + optional :y_cb_cr_positioning, Integer, api_name: :YCbCrPositioning + + # @!attribute y_resolution + # + # @return [Integer, nil] + optional :y_resolution, Integer, api_name: :YResolution + + # @!method initialize(exif_offset: nil, gps_info: nil, make: nil, model: nil, modify_date: nil, orientation: nil, resolution_unit: nil, software: nil, x_resolution: nil, y_cb_cr_positioning: nil, y_resolution: nil) + # Object containing EXIF image information. + # + # @param exif_offset [Integer] + # @param gps_info [Integer] + # @param make [String] + # @param model [String] + # @param modify_date [String] + # @param orientation [Integer] + # @param resolution_unit [Integer] + # @param software [String] + # @param x_resolution [Integer] + # @param y_cb_cr_positioning [Integer] + # @param y_resolution [Integer] + end + + # @see Imagekit::Models::Metadata::Exif#interoperability + class Interoperability < Imagekit::Internal::Type::BaseModel + # @!attribute interop_index + # + # @return [String, nil] + optional :interop_index, String, api_name: :InteropIndex + + # @!attribute interop_version + # + # @return [String, nil] + optional :interop_version, String, api_name: :InteropVersion + + # @!method initialize(interop_index: nil, interop_version: nil) + # JSON object. + # + # @param interop_index [String] + # @param interop_version [String] + end + + # @see Imagekit::Models::Metadata::Exif#thumbnail + class Thumbnail < Imagekit::Internal::Type::BaseModel + # @!attribute compression + # + # @return [Integer, nil] + optional :compression, Integer, api_name: :Compression + + # @!attribute resolution_unit + # + # @return [Integer, nil] + optional :resolution_unit, Integer, api_name: :ResolutionUnit + + # @!attribute thumbnail_length + # + # @return [Integer, nil] + optional :thumbnail_length, Integer, api_name: :ThumbnailLength + + # @!attribute thumbnail_offset + # + # @return [Integer, nil] + optional :thumbnail_offset, Integer, api_name: :ThumbnailOffset + + # @!attribute x_resolution + # + # @return [Integer, nil] + optional :x_resolution, Integer, api_name: :XResolution + + # @!attribute y_resolution + # + # @return [Integer, nil] + optional :y_resolution, Integer, api_name: :YResolution + + # @!method initialize(compression: nil, resolution_unit: nil, thumbnail_length: nil, thumbnail_offset: nil, x_resolution: nil, y_resolution: nil) + # Object containing Thumbnail information. + # + # @param compression [Integer] + # @param resolution_unit [Integer] + # @param thumbnail_length [Integer] + # @param thumbnail_offset [Integer] + # @param x_resolution [Integer] + # @param y_resolution [Integer] + end + end + end + end +end diff --git a/lib/imagekit/models/overlay.rb b/lib/imagekit/models/overlay.rb new file mode 100644 index 00000000..3c1873ca --- /dev/null +++ b/lib/imagekit/models/overlay.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # Specifies an overlay to be applied on the parent image or video. ImageKit + # supports overlays including images, text, videos, subtitles, and solid colors. + # See + # [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers). + module Overlay + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :text, -> { Imagekit::TextOverlay } + + variant :image, -> { Imagekit::ImageOverlay } + + variant :video, -> { Imagekit::VideoOverlay } + + variant :subtitle, -> { Imagekit::SubtitleOverlay } + + variant :solidColor, -> { Imagekit::SolidColorOverlay } + + # @!method self.variants + # @return [Array(Imagekit::Models::TextOverlay, Imagekit::Models::ImageOverlay, Imagekit::Models::VideoOverlay, Imagekit::Models::SubtitleOverlay, Imagekit::Models::SolidColorOverlay)] + end + end +end diff --git a/lib/imagekit/models/overlay_position.rb b/lib/imagekit/models/overlay_position.rb new file mode 100644 index 00000000..1613fe15 --- /dev/null +++ b/lib/imagekit/models/overlay_position.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class OverlayPosition < Imagekit::Internal::Type::BaseModel + # @!attribute focus + # Specifies the position of the overlay relative to the parent image or video. + # Maps to `lfo` in the URL. + # + # @return [Symbol, Imagekit::Models::OverlayPosition::Focus, nil] + optional :focus, enum: -> { Imagekit::OverlayPosition::Focus } + + # @!attribute x + # Specifies the x-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bw_mul_0.4` or `bw_sub_cw`. Maps to `lx` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @return [Float, String, nil] + optional :x, union: -> { Imagekit::OverlayPosition::X } + + # @!attribute y_ + # Specifies the y-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bh_mul_0.4` or `bh_sub_ch`. Maps to `ly` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @return [Float, String, nil] + optional :y_, union: -> { Imagekit::OverlayPosition::Y }, api_name: :y + + # @!method initialize(focus: nil, x: nil, y_: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::OverlayPosition} for more details. + # + # @param focus [Symbol, Imagekit::Models::OverlayPosition::Focus] Specifies the position of the overlay relative to the parent image or video. + # + # @param x [Float, String] Specifies the x-coordinate of the top-left corner of the base asset where the ov + # + # @param y_ [Float, String] Specifies the y-coordinate of the top-left corner of the base asset where the ov + + # Specifies the position of the overlay relative to the parent image or video. + # Maps to `lfo` in the URL. + # + # @see Imagekit::Models::OverlayPosition#focus + module Focus + extend Imagekit::Internal::Type::Enum + + CENTER = :center + TOP = :top + LEFT = :left + BOTTOM = :bottom + RIGHT = :right + TOP_LEFT = :top_left + TOP_RIGHT = :top_right + BOTTOM_LEFT = :bottom_left + BOTTOM_RIGHT = :bottom_right + + # @!method self.values + # @return [Array] + end + + # Specifies the x-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bw_mul_0.4` or `bw_sub_cw`. Maps to `lx` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @see Imagekit::Models::OverlayPosition#x + module X + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the y-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bh_mul_0.4` or `bh_sub_ch`. Maps to `ly` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @see Imagekit::Models::OverlayPosition#y_ + module Y + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + end + end +end diff --git a/lib/imagekit/models/overlay_timing.rb b/lib/imagekit/models/overlay_timing.rb new file mode 100644 index 00000000..7e399421 --- /dev/null +++ b/lib/imagekit/models/overlay_timing.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class OverlayTiming < Imagekit::Internal::Type::BaseModel + # @!attribute duration + # Specifies the duration (in seconds) during which the overlay should appear on + # the base video. Accepts a positive number up to two decimal places (e.g., `20` + # or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `ldu` in the URL. + # + # @return [Float, String, nil] + optional :duration, union: -> { Imagekit::OverlayTiming::Duration } + + # @!attribute end_ + # Specifies the end time (in seconds) for when the overlay should disappear from + # the base video. If both end and duration are provided, duration is ignored. + # Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and + # arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if + # the base asset is a video. Maps to `leo` in the URL. + # + # @return [Float, String, nil] + optional :end_, union: -> { Imagekit::OverlayTiming::End }, api_name: :end + + # @!attribute start + # Specifies the start time (in seconds) for when the overlay should appear on the + # base video. Accepts a positive number up to two decimal places (e.g., `20` or + # `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `lso` in the URL. + # + # @return [Float, String, nil] + optional :start, union: -> { Imagekit::OverlayTiming::Start } + + # @!method initialize(duration: nil, end_: nil, start: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::OverlayTiming} for more details. + # + # @param duration [Float, String] Specifies the duration (in seconds) during which the overlay should appear on th + # + # @param end_ [Float, String] Specifies the end time (in seconds) for when the overlay should disappear from t + # + # @param start [Float, String] Specifies the start time (in seconds) for when the overlay should appear on the + + # Specifies the duration (in seconds) during which the overlay should appear on + # the base video. Accepts a positive number up to two decimal places (e.g., `20` + # or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `ldu` in the URL. + # + # @see Imagekit::Models::OverlayTiming#duration + module Duration + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the end time (in seconds) for when the overlay should disappear from + # the base video. If both end and duration are provided, duration is ignored. + # Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and + # arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if + # the base asset is a video. Maps to `leo` in the URL. + # + # @see Imagekit::Models::OverlayTiming#end_ + module End + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the start time (in seconds) for when the overlay should appear on the + # base video. Accepts a positive number up to two decimal places (e.g., `20` or + # `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `lso` in the URL. + # + # @see Imagekit::Models::OverlayTiming#start + module Start + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + end + end +end diff --git a/lib/imagekit/models/solid_color_overlay.rb b/lib/imagekit/models/solid_color_overlay.rb new file mode 100644 index 00000000..e9851237 --- /dev/null +++ b/lib/imagekit/models/solid_color_overlay.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class SolidColorOverlay < Imagekit::Models::BaseOverlay + # @!attribute color + # Specifies the color of the block using an RGB hex code (e.g., `FF0000`), an RGBA + # code (e.g., `FFAABB50`), or a color name (e.g., `red`). If an 8-character value + # is provided, the last two characters represent the opacity level (from `00` for + # 0.00 to `99` for 0.99). + # + # @return [String] + required :color, String + + # @!attribute type + # + # @return [Symbol, :solidColor] + required :type, const: :solidColor + + # @!attribute transformation + # Control width and height of the solid color overlay. Supported transformations + # depend on the base/parent asset. See overlays on + # [Images](https://imagekit.io/docs/add-overlays-on-images#apply-transformation-on-solid-color-overlay) + # and + # [Videos](https://imagekit.io/docs/add-overlays-on-videos#apply-transformations-on-solid-color-block-overlay). + # + # @return [Array, nil] + optional :transformation, + -> { Imagekit::Internal::Type::ArrayOf[Imagekit::SolidColorOverlayTransformation] } + + # @!method initialize(color:, transformation: nil, type: :solidColor) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::SolidColorOverlay} for more details. + # + # @param color [String] Specifies the color of the block using an RGB hex code (e.g., `FF0000`), an RGBA + # + # @param transformation [Array] Control width and height of the solid color overlay. Supported transformations d + # + # @param type [Symbol, :solidColor] + end + end +end diff --git a/lib/imagekit/models/solid_color_overlay_transformation.rb b/lib/imagekit/models/solid_color_overlay_transformation.rb new file mode 100644 index 00000000..dacca6bb --- /dev/null +++ b/lib/imagekit/models/solid_color_overlay_transformation.rb @@ -0,0 +1,135 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class SolidColorOverlayTransformation < Imagekit::Internal::Type::BaseModel + # @!attribute alpha + # Specifies the transparency level of the solid color overlay. Accepts integers + # from `1` to `9`. + # + # @return [Float, nil] + optional :alpha, Float + + # @!attribute background + # Specifies the background color of the solid color overlay. Accepts an RGB hex + # code (e.g., `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. + # + # @return [String, nil] + optional :background, String + + # @!attribute gradient + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. Only works if the base asset is an + # image. See + # [gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + # + # @return [Boolean, true, String, nil] + optional :gradient, union: -> { Imagekit::SolidColorOverlayTransformation::Gradient } + + # @!attribute height + # Controls the height of the solid color overlay. Accepts a numeric value or an + # arithmetic expression. Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @return [Float, String, nil] + optional :height, union: -> { Imagekit::SolidColorOverlayTransformation::Height } + + # @!attribute radius + # Specifies the corner radius of the solid color overlay. Set to `max` for + # circular or oval shape. See + # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # + # @return [Float, Symbol, :max, nil] + optional :radius, union: -> { Imagekit::SolidColorOverlayTransformation::Radius } + + # @!attribute width + # Controls the width of the solid color overlay. Accepts a numeric value or an + # arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @return [Float, String, nil] + optional :width, union: -> { Imagekit::SolidColorOverlayTransformation::Width } + + # @!method initialize(alpha: nil, background: nil, gradient: nil, height: nil, radius: nil, width: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::SolidColorOverlayTransformation} for more details. + # + # @param alpha [Float] Specifies the transparency level of the solid color overlay. Accepts integers fr + # + # @param background [String] Specifies the background color of the solid color overlay. Accepts an RGB hex co + # + # @param gradient [Boolean, true, String] Creates a linear gradient with two colors. Pass `true` for a default gradient, o + # + # @param height [Float, String] Controls the height of the solid color overlay. Accepts a numeric value or an ar + # + # @param radius [Float, Symbol, :max] Specifies the corner radius of the solid color overlay. Set to `max` for circula + # + # @param width [Float, String] Controls the width of the solid color overlay. Accepts a numeric value or an ari + + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. Only works if the base asset is an + # image. See + # [gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + # + # @see Imagekit::Models::SolidColorOverlayTransformation#gradient + module Gradient + extend Imagekit::Internal::Type::Union + + variant const: true + + variant String + + # @!method self.variants + # @return [Array(Boolean, true, String)] + end + + # Controls the height of the solid color overlay. Accepts a numeric value or an + # arithmetic expression. Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @see Imagekit::Models::SolidColorOverlayTransformation#height + module Height + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the corner radius of the solid color overlay. Set to `max` for + # circular or oval shape. See + # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # + # @see Imagekit::Models::SolidColorOverlayTransformation#radius + module Radius + extend Imagekit::Internal::Type::Union + + variant Float + + variant const: :max + + # @!method self.variants + # @return [Array(Float, Symbol, :max)] + end + + # Controls the width of the solid color overlay. Accepts a numeric value or an + # arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @see Imagekit::Models::SolidColorOverlayTransformation#width + module Width + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + end + end +end diff --git a/lib/imagekit/models/src_options.rb b/lib/imagekit/models/src_options.rb new file mode 100644 index 00000000..ed73d6c7 --- /dev/null +++ b/lib/imagekit/models/src_options.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class SrcOptions < Imagekit::Internal::Type::BaseModel + # @!attribute src + # Accepts a relative or absolute path of the resource. If a relative path is + # provided, it is appended to the `urlEndpoint`. If an absolute path is provided, + # `urlEndpoint` is ignored. + # + # @return [String] + required :src, String + + # @!attribute url_endpoint + # Get your urlEndpoint from the + # [ImageKit dashboard](https://imagekit.io/dashboard/url-endpoints). + # + # @return [String] + required :url_endpoint, String, api_name: :urlEndpoint + + # @!attribute expires_in + # When you want the signed URL to expire, specified in seconds. If `expiresIn` is + # anything above 0, the URL will always be signed even if `signed` is set to + # false. If not specified and `signed` is `true`, the signed URL will not expire + # (valid indefinitely). + # + # Example: Setting `expiresIn: 3600` will make the URL expire 1 hour from + # generation time. After the expiry time, the signed URL will no longer be valid + # and ImageKit will return a 401 Unauthorized status code. + # + # [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + # + # @return [Float, nil] + optional :expires_in, Float, api_name: :expiresIn + + # @!attribute query_parameters + # These are additional query parameters that you want to add to the final URL. + # They can be any query parameters and not necessarily related to ImageKit. This + # is especially useful if you want to add a versioning parameter to your URLs. + # + # @return [Hash{Symbol=>String}, nil] + optional :query_parameters, Imagekit::Internal::Type::HashOf[String], api_name: :queryParameters + + # @!attribute signed + # Whether to sign the URL or not. Set this to `true` if you want to generate a + # signed URL. If `signed` is `true` and `expiresIn` is not specified, the signed + # URL will not expire (valid indefinitely). Note: If `expiresIn` is set to any + # value above 0, the URL will always be signed regardless of this setting. + # [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + # + # @return [Boolean, nil] + optional :signed, Imagekit::Internal::Type::Boolean + + # @!attribute transformation + # An array of objects specifying the transformations to be applied in the URL. If + # more than one transformation is specified, they are applied in the order they + # are specified as chained transformations. See + # [Chained transformations](https://imagekit.io/docs/transformations#chained-transformations). + # + # @return [Array, nil] + optional :transformation, -> { Imagekit::Internal::Type::ArrayOf[Imagekit::Transformation] } + + # @!attribute transformation_position + # By default, the transformation string is added as a query parameter in the URL, + # e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the + # path of the URL, set this to `path`. Learn more in the + # [Transformations guide](https://imagekit.io/docs/transformations). + # + # @return [Symbol, Imagekit::Models::TransformationPosition, nil] + optional :transformation_position, + enum: -> { Imagekit::TransformationPosition }, + api_name: :transformationPosition + + # @!method initialize(src:, url_endpoint:, expires_in: nil, query_parameters: nil, signed: nil, transformation: nil, transformation_position: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::SrcOptions} for more details. + # + # Options for generating ImageKit URLs with transformations. See the + # [Transformations guide](https://imagekit.io/docs/transformations). + # + # @param src [String] Accepts a relative or absolute path of the resource. If a relative path is provi + # + # @param url_endpoint [String] Get your urlEndpoint from the [ImageKit dashboard](https://imagekit.io/dashboard + # + # @param expires_in [Float] When you want the signed URL to expire, specified in seconds. If `expiresIn` is + # + # @param query_parameters [Hash{Symbol=>String}] These are additional query parameters that you want to add to the final URL. + # + # @param signed [Boolean] Whether to sign the URL or not. Set this to `true` if you want to generate a sig + # + # @param transformation [Array] An array of objects specifying the transformations to be applied in the URL. If + # + # @param transformation_position [Symbol, Imagekit::Models::TransformationPosition] By default, the transformation string is added as a query parameter in the URL, + end + end +end diff --git a/lib/imagekit/models/streaming_resolution.rb b/lib/imagekit/models/streaming_resolution.rb new file mode 100644 index 00000000..c30c25e1 --- /dev/null +++ b/lib/imagekit/models/streaming_resolution.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # Available streaming resolutions for + # [adaptive bitrate streaming](https://imagekit.io/docs/adaptive-bitrate-streaming) + module StreamingResolution + extend Imagekit::Internal::Type::Enum + + STREAMING_RESOLUTION_240 = :"240" + STREAMING_RESOLUTION_360 = :"360" + STREAMING_RESOLUTION_480 = :"480" + STREAMING_RESOLUTION_720 = :"720" + STREAMING_RESOLUTION_1080 = :"1080" + STREAMING_RESOLUTION_1440 = :"1440" + STREAMING_RESOLUTION_2160 = :"2160" + + # @!method self.values + # @return [Array] + end + end +end diff --git a/lib/imagekit/models/subtitle_overlay.rb b/lib/imagekit/models/subtitle_overlay.rb new file mode 100644 index 00000000..4fc0a96b --- /dev/null +++ b/lib/imagekit/models/subtitle_overlay.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class SubtitleOverlay < Imagekit::Models::BaseOverlay + # @!attribute input + # Specifies the relative path to the subtitle file used as an overlay. + # + # @return [String] + required :input, String + + # @!attribute type + # + # @return [Symbol, :subtitle] + required :type, const: :subtitle + + # @!attribute encoding + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + # + # @return [Symbol, Imagekit::Models::SubtitleOverlay::Encoding, nil] + optional :encoding, enum: -> { Imagekit::SubtitleOverlay::Encoding } + + # @!attribute transformation + # Control styling of the subtitle. See + # [Styling subtitles](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer). + # + # @return [Array, nil] + optional :transformation, + -> { Imagekit::Internal::Type::ArrayOf[Imagekit::SubtitleOverlayTransformation] } + + # @!method initialize(input:, encoding: nil, transformation: nil, type: :subtitle) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::SubtitleOverlay} for more details. + # + # @param input [String] Specifies the relative path to the subtitle file used as an overlay. + # + # @param encoding [Symbol, Imagekit::Models::SubtitleOverlay::Encoding] The input path can be included in the layer as either `i-{input}` or `ie-{base64 + # + # @param transformation [Array] Control styling of the subtitle. See [Styling subtitles](https://imagekit.io/doc + # + # @param type [Symbol, :subtitle] + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO = :auto + PLAIN = :plain + BASE64 = :base64 + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/imagekit/models/subtitle_overlay_transformation.rb b/lib/imagekit/models/subtitle_overlay_transformation.rb new file mode 100644 index 00000000..a2586ae2 --- /dev/null +++ b/lib/imagekit/models/subtitle_overlay_transformation.rb @@ -0,0 +1,113 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class SubtitleOverlayTransformation < Imagekit::Internal::Type::BaseModel + # @!attribute background + # Specifies the subtitle background color using a standard color name, an RGB + # color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # + # @return [String, nil] + optional :background, String + + # @!attribute color + # Sets the font color of the subtitle text using a standard color name, an RGB + # color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # + # @return [String, nil] + optional :color, String + + # @!attribute font_family + # Font family for subtitles. Refer to the + # [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list). + # + # @return [String, nil] + optional :font_family, String, api_name: :fontFamily + + # @!attribute font_outline + # Sets the font outline of the subtitle text. Requires the outline width (an + # integer) and the outline color (as an RGB color code, RGBA color code, or + # standard web color name) separated by an underscore. Example: `fol-2_blue` + # (outline width of 2px and outline color blue), `fol-2_A1CCDD` (outline width of + # 2px and outline color `#A1CCDD`) and `fol-2_A1CCDD50` (outline width of 2px and + # outline color `#A1CCDD` at 50% opacity). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # + # @return [String, nil] + optional :font_outline, String, api_name: :fontOutline + + # @!attribute font_shadow + # Sets the font shadow for the subtitle text. Requires the shadow color (as an RGB + # color code, RGBA color code, or standard web color name) and shadow indent (an + # integer) separated by an underscore. Example: `fsh-blue_2` (shadow color blue, + # indent of 2px), `fsh-A1CCDD_3` (shadow color `#A1CCDD`, indent of 3px), + # `fsh-A1CCDD50_3` (shadow color `#A1CCDD` at 50% opacity, indent of 3px). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # + # @return [String, nil] + optional :font_shadow, String, api_name: :fontShadow + + # @!attribute font_size + # Sets the font size of subtitle text. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # + # @return [Float, nil] + optional :font_size, Float, api_name: :fontSize + + # @!attribute typography + # Sets the typography style of the subtitle text. Supports values are `b` for + # bold, `i` for italics, and `b_i` for bold with italics. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # + # @return [Symbol, Imagekit::Models::SubtitleOverlayTransformation::Typography, nil] + optional :typography, enum: -> { Imagekit::SubtitleOverlayTransformation::Typography } + + # @!method initialize(background: nil, color: nil, font_family: nil, font_outline: nil, font_shadow: nil, font_size: nil, typography: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::SubtitleOverlayTransformation} for more details. + # + # Subtitle styling options. + # [Learn more](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # from the docs. + # + # @param background [String] Specifies the subtitle background color using a standard color name, an RGB colo + # + # @param color [String] Sets the font color of the subtitle text using a standard color name, an RGB col + # + # @param font_family [String] Font family for subtitles. Refer to the [supported fonts](https://imagekit.io/do + # + # @param font_outline [String] Sets the font outline of the subtitle text. + # + # @param font_shadow [String] Sets the font shadow for the subtitle text. + # + # @param font_size [Float] Sets the font size of subtitle text. + # + # @param typography [Symbol, Imagekit::Models::SubtitleOverlayTransformation::Typography] Sets the typography style of the subtitle text. Supports values are `b` for bold + + # Sets the typography style of the subtitle text. Supports values are `b` for + # bold, `i` for italics, and `b_i` for bold with italics. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # + # @see Imagekit::Models::SubtitleOverlayTransformation#typography + module Typography + extend Imagekit::Internal::Type::Enum + + B = :b + I = :i + B_I = :b_i + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/imagekit/models/text_overlay.rb b/lib/imagekit/models/text_overlay.rb new file mode 100644 index 00000000..523cf4ff --- /dev/null +++ b/lib/imagekit/models/text_overlay.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class TextOverlay < Imagekit::Models::BaseOverlay + # @!attribute text + # Specifies the text to be displayed in the overlay. The SDK automatically handles + # special characters and encoding. + # + # @return [String] + required :text, String + + # @!attribute type + # + # @return [Symbol, :text] + required :type, const: :text + + # @!attribute encoding + # Text can be included in the layer as either `i-{input}` (plain text) or + # `ie-{base64_encoded_input}` (base64). By default, the SDK selects the + # appropriate format based on the input text. To always use base64 + # (`ie-{base64}`), set this parameter to `base64`. To always use plain text + # (`i-{input}`), set it to `plain`. + # + # @return [Symbol, Imagekit::Models::TextOverlay::Encoding, nil] + optional :encoding, enum: -> { Imagekit::TextOverlay::Encoding } + + # @!attribute transformation + # Control styling of the text overlay. See + # [Text overlays](https://imagekit.io/docs/add-overlays-on-images#text-overlay). + # + # @return [Array, nil] + optional :transformation, -> { Imagekit::Internal::Type::ArrayOf[Imagekit::TextOverlayTransformation] } + + # @!method initialize(text:, encoding: nil, transformation: nil, type: :text) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::TextOverlay} for more details. + # + # @param text [String] Specifies the text to be displayed in the overlay. The SDK automatically handles + # + # @param encoding [Symbol, Imagekit::Models::TextOverlay::Encoding] Text can be included in the layer as either `i-{input}` (plain text) or `ie-{bas + # + # @param transformation [Array] Control styling of the text overlay. See [Text overlays](https://imagekit.io/doc + # + # @param type [Symbol, :text] + + # Text can be included in the layer as either `i-{input}` (plain text) or + # `ie-{base64_encoded_input}` (base64). By default, the SDK selects the + # appropriate format based on the input text. To always use base64 + # (`ie-{base64}`), set this parameter to `base64`. To always use plain text + # (`i-{input}`), set it to `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO = :auto + PLAIN = :plain + BASE64 = :base64 + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/imagekit/models/text_overlay_transformation.rb b/lib/imagekit/models/text_overlay_transformation.rb new file mode 100644 index 00000000..710ad972 --- /dev/null +++ b/lib/imagekit/models/text_overlay_transformation.rb @@ -0,0 +1,267 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class TextOverlayTransformation < Imagekit::Internal::Type::BaseModel + # @!attribute alpha + # Specifies the transparency level of the text overlay. Accepts integers from `1` + # to `9`. + # + # @return [Float, nil] + optional :alpha, Float + + # @!attribute background + # Specifies the background color of the text overlay. Accepts an RGB hex code, an + # RGBA code, or a color name. + # + # @return [String, nil] + optional :background, String + + # @!attribute flip + # Flip the text overlay horizontally, vertically, or both. + # + # @return [Symbol, Imagekit::Models::TextOverlayTransformation::Flip, nil] + optional :flip, enum: -> { Imagekit::TextOverlayTransformation::Flip } + + # @!attribute font_color + # Specifies the font color of the overlaid text. Accepts an RGB hex code (e.g., + # `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. + # + # @return [String, nil] + optional :font_color, String, api_name: :fontColor + + # @!attribute font_family + # Specifies the font family of the overlaid text. Choose from the supported fonts + # list or use a custom font. See + # [Supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list) + # and + # [Custom font](https://imagekit.io/docs/add-overlays-on-images#change-font-family-in-text-overlay). + # + # @return [String, nil] + optional :font_family, String, api_name: :fontFamily + + # @!attribute font_size + # Specifies the font size of the overlaid text. Accepts a numeric value or an + # arithmetic expression. + # + # @return [Float, String, nil] + optional :font_size, union: -> { Imagekit::TextOverlayTransformation::FontSize }, api_name: :fontSize + + # @!attribute inner_alignment + # Specifies the inner alignment of the text when width is more than the text + # length. + # + # @return [Symbol, Imagekit::Models::TextOverlayTransformation::InnerAlignment, nil] + optional :inner_alignment, + enum: -> { Imagekit::TextOverlayTransformation::InnerAlignment }, + api_name: :innerAlignment + + # @!attribute line_height + # Specifies the line height of the text overlay. Accepts integer values + # representing line height in points. It can also accept + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) + # such as `bw_mul_0.2`, or `bh_div_20`. + # + # @return [Float, String, nil] + optional :line_height, + union: -> { Imagekit::TextOverlayTransformation::LineHeight }, + api_name: :lineHeight + + # @!attribute padding + # Specifies the padding around the overlaid text. Can be provided as a single + # positive integer or multiple values separated by underscores (following CSS + # shorthand order). Arithmetic expressions are also accepted. + # + # @return [Float, String, nil] + optional :padding, union: -> { Imagekit::TextOverlayTransformation::Padding } + + # @!attribute radius + # Specifies the corner radius of the text overlay. Set to `max` to achieve a + # circular or oval shape. + # + # @return [Float, Symbol, :max, nil] + optional :radius, union: -> { Imagekit::TextOverlayTransformation::Radius } + + # @!attribute rotation + # Specifies the rotation angle of the text overlay. Accepts a numeric value for + # clockwise rotation or a string prefixed with "N" for counter-clockwise rotation. + # + # @return [Float, String, nil] + optional :rotation, union: -> { Imagekit::TextOverlayTransformation::Rotation } + + # @!attribute typography + # Specifies the typography style of the text. Supported values: + # + # - Single styles: `b` (bold), `i` (italic), `strikethrough`. + # - Combinations: Any combination separated by underscores, e.g., `b_i`, + # `b_i_strikethrough`. + # + # @return [String, nil] + optional :typography, String + + # @!attribute width + # Specifies the maximum width (in pixels) of the overlaid text. The text wraps + # automatically, and arithmetic expressions (e.g., `bw_mul_0.2` or `bh_div_2`) are + # supported. Useful when used in conjunction with the `background`. Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @return [Float, String, nil] + optional :width, union: -> { Imagekit::TextOverlayTransformation::Width } + + # @!method initialize(alpha: nil, background: nil, flip: nil, font_color: nil, font_family: nil, font_size: nil, inner_alignment: nil, line_height: nil, padding: nil, radius: nil, rotation: nil, typography: nil, width: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::TextOverlayTransformation} for more details. + # + # @param alpha [Float] Specifies the transparency level of the text overlay. Accepts integers from `1` + # + # @param background [String] Specifies the background color of the text overlay. + # + # @param flip [Symbol, Imagekit::Models::TextOverlayTransformation::Flip] Flip the text overlay horizontally, vertically, or both. + # + # @param font_color [String] Specifies the font color of the overlaid text. Accepts an RGB hex code (e.g., `F + # + # @param font_family [String] Specifies the font family of the overlaid text. Choose from the supported fonts + # + # @param font_size [Float, String] Specifies the font size of the overlaid text. Accepts a numeric value or an arit + # + # @param inner_alignment [Symbol, Imagekit::Models::TextOverlayTransformation::InnerAlignment] Specifies the inner alignment of the text when width is more than the text lengt + # + # @param line_height [Float, String] Specifies the line height of the text overlay. + # + # @param padding [Float, String] Specifies the padding around the overlaid text. + # + # @param radius [Float, Symbol, :max] Specifies the corner radius of the text overlay. + # + # @param rotation [Float, String] Specifies the rotation angle of the text overlay. + # + # @param typography [String] Specifies the typography style of the text. + # + # @param width [Float, String] Specifies the maximum width (in pixels) of the overlaid text. The text wraps aut + + # Flip the text overlay horizontally, vertically, or both. + # + # @see Imagekit::Models::TextOverlayTransformation#flip + module Flip + extend Imagekit::Internal::Type::Enum + + H = :h + V = :v + H_V = :h_v + V_H = :v_h + + # @!method self.values + # @return [Array] + end + + # Specifies the font size of the overlaid text. Accepts a numeric value or an + # arithmetic expression. + # + # @see Imagekit::Models::TextOverlayTransformation#font_size + module FontSize + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the inner alignment of the text when width is more than the text + # length. + # + # @see Imagekit::Models::TextOverlayTransformation#inner_alignment + module InnerAlignment + extend Imagekit::Internal::Type::Enum + + LEFT = :left + RIGHT = :right + CENTER = :center + + # @!method self.values + # @return [Array] + end + + # Specifies the line height of the text overlay. Accepts integer values + # representing line height in points. It can also accept + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) + # such as `bw_mul_0.2`, or `bh_div_20`. + # + # @see Imagekit::Models::TextOverlayTransformation#line_height + module LineHeight + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the padding around the overlaid text. Can be provided as a single + # positive integer or multiple values separated by underscores (following CSS + # shorthand order). Arithmetic expressions are also accepted. + # + # @see Imagekit::Models::TextOverlayTransformation#padding + module Padding + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the corner radius of the text overlay. Set to `max` to achieve a + # circular or oval shape. + # + # @see Imagekit::Models::TextOverlayTransformation#radius + module Radius + extend Imagekit::Internal::Type::Union + + variant Float + + variant const: :max + + # @!method self.variants + # @return [Array(Float, Symbol, :max)] + end + + # Specifies the rotation angle of the text overlay. Accepts a numeric value for + # clockwise rotation or a string prefixed with "N" for counter-clockwise rotation. + # + # @see Imagekit::Models::TextOverlayTransformation#rotation + module Rotation + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the maximum width (in pixels) of the overlaid text. The text wraps + # automatically, and arithmetic expressions (e.g., `bw_mul_0.2` or `bh_div_2`) are + # supported. Useful when used in conjunction with the `background`. Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + # + # @see Imagekit::Models::TextOverlayTransformation#width + module Width + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + end + end +end diff --git a/lib/imagekit/models/transformation.rb b/lib/imagekit/models/transformation.rb new file mode 100644 index 00000000..cd72bdb1 --- /dev/null +++ b/lib/imagekit/models/transformation.rb @@ -0,0 +1,1096 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute ai_change_background + # Uses AI to change the background. Provide a text prompt or a base64-encoded + # prompt, e.g., `prompt-snow road` or `prompte-[urlencoded_base64_encoded_text]`. + # Not supported inside overlay. See + # [AI Change Background](https://imagekit.io/docs/ai-transformations#change-background-e-changebg). + # + # @return [String, nil] + optional :ai_change_background, String, api_name: :aiChangeBackground + + # @!attribute ai_drop_shadow + # Adds an AI-based drop shadow around a foreground object on a transparent or + # removed background. Optionally, control the direction, elevation, and saturation + # of the light source (e.g., `az-45` to change light direction). Pass `true` for + # the default drop shadow, or provide a string for a custom drop shadow. Supported + # inside overlay. See + # [AI Drop Shadow](https://imagekit.io/docs/ai-transformations#ai-drop-shadow-e-dropshadow). + # + # @return [Boolean, true, String, nil] + optional :ai_drop_shadow, union: -> { Imagekit::Transformation::AIDropShadow }, api_name: :aiDropShadow + + # @!attribute ai_edit + # Uses AI to edit images based on a text prompt. Provide a text prompt or a + # base64-encoded prompt, e.g., `prompt-snow road` or + # `prompte-[urlencoded_base64_encoded_text]`. Not supported inside overlay. + # See [AI Edit](https://imagekit.io/docs/ai-transformations#edit-image-e-edit). + # + # @return [String, nil] + optional :ai_edit, String, api_name: :aiEdit + + # @!attribute ai_remove_background + # Applies ImageKit's in-house background removal. Supported inside overlay. See + # [AI Background Removal](https://imagekit.io/docs/ai-transformations#imagekit-background-removal-e-bgremove). + # + # @return [Boolean, Imagekit::Models::Transformation::AIRemoveBackground, nil] + optional :ai_remove_background, + enum: -> { Imagekit::Transformation::AIRemoveBackground }, + api_name: :aiRemoveBackground + + # @!attribute ai_remove_background_external + # Uses third-party background removal. Note: It is recommended to use + # aiRemoveBackground, ImageKit's in-house solution, which is more cost-effective. + # Supported inside overlay. See + # [External Background Removal](https://imagekit.io/docs/ai-transformations#background-removal-e-removedotbg). + # + # @return [Boolean, Imagekit::Models::Transformation::AIRemoveBackgroundExternal, nil] + optional :ai_remove_background_external, + enum: -> { Imagekit::Transformation::AIRemoveBackgroundExternal }, + api_name: :aiRemoveBackgroundExternal + + # @!attribute ai_retouch + # Performs AI-based retouching to improve faces or product shots. Not supported + # inside overlay. See + # [AI Retouch](https://imagekit.io/docs/ai-transformations#retouch-e-retouch). + # + # @return [Boolean, Imagekit::Models::Transformation::AIRetouch, nil] + optional :ai_retouch, enum: -> { Imagekit::Transformation::AIRetouch }, api_name: :aiRetouch + + # @!attribute ai_upscale + # Upscales images beyond their original dimensions using AI. Not supported inside + # overlay. See + # [AI Upscale](https://imagekit.io/docs/ai-transformations#upscale-e-upscale). + # + # @return [Boolean, Imagekit::Models::Transformation::AIUpscale, nil] + optional :ai_upscale, enum: -> { Imagekit::Transformation::AIUpscale }, api_name: :aiUpscale + + # @!attribute ai_variation + # Generates a variation of an image using AI. This produces a new image with + # slight variations from the original, such as changes in color, texture, and + # other visual elements, while preserving the structure and essence of the + # original image. Not supported inside overlay. See + # [AI Generate Variations](https://imagekit.io/docs/ai-transformations#generate-variations-of-an-image-e-genvar). + # + # @return [Boolean, Imagekit::Models::Transformation::AIVariation, nil] + optional :ai_variation, enum: -> { Imagekit::Transformation::AIVariation }, api_name: :aiVariation + + # @!attribute aspect_ratio + # Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with + # either width or height (but not both). For example: aspectRatio = `4:3`, `4_3`, + # or an expression like `iar_div_2`. See + # [Image resize and crop – Aspect ratio](https://imagekit.io/docs/image-resize-and-crop#aspect-ratio---ar). + # + # @return [Float, String, nil] + optional :aspect_ratio, union: -> { Imagekit::Transformation::AspectRatio }, api_name: :aspectRatio + + # @!attribute audio_codec + # Specifies the audio codec, e.g., `aac`, `opus`, or `none`. See + # [Audio codec](https://imagekit.io/docs/video-optimization#audio-codec---ac). + # + # @return [Symbol, Imagekit::Models::Transformation::AudioCodec, nil] + optional :audio_codec, enum: -> { Imagekit::Transformation::AudioCodec }, api_name: :audioCodec + + # @!attribute background + # Specifies the background to be used in conjunction with certain cropping + # strategies when resizing an image. + # + # - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See + # [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background). + # - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See + # [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background). + # - Expand the image boundaries using generative fill: `genfill`. Not supported + # inside overlay. Optionally, control the background scene by passing a text + # prompt: `genfill[:-prompt-${text}]` or + # `genfill[:-prompte-${urlencoded_base64_encoded_text}]`. See + # [Generative fill background](https://imagekit.io/docs/ai-transformations#generative-fill-bg-genfill). + # + # @return [String, nil] + optional :background, String + + # @!attribute blur + # Specifies the Gaussian blur level. Accepts an integer value between 1 and 100, + # or an expression like `bl-10`. See + # [Blur](https://imagekit.io/docs/effects-and-enhancements#blur---bl). + # + # @return [Float, nil] + optional :blur, Float + + # @!attribute border + # Adds a border to the output media. Accepts a string in the format + # `_` (e.g., `5_FFF000` for a 5px yellow border), or an + # expression like `ih_div_20_FF00FF`. See + # [Border](https://imagekit.io/docs/effects-and-enhancements#border---b). + # + # @return [String, nil] + optional :border, String + + # @!attribute color_profile + # Indicates whether the output image should retain the original color profile. See + # [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). + # + # @return [Boolean, nil] + optional :color_profile, Imagekit::Internal::Type::Boolean, api_name: :colorProfile + + # @!attribute contrast_stretch + # Automatically enhances the contrast of an image (contrast stretch). See + # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). + # + # @return [Boolean, Imagekit::Models::Transformation::ContrastStretch, nil] + optional :contrast_stretch, + enum: -> { Imagekit::Transformation::ContrastStretch }, + api_name: :contrastStretch + + # @!attribute crop + # Crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + # + # @return [Symbol, Imagekit::Models::Transformation::Crop, nil] + optional :crop, enum: -> { Imagekit::Transformation::Crop } + + # @!attribute crop_mode + # Additional crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + # + # @return [Symbol, Imagekit::Models::Transformation::CropMode, nil] + optional :crop_mode, enum: -> { Imagekit::Transformation::CropMode }, api_name: :cropMode + + # @!attribute default_image + # Specifies a fallback image if the resource is not found, e.g., a URL or file + # path. See + # [Default image](https://imagekit.io/docs/image-transformation#default-image---di). + # + # @return [String, nil] + optional :default_image, String, api_name: :defaultImage + + # @!attribute dpr + # Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio + # (DPR) calculation. See + # [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). + # + # @return [Float, nil] + optional :dpr, Float + + # @!attribute duration + # Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to indicate the length from the start offset. + # Arithmetic expressions are supported. See + # [Trim videos – Duration](https://imagekit.io/docs/trim-videos#duration---du). + # + # @return [Float, String, nil] + optional :duration, union: -> { Imagekit::Transformation::Duration } + + # @!attribute end_offset + # Specifies the end offset (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to define a time window. Arithmetic expressions + # are supported. See + # [Trim videos – End offset](https://imagekit.io/docs/trim-videos#end-offset---eo). + # + # @return [Float, String, nil] + optional :end_offset, union: -> { Imagekit::Transformation::EndOffset }, api_name: :endOffset + + # @!attribute flip + # Flips or mirrors an image either horizontally, vertically, or both. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. See [Flip](https://imagekit.io/docs/effects-and-enhancements#flip---fl). + # + # @return [Symbol, Imagekit::Models::Transformation::Flip, nil] + optional :flip, enum: -> { Imagekit::Transformation::Flip } + + # @!attribute focus + # Refines padding and cropping behavior for pad resize, maintain ratio, and + # extract crop modes. Supports manual positions and coordinate-based focus. With + # AI-based cropping, you can automatically keep key subjects in frame—such as + # faces or detected objects (e.g., `fo-face`, `fo-person`, `fo-car`)— while + # resizing. + # + # - See [Focus](https://imagekit.io/docs/image-resize-and-crop#focus---fo). + # - [Object aware cropping](https://imagekit.io/docs/image-resize-and-crop#object-aware-cropping---fo-object-name) + # + # @return [String, nil] + optional :focus, String + + # @!attribute format_ + # Specifies the output format for images or videos, e.g., `jpg`, `png`, `webp`, + # `mp4`, or `auto`. You can also pass `orig` for images to return the original + # format. ImageKit automatically delivers images and videos in the optimal format + # based on device support unless overridden by the dashboard settings or the + # format parameter. See + # [Image format](https://imagekit.io/docs/image-optimization#format---f) and + # [Video format](https://imagekit.io/docs/video-optimization#format---f). + # + # @return [Symbol, Imagekit::Models::Transformation::Format, nil] + optional :format_, enum: -> { Imagekit::Transformation::Format }, api_name: :format + + # @!attribute gradient + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. See + # [Gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + # + # @return [Boolean, true, String, nil] + optional :gradient, union: -> { Imagekit::Transformation::Gradient } + + # @!attribute grayscale + # Enables a grayscale effect for images. See + # [Grayscale](https://imagekit.io/docs/effects-and-enhancements#grayscale---e-grayscale). + # + # @return [Boolean, Imagekit::Models::Transformation::Grayscale, nil] + optional :grayscale, enum: -> { Imagekit::Transformation::Grayscale } + + # @!attribute height + # Specifies the height of the output. If a value between 0 and 1 is provided, it + # is treated as a percentage (e.g., `0.5` represents 50% of the original height). + # You can also supply arithmetic expressions (e.g., `ih_mul_0.5`). Height + # transformation – + # [Images](https://imagekit.io/docs/image-resize-and-crop#height---h) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#height---h) + # + # @return [Float, String, nil] + optional :height, union: -> { Imagekit::Transformation::Height } + + # @!attribute lossless + # Specifies whether the output image (in JPEG or PNG) should be compressed + # losslessly. See + # [Lossless compression](https://imagekit.io/docs/image-optimization#lossless-webp-and-png---lo). + # + # @return [Boolean, nil] + optional :lossless, Imagekit::Internal::Type::Boolean + + # @!attribute metadata + # By default, ImageKit removes all metadata during automatic image compression. + # Set this to true to preserve metadata. See + # [Image metadata](https://imagekit.io/docs/image-optimization#image-metadata---md). + # + # @return [Boolean, nil] + optional :metadata, Imagekit::Internal::Type::Boolean + + # @!attribute named + # Named transformation reference. See + # [Named transformations](https://imagekit.io/docs/transformations#named-transformations). + # + # @return [String, nil] + optional :named, String + + # @!attribute opacity + # Specifies the opacity level of the output image. See + # [Opacity](https://imagekit.io/docs/effects-and-enhancements#opacity---o). + # + # @return [Float, nil] + optional :opacity, Float + + # @!attribute original + # If set to true, serves the original file without applying any transformations. + # See + # [Deliver original file as-is](https://imagekit.io/docs/core-delivery-features#deliver-original-file-as-is---orig-true). + # + # @return [Boolean, nil] + optional :original, Imagekit::Internal::Type::Boolean + + # @!attribute overlay + # Specifies an overlay to be applied on the parent image or video. ImageKit + # supports overlays including images, text, videos, subtitles, and solid colors. + # See + # [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers). + # + # @return [Imagekit::Models::Overlay, nil] + optional :overlay, union: -> { Imagekit::Overlay } + + # @!attribute page + # Extracts a specific page or frame from multi-page or layered files (PDF, PSD, + # AI). For example, specify by number (e.g., `2`), a range (e.g., `3-4` for the + # 2nd and 3rd layers), or by name (e.g., `name-layer-4` for a PSD layer). See + # [Thumbnail extraction](https://imagekit.io/docs/vector-and-animated-images#get-thumbnail-from-psd-pdf-ai-eps-and-animated-files). + # + # @return [Float, String, nil] + optional :page, union: -> { Imagekit::Transformation::Page } + + # @!attribute progressive + # Specifies whether the output JPEG image should be rendered progressively. + # Progressive loading begins with a low-quality, pixelated version of the full + # image, which gradually improves to provide a faster perceived load time. See + # [Progressive images](https://imagekit.io/docs/image-optimization#progressive-image---pr). + # + # @return [Boolean, nil] + optional :progressive, Imagekit::Internal::Type::Boolean + + # @!attribute quality + # Specifies the quality of the output image for lossy formats such as JPEG, WebP, + # and AVIF. A higher quality value results in a larger file size with better + # quality, while a lower value produces a smaller file size with reduced quality. + # See [Quality](https://imagekit.io/docs/image-optimization#quality---q). + # + # @return [Float, nil] + optional :quality, Float + + # @!attribute radius + # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular + # or oval shape. See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # + # @return [Float, Symbol, :max, nil] + optional :radius, union: -> { Imagekit::Transformation::Radius } + + # @!attribute raw + # Pass any transformation not directly supported by the SDK. This transformation + # string is appended to the URL as provided. + # + # @return [String, nil] + optional :raw, String + + # @!attribute rotation + # Specifies the rotation angle in degrees. Positive values rotate the image + # clockwise; you can also use, for example, `N40` for counterclockwise rotation or + # `auto` to use the orientation specified in the image's EXIF data. For videos, + # only the following values are supported: 0, 90, 180, 270, or 360. See + # [Rotate](https://imagekit.io/docs/effects-and-enhancements#rotate---rt). + # + # @return [Float, String, nil] + optional :rotation, union: -> { Imagekit::Transformation::Rotation } + + # @!attribute shadow + # Adds a shadow beneath solid objects in an image with a transparent background. + # For AI-based drop shadows, refer to aiDropShadow. Pass `true` for a default + # shadow, or provide a string for a custom shadow. See + # [Shadow](https://imagekit.io/docs/effects-and-enhancements#shadow---e-shadow). + # + # @return [Boolean, true, String, nil] + optional :shadow, union: -> { Imagekit::Transformation::Shadow } + + # @!attribute sharpen + # Sharpens the input image, highlighting edges and finer details. Pass `true` for + # default sharpening, or provide a numeric value for custom sharpening. See + # [Sharpen](https://imagekit.io/docs/effects-and-enhancements#sharpen---e-sharpen). + # + # @return [Boolean, true, Float, nil] + optional :sharpen, union: -> { Imagekit::Transformation::Sharpen } + + # @!attribute start_offset + # Specifies the start offset (in seconds) for trimming videos, e.g., `5` or + # `10.5`. Arithmetic expressions are also supported. See + # [Trim videos – Start offset](https://imagekit.io/docs/trim-videos#start-offset---so). + # + # @return [Float, String, nil] + optional :start_offset, union: -> { Imagekit::Transformation::StartOffset }, api_name: :startOffset + + # @!attribute streaming_resolutions + # An array of resolutions for adaptive bitrate streaming, e.g., [`240`, `360`, + # `480`, `720`, `1080`]. See + # [Adaptive Bitrate Streaming](https://imagekit.io/docs/adaptive-bitrate-streaming). + # + # @return [Array, nil] + optional :streaming_resolutions, + -> { Imagekit::Internal::Type::ArrayOf[enum: Imagekit::StreamingResolution] }, + api_name: :streamingResolutions + + # @!attribute trim + # Useful for images with a solid or nearly solid background and a central object. + # This parameter trims the background, leaving only the central object in the + # output image. See + # [Trim edges](https://imagekit.io/docs/effects-and-enhancements#trim-edges---t). + # + # @return [Boolean, true, Float, nil] + optional :trim, union: -> { Imagekit::Transformation::Trim } + + # @!attribute unsharp_mask + # Applies Unsharp Masking (USM), an image sharpening technique. Pass `true` for a + # default unsharp mask, or provide a string for a custom unsharp mask. See + # [Unsharp Mask](https://imagekit.io/docs/effects-and-enhancements#unsharp-mask---e-usm). + # + # @return [Boolean, true, String, nil] + optional :unsharp_mask, union: -> { Imagekit::Transformation::UnsharpMask }, api_name: :unsharpMask + + # @!attribute video_codec + # Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. See + # [Video codec](https://imagekit.io/docs/video-optimization#video-codec---vc). + # + # @return [Symbol, Imagekit::Models::Transformation::VideoCodec, nil] + optional :video_codec, enum: -> { Imagekit::Transformation::VideoCodec }, api_name: :videoCodec + + # @!attribute width + # Specifies the width of the output. If a value between 0 and 1 is provided, it is + # treated as a percentage (e.g., `0.4` represents 40% of the original width). You + # can also supply arithmetic expressions (e.g., `iw_div_2`). Width transformation + # – [Images](https://imagekit.io/docs/image-resize-and-crop#width---w) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#width---w) + # + # @return [Float, String, nil] + optional :width, union: -> { Imagekit::Transformation::Width } + + # @!attribute x + # Focus using cropped image coordinates - X coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @return [Float, String, nil] + optional :x, union: -> { Imagekit::Transformation::X } + + # @!attribute x_center + # Focus using cropped image coordinates - X center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @return [Float, String, nil] + optional :x_center, union: -> { Imagekit::Transformation::XCenter }, api_name: :xCenter + + # @!attribute y_ + # Focus using cropped image coordinates - Y coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @return [Float, String, nil] + optional :y_, union: -> { Imagekit::Transformation::Y }, api_name: :y + + # @!attribute y_center + # Focus using cropped image coordinates - Y center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @return [Float, String, nil] + optional :y_center, union: -> { Imagekit::Transformation::YCenter }, api_name: :yCenter + + # @!attribute zoom + # Accepts a numeric value that determines how much to zoom in or out of the + # cropped area. It should be used in conjunction with fo-face or fo-. + # See [Zoom](https://imagekit.io/docs/image-resize-and-crop#zoom---z). + # + # @return [Float, nil] + optional :zoom, Float + + # @!method initialize(ai_change_background: nil, ai_drop_shadow: nil, ai_edit: nil, ai_remove_background: nil, ai_remove_background_external: nil, ai_retouch: nil, ai_upscale: nil, ai_variation: nil, aspect_ratio: nil, audio_codec: nil, background: nil, blur: nil, border: nil, color_profile: nil, contrast_stretch: nil, crop: nil, crop_mode: nil, default_image: nil, dpr: nil, duration: nil, end_offset: nil, flip: nil, focus: nil, format_: nil, gradient: nil, grayscale: nil, height: nil, lossless: nil, metadata: nil, named: nil, opacity: nil, original: nil, overlay: nil, page: nil, progressive: nil, quality: nil, radius: nil, raw: nil, rotation: nil, shadow: nil, sharpen: nil, start_offset: nil, streaming_resolutions: nil, trim: nil, unsharp_mask: nil, video_codec: nil, width: nil, x: nil, x_center: nil, y_: nil, y_center: nil, zoom: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Transformation} for more details. + # + # The SDK provides easy-to-use names for transformations. These names are + # converted to the corresponding transformation string before being added to the + # URL. SDKs are updated regularly to support new transformations. If you want to + # use a transformation that is not supported by the SDK, You can use the `raw` + # parameter to pass the transformation string directly. See the + # [Transformations documentation](https://imagekit.io/docs/transformations). + # + # @param ai_change_background [String] Uses AI to change the background. Provide a text prompt or a base64-encoded prom + # + # @param ai_drop_shadow [Boolean, true, String] Adds an AI-based drop shadow around a foreground object on a transparent or remo + # + # @param ai_edit [String] Uses AI to edit images based on a text prompt. Provide a text prompt or a base64 + # + # @param ai_remove_background [Boolean, Imagekit::Models::Transformation::AIRemoveBackground] Applies ImageKit's in-house background removal. + # + # @param ai_remove_background_external [Boolean, Imagekit::Models::Transformation::AIRemoveBackgroundExternal] Uses third-party background removal. + # + # @param ai_retouch [Boolean, Imagekit::Models::Transformation::AIRetouch] Performs AI-based retouching to improve faces or product shots. Not supported in + # + # @param ai_upscale [Boolean, Imagekit::Models::Transformation::AIUpscale] Upscales images beyond their original dimensions using AI. Not supported inside + # + # @param ai_variation [Boolean, Imagekit::Models::Transformation::AIVariation] Generates a variation of an image using AI. This produces a new image with sligh + # + # @param aspect_ratio [Float, String] Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with e + # + # @param audio_codec [Symbol, Imagekit::Models::Transformation::AudioCodec] Specifies the audio codec, e.g., `aac`, `opus`, or `none`. See [Audio codec](htt + # + # @param background [String] Specifies the background to be used in conjunction with certain cropping strateg + # + # @param blur [Float] Specifies the Gaussian blur level. Accepts an integer value between 1 and 100, o + # + # @param border [String] Adds a border to the output media. Accepts a string in the format `] An array of resolutions for adaptive bitrate streaming, e.g., [`240`, `360`, `48 + # + # @param trim [Boolean, true, Float] Useful for images with a solid or nearly solid background and a central object. + # + # @param unsharp_mask [Boolean, true, String] Applies Unsharp Masking (USM), an image sharpening technique. + # + # @param video_codec [Symbol, Imagekit::Models::Transformation::VideoCodec] Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. See [Video cod + # + # @param width [Float, String] Specifies the width of the output. If a value between 0 and 1 is provided, it is + # + # @param x [Float, String] Focus using cropped image coordinates - X coordinate. See [Focus using cropped c + # + # @param x_center [Float, String] Focus using cropped image coordinates - X center coordinate. See [Focus using cr + # + # @param y_ [Float, String] Focus using cropped image coordinates - Y coordinate. See [Focus using cropped c + # + # @param y_center [Float, String] Focus using cropped image coordinates - Y center coordinate. See [Focus using cr + # + # @param zoom [Float] Accepts a numeric value that determines how much to zoom in or out of the croppe + + # Adds an AI-based drop shadow around a foreground object on a transparent or + # removed background. Optionally, control the direction, elevation, and saturation + # of the light source (e.g., `az-45` to change light direction). Pass `true` for + # the default drop shadow, or provide a string for a custom drop shadow. Supported + # inside overlay. See + # [AI Drop Shadow](https://imagekit.io/docs/ai-transformations#ai-drop-shadow-e-dropshadow). + # + # @see Imagekit::Models::Transformation#ai_drop_shadow + module AIDropShadow + extend Imagekit::Internal::Type::Union + + variant const: true + + variant String + + # @!method self.variants + # @return [Array(Boolean, true, String)] + end + + # Applies ImageKit's in-house background removal. Supported inside overlay. See + # [AI Background Removal](https://imagekit.io/docs/ai-transformations#imagekit-background-removal-e-bgremove). + # + # @see Imagekit::Models::Transformation#ai_remove_background + module AIRemoveBackground + extend Imagekit::Internal::Type::Enum + + TRUE = true + + # @!method self.values + # @return [Array] + end + + # Uses third-party background removal. Note: It is recommended to use + # aiRemoveBackground, ImageKit's in-house solution, which is more cost-effective. + # Supported inside overlay. See + # [External Background Removal](https://imagekit.io/docs/ai-transformations#background-removal-e-removedotbg). + # + # @see Imagekit::Models::Transformation#ai_remove_background_external + module AIRemoveBackgroundExternal + extend Imagekit::Internal::Type::Enum + + TRUE = true + + # @!method self.values + # @return [Array] + end + + # Performs AI-based retouching to improve faces or product shots. Not supported + # inside overlay. See + # [AI Retouch](https://imagekit.io/docs/ai-transformations#retouch-e-retouch). + # + # @see Imagekit::Models::Transformation#ai_retouch + module AIRetouch + extend Imagekit::Internal::Type::Enum + + TRUE = true + + # @!method self.values + # @return [Array] + end + + # Upscales images beyond their original dimensions using AI. Not supported inside + # overlay. See + # [AI Upscale](https://imagekit.io/docs/ai-transformations#upscale-e-upscale). + # + # @see Imagekit::Models::Transformation#ai_upscale + module AIUpscale + extend Imagekit::Internal::Type::Enum + + TRUE = true + + # @!method self.values + # @return [Array] + end + + # Generates a variation of an image using AI. This produces a new image with + # slight variations from the original, such as changes in color, texture, and + # other visual elements, while preserving the structure and essence of the + # original image. Not supported inside overlay. See + # [AI Generate Variations](https://imagekit.io/docs/ai-transformations#generate-variations-of-an-image-e-genvar). + # + # @see Imagekit::Models::Transformation#ai_variation + module AIVariation + extend Imagekit::Internal::Type::Enum + + TRUE = true + + # @!method self.values + # @return [Array] + end + + # Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with + # either width or height (but not both). For example: aspectRatio = `4:3`, `4_3`, + # or an expression like `iar_div_2`. See + # [Image resize and crop – Aspect ratio](https://imagekit.io/docs/image-resize-and-crop#aspect-ratio---ar). + # + # @see Imagekit::Models::Transformation#aspect_ratio + module AspectRatio + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the audio codec, e.g., `aac`, `opus`, or `none`. See + # [Audio codec](https://imagekit.io/docs/video-optimization#audio-codec---ac). + # + # @see Imagekit::Models::Transformation#audio_codec + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC = :aac + OPUS = :opus + NONE = :none + + # @!method self.values + # @return [Array] + end + + # Automatically enhances the contrast of an image (contrast stretch). See + # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). + # + # @see Imagekit::Models::Transformation#contrast_stretch + module ContrastStretch + extend Imagekit::Internal::Type::Enum + + TRUE = true + + # @!method self.values + # @return [Array] + end + + # Crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + # + # @see Imagekit::Models::Transformation#crop + module Crop + extend Imagekit::Internal::Type::Enum + + FORCE = :force + AT_MAX = :at_max + AT_MAX_ENLARGE = :at_max_enlarge + AT_LEAST = :at_least + MAINTAIN_RATIO = :maintain_ratio + + # @!method self.values + # @return [Array] + end + + # Additional crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + # + # @see Imagekit::Models::Transformation#crop_mode + module CropMode + extend Imagekit::Internal::Type::Enum + + PAD_RESIZE = :pad_resize + EXTRACT = :extract + PAD_EXTRACT = :pad_extract + + # @!method self.values + # @return [Array] + end + + # Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to indicate the length from the start offset. + # Arithmetic expressions are supported. See + # [Trim videos – Duration](https://imagekit.io/docs/trim-videos#duration---du). + # + # @see Imagekit::Models::Transformation#duration + module Duration + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the end offset (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to define a time window. Arithmetic expressions + # are supported. See + # [Trim videos – End offset](https://imagekit.io/docs/trim-videos#end-offset---eo). + # + # @see Imagekit::Models::Transformation#end_offset + module EndOffset + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Flips or mirrors an image either horizontally, vertically, or both. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. See [Flip](https://imagekit.io/docs/effects-and-enhancements#flip---fl). + # + # @see Imagekit::Models::Transformation#flip + module Flip + extend Imagekit::Internal::Type::Enum + + H = :h + V = :v + H_V = :h_v + V_H = :v_h + + # @!method self.values + # @return [Array] + end + + # Specifies the output format for images or videos, e.g., `jpg`, `png`, `webp`, + # `mp4`, or `auto`. You can also pass `orig` for images to return the original + # format. ImageKit automatically delivers images and videos in the optimal format + # based on device support unless overridden by the dashboard settings or the + # format parameter. See + # [Image format](https://imagekit.io/docs/image-optimization#format---f) and + # [Video format](https://imagekit.io/docs/video-optimization#format---f). + # + # @see Imagekit::Models::Transformation#format_ + module Format + extend Imagekit::Internal::Type::Enum + + AUTO = :auto + WEBP = :webp + JPG = :jpg + JPEG = :jpeg + PNG = :png + GIF = :gif + SVG = :svg + MP4 = :mp4 + WEBM = :webm + AVIF = :avif + ORIG = :orig + + # @!method self.values + # @return [Array] + end + + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. See + # [Gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + # + # @see Imagekit::Models::Transformation#gradient + module Gradient + extend Imagekit::Internal::Type::Union + + variant const: true + + variant String + + # @!method self.variants + # @return [Array(Boolean, true, String)] + end + + # Enables a grayscale effect for images. See + # [Grayscale](https://imagekit.io/docs/effects-and-enhancements#grayscale---e-grayscale). + # + # @see Imagekit::Models::Transformation#grayscale + module Grayscale + extend Imagekit::Internal::Type::Enum + + TRUE = true + + # @!method self.values + # @return [Array] + end + + # Specifies the height of the output. If a value between 0 and 1 is provided, it + # is treated as a percentage (e.g., `0.5` represents 50% of the original height). + # You can also supply arithmetic expressions (e.g., `ih_mul_0.5`). Height + # transformation – + # [Images](https://imagekit.io/docs/image-resize-and-crop#height---h) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#height---h) + # + # @see Imagekit::Models::Transformation#height + module Height + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Extracts a specific page or frame from multi-page or layered files (PDF, PSD, + # AI). For example, specify by number (e.g., `2`), a range (e.g., `3-4` for the + # 2nd and 3rd layers), or by name (e.g., `name-layer-4` for a PSD layer). See + # [Thumbnail extraction](https://imagekit.io/docs/vector-and-animated-images#get-thumbnail-from-psd-pdf-ai-eps-and-animated-files). + # + # @see Imagekit::Models::Transformation#page + module Page + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular + # or oval shape. See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + # + # @see Imagekit::Models::Transformation#radius + module Radius + extend Imagekit::Internal::Type::Union + + variant Float + + variant const: :max + + # @!method self.variants + # @return [Array(Float, Symbol, :max)] + end + + # Specifies the rotation angle in degrees. Positive values rotate the image + # clockwise; you can also use, for example, `N40` for counterclockwise rotation or + # `auto` to use the orientation specified in the image's EXIF data. For videos, + # only the following values are supported: 0, 90, 180, 270, or 360. See + # [Rotate](https://imagekit.io/docs/effects-and-enhancements#rotate---rt). + # + # @see Imagekit::Models::Transformation#rotation + module Rotation + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Adds a shadow beneath solid objects in an image with a transparent background. + # For AI-based drop shadows, refer to aiDropShadow. Pass `true` for a default + # shadow, or provide a string for a custom shadow. See + # [Shadow](https://imagekit.io/docs/effects-and-enhancements#shadow---e-shadow). + # + # @see Imagekit::Models::Transformation#shadow + module Shadow + extend Imagekit::Internal::Type::Union + + variant const: true + + variant String + + # @!method self.variants + # @return [Array(Boolean, true, String)] + end + + # Sharpens the input image, highlighting edges and finer details. Pass `true` for + # default sharpening, or provide a numeric value for custom sharpening. See + # [Sharpen](https://imagekit.io/docs/effects-and-enhancements#sharpen---e-sharpen). + # + # @see Imagekit::Models::Transformation#sharpen + module Sharpen + extend Imagekit::Internal::Type::Union + + variant const: true + + variant Float + + # @!method self.variants + # @return [Array(Boolean, true, Float)] + end + + # Specifies the start offset (in seconds) for trimming videos, e.g., `5` or + # `10.5`. Arithmetic expressions are also supported. See + # [Trim videos – Start offset](https://imagekit.io/docs/trim-videos#start-offset---so). + # + # @see Imagekit::Models::Transformation#start_offset + module StartOffset + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Useful for images with a solid or nearly solid background and a central object. + # This parameter trims the background, leaving only the central object in the + # output image. See + # [Trim edges](https://imagekit.io/docs/effects-and-enhancements#trim-edges---t). + # + # @see Imagekit::Models::Transformation#trim + module Trim + extend Imagekit::Internal::Type::Union + + variant const: true + + variant Float + + # @!method self.variants + # @return [Array(Boolean, true, Float)] + end + + # Applies Unsharp Masking (USM), an image sharpening technique. Pass `true` for a + # default unsharp mask, or provide a string for a custom unsharp mask. See + # [Unsharp Mask](https://imagekit.io/docs/effects-and-enhancements#unsharp-mask---e-usm). + # + # @see Imagekit::Models::Transformation#unsharp_mask + module UnsharpMask + extend Imagekit::Internal::Type::Union + + variant const: true + + variant String + + # @!method self.variants + # @return [Array(Boolean, true, String)] + end + + # Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. See + # [Video codec](https://imagekit.io/docs/video-optimization#video-codec---vc). + # + # @see Imagekit::Models::Transformation#video_codec + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264 = :h264 + VP9 = :vp9 + AV1 = :av1 + NONE = :none + + # @!method self.values + # @return [Array] + end + + # Specifies the width of the output. If a value between 0 and 1 is provided, it is + # treated as a percentage (e.g., `0.4` represents 40% of the original width). You + # can also supply arithmetic expressions (e.g., `iw_div_2`). Width transformation + # – [Images](https://imagekit.io/docs/image-resize-and-crop#width---w) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#width---w) + # + # @see Imagekit::Models::Transformation#width + module Width + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Focus using cropped image coordinates - X coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @see Imagekit::Models::Transformation#x + module X + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Focus using cropped image coordinates - X center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @see Imagekit::Models::Transformation#x_center + module XCenter + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Focus using cropped image coordinates - Y coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @see Imagekit::Models::Transformation#y_ + module Y + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + + # Focus using cropped image coordinates - Y center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + # + # @see Imagekit::Models::Transformation#y_center + module YCenter + extend Imagekit::Internal::Type::Union + + variant Float + + variant String + + # @!method self.variants + # @return [Array(Float, String)] + end + end + end +end diff --git a/lib/imagekit/models/transformation_position.rb b/lib/imagekit/models/transformation_position.rb new file mode 100644 index 00000000..e2281215 --- /dev/null +++ b/lib/imagekit/models/transformation_position.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # By default, the transformation string is added as a query parameter in the URL, + # e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the + # path of the URL, set this to `path`. Learn more in the + # [Transformations guide](https://imagekit.io/docs/transformations). + module TransformationPosition + extend Imagekit::Internal::Type::Enum + + PATH = :path + QUERY = :query + + # @!method self.values + # @return [Array] + end + end +end diff --git a/lib/imagekit/models/unsafe_unwrap_webhook_event.rb b/lib/imagekit/models/unsafe_unwrap_webhook_event.rb new file mode 100644 index 00000000..28e1b855 --- /dev/null +++ b/lib/imagekit/models/unsafe_unwrap_webhook_event.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. + module UnsafeUnwrapWebhookEvent + extend Imagekit::Internal::Type::Union + + # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. + variant -> { Imagekit::VideoTransformationAcceptedEvent } + + # Triggered when video encoding is finished and the transformed resource is ready to be served. This is the key event to listen for - update your database or CMS flags when you receive this so your application can start showing the transformed video to users. + variant -> { Imagekit::VideoTransformationReadyEvent } + + # Triggered when an error occurs during video encoding. Listen to this webhook to log error reasons and debug issues. Check your origin and URL endpoint settings if the reason is related to download failure. For other errors, contact ImageKit support. + variant -> { Imagekit::VideoTransformationErrorEvent } + + # Triggered when a pre-transformation completes successfully. The file has been processed with the requested transformation and is now available in the Media Library. + variant -> { Imagekit::UploadPreTransformSuccessEvent } + + # Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied. + variant -> { Imagekit::UploadPreTransformErrorEvent } + + # Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event. + variant -> { Imagekit::UploadPostTransformSuccessEvent } + + # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. + variant -> { Imagekit::UploadPostTransformErrorEvent } + + # @!method self.variants + # @return [Array(Imagekit::Models::VideoTransformationAcceptedEvent, Imagekit::Models::VideoTransformationReadyEvent, Imagekit::Models::VideoTransformationErrorEvent, Imagekit::Models::UploadPreTransformSuccessEvent, Imagekit::Models::UploadPreTransformErrorEvent, Imagekit::Models::UploadPostTransformSuccessEvent, Imagekit::Models::UploadPostTransformErrorEvent)] + end + end +end diff --git a/lib/imagekit/models/unwrap_webhook_event.rb b/lib/imagekit/models/unwrap_webhook_event.rb new file mode 100644 index 00000000..c200c085 --- /dev/null +++ b/lib/imagekit/models/unwrap_webhook_event.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. + module UnwrapWebhookEvent + extend Imagekit::Internal::Type::Union + + # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. + variant -> { Imagekit::VideoTransformationAcceptedEvent } + + # Triggered when video encoding is finished and the transformed resource is ready to be served. This is the key event to listen for - update your database or CMS flags when you receive this so your application can start showing the transformed video to users. + variant -> { Imagekit::VideoTransformationReadyEvent } + + # Triggered when an error occurs during video encoding. Listen to this webhook to log error reasons and debug issues. Check your origin and URL endpoint settings if the reason is related to download failure. For other errors, contact ImageKit support. + variant -> { Imagekit::VideoTransformationErrorEvent } + + # Triggered when a pre-transformation completes successfully. The file has been processed with the requested transformation and is now available in the Media Library. + variant -> { Imagekit::UploadPreTransformSuccessEvent } + + # Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied. + variant -> { Imagekit::UploadPreTransformErrorEvent } + + # Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event. + variant -> { Imagekit::UploadPostTransformSuccessEvent } + + # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. + variant -> { Imagekit::UploadPostTransformErrorEvent } + + # @!method self.variants + # @return [Array(Imagekit::Models::VideoTransformationAcceptedEvent, Imagekit::Models::VideoTransformationReadyEvent, Imagekit::Models::VideoTransformationErrorEvent, Imagekit::Models::UploadPreTransformSuccessEvent, Imagekit::Models::UploadPreTransformErrorEvent, Imagekit::Models::UploadPostTransformSuccessEvent, Imagekit::Models::UploadPostTransformErrorEvent)] + end + end +end diff --git a/lib/imagekit/models/upload_post_transform_error_event.rb b/lib/imagekit/models/upload_post_transform_error_event.rb new file mode 100644 index 00000000..3569da50 --- /dev/null +++ b/lib/imagekit/models/upload_post_transform_error_event.rb @@ -0,0 +1,190 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekit::Models::UploadPostTransformErrorEvent::Data] + required :data, -> { Imagekit::UploadPostTransformErrorEvent::Data } + + # @!attribute request + # + # @return [Imagekit::Models::UploadPostTransformErrorEvent::Request] + required :request, -> { Imagekit::UploadPostTransformErrorEvent::Request } + + # @!attribute type + # + # @return [Symbol, :"upload.post-transform.error"] + required :type, const: :"upload.post-transform.error" + + # @!method initialize(id:, created_at:, data:, request:, type: :"upload.post-transform.error") + # Triggered when a post-transformation fails. The original file remains available, + # but the requested transformation could not be generated. + # + # @param id [String] Unique identifier for the event. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekit::Models::UploadPostTransformErrorEvent::Data] + # + # @param request [Imagekit::Models::UploadPostTransformErrorEvent::Request] + # + # @param type [Symbol, :"upload.post-transform.error"] + + # @see Imagekit::Models::UploadPostTransformErrorEvent#data + class Data < Imagekit::Internal::Type::BaseModel + # @!attribute file_id + # Unique identifier of the originally uploaded file. + # + # @return [String] + required :file_id, String, api_name: :fileId + + # @!attribute name + # Name of the file. + # + # @return [String] + required :name, String + + # @!attribute path + # Path of the file. + # + # @return [String] + required :path, String + + # @!attribute transformation + # + # @return [Imagekit::Models::UploadPostTransformErrorEvent::Data::Transformation] + required :transformation, -> { Imagekit::UploadPostTransformErrorEvent::Data::Transformation } + + # @!attribute url + # URL of the attempted post-transformation. + # + # @return [String] + required :url, String + + # @!method initialize(file_id:, name:, path:, transformation:, url:) + # @param file_id [String] Unique identifier of the originally uploaded file. + # + # @param name [String] Name of the file. + # + # @param path [String] Path of the file. + # + # @param transformation [Imagekit::Models::UploadPostTransformErrorEvent::Data::Transformation] + # + # @param url [String] URL of the attempted post-transformation. + + # @see Imagekit::Models::UploadPostTransformErrorEvent::Data#transformation + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute error + # + # @return [Imagekit::Models::UploadPostTransformErrorEvent::Data::Transformation::Error] + required :error, -> { Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error } + + # @!method initialize(error:) + # @param error [Imagekit::Models::UploadPostTransformErrorEvent::Data::Transformation::Error] + + # @see Imagekit::Models::UploadPostTransformErrorEvent::Data::Transformation#error + class Error < Imagekit::Internal::Type::BaseModel + # @!attribute reason + # Reason for the post-transformation failure. + # + # @return [String] + required :reason, String + + # @!method initialize(reason:) + # @param reason [String] Reason for the post-transformation failure. + end + end + end + + # @see Imagekit::Models::UploadPostTransformErrorEvent#request + class Request < Imagekit::Internal::Type::BaseModel + # @!attribute transformation + # + # @return [Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation] + required :transformation, -> { Imagekit::UploadPostTransformErrorEvent::Request::Transformation } + + # @!attribute x_request_id + # Unique identifier for the originating request. + # + # @return [String] + required :x_request_id, String + + # @!method initialize(transformation:, x_request_id:) + # @param transformation [Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation] + # + # @param x_request_id [String] Unique identifier for the originating request. + + # @see Imagekit::Models::UploadPostTransformErrorEvent::Request#transformation + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Type of the requested post-transformation. + # + # @return [Symbol, Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::Type] + required :type, enum: -> { Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type } + + # @!attribute protocol + # Only applicable if transformation type is 'abs'. Streaming protocol used. + # + # @return [Symbol, Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::Protocol, nil] + optional :protocol, + enum: -> { Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol } + + # @!attribute value + # Value for the requested transformation type. + # + # @return [String, nil] + optional :value, String + + # @!method initialize(type:, protocol: nil, value: nil) + # @param type [Symbol, Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::Type] Type of the requested post-transformation. + # + # @param protocol [Symbol, Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::Protocol] Only applicable if transformation type is 'abs'. Streaming protocol used. + # + # @param value [String] Value for the requested transformation type. + + # Type of the requested post-transformation. + # + # @see Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation#type + module Type + extend Imagekit::Internal::Type::Enum + + TRANSFORMATION = :transformation + ABS = :abs + GIF_TO_VIDEO = :"gif-to-video" + THUMBNAIL = :thumbnail + + # @!method self.values + # @return [Array] + end + + # Only applicable if transformation type is 'abs'. Streaming protocol used. + # + # @see Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation#protocol + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS = :hls + DASH = :dash + + # @!method self.values + # @return [Array] + end + end + end + end + end +end diff --git a/lib/imagekit/models/upload_post_transform_success_event.rb b/lib/imagekit/models/upload_post_transform_success_event.rb new file mode 100644 index 00000000..07b856b2 --- /dev/null +++ b/lib/imagekit/models/upload_post_transform_success_event.rb @@ -0,0 +1,153 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekit::Models::UploadPostTransformSuccessEvent::Data] + required :data, -> { Imagekit::UploadPostTransformSuccessEvent::Data } + + # @!attribute request + # + # @return [Imagekit::Models::UploadPostTransformSuccessEvent::Request] + required :request, -> { Imagekit::UploadPostTransformSuccessEvent::Request } + + # @!attribute type + # + # @return [Symbol, :"upload.post-transform.success"] + required :type, const: :"upload.post-transform.success" + + # @!method initialize(id:, created_at:, data:, request:, type: :"upload.post-transform.success") + # Triggered when a post-transformation completes successfully. The transformed + # version of the file is now ready and can be accessed via the provided URL. Note + # that each post-transformation generates a separate webhook event. + # + # @param id [String] Unique identifier for the event. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekit::Models::UploadPostTransformSuccessEvent::Data] + # + # @param request [Imagekit::Models::UploadPostTransformSuccessEvent::Request] + # + # @param type [Symbol, :"upload.post-transform.success"] + + # @see Imagekit::Models::UploadPostTransformSuccessEvent#data + class Data < Imagekit::Internal::Type::BaseModel + # @!attribute file_id + # Unique identifier of the originally uploaded file. + # + # @return [String] + required :file_id, String, api_name: :fileId + + # @!attribute name + # Name of the file. + # + # @return [String] + required :name, String + + # @!attribute url + # URL of the generated post-transformation. + # + # @return [String] + required :url, String + + # @!method initialize(file_id:, name:, url:) + # @param file_id [String] Unique identifier of the originally uploaded file. + # + # @param name [String] Name of the file. + # + # @param url [String] URL of the generated post-transformation. + end + + # @see Imagekit::Models::UploadPostTransformSuccessEvent#request + class Request < Imagekit::Internal::Type::BaseModel + # @!attribute transformation + # + # @return [Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation] + required :transformation, -> { Imagekit::UploadPostTransformSuccessEvent::Request::Transformation } + + # @!attribute x_request_id + # Unique identifier for the originating request. + # + # @return [String] + required :x_request_id, String + + # @!method initialize(transformation:, x_request_id:) + # @param transformation [Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation] + # + # @param x_request_id [String] Unique identifier for the originating request. + + # @see Imagekit::Models::UploadPostTransformSuccessEvent::Request#transformation + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Type of the requested post-transformation. + # + # @return [Symbol, Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::Type] + required :type, enum: -> { Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type } + + # @!attribute protocol + # Only applicable if transformation type is 'abs'. Streaming protocol used. + # + # @return [Symbol, Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::Protocol, nil] + optional :protocol, + enum: -> { Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol } + + # @!attribute value + # Value for the requested transformation type. + # + # @return [String, nil] + optional :value, String + + # @!method initialize(type:, protocol: nil, value: nil) + # @param type [Symbol, Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::Type] Type of the requested post-transformation. + # + # @param protocol [Symbol, Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::Protocol] Only applicable if transformation type is 'abs'. Streaming protocol used. + # + # @param value [String] Value for the requested transformation type. + + # Type of the requested post-transformation. + # + # @see Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation#type + module Type + extend Imagekit::Internal::Type::Enum + + TRANSFORMATION = :transformation + ABS = :abs + GIF_TO_VIDEO = :"gif-to-video" + THUMBNAIL = :thumbnail + + # @!method self.values + # @return [Array] + end + + # Only applicable if transformation type is 'abs'. Streaming protocol used. + # + # @see Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation#protocol + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS = :hls + DASH = :dash + + # @!method self.values + # @return [Array] + end + end + end + end + end +end diff --git a/lib/imagekit/models/upload_pre_transform_error_event.rb b/lib/imagekit/models/upload_pre_transform_error_event.rb new file mode 100644 index 00000000..d672e680 --- /dev/null +++ b/lib/imagekit/models/upload_pre_transform_error_event.rb @@ -0,0 +1,118 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!attribute created_at + # Timestamp of when the event occurred in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekit::Models::UploadPreTransformErrorEvent::Data] + required :data, -> { Imagekit::UploadPreTransformErrorEvent::Data } + + # @!attribute request + # + # @return [Imagekit::Models::UploadPreTransformErrorEvent::Request] + required :request, -> { Imagekit::UploadPreTransformErrorEvent::Request } + + # @!attribute type + # + # @return [Symbol, :"upload.pre-transform.error"] + required :type, const: :"upload.pre-transform.error" + + # @!method initialize(id:, created_at:, data:, request:, type: :"upload.pre-transform.error") + # Triggered when a pre-transformation fails. The file upload may have been + # accepted, but the requested transformation could not be applied. + # + # @param id [String] Unique identifier for the event. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekit::Models::UploadPreTransformErrorEvent::Data] + # + # @param request [Imagekit::Models::UploadPreTransformErrorEvent::Request] + # + # @param type [Symbol, :"upload.pre-transform.error"] + + # @see Imagekit::Models::UploadPreTransformErrorEvent#data + class Data < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Name of the file. + # + # @return [String] + required :name, String + + # @!attribute path + # Path of the file. + # + # @return [String] + required :path, String + + # @!attribute transformation + # + # @return [Imagekit::Models::UploadPreTransformErrorEvent::Data::Transformation] + required :transformation, -> { Imagekit::UploadPreTransformErrorEvent::Data::Transformation } + + # @!method initialize(name:, path:, transformation:) + # @param name [String] Name of the file. + # + # @param path [String] Path of the file. + # + # @param transformation [Imagekit::Models::UploadPreTransformErrorEvent::Data::Transformation] + + # @see Imagekit::Models::UploadPreTransformErrorEvent::Data#transformation + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute error + # + # @return [Imagekit::Models::UploadPreTransformErrorEvent::Data::Transformation::Error] + required :error, -> { Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error } + + # @!method initialize(error:) + # @param error [Imagekit::Models::UploadPreTransformErrorEvent::Data::Transformation::Error] + + # @see Imagekit::Models::UploadPreTransformErrorEvent::Data::Transformation#error + class Error < Imagekit::Internal::Type::BaseModel + # @!attribute reason + # Reason for the pre-transformation failure. + # + # @return [String] + required :reason, String + + # @!method initialize(reason:) + # @param reason [String] Reason for the pre-transformation failure. + end + end + end + + # @see Imagekit::Models::UploadPreTransformErrorEvent#request + class Request < Imagekit::Internal::Type::BaseModel + # @!attribute transformation + # The requested pre-transformation string. + # + # @return [String] + required :transformation, String + + # @!attribute x_request_id + # Unique identifier for the originating request. + # + # @return [String] + required :x_request_id, String + + # @!method initialize(transformation:, x_request_id:) + # @param transformation [String] The requested pre-transformation string. + # + # @param x_request_id [String] Unique identifier for the originating request. + end + end + end +end diff --git a/lib/imagekit/models/upload_pre_transform_success_event.rb b/lib/imagekit/models/upload_pre_transform_success_event.rb new file mode 100644 index 00000000..37c3be87 --- /dev/null +++ b/lib/imagekit/models/upload_pre_transform_success_event.rb @@ -0,0 +1,467 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!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 successful upload. + # + # @return [Imagekit::Models::UploadPreTransformSuccessEvent::Data] + required :data, -> { Imagekit::UploadPreTransformSuccessEvent::Data } + + # @!attribute request + # + # @return [Imagekit::Models::UploadPreTransformSuccessEvent::Request] + required :request, -> { Imagekit::UploadPreTransformSuccessEvent::Request } + + # @!attribute type + # + # @return [Symbol, :"upload.pre-transform.success"] + required :type, const: :"upload.pre-transform.success" + + # @!method initialize(id:, created_at:, data:, request:, type: :"upload.pre-transform.success") + # Triggered when a pre-transformation completes successfully. The file has been + # processed with the requested transformation and is now available in the Media + # Library. + # + # @param id [String] Unique identifier for the event. + # + # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. + # + # @param data [Imagekit::Models::UploadPreTransformSuccessEvent::Data] Object containing details of a successful upload. + # + # @param request [Imagekit::Models::UploadPreTransformSuccessEvent::Request] + # + # @param type [Symbol, :"upload.pre-transform.success"] + + # @see Imagekit::Models::UploadPreTransformSuccessEvent#data + class Data < Imagekit::Internal::Type::BaseModel + # @!attribute ai_tags + # An array of tags assigned to the uploaded file by auto tagging. + # + # @return [Array, nil] + optional :ai_tags, + -> { + Imagekit::Internal::Type::ArrayOf[Imagekit::UploadPreTransformSuccessEvent::Data::AITag] + }, + api_name: :AITags, + nil?: true + + # @!attribute audio_codec + # The audio codec used in the video (only for video). + # + # @return [String, nil] + optional :audio_codec, String, api_name: :audioCodec + + # @!attribute bit_rate + # The bit rate of the video in kbps (only for video). + # + # @return [Integer, nil] + optional :bit_rate, Integer, api_name: :bitRate + + # @!attribute custom_coordinates + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true + + # @!attribute custom_metadata + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + # + # @return [String, nil] + optional :description, String + + # @!attribute duration + # The duration of the video in seconds (only for video). + # + # @return [Integer, nil] + optional :duration, Integer + + # @!attribute embedded_metadata + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + # + # @return [Hash{Symbol=>Object}, nil] + optional :embedded_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :embeddedMetadata + + # @!attribute extension_status + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + # + # @return [Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus, nil] + optional :extension_status, + -> { Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus }, + api_name: :extensionStatus + + # @!attribute file_id + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + # + # @return [String, nil] + optional :file_id, String, api_name: :fileId + + # @!attribute file_path + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + # + # @return [String, nil] + optional :file_path, String, api_name: :filePath + + # @!attribute file_type + # Type of the uploaded file. Possible values are `image`, `non-image`. + # + # @return [String, nil] + optional :file_type, String, api_name: :fileType + + # @!attribute height + # Height of the image in pixels (Only for images) + # + # @return [Float, nil] + optional :height, Float + + # @!attribute is_private_file + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + # + # @return [Boolean, nil] + optional :is_private_file, Imagekit::Internal::Type::Boolean, api_name: :isPrivateFile + + # @!attribute is_published + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + # + # @return [Boolean, nil] + optional :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute metadata + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + # + # @return [Imagekit::Models::Metadata, nil] + optional :metadata, -> { Imagekit::Metadata } + + # @!attribute name + # Name of the asset. + # + # @return [String, nil] + optional :name, String + + # @!attribute size + # Size of the image file in Bytes. + # + # @return [Float, nil] + optional :size, Float + + # @!attribute tags + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute thumbnail_url + # In the case of an image, a small thumbnail URL. + # + # @return [String, nil] + optional :thumbnail_url, String, api_name: :thumbnailUrl + + # @!attribute url + # A publicly accessible URL of the file. + # + # @return [String, nil] + optional :url, String + + # @!attribute version_info + # An object containing the file or file version's `id` (versionId) and `name`. + # + # @return [Imagekit::Models::UploadPreTransformSuccessEvent::Data::VersionInfo, nil] + optional :version_info, + -> { Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo }, + api_name: :versionInfo + + # @!attribute video_codec + # The video codec used in the video (only for video). + # + # @return [String, nil] + optional :video_codec, String, api_name: :videoCodec + + # @!attribute width + # Width of the image in pixels (Only for Images) + # + # @return [Float, nil] + optional :width, Float + + # @!method initialize(ai_tags: nil, audio_codec: nil, bit_rate: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, duration: nil, embedded_metadata: nil, extension_status: nil, file_id: nil, file_path: nil, file_type: nil, height: nil, is_private_file: nil, is_published: nil, metadata: nil, name: nil, size: nil, tags: nil, thumbnail_url: nil, url: nil, version_info: nil, video_codec: nil, width: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::UploadPreTransformSuccessEvent::Data} for more details. + # + # 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 audio_codec [String] The audio codec used in the video (only for video). + # + # @param bit_rate [Integer] The bit rate of the video in kbps (only for video). + # + # @param custom_coordinates [String, nil] Value of custom coordinates associated with the image in the format `x,y,width,h + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data associated with the asset. Use `responseField` in API request t + # + # @param description [String] Optional text to describe the contents of the file. Can be set by the user or th + # + # @param duration [Integer] The duration of the video in seconds (only for video). + # + # @param embedded_metadata [Hash{Symbol=>Object}] Consolidated embedded metadata associated with the file. It includes exif, iptc, + # + # @param extension_status [Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus] Extension names with their processing status at the time of completion of the re + # + # @param file_id [String] Unique fileId. Store this fileld in your database, as this will be used to perfo + # + # @param file_path [String] The relative path of the file in the media library e.g. `/marketing-assets/new-b + # + # @param file_type [String] Type of the uploaded file. Possible values are `image`, `non-image`. + # + # @param height [Float] Height of the image in pixels (Only for images) + # + # @param is_private_file [Boolean] Is the file marked as private. It can be either `true` or `false`. Send `isPriva + # + # @param is_published [Boolean] Is the file published or in draft state. It can be either `true` or `false`. Sen + # + # @param metadata [Imagekit::Models::Metadata] Legacy metadata. Send `metadata` in `responseFields` in API request to get metad + # + # @param name [String] Name of the asset. + # + # @param size [Float] Size of the image file in Bytes. + # + # @param tags [Array, nil] The array of tags associated with the asset. If no tags are set, it will be `nul + # + # @param thumbnail_url [String] In the case of an image, a small thumbnail URL. + # + # @param url [String] A publicly accessible URL of the file. + # + # @param version_info [Imagekit::Models::UploadPreTransformSuccessEvent::Data::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 < Imagekit::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 + # {Imagekit::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 Imagekit::Models::UploadPreTransformSuccessEvent::Data#extension_status + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + # @!attribute ai_auto_description + # + # @return [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription, nil] + optional :ai_auto_description, + enum: -> { + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription + }, + api_name: :"ai-auto-description" + + # @!attribute aws_auto_tagging + # + # @return [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging, nil] + optional :aws_auto_tagging, + enum: -> { + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging + }, + api_name: :"aws-auto-tagging" + + # @!attribute google_auto_tagging + # + # @return [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging, nil] + optional :google_auto_tagging, + enum: -> { + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging + }, + api_name: :"google-auto-tagging" + + # @!attribute remove_bg + # + # @return [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg, nil] + optional :remove_bg, + enum: -> { Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg }, + api_name: :"remove-bg" + + # @!method initialize(ai_auto_description: nil, aws_auto_tagging: nil, google_auto_tagging: nil, remove_bg: nil) + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + # + # @param ai_auto_description [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription] + # @param aws_auto_tagging [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging] + # @param google_auto_tagging [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging] + # @param remove_bg [Symbol, Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg] + + # @see Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus#ai_auto_description + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus#aws_auto_tagging + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus#google_auto_tagging + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus#remove_bg + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS = :success + PENDING = :pending + FAILED = :failed + + # @!method self.values + # @return [Array] + end + end + + # @see Imagekit::Models::UploadPreTransformSuccessEvent::Data#version_info + class VersionInfo < Imagekit::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 + + # @see Imagekit::Models::UploadPreTransformSuccessEvent#request + class Request < Imagekit::Internal::Type::BaseModel + # @!attribute transformation + # The requested pre-transformation string. + # + # @return [String] + required :transformation, String + + # @!attribute x_request_id + # Unique identifier for the originating request. + # + # @return [String] + required :x_request_id, String + + # @!method initialize(transformation:, x_request_id:) + # @param transformation [String] The requested pre-transformation string. + # + # @param x_request_id [String] Unique identifier for the originating request. + end + end + end +end diff --git a/lib/imagekit/models/video_overlay.rb b/lib/imagekit/models/video_overlay.rb new file mode 100644 index 00000000..3a134813 --- /dev/null +++ b/lib/imagekit/models/video_overlay.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class VideoOverlay < Imagekit::Models::BaseOverlay + # @!attribute input + # Specifies the relative path to the video used as an overlay. + # + # @return [String] + required :input, String + + # @!attribute type + # + # @return [Symbol, :video] + required :type, const: :video + + # @!attribute encoding + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + # + # @return [Symbol, Imagekit::Models::VideoOverlay::Encoding, nil] + optional :encoding, enum: -> { Imagekit::VideoOverlay::Encoding } + + # @!attribute transformation + # Array of transformation to be applied to the overlay video. Except + # `streamingResolutions`, all other video transformations are supported. See + # [Video transformations](https://imagekit.io/docs/video-transformation). + # + # @return [Array, nil] + optional :transformation, -> { Imagekit::Internal::Type::ArrayOf[Imagekit::Transformation] } + + # @!method initialize(input:, encoding: nil, transformation: nil, type: :video) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::VideoOverlay} for more details. + # + # @param input [String] Specifies the relative path to the video used as an overlay. + # + # @param encoding [Symbol, Imagekit::Models::VideoOverlay::Encoding] The input path can be included in the layer as either `i-{input}` or `ie-{base64 + # + # @param transformation [Array] Array of transformation to be applied to the overlay video. Except `streamingRes + # + # @param type [Symbol, :video] + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO = :auto + PLAIN = :plain + BASE64 = :base64 + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/imagekit/models/video_transformation_accepted_event.rb b/lib/imagekit/models/video_transformation_accepted_event.rb new file mode 100644 index 00000000..05cf00ab --- /dev/null +++ b/lib/imagekit/models/video_transformation_accepted_event.rb @@ -0,0 +1,289 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!attribute created_at + # Timestamp when the event was created in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekit::Models::VideoTransformationAcceptedEvent::Data] + required :data, -> { Imagekit::VideoTransformationAcceptedEvent::Data } + + # @!attribute request + # Information about the original request that triggered the video transformation. + # + # @return [Imagekit::Models::VideoTransformationAcceptedEvent::Request] + required :request, -> { Imagekit::VideoTransformationAcceptedEvent::Request } + + # @!attribute type + # + # @return [Symbol, :"video.transformation.accepted"] + required :type, const: :"video.transformation.accepted" + + # @!method initialize(id:, created_at:, data:, request:, type: :"video.transformation.accepted") + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. + # + # @param id [String] Unique identifier for the event. + # + # @param created_at [Time] Timestamp when the event was created in ISO8601 format. + # + # @param data [Imagekit::Models::VideoTransformationAcceptedEvent::Data] + # + # @param request [Imagekit::Models::VideoTransformationAcceptedEvent::Request] Information about the original request that triggered the video transformation. + # + # @param type [Symbol, :"video.transformation.accepted"] + + # @see Imagekit::Models::VideoTransformationAcceptedEvent#data + class Data < Imagekit::Internal::Type::BaseModel + # @!attribute asset + # Information about the source video asset being transformed. + # + # @return [Imagekit::Models::VideoTransformationAcceptedEvent::Data::Asset] + required :asset, -> { Imagekit::VideoTransformationAcceptedEvent::Data::Asset } + + # @!attribute transformation + # Base information about a video transformation request. + # + # @return [Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation] + required :transformation, -> { Imagekit::VideoTransformationAcceptedEvent::Data::Transformation } + + # @!method initialize(asset:, transformation:) + # @param asset [Imagekit::Models::VideoTransformationAcceptedEvent::Data::Asset] Information about the source video asset being transformed. + # + # @param transformation [Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation] Base information about a video transformation request. + + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data#asset + class Asset < Imagekit::Internal::Type::BaseModel + # @!attribute url + # URL to download or access the source video file. + # + # @return [String] + required :url, String + + # @!method initialize(url:) + # Information about the source video asset being transformed. + # + # @param url [String] URL to download or access the source video file. + end + + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data#transformation + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + # + # @return [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Type] + required :type, enum: -> { Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type } + + # @!attribute options + # Configuration options for video transformations. + # + # @return [Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options, nil] + optional :options, -> { Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options } + + # @!method initialize(type:, options: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation} for + # more details. + # + # Base information about a video transformation request. + # + # @param type [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Type] Type of video transformation: + # + # @param options [Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options] Configuration options for video transformations. + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + # + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation#type + module Type + extend Imagekit::Internal::Type::Enum + + VIDEO_TRANSFORMATION = :"video-transformation" + GIF_TO_VIDEO = :"gif-to-video" + VIDEO_THUMBNAIL = :"video-thumbnail" + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation#options + class Options < Imagekit::Internal::Type::BaseModel + # @!attribute audio_codec + # Audio codec used for encoding (aac or opus). + # + # @return [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec, nil] + optional :audio_codec, + enum: -> { Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec } + + # @!attribute auto_rotate + # Whether to automatically rotate the video based on metadata. + # + # @return [Boolean, nil] + optional :auto_rotate, Imagekit::Internal::Type::Boolean + + # @!attribute format_ + # Output format for the transformed video or thumbnail. + # + # @return [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format, nil] + optional :format_, + enum: -> { + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format + }, + api_name: :format + + # @!attribute quality + # Quality setting for the output video. + # + # @return [Integer, nil] + optional :quality, Integer + + # @!attribute stream_protocol + # Streaming protocol for adaptive bitrate streaming. + # + # @return [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol, nil] + optional :stream_protocol, + enum: -> { Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol } + + # @!attribute variants + # Array of quality representations for adaptive bitrate streaming. + # + # @return [Array, nil] + optional :variants, Imagekit::Internal::Type::ArrayOf[String] + + # @!attribute video_codec + # Video codec used for encoding (h264, vp9, or av1). + # + # @return [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec, nil] + optional :video_codec, + enum: -> { Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec } + + # @!method initialize(audio_codec: nil, auto_rotate: nil, format_: nil, quality: nil, stream_protocol: nil, variants: nil, video_codec: nil) + # Configuration options for video transformations. + # + # @param audio_codec [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec] Audio codec used for encoding (aac or opus). + # + # @param auto_rotate [Boolean] Whether to automatically rotate the video based on metadata. + # + # @param format_ [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format] Output format for the transformed video or thumbnail. + # + # @param quality [Integer] Quality setting for the output video. + # + # @param stream_protocol [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol] Streaming protocol for adaptive bitrate streaming. + # + # @param variants [Array] Array of quality representations for adaptive bitrate streaming. + # + # @param video_codec [Symbol, Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec] Video codec used for encoding (h264, vp9, or av1). + + # Audio codec used for encoding (aac or opus). + # + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options#audio_codec + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC = :aac + OPUS = :opus + + # @!method self.values + # @return [Array] + end + + # Output format for the transformed video or thumbnail. + # + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options#format_ + module Format + extend Imagekit::Internal::Type::Enum + + MP4 = :mp4 + WEBM = :webm + JPG = :jpg + PNG = :png + WEBP = :webp + + # @!method self.values + # @return [Array] + end + + # Streaming protocol for adaptive bitrate streaming. + # + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options#stream_protocol + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + HLS = :HLS + DASH = :DASH + + # @!method self.values + # @return [Array] + end + + # Video codec used for encoding (h264, vp9, or av1). + # + # @see Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options#video_codec + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264 = :h264 + VP9 = :vp9 + AV1 = :av1 + + # @!method self.values + # @return [Array] + end + end + end + end + + # @see Imagekit::Models::VideoTransformationAcceptedEvent#request + class Request < Imagekit::Internal::Type::BaseModel + # @!attribute url + # Full URL of the transformation request that was submitted. + # + # @return [String] + required :url, String + + # @!attribute x_request_id + # Unique identifier for the originating transformation request. + # + # @return [String] + required :x_request_id, String + + # @!attribute user_agent + # User-Agent header from the original request that triggered the transformation. + # + # @return [String, nil] + optional :user_agent, String + + # @!method initialize(url:, x_request_id:, user_agent: nil) + # Information about the original request that triggered the video transformation. + # + # @param url [String] Full URL of the transformation request that was submitted. + # + # @param x_request_id [String] Unique identifier for the originating transformation request. + # + # @param user_agent [String] User-Agent header from the original request that triggered the transformation. + end + end + end +end diff --git a/lib/imagekit/models/video_transformation_error_event.rb b/lib/imagekit/models/video_transformation_error_event.rb new file mode 100644 index 00000000..fe6c9a88 --- /dev/null +++ b/lib/imagekit/models/video_transformation_error_event.rb @@ -0,0 +1,336 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!attribute created_at + # Timestamp when the event was created in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekit::Models::VideoTransformationErrorEvent::Data] + required :data, -> { Imagekit::VideoTransformationErrorEvent::Data } + + # @!attribute request + # Information about the original request that triggered the video transformation. + # + # @return [Imagekit::Models::VideoTransformationErrorEvent::Request] + required :request, -> { Imagekit::VideoTransformationErrorEvent::Request } + + # @!attribute type + # + # @return [Symbol, :"video.transformation.error"] + required :type, const: :"video.transformation.error" + + # @!method initialize(id:, created_at:, data:, request:, type: :"video.transformation.error") + # Triggered when an error occurs during video encoding. Listen to this webhook to + # log error reasons and debug issues. Check your origin and URL endpoint settings + # if the reason is related to download failure. For other errors, contact ImageKit + # support. + # + # @param id [String] Unique identifier for the event. + # + # @param created_at [Time] Timestamp when the event was created in ISO8601 format. + # + # @param data [Imagekit::Models::VideoTransformationErrorEvent::Data] + # + # @param request [Imagekit::Models::VideoTransformationErrorEvent::Request] Information about the original request that triggered the video transformation. + # + # @param type [Symbol, :"video.transformation.error"] + + # @see Imagekit::Models::VideoTransformationErrorEvent#data + class Data < Imagekit::Internal::Type::BaseModel + # @!attribute asset + # Information about the source video asset being transformed. + # + # @return [Imagekit::Models::VideoTransformationErrorEvent::Data::Asset] + required :asset, -> { Imagekit::VideoTransformationErrorEvent::Data::Asset } + + # @!attribute transformation + # + # @return [Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation] + required :transformation, -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation } + + # @!method initialize(asset:, transformation:) + # @param asset [Imagekit::Models::VideoTransformationErrorEvent::Data::Asset] Information about the source video asset being transformed. + # + # @param transformation [Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation] + + # @see Imagekit::Models::VideoTransformationErrorEvent::Data#asset + class Asset < Imagekit::Internal::Type::BaseModel + # @!attribute url + # URL to download or access the source video file. + # + # @return [String] + required :url, String + + # @!method initialize(url:) + # Information about the source video asset being transformed. + # + # @param url [String] URL to download or access the source video file. + end + + # @see Imagekit::Models::VideoTransformationErrorEvent::Data#transformation + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + # + # @return [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Type] + required :type, enum: -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type } + + # @!attribute error + # Details about the transformation error. + # + # @return [Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error, nil] + optional :error, -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error } + + # @!attribute options + # Configuration options for video transformations. + # + # @return [Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options, nil] + optional :options, -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options } + + # @!method initialize(type:, error: nil, options: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation} for more + # details. + # + # @param type [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Type] Type of video transformation: + # + # @param error [Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error] Details about the transformation error. + # + # @param options [Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options] Configuration options for video transformations. + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + # + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation#type + module Type + extend Imagekit::Internal::Type::Enum + + VIDEO_TRANSFORMATION = :"video-transformation" + GIF_TO_VIDEO = :"gif-to-video" + VIDEO_THUMBNAIL = :"video-thumbnail" + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation#error + class Error < Imagekit::Internal::Type::BaseModel + # @!attribute reason + # Specific reason for the transformation failure: + # + # - `encoding_failed`: Error during video encoding process + # - `download_failed`: Could not download source video + # - `internal_server_error`: Unexpected server error + # + # @return [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error::Reason] + required :reason, + enum: -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason } + + # @!method initialize(reason:) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error} + # for more details. + # + # Details about the transformation error. + # + # @param reason [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error::Reason] Specific reason for the transformation failure: + + # Specific reason for the transformation failure: + # + # - `encoding_failed`: Error during video encoding process + # - `download_failed`: Could not download source video + # - `internal_server_error`: Unexpected server error + # + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error#reason + module Reason + extend Imagekit::Internal::Type::Enum + + ENCODING_FAILED = :encoding_failed + DOWNLOAD_FAILED = :download_failed + INTERNAL_SERVER_ERROR = :internal_server_error + + # @!method self.values + # @return [Array] + end + end + + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation#options + class Options < Imagekit::Internal::Type::BaseModel + # @!attribute audio_codec + # Audio codec used for encoding (aac or opus). + # + # @return [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec, nil] + optional :audio_codec, + enum: -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec } + + # @!attribute auto_rotate + # Whether to automatically rotate the video based on metadata. + # + # @return [Boolean, nil] + optional :auto_rotate, Imagekit::Internal::Type::Boolean + + # @!attribute format_ + # Output format for the transformed video or thumbnail. + # + # @return [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::Format, nil] + optional :format_, + enum: -> { + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format + }, + api_name: :format + + # @!attribute quality + # Quality setting for the output video. + # + # @return [Integer, nil] + optional :quality, Integer + + # @!attribute stream_protocol + # Streaming protocol for adaptive bitrate streaming. + # + # @return [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol, nil] + optional :stream_protocol, + enum: -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol } + + # @!attribute variants + # Array of quality representations for adaptive bitrate streaming. + # + # @return [Array, nil] + optional :variants, Imagekit::Internal::Type::ArrayOf[String] + + # @!attribute video_codec + # Video codec used for encoding (h264, vp9, or av1). + # + # @return [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec, nil] + optional :video_codec, + enum: -> { Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec } + + # @!method initialize(audio_codec: nil, auto_rotate: nil, format_: nil, quality: nil, stream_protocol: nil, variants: nil, video_codec: nil) + # Configuration options for video transformations. + # + # @param audio_codec [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec] Audio codec used for encoding (aac or opus). + # + # @param auto_rotate [Boolean] Whether to automatically rotate the video based on metadata. + # + # @param format_ [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::Format] Output format for the transformed video or thumbnail. + # + # @param quality [Integer] Quality setting for the output video. + # + # @param stream_protocol [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol] Streaming protocol for adaptive bitrate streaming. + # + # @param variants [Array] Array of quality representations for adaptive bitrate streaming. + # + # @param video_codec [Symbol, Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec] Video codec used for encoding (h264, vp9, or av1). + + # Audio codec used for encoding (aac or opus). + # + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options#audio_codec + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC = :aac + OPUS = :opus + + # @!method self.values + # @return [Array] + end + + # Output format for the transformed video or thumbnail. + # + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options#format_ + module Format + extend Imagekit::Internal::Type::Enum + + MP4 = :mp4 + WEBM = :webm + JPG = :jpg + PNG = :png + WEBP = :webp + + # @!method self.values + # @return [Array] + end + + # Streaming protocol for adaptive bitrate streaming. + # + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options#stream_protocol + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + HLS = :HLS + DASH = :DASH + + # @!method self.values + # @return [Array] + end + + # Video codec used for encoding (h264, vp9, or av1). + # + # @see Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options#video_codec + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264 = :h264 + VP9 = :vp9 + AV1 = :av1 + + # @!method self.values + # @return [Array] + end + end + end + end + + # @see Imagekit::Models::VideoTransformationErrorEvent#request + class Request < Imagekit::Internal::Type::BaseModel + # @!attribute url + # Full URL of the transformation request that was submitted. + # + # @return [String] + required :url, String + + # @!attribute x_request_id + # Unique identifier for the originating transformation request. + # + # @return [String] + required :x_request_id, String + + # @!attribute user_agent + # User-Agent header from the original request that triggered the transformation. + # + # @return [String, nil] + optional :user_agent, String + + # @!method initialize(url:, x_request_id:, user_agent: nil) + # Information about the original request that triggered the video transformation. + # + # @param url [String] Full URL of the transformation request that was submitted. + # + # @param x_request_id [String] Unique identifier for the originating transformation request. + # + # @param user_agent [String] User-Agent header from the original request that triggered the transformation. + end + end + end +end diff --git a/lib/imagekit/models/video_transformation_ready_event.rb b/lib/imagekit/models/video_transformation_ready_event.rb new file mode 100644 index 00000000..076e88c4 --- /dev/null +++ b/lib/imagekit/models/video_transformation_ready_event.rb @@ -0,0 +1,390 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!attribute created_at + # Timestamp when the event was created in ISO8601 format. + # + # @return [Time] + required :created_at, Time + + # @!attribute data + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Data] + required :data, -> { Imagekit::VideoTransformationReadyEvent::Data } + + # @!attribute request + # Information about the original request that triggered the video transformation. + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Request] + required :request, -> { Imagekit::VideoTransformationReadyEvent::Request } + + # @!attribute type + # + # @return [Symbol, :"video.transformation.ready"] + required :type, const: :"video.transformation.ready" + + # @!attribute timings + # Performance metrics for the transformation process. + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Timings, nil] + optional :timings, -> { Imagekit::VideoTransformationReadyEvent::Timings } + + # @!method initialize(id:, created_at:, data:, request:, timings: nil, type: :"video.transformation.ready") + # Triggered when video encoding is finished and the transformed resource is ready + # to be served. This is the key event to listen for - update your database or CMS + # flags when you receive this so your application can start showing the + # transformed video to users. + # + # @param id [String] Unique identifier for the event. + # + # @param created_at [Time] Timestamp when the event was created in ISO8601 format. + # + # @param data [Imagekit::Models::VideoTransformationReadyEvent::Data] + # + # @param request [Imagekit::Models::VideoTransformationReadyEvent::Request] Information about the original request that triggered the video transformation. + # + # @param timings [Imagekit::Models::VideoTransformationReadyEvent::Timings] Performance metrics for the transformation process. + # + # @param type [Symbol, :"video.transformation.ready"] + + # @see Imagekit::Models::VideoTransformationReadyEvent#data + class Data < Imagekit::Internal::Type::BaseModel + # @!attribute asset + # Information about the source video asset being transformed. + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Data::Asset] + required :asset, -> { Imagekit::VideoTransformationReadyEvent::Data::Asset } + + # @!attribute transformation + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation] + required :transformation, -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation } + + # @!method initialize(asset:, transformation:) + # @param asset [Imagekit::Models::VideoTransformationReadyEvent::Data::Asset] Information about the source video asset being transformed. + # + # @param transformation [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation] + + # @see Imagekit::Models::VideoTransformationReadyEvent::Data#asset + class Asset < Imagekit::Internal::Type::BaseModel + # @!attribute url + # URL to download or access the source video file. + # + # @return [String] + required :url, String + + # @!method initialize(url:) + # Information about the source video asset being transformed. + # + # @param url [String] URL to download or access the source video file. + end + + # @see Imagekit::Models::VideoTransformationReadyEvent::Data#transformation + class Transformation < Imagekit::Internal::Type::BaseModel + # @!attribute type + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + # + # @return [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Type] + required :type, enum: -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type } + + # @!attribute options + # Configuration options for video transformations. + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options, nil] + optional :options, -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options } + + # @!attribute output + # Information about the transformed output video. + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Output, nil] + optional :output, -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output } + + # @!method initialize(type:, options: nil, output: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation} for more + # details. + # + # @param type [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Type] Type of video transformation: + # + # @param options [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options] Configuration options for video transformations. + # + # @param output [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Output] Information about the transformed output video. + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + # + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation#type + module Type + extend Imagekit::Internal::Type::Enum + + VIDEO_TRANSFORMATION = :"video-transformation" + GIF_TO_VIDEO = :"gif-to-video" + VIDEO_THUMBNAIL = :"video-thumbnail" + + # @!method self.values + # @return [Array] + end + + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation#options + class Options < Imagekit::Internal::Type::BaseModel + # @!attribute audio_codec + # Audio codec used for encoding (aac or opus). + # + # @return [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec, nil] + optional :audio_codec, + enum: -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec } + + # @!attribute auto_rotate + # Whether to automatically rotate the video based on metadata. + # + # @return [Boolean, nil] + optional :auto_rotate, Imagekit::Internal::Type::Boolean + + # @!attribute format_ + # Output format for the transformed video or thumbnail. + # + # @return [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::Format, nil] + optional :format_, + enum: -> { + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format + }, + api_name: :format + + # @!attribute quality + # Quality setting for the output video. + # + # @return [Integer, nil] + optional :quality, Integer + + # @!attribute stream_protocol + # Streaming protocol for adaptive bitrate streaming. + # + # @return [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol, nil] + optional :stream_protocol, + enum: -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol } + + # @!attribute variants + # Array of quality representations for adaptive bitrate streaming. + # + # @return [Array, nil] + optional :variants, Imagekit::Internal::Type::ArrayOf[String] + + # @!attribute video_codec + # Video codec used for encoding (h264, vp9, or av1). + # + # @return [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec, nil] + optional :video_codec, + enum: -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec } + + # @!method initialize(audio_codec: nil, auto_rotate: nil, format_: nil, quality: nil, stream_protocol: nil, variants: nil, video_codec: nil) + # Configuration options for video transformations. + # + # @param audio_codec [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec] Audio codec used for encoding (aac or opus). + # + # @param auto_rotate [Boolean] Whether to automatically rotate the video based on metadata. + # + # @param format_ [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::Format] Output format for the transformed video or thumbnail. + # + # @param quality [Integer] Quality setting for the output video. + # + # @param stream_protocol [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol] Streaming protocol for adaptive bitrate streaming. + # + # @param variants [Array] Array of quality representations for adaptive bitrate streaming. + # + # @param video_codec [Symbol, Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec] Video codec used for encoding (h264, vp9, or av1). + + # Audio codec used for encoding (aac or opus). + # + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options#audio_codec + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC = :aac + OPUS = :opus + + # @!method self.values + # @return [Array] + end + + # Output format for the transformed video or thumbnail. + # + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options#format_ + module Format + extend Imagekit::Internal::Type::Enum + + MP4 = :mp4 + WEBM = :webm + JPG = :jpg + PNG = :png + WEBP = :webp + + # @!method self.values + # @return [Array] + end + + # Streaming protocol for adaptive bitrate streaming. + # + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options#stream_protocol + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + HLS = :HLS + DASH = :DASH + + # @!method self.values + # @return [Array] + end + + # Video codec used for encoding (h264, vp9, or av1). + # + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options#video_codec + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264 = :h264 + VP9 = :vp9 + AV1 = :av1 + + # @!method self.values + # @return [Array] + end + end + + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation#output + class Output < Imagekit::Internal::Type::BaseModel + # @!attribute url + # URL to access the transformed video. + # + # @return [String] + required :url, String + + # @!attribute video_metadata + # Metadata of the output video file. + # + # @return [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata, nil] + optional :video_metadata, + -> { Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata } + + # @!method initialize(url:, video_metadata: nil) + # Information about the transformed output video. + # + # @param url [String] URL to access the transformed video. + # + # @param video_metadata [Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata] Metadata of the output video file. + + # @see Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Output#video_metadata + class VideoMetadata < Imagekit::Internal::Type::BaseModel + # @!attribute bitrate + # Bitrate of the output video in bits per second. + # + # @return [Integer] + required :bitrate, Integer + + # @!attribute duration + # Duration of the output video in seconds. + # + # @return [Float] + required :duration, Float + + # @!attribute height + # Height of the output video in pixels. + # + # @return [Integer] + required :height, Integer + + # @!attribute width + # Width of the output video in pixels. + # + # @return [Integer] + required :width, Integer + + # @!method initialize(bitrate:, duration:, height:, width:) + # Metadata of the output video file. + # + # @param bitrate [Integer] Bitrate of the output video in bits per second. + # + # @param duration [Float] Duration of the output video in seconds. + # + # @param height [Integer] Height of the output video in pixels. + # + # @param width [Integer] Width of the output video in pixels. + end + end + end + end + + # @see Imagekit::Models::VideoTransformationReadyEvent#request + class Request < Imagekit::Internal::Type::BaseModel + # @!attribute url + # Full URL of the transformation request that was submitted. + # + # @return [String] + required :url, String + + # @!attribute x_request_id + # Unique identifier for the originating transformation request. + # + # @return [String] + required :x_request_id, String + + # @!attribute user_agent + # User-Agent header from the original request that triggered the transformation. + # + # @return [String, nil] + optional :user_agent, String + + # @!method initialize(url:, x_request_id:, user_agent: nil) + # Information about the original request that triggered the video transformation. + # + # @param url [String] Full URL of the transformation request that was submitted. + # + # @param x_request_id [String] Unique identifier for the originating transformation request. + # + # @param user_agent [String] User-Agent header from the original request that triggered the transformation. + end + + # @see Imagekit::Models::VideoTransformationReadyEvent#timings + class Timings < Imagekit::Internal::Type::BaseModel + # @!attribute download_duration + # Time spent downloading the source video from your origin or media library, in + # milliseconds. + # + # @return [Integer, nil] + optional :download_duration, Integer + + # @!attribute encoding_duration + # Time spent encoding the video, in milliseconds. + # + # @return [Integer, nil] + optional :encoding_duration, Integer + + # @!method initialize(download_duration: nil, encoding_duration: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::VideoTransformationReadyEvent::Timings} for more details. + # + # Performance metrics for the transformation process. + # + # @param download_duration [Integer] Time spent downloading the source video from your origin or media library, in mi + # + # @param encoding_duration [Integer] Time spent encoding the video, in milliseconds. + end + end + end +end diff --git a/lib/imagekit/models/webhook_unsafe_unwrap_params.rb b/lib/imagekit/models/webhook_unsafe_unwrap_params.rb new file mode 100644 index 00000000..15530402 --- /dev/null +++ b/lib/imagekit/models/webhook_unsafe_unwrap_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Webhooks#unsafe_unwrap + class WebhookUnsafeUnwrapParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/models/webhook_unwrap_params.rb b/lib/imagekit/models/webhook_unwrap_params.rb new file mode 100644 index 00000000..d93a86a9 --- /dev/null +++ b/lib/imagekit/models/webhook_unwrap_params.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Imagekit + module Models + # @see Imagekit::Resources::Webhooks#unwrap + class WebhookUnwrapParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + # @!method initialize(request_options: {}) + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] + end + end +end diff --git a/lib/imagekit/request_options.rb b/lib/imagekit/request_options.rb new file mode 100644 index 00000000..2e8ffb9e --- /dev/null +++ b/lib/imagekit/request_options.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module Imagekit + # Specify HTTP behaviour to use for a specific request. These options supplement + # or override those provided at the client level. + # + # When making a request, you can pass an actual {RequestOptions} instance, or + # simply pass a Hash with symbol keys matching the attributes on this class. + class RequestOptions < Imagekit::Internal::Type::BaseModel + # @api private + # + # @param opts [Imagekit::RequestOptions, Hash{Symbol=>Object}] + # + # @raise [ArgumentError] + def self.validate!(opts) + case opts + in Imagekit::RequestOptions | Hash + opts.to_h.each_key do |k| + unless fields.include?(k) + raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}") + end + end + else + raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}") + end + end + + # @!attribute idempotency_key + # Idempotency key to send with request and all associated retries. Will only be + # sent for write requests. + # + # @return [String, nil] + optional :idempotency_key, String + + # @!attribute extra_query + # Extra query params to send with the request. These are `.merge`’d into any + # `query` given at the client level. + # + # @return [Hash{String=>Array, String, nil}, nil] + optional :extra_query, Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::ArrayOf[String]] + + # @!attribute extra_headers + # Extra headers to send with the request. These are `.merged`’d into any + # `extra_headers` given at the client level. + # + # @return [Hash{String=>String, nil}, nil] + optional :extra_headers, Imagekit::Internal::Type::HashOf[String, nil?: true] + + # @!attribute extra_body + # Extra data to send with the request. These are deep merged into any data + # generated as part of the normal request. + # + # @return [Object, nil] + optional :extra_body, Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown] + + # @!attribute max_retries + # Maximum number of retries to attempt after a failed initial request. + # + # @return [Integer, nil] + optional :max_retries, Integer + + # @!attribute timeout + # Request timeout in seconds. + # + # @return [Float, nil] + optional :timeout, Float + + # @!method initialize(values = {}) + # Returns a new instance of RequestOptions. + # + # @param values [Hash{Symbol=>Object}] + + define_sorbet_constant!(:OrHash) do + T.type_alias { T.any(Imagekit::RequestOptions, Imagekit::Internal::AnyHash) } + end + end +end diff --git a/lib/imagekit/resources/accounts.rb b/lib/imagekit/resources/accounts.rb new file mode 100644 index 00000000..5946d26e --- /dev/null +++ b/lib/imagekit/resources/accounts.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Accounts + # @return [Imagekit::Resources::Accounts::Usage] + attr_reader :usage + + # @return [Imagekit::Resources::Accounts::Origins] + attr_reader :origins + + # @return [Imagekit::Resources::Accounts::URLEndpoints] + attr_reader :url_endpoints + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + @usage = Imagekit::Resources::Accounts::Usage.new(client: client) + @origins = Imagekit::Resources::Accounts::Origins.new(client: client) + @url_endpoints = Imagekit::Resources::Accounts::URLEndpoints.new(client: client) + end + end + end +end diff --git a/lib/imagekit/resources/accounts/origins.rb b/lib/imagekit/resources/accounts/origins.rb new file mode 100644 index 00000000..c4b0cba9 --- /dev/null +++ b/lib/imagekit/resources/accounts/origins.rb @@ -0,0 +1,135 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Accounts + class Origins + # **Note:** This API is currently in beta. + # Creates a new origin and returns the origin object. + # + # @overload create(origin:, request_options: {}) + # + # @param origin [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Accounts::OriginResponse::S3, Imagekit::Models::Accounts::OriginResponse::S3Compatible, Imagekit::Models::Accounts::OriginResponse::CloudinaryBackup, Imagekit::Models::Accounts::OriginResponse::WebFolder, Imagekit::Models::Accounts::OriginResponse::WebProxy, Imagekit::Models::Accounts::OriginResponse::Gcs, Imagekit::Models::Accounts::OriginResponse::AzureBlob, Imagekit::Models::Accounts::OriginResponse::AkeneoPim] + # + # @see Imagekit::Models::Accounts::OriginCreateParams + def create(params) + parsed, options = Imagekit::Accounts::OriginCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/accounts/origins", + body: parsed[:origin], + model: Imagekit::Accounts::OriginResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginUpdateParams} for more details. + # + # **Note:** This API is currently in beta. + # Updates the origin identified by `id` and returns the updated origin object. + # + # @overload update(id, origin:, request_options: {}) + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param origin [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Accounts::OriginResponse::S3, Imagekit::Models::Accounts::OriginResponse::S3Compatible, Imagekit::Models::Accounts::OriginResponse::CloudinaryBackup, Imagekit::Models::Accounts::OriginResponse::WebFolder, Imagekit::Models::Accounts::OriginResponse::WebProxy, Imagekit::Models::Accounts::OriginResponse::Gcs, Imagekit::Models::Accounts::OriginResponse::AzureBlob, Imagekit::Models::Accounts::OriginResponse::AkeneoPim] + # + # @see Imagekit::Models::Accounts::OriginUpdateParams + def update(id, params) + parsed, options = Imagekit::Accounts::OriginUpdateParams.dump_request(params) + @client.request( + method: :put, + path: ["v1/accounts/origins/%1$s", id], + body: parsed[:origin], + model: Imagekit::Accounts::OriginResponse, + options: options + ) + end + + # **Note:** This API is currently in beta. + # Returns an array of all configured origins for the current account. + # + # @overload list(request_options: {}) + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekit::Models::Accounts::OriginListParams + def list(params = {}) + @client.request( + method: :get, + path: "v1/accounts/origins", + model: Imagekit::Internal::Type::ArrayOf[union: Imagekit::Accounts::OriginResponse], + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginDeleteParams} for more details. + # + # **Note:** This API is currently in beta. + # Permanently removes the origin identified by `id`. If the origin is in use by + # any URL‑endpoints, the API will return an error. + # + # @overload delete(id, request_options: {}) + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Imagekit::Models::Accounts::OriginDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["v1/accounts/origins/%1$s", id], + model: NilClass, + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::OriginGetParams} for more details. + # + # **Note:** This API is currently in beta. + # Retrieves the origin identified by `id`. + # + # @overload get(id, request_options: {}) + # + # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Accounts::OriginResponse::S3, Imagekit::Models::Accounts::OriginResponse::S3Compatible, Imagekit::Models::Accounts::OriginResponse::CloudinaryBackup, Imagekit::Models::Accounts::OriginResponse::WebFolder, Imagekit::Models::Accounts::OriginResponse::WebProxy, Imagekit::Models::Accounts::OriginResponse::Gcs, Imagekit::Models::Accounts::OriginResponse::AzureBlob, Imagekit::Models::Accounts::OriginResponse::AkeneoPim] + # + # @see Imagekit::Models::Accounts::OriginGetParams + def get(id, params = {}) + @client.request( + method: :get, + path: ["v1/accounts/origins/%1$s", id], + model: Imagekit::Accounts::OriginResponse, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/accounts/url_endpoints.rb b/lib/imagekit/resources/accounts/url_endpoints.rb new file mode 100644 index 00000000..c94d9fe9 --- /dev/null +++ b/lib/imagekit/resources/accounts/url_endpoints.rb @@ -0,0 +1,151 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Accounts + class URLEndpoints + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::URLEndpointCreateParams} for more details. + # + # **Note:** This API is currently in beta. + # Creates a new URL‑endpoint and returns the resulting object. + # + # @overload create(description:, origins: nil, url_prefix: nil, url_rewriter: nil, request_options: {}) + # + # @param description [String] Description of the URL endpoint. + # + # @param origins [Array] Ordered list of origin IDs to try when the file isn’t in the Media Library; Imag + # + # @param url_prefix [String] Path segment appended to your base URL to form the endpoint (letters, digits, an + # + # @param url_rewriter [Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Akamai] Configuration for third-party URL rewriting. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Accounts::URLEndpointResponse] + # + # @see Imagekit::Models::Accounts::URLEndpointCreateParams + def create(params) + parsed, options = Imagekit::Accounts::URLEndpointCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/accounts/url-endpoints", + body: parsed, + model: Imagekit::Accounts::URLEndpointResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::URLEndpointUpdateParams} for more details. + # + # **Note:** This API is currently in beta. + # Updates the URL‑endpoint identified by `id` and returns the updated object. + # + # @overload update(id, description:, origins: nil, url_prefix: nil, url_rewriter: nil, request_options: {}) + # + # @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c + # + # @param description [String] Description of the URL endpoint. + # + # @param origins [Array] Ordered list of origin IDs to try when the file isn’t in the Media Library; Imag + # + # @param url_prefix [String] Path segment appended to your base URL to form the endpoint (letters, digits, an + # + # @param url_rewriter [Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Imgix, Imagekit::Models::Accounts::URLEndpointRequest::URLRewriter::Akamai] Configuration for third-party URL rewriting. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Accounts::URLEndpointResponse] + # + # @see Imagekit::Models::Accounts::URLEndpointUpdateParams + def update(id, params) + parsed, options = Imagekit::Accounts::URLEndpointUpdateParams.dump_request(params) + @client.request( + method: :put, + path: ["v1/accounts/url-endpoints/%1$s", id], + body: parsed, + model: Imagekit::Accounts::URLEndpointResponse, + options: options + ) + end + + # **Note:** This API is currently in beta. + # Returns an array of all URL‑endpoints configured including the default + # URL-endpoint generated by ImageKit during account creation. + # + # @overload list(request_options: {}) + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekit::Models::Accounts::URLEndpointListParams + def list(params = {}) + @client.request( + method: :get, + path: "v1/accounts/url-endpoints", + model: Imagekit::Internal::Type::ArrayOf[Imagekit::Accounts::URLEndpointResponse], + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::URLEndpointDeleteParams} for more details. + # + # **Note:** This API is currently in beta. + # Deletes the URL‑endpoint identified by `id`. You cannot delete the default + # URL‑endpoint created by ImageKit during account creation. + # + # @overload delete(id, request_options: {}) + # + # @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Imagekit::Models::Accounts::URLEndpointDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["v1/accounts/url-endpoints/%1$s", id], + model: NilClass, + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::URLEndpointGetParams} for more details. + # + # **Note:** This API is currently in beta. + # Retrieves the URL‑endpoint identified by `id`. + # + # @overload get(id, request_options: {}) + # + # @param id [String] Unique identifier for the URL-endpoint. This is generated by ImageKit when you c + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Accounts::URLEndpointResponse] + # + # @see Imagekit::Models::Accounts::URLEndpointGetParams + def get(id, params = {}) + @client.request( + method: :get, + path: ["v1/accounts/url-endpoints/%1$s", id], + model: Imagekit::Accounts::URLEndpointResponse, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/accounts/usage.rb b/lib/imagekit/resources/accounts/usage.rb new file mode 100644 index 00000000..ed062095 --- /dev/null +++ b/lib/imagekit/resources/accounts/usage.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Accounts + class Usage + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Accounts::UsageGetParams} for more details. + # + # Get the account usage information between two dates. Note that the API response + # includes data from the start date while excluding data from the end date. In + # other words, the data covers the period starting from the specified start date + # up to, but not including, the end date. + # + # @overload get(end_date:, start_date:, request_options: {}) + # + # @param end_date [Date] Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + # + # @param start_date [Date] Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Accounts::UsageGetResponse] + # + # @see Imagekit::Models::Accounts::UsageGetParams + def get(params) + parsed, options = Imagekit::Accounts::UsageGetParams.dump_request(params) + @client.request( + method: :get, + path: "v1/accounts/usage", + query: parsed.transform_keys(end_date: "endDate", start_date: "startDate"), + model: Imagekit::Models::Accounts::UsageGetResponse, + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/assets.rb b/lib/imagekit/resources/assets.rb new file mode 100644 index 00000000..de7abc9a --- /dev/null +++ b/lib/imagekit/resources/assets.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Assets + # Some parameter documentations has been truncated, see + # {Imagekit::Models::AssetListParams} for more details. + # + # This API can list all the uploaded files and folders in your ImageKit.io media + # library. In addition, you can fine-tune your query by specifying various filters + # by generating a query string in a Lucene-like syntax and provide this generated + # string as the value of the `searchQuery`. + # + # @overload list(file_type: nil, limit: nil, path: nil, search_query: nil, skip: nil, sort: nil, type: nil, request_options: {}) + # + # @param file_type [Symbol, Imagekit::Models::AssetListParams::FileType] Filter results by file type. + # + # @param limit [Integer] The maximum number of results to return in response. + # + # @param path [String] Folder path if you want to limit the search within a specific folder. For exampl + # + # @param search_query [String] Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + # + # @param skip [Integer] The number of results to skip before returning results. + # + # @param sort [Symbol, Imagekit::Models::AssetListParams::Sort] Sort the results by one of the supported fields in ascending or descending order + # + # @param type [Symbol, Imagekit::Models::AssetListParams::Type] Filter results by asset type. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekit::Models::AssetListParams + def list(params = {}) + parsed, options = Imagekit::AssetListParams.dump_request(params) + @client.request( + method: :get, + path: "v1/files", + query: parsed.transform_keys(file_type: "fileType", search_query: "searchQuery"), + model: Imagekit::Internal::Type::ArrayOf[union: Imagekit::Models::AssetListResponseItem], + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/imagekit/resources/beta.rb b/lib/imagekit/resources/beta.rb new file mode 100644 index 00000000..b7d7a5ea --- /dev/null +++ b/lib/imagekit/resources/beta.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Beta + # @return [Imagekit::Resources::Beta::V2] + attr_reader :v2 + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + @v2 = Imagekit::Resources::Beta::V2.new(client: client) + end + end + end +end diff --git a/lib/imagekit/resources/beta/v2.rb b/lib/imagekit/resources/beta/v2.rb new file mode 100644 index 00000000..8510456c --- /dev/null +++ b/lib/imagekit/resources/beta/v2.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Beta + class V2 + # @return [Imagekit::Resources::Beta::V2::Files] + attr_reader :files + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + @files = Imagekit::Resources::Beta::V2::Files.new(client: client) + end + end + end + end +end diff --git a/lib/imagekit/resources/beta/v2/files.rb b/lib/imagekit/resources/beta/v2/files.rb new file mode 100644 index 00000000..c50545df --- /dev/null +++ b/lib/imagekit/resources/beta/v2/files.rb @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Beta + class V2 + class Files + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Beta::V2::FileUploadParams} for more details. + # + # The V2 API enhances security by verifying the entire payload using JWT. This API + # is in beta. + # + # ImageKit.io allows you to upload files directly from both the server and client + # sides. For server-side uploads, private API key authentication is used. For + # client-side uploads, generate a one-time `token` from your secure backend using + # private API. + # [Learn more](/docs/api-reference/upload-file/upload-file-v2#how-to-implement-secure-client-side-file-upload) + # about how to implement secure client-side file upload. + # + # **File size limit** \ + # On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + # files, and 100MB for videos. On the paid plan, these limits increase to 40MB for + # images, audio, and raw files, and 2GB for videos. These limits can be further increased + # with higher-tier plans. + # + # **Version limit** \ + # A file can have a maximum of 100 versions. + # + # **Demo applications** + # + # - A full-fledged + # [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + # supporting file selections from local storage, URL, Dropbox, Google Drive, + # Instagram, and more. + # - [Quick start guides](/docs/quick-start-guides) for various frameworks and + # technologies. + # + # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, response_fields: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) + # + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # + # @param file_name [String] The name with which the file has to be uploaded. + # + # @param token [String] This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses i + # + # @param checks [String] Server-side checks to run on the asset. + # + # @param custom_coordinates [String] Define an important area in the image. This is only relevant for image type file + # + # @param custom_metadata [Hash{Symbol=>Object}] JSON key-value pairs to associate with the asset. Create the custom metadata fie + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # + # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e + # + # @param is_private_file [Boolean] Whether to mark the file as private or not. + # + # @param is_published [Boolean] Whether to upload file as published or not. + # + # @param overwrite_ai_tags [Boolean] If set to `true` and a file already exists at the exact location, its AITags wil + # + # @param overwrite_custom_metadata [Boolean] If the request does not have `customMetadata`, and a file already exists at the + # + # @param overwrite_file [Boolean] If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # + # @param overwrite_tags [Boolean] If the request does not have `tags`, and a file already exists at the exact loca + # + # @param response_fields [Array] Array of response field keys to include in the API response body. + # + # @param tags [Array] Set the tags while uploading the file. + # + # @param transformation [Imagekit::Models::Beta::V2::FileUploadParams::Transformation] Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # @param use_unique_file_name [Boolean] Whether to use a unique filename for this file or not. + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Beta::V2::FileUploadResponse] + # + # @see Imagekit::Models::Beta::V2::FileUploadParams + def upload(params) + parsed, options = Imagekit::Beta::V2::FileUploadParams.dump_request(params) + path = + @client.base_url_overridden? ? "api/v2/files/upload" : "https://upload.imagekit.io/api/v2/files/upload" + @client.request( + method: :post, + path: path, + headers: {"content-type" => "multipart/form-data"}, + body: parsed, + model: Imagekit::Models::Beta::V2::FileUploadResponse, + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end + end +end diff --git a/lib/imagekit/resources/cache.rb b/lib/imagekit/resources/cache.rb new file mode 100644 index 00000000..1b666377 --- /dev/null +++ b/lib/imagekit/resources/cache.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Cache + # @return [Imagekit::Resources::Cache::Invalidation] + attr_reader :invalidation + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + @invalidation = Imagekit::Resources::Cache::Invalidation.new(client: client) + end + end + end +end diff --git a/lib/imagekit/resources/cache/invalidation.rb b/lib/imagekit/resources/cache/invalidation.rb new file mode 100644 index 00000000..a084abea --- /dev/null +++ b/lib/imagekit/resources/cache/invalidation.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Cache + class Invalidation + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Cache::InvalidationCreateParams} for more details. + # + # This API will purge CDN cache and ImageKit.io's internal cache for a file. Note: + # Purge cache is an asynchronous process and it may take some time to reflect the + # changes. + # + # @overload create(url:, request_options: {}) + # + # @param url [String] The full URL of the file to be purged. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Cache::InvalidationCreateResponse] + # + # @see Imagekit::Models::Cache::InvalidationCreateParams + def create(params) + parsed, options = Imagekit::Cache::InvalidationCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/files/purge", + body: parsed, + model: Imagekit::Models::Cache::InvalidationCreateResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Cache::InvalidationGetParams} for more details. + # + # This API returns the status of a purge cache request. + # + # @overload get(request_id, request_options: {}) + # + # @param request_id [String] Should be a valid requestId. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Cache::InvalidationGetResponse] + # + # @see Imagekit::Models::Cache::InvalidationGetParams + def get(request_id, params = {}) + @client.request( + method: :get, + path: ["v1/files/purge/%1$s", request_id], + model: Imagekit::Models::Cache::InvalidationGetResponse, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/custom_metadata_fields.rb b/lib/imagekit/resources/custom_metadata_fields.rb new file mode 100644 index 00000000..29da6980 --- /dev/null +++ b/lib/imagekit/resources/custom_metadata_fields.rb @@ -0,0 +1,126 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class CustomMetadataFields + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldCreateParams} for more details. + # + # This API creates a new custom metadata field. Once a custom metadata field is + # created either through this API or using the dashboard UI, its value can be set + # on the assets. The value of a field for an asset can be set using the media + # library UI or programmatically through upload or update assets API. + # + # @overload create(label:, name:, schema:, request_options: {}) + # + # @param label [String] Human readable name of the custom metadata field. This should be unique across a + # + # @param name [String] API name of the custom metadata field. This should be unique across all (includi + # + # @param schema [Imagekit::Models::CustomMetadataFieldCreateParams::Schema] + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::CustomMetadataField] + # + # @see Imagekit::Models::CustomMetadataFieldCreateParams + def create(params) + parsed, options = Imagekit::CustomMetadataFieldCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/customMetadataFields", + body: parsed, + model: Imagekit::CustomMetadataField, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldUpdateParams} for more details. + # + # This API updates the label or schema of an existing custom metadata field. + # + # @overload update(id, label: nil, schema: nil, request_options: {}) + # + # @param id [String] Should be a valid custom metadata field id. + # + # @param label [String] Human readable name of the custom metadata field. This should be unique across a + # + # @param schema [Imagekit::Models::CustomMetadataFieldUpdateParams::Schema] An object that describes the rules for the custom metadata key. This parameter i + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::CustomMetadataField] + # + # @see Imagekit::Models::CustomMetadataFieldUpdateParams + def update(id, params = {}) + parsed, options = Imagekit::CustomMetadataFieldUpdateParams.dump_request(params) + @client.request( + method: :patch, + path: ["v1/customMetadataFields/%1$s", id], + body: parsed, + model: Imagekit::CustomMetadataField, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldListParams} for more details. + # + # This API returns the array of created custom metadata field objects. By default + # the API returns only non deleted field objects, but you can include deleted + # fields in the API response. + # + # @overload list(include_deleted: nil, request_options: {}) + # + # @param include_deleted [Boolean] Set it to `true` to include deleted field objects in the API response. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekit::Models::CustomMetadataFieldListParams + def list(params = {}) + parsed, options = Imagekit::CustomMetadataFieldListParams.dump_request(params) + @client.request( + method: :get, + path: "v1/customMetadataFields", + query: parsed.transform_keys(include_deleted: "includeDeleted"), + model: Imagekit::Internal::Type::ArrayOf[Imagekit::CustomMetadataField], + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::CustomMetadataFieldDeleteParams} for more details. + # + # This API deletes a custom metadata field. Even after deleting a custom metadata + # field, you cannot create any new custom metadata field with the same name. + # + # @overload delete(id, request_options: {}) + # + # @param id [String] Should be a valid custom metadata field id. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::CustomMetadataFieldDeleteResponse] + # + # @see Imagekit::Models::CustomMetadataFieldDeleteParams + def delete(id, params = {}) + @client.request( + method: :delete, + path: ["v1/customMetadataFields/%1$s", id], + model: Imagekit::Models::CustomMetadataFieldDeleteResponse, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb new file mode 100644 index 00000000..d138d933 --- /dev/null +++ b/lib/imagekit/resources/files.rb @@ -0,0 +1,300 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Files + # @return [Imagekit::Resources::Files::Bulk] + attr_reader :bulk + + # @return [Imagekit::Resources::Files::Versions] + attr_reader :versions + + # @return [Imagekit::Resources::Files::Metadata] + attr_reader :metadata + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUpdateParams} for more details. + # + # This API updates the details or attributes of the current version of the file. + # You can update `tags`, `customCoordinates`, `customMetadata`, publication + # status, remove existing `AITags` and apply extensions using this API. + # + # @overload update(file_id, update: nil, request_options: {}) + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc + # + # @param update [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus] + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FileUpdateResponse] + # + # @see Imagekit::Models::FileUpdateParams + def update(file_id, params = {}) + parsed, options = Imagekit::FileUpdateParams.dump_request(params) + @client.request( + method: :patch, + path: ["v1/files/%1$s/details", file_id], + body: parsed[:update], + model: Imagekit::Models::FileUpdateResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileDeleteParams} for more details. + # + # This API deletes the file and all its file versions permanently. + # + # Note: If a file or specific transformation has been requested in the past, then + # the response is cached. Deleting a file does not purge the cache. You can purge + # the cache using purge cache API. + # + # @overload delete(file_id, request_options: {}) + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see Imagekit::Models::FileDeleteParams + def delete(file_id, params = {}) + @client.request( + method: :delete, + path: ["v1/files/%1$s", file_id], + model: NilClass, + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileCopyParams} for more details. + # + # This will copy a file from one folder to another. + # + # Note: If any file at the destination has the same name as the source file, then + # the source file and its versions (if `includeFileVersions` is set to true) will + # be appended to the destination file version history. + # + # @overload copy(destination_path:, source_file_path:, include_file_versions: nil, request_options: {}) + # + # @param destination_path [String] Full path to the folder you want to copy the above file into. + # + # @param source_file_path [String] The full path of the file you want to copy. + # + # @param include_file_versions [Boolean] Option to copy all versions of a file. By default, only the current version of t + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FileCopyResponse] + # + # @see Imagekit::Models::FileCopyParams + def copy(params) + parsed, options = Imagekit::FileCopyParams.dump_request(params) + @client.request( + method: :post, + path: "v1/files/copy", + body: parsed, + model: Imagekit::Models::FileCopyResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileGetParams} for more details. + # + # This API returns an object with details or attributes about the current version + # of the file. + # + # @overload get(file_id, request_options: {}) + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in the list and s + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::File] + # + # @see Imagekit::Models::FileGetParams + def get(file_id, params = {}) + @client.request( + method: :get, + path: ["v1/files/%1$s/details", file_id], + model: Imagekit::File, + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileMoveParams} for more details. + # + # This will move a file and all its versions from one folder to another. + # + # Note: If any file at the destination has the same name as the source file, then + # the source file and its versions will be appended to the destination file. + # + # @overload move(destination_path:, source_file_path:, request_options: {}) + # + # @param destination_path [String] Full path to the folder you want to move the above file into. + # + # @param source_file_path [String] The full path of the file you want to move. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FileMoveResponse] + # + # @see Imagekit::Models::FileMoveParams + def move(params) + parsed, options = Imagekit::FileMoveParams.dump_request(params) + @client.request( + method: :post, + path: "v1/files/move", + body: parsed, + model: Imagekit::Models::FileMoveResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileRenameParams} for more details. + # + # You can rename an already existing file in the media library using rename file + # API. This operation would rename all file versions of the file. + # + # Note: The old URLs will stop working. The file/file version URLs cached on CDN + # will continue to work unless a purge is requested. + # + # @overload rename(file_path:, new_file_name:, purge_cache: nil, request_options: {}) + # + # @param file_path [String] The full path of the file you want to rename. + # + # @param new_file_name [String] The new name of the file. A filename can contain: + # + # @param purge_cache [Boolean] Option to purge cache for the old file and its versions' URLs. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FileRenameResponse] + # + # @see Imagekit::Models::FileRenameParams + def rename(params) + parsed, options = Imagekit::FileRenameParams.dump_request(params) + @client.request( + method: :put, + path: "v1/files/rename", + body: parsed, + model: Imagekit::Models::FileRenameResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUploadParams} for more details. + # + # ImageKit.io allows you to upload files directly from both the server and client + # sides. For server-side uploads, private API key authentication is used. For + # client-side uploads, generate a one-time `token`, `signature`, and `expire` from + # your secure backend using private API. + # [Learn more](/docs/api-reference/upload-file/upload-file#how-to-implement-client-side-file-upload) + # about how to implement client-side file upload. + # + # The [V2 API](/docs/api-reference/upload-file/upload-file-v2) enhances security + # by verifying the entire payload using JWT. + # + # **File size limit** \ + # On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + # files and 100MB for videos. On the paid plan, these limits increase to 40MB for images, + # audio, and raw files and 2GB for videos. These limits can be further increased with + # higher-tier plans. + # + # **Version limit** \ + # A file can have a maximum of 100 versions. + # + # **Demo applications** + # + # - A full-fledged + # [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + # supporting file selections from local storage, URL, Dropbox, Google Drive, + # Instagram, and more. + # - [Quick start guides](/docs/quick-start-guides) for various frameworks and + # technologies. + # + # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) + # + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # + # @param file_name [String] The name with which the file has to be uploaded. + # + # @param token [String] A unique value that the ImageKit.io server will use to recognize and prevent sub + # + # @param checks [String] Server-side checks to run on the asset. + # + # @param custom_coordinates [String] Define an important area in the image. This is only relevant for image type file + # + # @param custom_metadata [Hash{Symbol=>Object}] JSON key-value pairs to associate with the asset. Create the custom metadata fie + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki + # + # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # + # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e + # + # @param is_private_file [Boolean] Whether to mark the file as private or not. + # + # @param is_published [Boolean] Whether to upload file as published or not. + # + # @param overwrite_ai_tags [Boolean] If set to `true` and a file already exists at the exact location, its AITags wil + # + # @param overwrite_custom_metadata [Boolean] If the request does not have `customMetadata`, and a file already exists at the + # + # @param overwrite_file [Boolean] If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # + # @param overwrite_tags [Boolean] If the request does not have `tags`, and a file already exists at the exact loca + # + # @param public_key [String] Your ImageKit.io public key. This field is only required for authentication when + # + # @param response_fields [Array] Array of response field keys to include in the API response body. + # + # @param signature [String] HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + # + # @param tags [Array] Set the tags while uploading the file. + # + # @param transformation [Imagekit::Models::FileUploadParams::Transformation] Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # @param use_unique_file_name [Boolean] Whether to use a unique filename for this file or not. + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FileUploadResponse] + # + # @see Imagekit::Models::FileUploadParams + def upload(params) + parsed, options = Imagekit::FileUploadParams.dump_request(params) + path = + @client.base_url_overridden? ? "api/v1/files/upload" : "https://upload.imagekit.io/api/v1/files/upload" + @client.request( + method: :post, + path: path, + headers: {"content-type" => "multipart/form-data"}, + body: parsed, + model: Imagekit::Models::FileUploadResponse, + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + @bulk = Imagekit::Resources::Files::Bulk.new(client: client) + @versions = Imagekit::Resources::Files::Versions.new(client: client) + @metadata = Imagekit::Resources::Files::Metadata.new(client: client) + end + end + end +end diff --git a/lib/imagekit/resources/files/bulk.rb b/lib/imagekit/resources/files/bulk.rb new file mode 100644 index 00000000..1f09cdbe --- /dev/null +++ b/lib/imagekit/resources/files/bulk.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Files + class Bulk + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkDeleteParams} for more details. + # + # This API deletes multiple files and all their file versions permanently. + # + # Note: If a file or specific transformation has been requested in the past, then + # the response is cached. Deleting a file does not purge the cache. You can purge + # the cache using purge cache API. + # + # A maximum of 100 files can be deleted at a time. + # + # @overload delete(file_ids:, request_options: {}) + # + # @param file_ids [Array] An array of fileIds which you want to delete. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Files::BulkDeleteResponse] + # + # @see Imagekit::Models::Files::BulkDeleteParams + def delete(params) + parsed, options = Imagekit::Files::BulkDeleteParams.dump_request(params) + @client.request( + method: :post, + path: "v1/files/batch/deleteByFileIds", + body: parsed, + model: Imagekit::Models::Files::BulkDeleteResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkAddTagsParams} for more details. + # + # This API adds tags to multiple files in bulk. A maximum of 50 files can be + # specified at a time. + # + # @overload add_tags(file_ids:, tags:, request_options: {}) + # + # @param file_ids [Array] An array of fileIds to which you want to add tags. + # + # @param tags [Array] An array of tags that you want to add to the files. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Files::BulkAddTagsResponse] + # + # @see Imagekit::Models::Files::BulkAddTagsParams + def add_tags(params) + parsed, options = Imagekit::Files::BulkAddTagsParams.dump_request(params) + @client.request( + method: :post, + path: "v1/files/addTags", + body: parsed, + model: Imagekit::Models::Files::BulkAddTagsResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkRemoveAITagsParams} for more details. + # + # This API removes AITags from multiple files in bulk. A maximum of 50 files can + # be specified at a time. + # + # @overload remove_ai_tags(ai_tags:, file_ids:, request_options: {}) + # + # @param ai_tags [Array] An array of AITags that you want to remove from the files. + # + # @param file_ids [Array] An array of fileIds from which you want to remove AITags. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Files::BulkRemoveAITagsResponse] + # + # @see Imagekit::Models::Files::BulkRemoveAITagsParams + def remove_ai_tags(params) + parsed, options = Imagekit::Files::BulkRemoveAITagsParams.dump_request(params) + @client.request( + method: :post, + path: "v1/files/removeAITags", + body: parsed, + model: Imagekit::Models::Files::BulkRemoveAITagsResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::BulkRemoveTagsParams} for more details. + # + # This API removes tags from multiple files in bulk. A maximum of 50 files can be + # specified at a time. + # + # @overload remove_tags(file_ids:, tags:, request_options: {}) + # + # @param file_ids [Array] An array of fileIds from which you want to remove tags. + # + # @param tags [Array] An array of tags that you want to remove from the files. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Files::BulkRemoveTagsResponse] + # + # @see Imagekit::Models::Files::BulkRemoveTagsParams + def remove_tags(params) + parsed, options = Imagekit::Files::BulkRemoveTagsParams.dump_request(params) + @client.request( + method: :post, + path: "v1/files/removeTags", + body: parsed, + model: Imagekit::Models::Files::BulkRemoveTagsResponse, + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/files/metadata.rb b/lib/imagekit/resources/files/metadata.rb new file mode 100644 index 00000000..cc941499 --- /dev/null +++ b/lib/imagekit/resources/files/metadata.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Files + class Metadata + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::MetadataGetParams} for more details. + # + # You can programmatically get image EXIF, pHash, and other metadata for uploaded + # files in the ImageKit.io media library using this API. + # + # You can also get the metadata in upload API response by passing `metadata` in + # `responseFields` parameter. + # + # @overload get(file_id, request_options: {}) + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in the list and s + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Metadata] + # + # @see Imagekit::Models::Files::MetadataGetParams + def get(file_id, params = {}) + @client.request( + method: :get, + path: ["v1/files/%1$s/metadata", file_id], + model: Imagekit::Metadata, + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::MetadataGetFromURLParams} for more details. + # + # Get image EXIF, pHash, and other metadata from ImageKit.io powered remote URL + # using this API. + # + # @overload get_from_url(url:, request_options: {}) + # + # @param url [String] Should be a valid file URL. It should be accessible using your ImageKit.io accou + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Metadata] + # + # @see Imagekit::Models::Files::MetadataGetFromURLParams + def get_from_url(params) + parsed, options = Imagekit::Files::MetadataGetFromURLParams.dump_request(params) + @client.request( + method: :get, + path: "v1/files/metadata", + query: parsed, + model: Imagekit::Metadata, + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/files/versions.rb b/lib/imagekit/resources/files/versions.rb new file mode 100644 index 00000000..dd712b77 --- /dev/null +++ b/lib/imagekit/resources/files/versions.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Files + class Versions + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::VersionListParams} for more details. + # + # This API returns details of all versions of a file. + # + # @overload list(file_id, request_options: {}) + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Array] + # + # @see Imagekit::Models::Files::VersionListParams + def list(file_id, params = {}) + @client.request( + method: :get, + path: ["v1/files/%1$s/versions", file_id], + model: Imagekit::Internal::Type::ArrayOf[Imagekit::File], + options: params[:request_options] + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::VersionDeleteParams} for more details. + # + # This API deletes a non-current file version permanently. The API returns an + # empty response. + # + # Note: If you want to delete all versions of a file, use the delete file API. + # + # @overload delete(version_id, file_id:, request_options: {}) + # + # @param version_id [String] The unique `versionId` of the uploaded file. `versionId` is returned in list and + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Files::VersionDeleteResponse] + # + # @see Imagekit::Models::Files::VersionDeleteParams + def delete(version_id, params) + parsed, options = Imagekit::Files::VersionDeleteParams.dump_request(params) + file_id = + parsed.delete(:file_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :delete, + path: ["v1/files/%1$s/versions/%2$s", file_id, version_id], + model: Imagekit::Models::Files::VersionDeleteResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::VersionGetParams} for more details. + # + # This API returns an object with details or attributes of a file version. + # + # @overload get(version_id, file_id:, request_options: {}) + # + # @param version_id [String] The unique `versionId` of the uploaded file. `versionId` is returned in list and + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::File] + # + # @see Imagekit::Models::Files::VersionGetParams + def get(version_id, params) + parsed, options = Imagekit::Files::VersionGetParams.dump_request(params) + file_id = + parsed.delete(:file_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :get, + path: ["v1/files/%1$s/versions/%2$s", file_id, version_id], + model: Imagekit::File, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Files::VersionRestoreParams} for more details. + # + # This API restores a file version as the current file version. + # + # @overload restore(version_id, file_id:, request_options: {}) + # + # @param version_id [String] The unique `versionId` of the uploaded file. `versionId` is returned in list and + # + # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::File] + # + # @see Imagekit::Models::Files::VersionRestoreParams + def restore(version_id, params) + parsed, options = Imagekit::Files::VersionRestoreParams.dump_request(params) + file_id = + parsed.delete(:file_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + @client.request( + method: :put, + path: ["v1/files/%1$s/versions/%2$s/restore", file_id, version_id], + model: Imagekit::File, + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/folders.rb b/lib/imagekit/resources/folders.rb new file mode 100644 index 00000000..ad5e4b10 --- /dev/null +++ b/lib/imagekit/resources/folders.rb @@ -0,0 +1,166 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Folders + # @return [Imagekit::Resources::Folders::Job] + attr_reader :job + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderCreateParams} for more details. + # + # This will create a new folder. You can specify the folder name and location of + # the parent folder where this new folder should be created. + # + # @overload create(folder_name:, parent_folder_path:, request_options: {}) + # + # @param folder_name [String] The folder will be created with this name. + # + # @param parent_folder_path [String] The folder where the new folder should be created, for root use `/` else the pat + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FolderCreateResponse] + # + # @see Imagekit::Models::FolderCreateParams + def create(params) + parsed, options = Imagekit::FolderCreateParams.dump_request(params) + @client.request( + method: :post, + path: "v1/folder", + body: parsed, + model: Imagekit::Models::FolderCreateResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderDeleteParams} for more details. + # + # This will delete a folder and all its contents permanently. The API returns an + # empty response. + # + # @overload delete(folder_path:, request_options: {}) + # + # @param folder_path [String] Full path to the folder you want to delete. For example `/folder/to/delete/`. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FolderDeleteResponse] + # + # @see Imagekit::Models::FolderDeleteParams + def delete(params) + parsed, options = Imagekit::FolderDeleteParams.dump_request(params) + @client.request( + method: :delete, + path: "v1/folder", + body: parsed, + model: Imagekit::Models::FolderDeleteResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderCopyParams} for more details. + # + # This will copy one folder into another. The selected folder, its nested folders, + # files, and their versions (in `includeVersions` is set to true) are copied in + # this operation. Note: If any file at the destination has the same name as the + # source file, then the source file and its versions will be appended to the + # destination file version history. + # + # @overload copy(destination_path:, source_folder_path:, include_versions: nil, request_options: {}) + # + # @param destination_path [String] Full path to the destination folder where you want to copy the source folder int + # + # @param source_folder_path [String] The full path to the source folder you want to copy. + # + # @param include_versions [Boolean] Option to copy all versions of files that are nested inside the selected folder. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FolderCopyResponse] + # + # @see Imagekit::Models::FolderCopyParams + def copy(params) + parsed, options = Imagekit::FolderCopyParams.dump_request(params) + @client.request( + method: :post, + path: "v1/bulkJobs/copyFolder", + body: parsed, + model: Imagekit::Models::FolderCopyResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderMoveParams} for more details. + # + # This will move one folder into another. The selected folder, its nested folders, + # files, and their versions are moved in this operation. Note: If any file at the + # destination has the same name as the source file, then the source file and its + # versions will be appended to the destination file version history. + # + # @overload move(destination_path:, source_folder_path:, request_options: {}) + # + # @param destination_path [String] Full path to the destination folder where you want to move the source folder int + # + # @param source_folder_path [String] The full path to the source folder you want to move. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FolderMoveResponse] + # + # @see Imagekit::Models::FolderMoveParams + def move(params) + parsed, options = Imagekit::FolderMoveParams.dump_request(params) + @client.request( + method: :post, + path: "v1/bulkJobs/moveFolder", + body: parsed, + model: Imagekit::Models::FolderMoveResponse, + options: options + ) + end + + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FolderRenameParams} for more details. + # + # This API allows you to rename an existing folder. The folder and all its nested + # assets and sub-folders will remain unchanged, but their paths will be updated to + # reflect the new folder name. + # + # @overload rename(folder_path:, new_folder_name:, purge_cache: nil, request_options: {}) + # + # @param folder_path [String] The full path to the folder you want to rename. + # + # @param new_folder_name [String] The new name for the folder. + # + # @param purge_cache [Boolean] Option to purge cache for the old nested files and their versions' URLs. + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::FolderRenameResponse] + # + # @see Imagekit::Models::FolderRenameParams + def rename(params) + parsed, options = Imagekit::FolderRenameParams.dump_request(params) + @client.request( + method: :post, + path: "v1/bulkJobs/renameFolder", + body: parsed, + model: Imagekit::Models::FolderRenameResponse, + options: options + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + @job = Imagekit::Resources::Folders::Job.new(client: client) + end + end + end +end diff --git a/lib/imagekit/resources/folders/job.rb b/lib/imagekit/resources/folders/job.rb new file mode 100644 index 00000000..8c900133 --- /dev/null +++ b/lib/imagekit/resources/folders/job.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Folders + class Job + # Some parameter documentations has been truncated, see + # {Imagekit::Models::Folders::JobGetParams} for more details. + # + # This API returns the status of a bulk job like copy and move folder operations. + # + # @overload get(job_id, request_options: {}) + # + # @param job_id [String] The `jobId` is returned in the response of bulk job API e.g. copy folder or move + # + # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [Imagekit::Models::Folders::JobGetResponse] + # + # @see Imagekit::Models::Folders::JobGetParams + def get(job_id, params = {}) + @client.request( + method: :get, + path: ["v1/bulkJobs/%1$s", job_id], + model: Imagekit::Models::Folders::JobGetResponse, + options: params[:request_options] + ) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end + end +end diff --git a/lib/imagekit/resources/webhooks.rb b/lib/imagekit/resources/webhooks.rb new file mode 100644 index 00000000..067574cf --- /dev/null +++ b/lib/imagekit/resources/webhooks.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module Imagekit + module Resources + class Webhooks + # @param payload [String] The raw webhook payload as a string + # + # @return [Imagekit::Models::VideoTransformationAcceptedEvent, Imagekit::Models::VideoTransformationReadyEvent, Imagekit::Models::VideoTransformationErrorEvent, Imagekit::Models::UploadPreTransformSuccessEvent, Imagekit::Models::UploadPreTransformErrorEvent, Imagekit::Models::UploadPostTransformSuccessEvent, Imagekit::Models::UploadPostTransformErrorEvent] + def unsafe_unwrap(payload) + parsed = JSON.parse(payload, symbolize_names: true) + Imagekit::Internal::Type::Converter.coerce(Imagekit::Models::UnsafeUnwrapWebhookEvent, parsed) + end + + # @param payload [String] The raw webhook payload as a string + # + # @return [Imagekit::Models::VideoTransformationAcceptedEvent, Imagekit::Models::VideoTransformationReadyEvent, Imagekit::Models::VideoTransformationErrorEvent, Imagekit::Models::UploadPreTransformSuccessEvent, Imagekit::Models::UploadPreTransformErrorEvent, Imagekit::Models::UploadPostTransformSuccessEvent, Imagekit::Models::UploadPostTransformErrorEvent] + def unwrap(payload) + parsed = JSON.parse(payload, symbolize_names: true) + Imagekit::Internal::Type::Converter.coerce(Imagekit::Models::UnwrapWebhookEvent, parsed) + end + + # @api private + # + # @param client [Imagekit::Client] + def initialize(client:) + @client = client + end + end + end +end diff --git a/lib/imagekit/version.rb b/lib/imagekit/version.rb new file mode 100644 index 00000000..2350f394 --- /dev/null +++ b/lib/imagekit/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Imagekit + VERSION = "0.0.1" +end diff --git a/lib/imagekitio.rb b/lib/imagekitio.rb deleted file mode 100644 index 6e15fa8e..00000000 --- a/lib/imagekitio.rb +++ /dev/null @@ -1,13 +0,0 @@ -require "imagekitio/railtie" if defined? Rails - -require 'base64' - -require_relative './imagekitio/constant' -require_relative './imagekitio/base' -require_relative './imagekitio/configurable' -require_relative './imagekitio/client' -require_relative "./imagekitio/request" -require_relative "./imagekitio/url" -require_relative './imagekitio/api_service/custom_metadata_field' -require_relative './imagekitio/api_service/file' -require_relative './imagekitio/api_service/folder' diff --git a/lib/imagekitio/api_service/bulk.rb b/lib/imagekitio/api_service/bulk.rb deleted file mode 100644 index 2ee35f63..00000000 --- a/lib/imagekitio/api_service/bulk.rb +++ /dev/null @@ -1,58 +0,0 @@ -require_relative '../constant' - -module ImageKitIo - module ApiService - class Bulk - include Constantable - - def initialize(req_obj) - @req_obj = req_obj - end - - def job_status(job_id: nil) - if job_id == '' || job_id.nil? - raise ArgumentError, 'job_id is required' - end - url = "#{constants.BULK_BASE_URL}/#{job_id}" - payload = { 'jobId': job_id } - @req_obj.request('get', url, @req_obj.create_headers, payload) - end - - def add_tags(file_ids: [], tags: []) - if file_ids.empty? || tags.empty? - raise ArgumentError, 'Parameters are required' - end - url = "#{constants.BASE_URL}/addTags" - payload = { 'fileIds': file_ids, 'tags': tags }.to_json - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def remove_tags(file_ids: [], tags: []) - if file_ids.empty? || tags.empty? - raise ArgumentError, 'Parameters are required' - end - url = "#{constants.BASE_URL}/removeTags" - payload = { 'fileIds': file_ids, 'tags': tags }.to_json - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def remove_ai_tags(file_ids: [], ai_tags: []) - if file_ids.empty? || ai_tags.empty? - raise ArgumentError, 'Parameters are required' - end - url = "#{constants.BASE_URL}/removeAITags" - payload = { 'fileIds': file_ids, 'AITags': ai_tags }.to_json - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def remove_files(file_ids: []) - if file_ids.empty? - raise ArgumentError, 'File ids are required' - end - url = "#{constants.BASE_URL}#{constants.BULK_FILE_DELETE}" - payload = {'fileIds': file_ids}.to_json - @req_obj.request("post", url, @req_obj.create_headers, payload) - end - end - end -end diff --git a/lib/imagekitio/api_service/custom_metadata_field.rb b/lib/imagekitio/api_service/custom_metadata_field.rb deleted file mode 100644 index 7bc213ad..00000000 --- a/lib/imagekitio/api_service/custom_metadata_field.rb +++ /dev/null @@ -1,52 +0,0 @@ -require_relative '../utils/option_validator' -require_relative '../constant' - -module ImageKitIo - module ApiService - class CustomMetadataField - include Utils::OptionValidator - include Constantable - - def initialize(req_obj) - @req_obj = req_obj - end - - def create(name: nil, label: nil, schema: nil) - if name == '' || name.nil? || label == '' || label.nil? || schema == '' || schema.nil? - raise ArgumentError, 'Parameters required' - end - unless schema.is_a?(Hash) - raise ArgumentError, 'Schema must be hash object' - end - url = "#{constants.API_BASE_URL}/customMetadataFields" - payload = { 'name': name, 'label': label, 'schema': schema }.to_json - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def list(**options) - url = "#{constants.API_BASE_URL}/customMetadataFields" - payload = request_formatter(options || {}) - @req_obj.request('get', url, @req_obj.create_headers, payload) - end - - def update(id: nil, label: nil, schema: nil) - if id == '' || id.nil? - raise ArgumentError, 'id is required' - end - url = "#{constants.API_BASE_URL}/customMetadataFields/#{id}" - payload = {} - payload = payload.merge({ 'label': label }) unless label.nil? - payload = payload.merge({ 'schema': label }) unless schema.nil? - @req_obj.request('patch', url, @req_obj.create_headers, payload.to_json) - end - - def delete(id: nil) - if id == '' || id.nil? - raise ArgumentError, 'id is required' - end - url = "#{constants.API_BASE_URL}/customMetadataFields/#{id}" - @req_obj.request('delete', url, @req_obj.create_headers) - end - end - end -end diff --git a/lib/imagekitio/api_service/file.rb b/lib/imagekitio/api_service/file.rb deleted file mode 100644 index 986cd21a..00000000 --- a/lib/imagekitio/api_service/file.rb +++ /dev/null @@ -1,221 +0,0 @@ -# frozen_string_literal: true -require_relative '../constant' -require_relative '../utils/option_validator' -require 'net/http/post/multipart' - -module ImageKitIo - module ApiService - class File - include Utils::OptionValidator - include Constantable - - # This File class holds file related operations like - # upload, list etc - def initialize(req_obj) - @req_obj = req_obj - end - - # uploads files with required arguments, supports bot url and binary - # Options types: - # - `extensions` should be array of hash - # eg: option['extension'] = [ - # { 'name' => 'remove-bg', 'options' => { 'add_shadow' => 'true' } }, - # { 'name' => 'google-auto-tagging', 'minConfidence' => 80 } - # ] - # - `custom_metadata` should be hash - # eg: option['custom_metadata'] = { - # "SKU": "VS882HJ2JD", - # "price": 599.99, - # "brand": "H&M", - # "discount": 30 - # } - def upload(file: nil, file_name: nil, **options) - raise ArgumentError, constants.MISSING_UPLOAD_FILE_PARAMETER unless file - raise ArgumentError, constants.MISSING_UPLOAD_FILE_PARAMETER unless file_name - - content_type = options.delete(:content_type) || '' - options = format_to_json(options, :extensions, Array) - options = format_to_json(options, :custom_metadata, Hash) - options = format_to_json(options, :transformation, Hash) - options = validate_upload_options(options || {}) - if options.is_a?(FalseClass) - raise ArgumentError, "Invalid Upload option" - else - headers = @req_obj.create_headers - payload = { - multipart: true, - file: file.is_a?(String) ? file : ::UploadIO.new(file, content_type, file_name), - fileName: file_name - } - payload.merge!(options) - url = "#{constants.BASE_URL}#{constants.UPLOAD}" - @req_obj.request("post", url, headers, payload) - end - end - - def update_details(file_id: nil, **options) - unless options.fetch(:tags, []).is_a?(Array) - raise ArgumentError, constants.UPDATE_DATA_TAGS_INVALID - end - unless options.fetch(:custom_coordinates, "").is_a?(String) - raise ArgumentError, constants.UPDATE_DATA_COORDS_INVALID - end - url = "#{constants.BASE_URL}/#{file_id}/details/" - headers = @req_obj.create_headers - payload = request_formatter(options || {}) - @req_obj.request("patch", url, headers, payload.to_json) - end - - def list(**options) - # returns list of files on ImageKitIo Server - # :options dictionary of options - formatted_options = request_formatter(options || {}) - raise KeyError(constants.LIST_FILES_INPUT_MISSING) unless formatted_options.is_a?(Hash) - url = constants.BASE_URL - headers = @req_obj.create_headers.update({params: formatted_options}) - @req_obj.request("get", url, headers, formatted_options) - end - - def get_file_versions(file_id: nil) - if file_id == '' || file_id.nil? - raise ArgumentError, 'file_id is required' - end - url = "#{constants.BASE_URL}/#{file_id}/versions" - headers = @req_obj.create_headers - @req_obj.request('get', url, headers) - end - - def get_file_version_detail(file_id: nil, version_id: nil) - if file_id == "" || file_id.nil? - raise ArgumentError, "file_id is required" - end - if version_id == "" || version_id.nil? - raise ArgumentError, "version_id is required" - end - url = "#{constants.BASE_URL}/#{file_id}/versions/#{version_id}" - headers = @req_obj.create_headers - @req_obj.request('get', url, headers) - end - - def delete_file_version(file_id: nil, version_id: nil) - if file_id == "" || file_id.nil? - raise ArgumentError, "file_id is required" - end - if version_id == "" || version_id.nil? - raise ArgumentError, "version_id is required" - end - url = "#{constants.BASE_URL}/#{file_id}/versions/#{version_id}" - headers = @req_obj.create_headers - @req_obj.request('delete', url, headers) - end - - def restore_file_version(file_id: nil, version_id: nil) - if file_id == "" || file_id.nil? - raise ArgumentError, "file_id is required" - end - if version_id == "" || version_id.nil? - raise ArgumentError, "version_id is required" - end - url = "#{constants.BASE_URL}/#{file_id}/versions/#{version_id}/restore" - headers = @req_obj.create_headers - @req_obj.request('put', url, headers) - end - - def details(file_identifier: nil) - # Get detail of file by file_identifier - if file_identifier == "" || file_identifier.nil? - raise ArgumentError, "file_identifier is required" - end - url = "#{constants.BASE_URL}/#{file_identifier}/details/" - headers = @req_obj.create_headers - @req_obj.request("get", url, headers) - end - - def get_metadata(file_id: nil) - # Get metadata of a file by file_id - if file_id == "" || file_id.nil? - raise ArgumentError, "file_id is required" - end - url = "#{constants.BASE_URL}/#{file_id}/metadata" - @req_obj.request("get", url, @req_obj.create_headers) - end - - def delete(file_id: nil) - # Delete a file_id by file_id - if file_id == "" || file_id.nil? - raise ArgumentError, "file_id is required" - end - url = "#{constants.BASE_URL}/#{file_id}" - headers = @req_obj.create_headers - @req_obj.request("delete", url, headers) - end - - def purge_cache(file_url: nil) - # purges cache from server by file_url - if file_url == "" || file_url.nil? - raise ArgumentError, "file_url is required" - end - url = "#{constants.BASE_URL}/purge" - payload = {'url': file_url} - @req_obj.request("post", url, @req_obj.create_headers, payload) - end - - def purge_cache_status(request_id: nil) - # This function is to get cache_status - if request_id == "" || request_id.nil? - raise ArgumentError, "remote_file_url is required" - end - url = "#{constants.BASE_URL}/purge/#{request_id}" - @req_obj.request("get", url, @req_obj.create_headers) - end - - def get_metadata_from_remote_url(remote_file_url: nil) - if remote_file_url == "" || remote_file_url.nil? - raise ArgumentError, "remote_file_url is required" - end - url = "#{constants.REMOTE_METADATA_FULL_URL}?url=#{remote_file_url}" - @req_obj.request("get", url, @req_obj.create_headers) - end - - def stream_file(remote_file_url: nil, &block) - if remote_file_url == '' || remote_file_url.nil? - raise ArgumentError, 'remote_file_url is required' - end - @req_obj.request_stream('get', remote_file_url, headers: @req_obj.create_headers, &block) - end - - def copy(source_file_path: nil, destination_path: nil, include_file_versions: false) - if source_file_path == '' || source_file_path.nil? || destination_path == '' || destination_path.nil? - raise ArgumentError, 'parameters required' - end - url = "#{constants.BASE_URL}/copy" - payload = { 'sourceFilePath': source_file_path, 'destinationPath': destination_path, 'includeFileVersions': include_file_versions }.to_json - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def move(source_file_path: nil, destination_path: nil) - if source_file_path == '' || source_file_path.nil? || destination_path == '' || destination_path.nil? - raise ArgumentError, 'parameters required' - end - url = "#{constants.BASE_URL}/move" - payload = { 'sourceFilePath': source_file_path, 'destinationPath': destination_path } - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def rename(file_path: nil, new_file_name: nil, **options) - if file_path == '' || file_path.nil? || new_file_name == '' || new_file_name.nil? - raise ArgumentError, 'parameters required' - end - url = "#{constants.BASE_URL}/rename" - payload = { 'filePath': file_path, 'newFileName': new_file_name }.merge(request_formatter(options)).to_json - @req_obj.request('put', url, @req_obj.create_headers, payload) - end - - - private - def image_format?(type) - %(image/jpeg image/bmp image/apng image/avif image/gif image/ief image/svg+xml image/tiff image/x-icon image/rgb image/webp).include?(type) - end - end - end -end diff --git a/lib/imagekitio/api_service/folder.rb b/lib/imagekitio/api_service/folder.rb deleted file mode 100644 index 41bdb453..00000000 --- a/lib/imagekitio/api_service/folder.rb +++ /dev/null @@ -1,49 +0,0 @@ -require_relative '../constant' - -module ImageKitIo - module ApiService - class Folder - include Constantable - - def initialize(req_obj) - @req_obj = req_obj - end - - def create(folder_name: nil, parent_folder_path: nil) - if folder_name == '' || folder_name.nil? - raise ArgumentError, 'folder_name is required' - end - url = "#{constants.API_BASE_URL}/folder" - payload = { 'folderName': folder_name, 'parentFolderPath': parent_folder_path }.to_json - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def delete(folder_path: nil) - if folder_path == '' || folder_path.nil? - raise ArgumentError, 'folder_path is required' - end - url = "#{constants.API_BASE_URL}/folder" - payload = { 'folderPath': folder_path } - @req_obj.request('delete', url, @req_obj.create_headers, payload) - end - - def copy(source_folder_path: nil, destination_path: nil, include_file_versions: false) - if source_folder_path == '' || source_folder_path.nil? || destination_path == '' || destination_path.nil? - raise ArgumentError, 'Parameters required' - end - url = "#{constants.BULK_BASE_URL}/copyFolder" - payload = { 'sourceFolderPath': source_folder_path, 'destinationPath': destination_path, 'includeFileVersions': include_file_versions }.to_json - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - - def move(source_folder_path: nil, destination_path: nil) - if source_folder_path == '' || source_folder_path.nil? || destination_path == '' || destination_path.nil? - raise ArgumentError, 'Parameters required' - end - url = "#{constants.BULK_BASE_URL}/moveFolder" - payload = { 'sourceFolderPath': source_folder_path, 'destinationPath': destination_path } - @req_obj.request('post', url, @req_obj.create_headers, payload) - end - end - end -end diff --git a/lib/imagekitio/base.rb b/lib/imagekitio/base.rb deleted file mode 100644 index 162e89ef..00000000 --- a/lib/imagekitio/base.rb +++ /dev/null @@ -1,12 +0,0 @@ -require_relative './configurable' - -module ImageKitIo - include ImageKitIo::Configurable - - class << self - def client - ik_config = config - @client ||= ImageKitIo::Client.new(ik_config.private_key, ik_config.public_key, ik_config.url_endpoint) - end - end -end diff --git a/lib/imagekitio/client.rb b/lib/imagekitio/client.rb deleted file mode 100644 index 3c2b7851..00000000 --- a/lib/imagekitio/client.rb +++ /dev/null @@ -1,202 +0,0 @@ -# frozen_string_literal: true - -$VERBOSE = nil - -require_relative "./request" -require_relative "./url" -require_relative "./utils/calculation" -require_relative './constant' -require_relative './configurable' -require_relative './api_service/custom_metadata_field' -require_relative './api_service/folder' -require_relative './api_service/file' -require_relative './api_service/bulk' - -module ImageKitIo - # ImageKitIo class holds each method will be used by user - class Client - include Utils::Calculation - include Constantable - - attr_reader :file_service, :custom_metadata_field_service, :folder_service, :bulk_service - - def initialize(private_key, public_key, url_endpoint, transformation_pos = nil, options = nil) - unless(private_key.is_a?(String) && private_key.to_s.strip.length != 0) - raise ArgumentError, constants.MISSING_PRIVATE_KEY - end - unless(public_key.is_a?(String) && public_key.to_s.strip.length != 0) - raise ArgumentError, constants.MISSING_PUBLIC_KEY - end - unless(url_endpoint.is_a?(String) && url_endpoint.to_s.strip.length != 0) - raise ArgumentError, constants.MISSING_URL_ENDPOINT - end - - @private_key = private_key - @public_key = public_key - @url_endpoint = url_endpoint - @transformation_position = transformation_pos - @options = options - - @ik_req = Request.new(private_key, public_key, url_endpoint) - @url_obj = Url.new(@ik_req) - @file_service = ApiService::File.new(@ik_req) - @custom_metadata_field_service = ApiService::CustomMetadataField.new(@ik_req) - @folder_service = ApiService::Folder.new(@ik_req) - @bulk_service = ApiService::Bulk.new(@ik_req) - end - - def set_ik_request(ik_req) - # setter for imagekit request mainly will be used for - # test - @ik_req = ik_req - end - - def url(options = {}) - @url_obj.generate_url(options) - end - - def upload_file(file: nil, file_name: nil, **options) - # upload file to imagekit server - @file_service.upload(file: file, file_name: file_name, **options) - end - - def list_files(options = {}) - # list all files - @file_service.list(**options) - end - - def file_versions(file_id: nil) - @file_service.get_file_versions(file_id: file_id) - end - - def file_version_detail(file_id: nil, version_id: nil) - @file_service.get_file_version_detail(file_id: file_id, version_id: version_id) - end - - def delete_file_version(file_id: nil, version_id: nil) - @file_service.delete_file_version(file_id: file_id, version_id: version_id) - end - - def restore_file_version(file_id: nil, version_id: nil) - @file_service.restore_file_version(file_id: file_id, version_id: version_id) - end - - def get_file_details(file_id: nil) - # Get file detail by file-id or file_url - @file_service.details(file_identifier: file_id) - end - - def update_file_details(file_id: nil, **options) - # update file details by file id and other options payload - @file_service.update_details(file_id: file_id, **options) - end - - def delete_file(file_id: nil) - # Delete a file by file-id - @file_service.delete(file_id: file_id) - end - - def get_file_metadata(file_id: nil) - # Get metadata of a file by file-id - @file_service.get_metadata(file_id: file_id) - end - - def purge_file_cache(file_url: nil) - # Purge cache from ImageKitIo server by file_url - @file_service.purge_cache(file_url: file_url) - end - - def purge_file_cache_status(request_id: nil) - @file_service.purge_cache_status(request_id: request_id.to_s) - end - - # Get metadata from remote_file_url - # param remote_file_url: url string of remote file - def get_remote_file_url_metadata(remote_file_url: "") - @file_service.get_metadata_from_remote_url(remote_file_url: remote_file_url) - end - - def stream_file(file_url: nil, &block) - @file_service.stream_file(remote_file_url: file_url, &block) - end - - def copy_file(source_file_path: nil, destination_path: nil, include_file_versions: false) - @file_service.copy(source_file_path: source_file_path, destination_path: destination_path, include_file_versions: include_file_versions) - end - - def move_file(source_file_path: nil, destination_path: nil) - @file_service.move(source_file_path: source_file_path, destination_path: destination_path) - end - - def rename_file(file_path: nil, new_file_name: nil, **options) - @file_service.rename(file_path: file_path, new_file_name: new_file_name, **options) - end - - def add_bulk_tags(file_ids: [], tags: []) - @bulk_service.add_tags(file_ids: file_ids, tags: tags) - end - - def delete_bulk_files(file_ids: []) - # Delete file in bulks by list of file id - @bulk_service.remove_files(file_ids: file_ids) - end - - def delete_bulk_tags(file_ids: [], tags: []) - @bulk_service.remove_tags(file_ids: file_ids, tags: tags) - end - - def delete_bulk_ai_tags(file_ids: [], ai_tags: []) - @bulk_service.remove_ai_tags(file_ids: file_ids, ai_tags: ai_tags) - end - - def bulk_job_status(job_id: nil) - @bulk_service.job_status(job_id: job_id) - end - - def create_folder(folder_name: nil, parent_folder_path: "/") - @folder_service.create(folder_name: folder_name, parent_folder_path: parent_folder_path) - end - - def delete_folder(folder_path: nil) - @folder_service.delete(folder_path: folder_path) - end - - def copy_folder(source_folder_path: nil, destination_path: nil, include_file_versions: false) - @folder_service.copy(source_folder_path: source_folder_path, destination_path: destination_path, include_file_versions: include_file_versions) - end - - def move_folder(source_folder_path: nil, destination_path: nil) - @folder_service.move(source_folder_path: source_folder_path, destination_path: destination_path) - end - - def create_custom_metadata_field(name: nil, label: nil, schema: {}) - @custom_metadata_field_service.create(name: name, label: label, schema: schema) - end - - def get_custom_metadata_fields(options = {}) - @custom_metadata_field_service.list(**options) - end - - def update_custom_metadata_field(id: nil, label: nil, schema: nil) - @custom_metadata_field_service.update(id: id, label: label, schema: schema) - end - - def delete_custom_metadata_field(id: nil) - @custom_metadata_field_service.delete(id: id) - end - - def phash_distance(first, second) - # Get hamming distance between two phash(image hash) to check - # similarity between images - if first.to_s.strip == "" || second.to_s.strip == "" - raise ArgumentError, constants.MISSING_PHASH_VALUE - end - hamming_distance(first, second) - end - - def get_authentication_parameters(token = nil, expire = nil) - # Get Authentication params - get_authenticated_params(token, expire, @ik_req.private_key) - end - end -end diff --git a/lib/imagekitio/configurable.rb b/lib/imagekitio/configurable.rb deleted file mode 100644 index 98db3414..00000000 --- a/lib/imagekitio/configurable.rb +++ /dev/null @@ -1,43 +0,0 @@ -module ImageKitIo - module Configurable - def self.included(klass) - klass.extend ClassMethods - end - - module ClassMethods - def config - @config ||= Configuration.new - end - - def configure - yield config - initialize_service - end - - def initialize_service - if config.service == :carrierwave - require_relative '../carrierwave/carrierwave' - elsif config.service == :active_storage - require_relative '../active_storage/active_storage' - end - end - - def constants - config.constants - end - end - - class Configuration - AVAILABLE_SERVICE = [:carrierwave, :active_storage] - attr_accessor :public_key, :private_key, :url_endpoint, :service - - def service - @service&.to_sym || :carrierwave - end - - def constants - @constants ||= ImageKitIo::Constant - end - end - end -end diff --git a/lib/imagekitio/constant.rb b/lib/imagekitio/constant.rb deleted file mode 100644 index 21fa44a7..00000000 --- a/lib/imagekitio/constant.rb +++ /dev/null @@ -1,36 +0,0 @@ -require_relative './constants/default' -require_relative './constants/error' -require_relative './constants/file' -require_relative './constants/supported_transformation' -require_relative './constants/url' -require_relative './configurable' - -module ImageKitIo - module Constantable - def self.included(base) - def constants - ImageKitIo.constants - end - end - end - class Constant - include Constants::Default - include Constants::Error - include Constants::File - include Constants::SupportedTransformation - include Constants::URL - - class << self - def method_missing(symbol, *args) - method_name = symbol.to_s.gsub('=', '') - if self.const_defined? method_name - return self.const_get(method_name) if args.empty? - - self.const_set(method_name, args.first) - else - super - end - end - end - end -end diff --git a/lib/imagekitio/constants/default.rb b/lib/imagekitio/constants/default.rb deleted file mode 100644 index 34d9345e..00000000 --- a/lib/imagekitio/constants/default.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# Enum for defaults -module ImageKitIo - module Constants - module Default - TRANSFORMATION_POSITION = "path" - QUERY_TRANSFORMATION_POSITION = "query" - VALID_TRANSFORMATION_POSITION = [TRANSFORMATION_POSITION, - QUERY_TRANSFORMATION_POSITION,].freeze - DEFAULT_TIMESTAMP = "9999999999" - TRANSFORMATION_PARAMETER = "tr" - CHAIN_TRANSFORM_DELIMITER = ":" - TRANSFORM_DELIMITER = "," - TRANSFORM_KEY_VALUE_DELIMITER = "-" - - SIGNATURE_PARAMETER = "ik-s" - TIMESTAMP_PARAMETER = "ik-t" - TIMESTAMP = "9999999999" - end - end -end diff --git a/lib/imagekitio/constants/error.rb b/lib/imagekitio/constants/error.rb deleted file mode 100644 index 49c8f429..00000000 --- a/lib/imagekitio/constants/error.rb +++ /dev/null @@ -1,69 +0,0 @@ -module ImageKitIo - module Constants - module Error - MANDATORY_INIT_MISSING = { - 'message': "Missing public_key or private_key or url_endpoint during ImageKitIo initialization", - help: "", - } - INVALID_TRANSFORMATION_POS = {'message': "Invalid transformationPosition parameter", - help: "",} - INVALID_URL_GENERATION_PARAM = {'message': "Invalid url parameter", help: ""} - INVALID_TRANSFORMATION_OPTIONS = { - 'message': "Invalid transformation parameter options", - help: "", - } - CACHE_PURGE_URL_MISSING = {'message': "Missing URL parameter for this request", - help: "",} - CACHE_PURGE_STATUS_ID_MISSING = {'message': "Missing Request ID parameter for this request", - help: "",} - FILE_ID_MISSING = {'message': "Missing File ID parameter for this request", - help: "",} - UPDATE_DATA_MISSING = {'message': "Missing file update data for this request", - help: "",} - - UPDATE_DATA_TAGS_INVALID = {'message': "Invalid tags parameter for this request", - help: "tags should be passed as null or an array like ['tag1', 'tag2']",}.freeze - - UPDATE_DATA_COORDS_INVALID = - {'message': "Invalid custom_coordinates parameter for this request", - help: "custom_coordinates should be passed as null or a string like 'x,y,width,height'",} - - LIST_FILES_INPUT_MISSING = { - 'message': "Missing options for list files", - help: "If you do not want to pass any parameter for listing, pass an empty object", - } - MISSING_FILE_URL = {'message': "Missing file_url for purge_cache", help: ""} - MISSING_UPLOAD_DATA = {'message': "Missing data for upload", help: ""} - MISSING_UPLOAD_FILE_PARAMETER = { - 'message': "Missing file parameter for upload", - help: "", - } - MISSING_UPLOAD_FILENAME_PARAM = { - 'message': "Missing fileName parameter for upload", - help: "", - } - - INVALID_PHASH_VALUE = - { - 'message': "Invalid pHash value", - help: "Both pHash strings must be valid hexadecimal numbers", - } - - MISSING_PHASH_VALUE = { - 'message': "Missing pHash value", - help: "Please pass two pHash values", - } - UNEQUAL_STRING_LENGTH = { - '': "Unequal pHash string length", - help: "For distance calculation, the two pHash strings must have equal length", - } - - MISSING_PRIVATE_KEY = "ImageKitIo private key missing" - - MISSING_PUBLIC_KEY = "ImageKitIo public key missing" - - MISSING_URL_ENDPOINT = "ImageKitIo URL Endpoint missing. Default URL Endpoint: https://ik.imagekit.io//" - - end - end -end diff --git a/lib/imagekitio/constants/file.rb b/lib/imagekitio/constants/file.rb deleted file mode 100644 index 3af374dc..00000000 --- a/lib/imagekitio/constants/file.rb +++ /dev/null @@ -1,11 +0,0 @@ -module ImageKitIo - module Constants - module File - VALID_FILE_OPTIONS = %w[path fileType tags includeFolder name limit skip] - - VALID_FILE_DETAIL_OPTIONS = ["fileID"] - - VALID_UPLOAD_OPTIONS = %w[file file_name use_unique_file_name tags folder is_private_file custom_coordinates response_fields extensions webhook_url overwrite_file overwrite_AI_tags overwrite_custom_metadata custom_metadata mime overwrite_tags content_type transformation checks is_published] - end - end -end diff --git a/lib/imagekitio/constants/supported_transformation.rb b/lib/imagekitio/constants/supported_transformation.rb deleted file mode 100644 index c8158b6f..00000000 --- a/lib/imagekitio/constants/supported_transformation.rb +++ /dev/null @@ -1,39 +0,0 @@ -module ImageKitIo - module Constants - module SupportedTransformation - SUPPORTED_TRANS = { - 'height': "h", - 'width': "w", - 'aspect_ratio': "ar", - 'quality': "q", - 'crop': "c", - 'crop_mode': "cm", - 'x': "x", - 'y': "y", - 'focus': "fo", - 'format': "f", - 'radius': "r", - 'background': "bg", - 'border': "b", - 'rotation': "rt", - 'blur': "bl", - 'named': "n", - 'progressive': "pr", - 'lossless': "lo", - 'trim': "t", - 'metadata': "md", - 'color_profile': "cp", - 'default_image': "di", - 'dpr': "dpr", - 'effect_sharpen': "e-sharpen", - 'effect_usm': "e-usm", - 'effect_contrast': "e-contrast", - 'effect_gray': "e-grayscale", - 'effect_shadow': "e-shadow", - 'effect_gradient': "e-gradient", - 'original': "orig", - 'raw': 'raw', - } - end - end -end diff --git a/lib/imagekitio/constants/url.rb b/lib/imagekitio/constants/url.rb deleted file mode 100644 index 5b02252f..00000000 --- a/lib/imagekitio/constants/url.rb +++ /dev/null @@ -1,14 +0,0 @@ -module ImageKitIo - module Constants - module URL - # Default URL Constants - BASE_URL = "https://api.imagekit.io/v1/files" - PURGE_CACHE = "/purge" - BULK_FILE_DELETE = "/batch/deleteByFileIds" - UPLOAD = "/upload" - REMOTE_METADATA_FULL_URL = "https://api.imagekit.io/v1/metadata" - BULK_BASE_URL = 'https://api.imagekit.io/v1/bulkJobs' - API_BASE_URL = 'https://api.imagekit.io/v1' - end - end -end diff --git a/lib/imagekitio/errors.rb b/lib/imagekitio/errors.rb deleted file mode 100644 index eeac14de..00000000 --- a/lib/imagekitio/errors.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ImageKitIo - class Error < StandardError - end -end diff --git a/lib/imagekitio/railtie.rb b/lib/imagekitio/railtie.rb deleted file mode 100644 index d07f716a..00000000 --- a/lib/imagekitio/railtie.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ImageKitIo - class Railtie < ::Rails::Railtie - end -end diff --git a/lib/imagekitio/request.rb b/lib/imagekitio/request.rb deleted file mode 100644 index 355450c4..00000000 --- a/lib/imagekitio/request.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -require "base64" -require "rest-client" -require "json" -require 'net/http/post/multipart' -require_relative './constant' -# Request requests and sends data from server -module ImageKitIo - class Request - include Constantable - - attr_reader :private_key, :public_key, :url_endpoint, :transformation_position, :options - - def initialize(private_key, public_key, url_endpoint, transformation_position = nil, options = nil) - @private_key = private_key - @public_key = public_key - @url_endpoint = url_endpoint - @transformation_position = transformation_position || constants.TRANSFORMATION_POSITION - @options = options || {} - end - - # creates required headers - def create_headers - headers = {'Accept-Encoding': "application/json", 'Content-Type': "application/json"} - headers.update(auth_headers) - end - - def auth_headers - encoded_private_key = Base64.strict_encode64(@private_key+":") - {Authorization: "Basic #{encoded_private_key}"} - end - - # request method communicates with server - def request(method, url, headers = create_headers, payload = nil) - headers ||= create_headers - response = {} - begin - if(method.downcase.to_sym == :post && payload.is_a?(Hash) && payload[:multipart]) - uri = URI.parse(url) - http = Net::HTTP.new(uri.host, uri.port) - http.use_ssl = (uri.scheme == 'https') - req = Net::HTTP::Post::Multipart.new uri.path, payload, headers - resp = http.request(req) - response[:headers] = resp.to_hash - else - resp = RestClient::Request.new(method: method, - url: url, - headers: headers, - payload: payload).execute - response[:headers] = resp.raw_headers - end - response[:raw_body] = resp.body - response[:status_code] = resp.code - resp_c = resp.code.to_i - if [400, 403].include?(resp_c) - raise RestClient::ExceptionWithResponse, OpenStruct.new({ body: resp.body, code: resp_c, headers: response[:headers] }) - end - if (resp.code.to_i >= 200) && (resp.code.to_i < 204) - content_type = resp.respond_to?(:headers) ? resp.headers[:content_type] : resp.content_type - if (content_type.include? "application/json") - response[:response] = JSON.parse(resp.body.to_s) - else - raise RestClient::ExceptionWithResponse, OpenStruct.new(code: 404, body: resp.body) - end - elsif resp.code.to_i == 204 - response[:response] = {'success': true} - end - - rescue RestClient::ExceptionWithResponse => err - response[:status_code] = err.http_code if response[:status_code].nil? - response[:headers] = err.http_headers if response[:headers].nil? - response[:error] = if err.http_code.to_i == 404 - {'message': err.response.to_s} - else - err.response.is_a?(OpenStruct) ? JSON.parse(err.response.body) : JSON.parse(err.response) - end - end - response - end - - def request_stream(method, url, headers: nil, payload: nil, **options, &block) - headers ||= create_headers - response = { response: nil, error: nil } - begin - RestClient::Request.execute(method: method, - url: url, - headers: headers, - payload: payload, - **options, - block_response: block - ) - rescue RestClient::ExceptionWithResponse => err - err.http_code == 404 ? response[:error] = {'message': err.response.to_s} : JSON.parse(err.response) - end - end - end -end diff --git a/lib/imagekitio/sdk/version.rb b/lib/imagekitio/sdk/version.rb deleted file mode 100644 index a9dac6ed..00000000 --- a/lib/imagekitio/sdk/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -module ImageKitIo - module Sdk - VERSION = '3.1.0' - end -end diff --git a/lib/imagekitio/url.rb b/lib/imagekitio/url.rb deleted file mode 100644 index b2b736ae..00000000 --- a/lib/imagekitio/url.rb +++ /dev/null @@ -1,216 +0,0 @@ -# frozen_string_literal: true - -# Url holds url generation method - -require "cgi" -require "addressable/uri" -require "openssl" -require_relative "./utils/formatter" -require_relative "sdk/version.rb" - -module ImageKitIo - class Url - include Constantable - - def initialize(request_obj) - @req_obj = request_obj - end - - def generate_url(options) - if options.key? :src - options[:transformation_position] = constants.TRANSFORMATION_POSITION - end - extended_options = extend_url_options(options) - build_url(extended_options) - end - - def build_url(options) - # build url from all options - - path = options.fetch(:path, "") - src = options.fetch(:src, "") - url_endpoint = options.fetch(:url_endpoint, "") - transformation_position = options[:transformation_position] - - unless constants.VALID_TRANSFORMATION_POSITION.include? transformation_position - raise ArgumentError, constants.INVALID_TRANSFORMATION_POS - end - - src_param_used_for_url = false - if (src != "") || (transformation_position == constants.QUERY_TRANSFORMATION_POSITION) - src_param_used_for_url = true - end - - if path == "" && src == "" - return "" - end - - result_url_hash = {'host': "", 'path': "", 'query': ""} - parsed_host = Addressable::URI.parse(url_endpoint) - existing_query = nil - if path != "" - parsed_url = Addressable::URI.parse(path) - # making sure single '/' at end - result_url_hash[:host] = parsed_host.host.to_s.chomp("/") + parsed_host.path.chomp("/") + "/" - path_without_query = Addressable::URI.parse(path) - path_without_query.fragment = path_without_query.query = nil - result_url_hash[:path] = path_without_query.hostname.nil? ? trim_slash(path_without_query.to_s) : CGI.escape(trim_slash(path_without_query.to_s)) - else - parsed_url = Addressable::URI.parse(src) - result_url_hash[:userinfo] = parsed_url.userinfo if parsed_url.userinfo - result_url_hash[:host] = parsed_url.host - result_url_hash[:path] = parsed_url.path - src_param_used_for_url = true - end - - existing_query = parsed_url.query - result_url_hash[:scheme] = parsed_host.scheme - query_params = {} - query_params = CGI.parse(existing_query).reject {|k, v| v.empty? }.transform_values(&:first) unless existing_query.nil? - options.fetch(:query_parameters, {}).each do |key, value| - query_params[key] = value - end - transformation_str = transformation_to_str(options[:transformation]).chomp("/") - unless transformation_str.nil? || transformation_str.strip.empty? - if (transformation_position == constants.QUERY_TRANSFORMATION_POSITION) || src_param_used_for_url == true - result_url_hash[:query] = "#{constants.TRANSFORMATION_PARAMETER}=#{transformation_str}" - query_params[:tr]=transformation_str - else - result_url_hash[:path] = "#{constants.TRANSFORMATION_PARAMETER}:#{transformation_str}/#{result_url_hash[:path]}" - end - end - - result_url_hash[:host] = result_url_hash[:host].to_s.reverse.chomp("/").reverse - result_url_hash[:path] = result_url_hash[:path].chomp("/") unless result_url_hash[:path].nil? - result_url_hash[:scheme] ||= "https" - - query_param_arr = [] - query_params.each do |key, value| - if value.to_s == "" - query_param_arr.push(key.to_s) - else - query_param_arr.push(key.to_s + "=" + value.to_s) - end - end - query_param_str = query_param_arr.join("&") - result_url_hash[:query] = query_param_str - url = hash_to_url(result_url_hash) - if options[:signed] - private_key = options[:private_key] - expire_seconds = options[:expire_seconds] - expire_timestamp = get_signature_timestamp(expire_seconds) - url_signature = get_signature(private_key, url, url_endpoint, expire_timestamp) - query_param_arr.push(constants.SIGNATURE_PARAMETER + "=" + url_signature) - - if expire_timestamp && (expire_timestamp != constants.TIMESTAMP) - query_param_arr.push(constants.TIMESTAMP_PARAMETER + "=" + expire_timestamp.to_s) - end - query_param_str = query_param_arr.join("&") - result_url_hash[:query] = query_param_str - - url=hash_to_url(result_url_hash) - end - url - end - - def transformation_to_str(transformation) - # creates transformation_position string for url - # from transformation dictionary - - unless transformation.is_a?(Array) - return "" - end - - parsed_transforms = [] - (0..(transformation.length - 1)).each do |i| - parsed_transform_step = [] - - transformation[i].keys.each do |key| - transform_key = constants.SUPPORTED_TRANS.fetch(key, nil) - transform_key ||= key - - if transform_key == "oi" || transform_key == "di" - transformation[i][key][0] = "" if transformation[i][key][0] == "/" - transformation[i][key] = transformation[i][key].gsub("/", "@@") - end - - if transformation[i][key] == "-" - parsed_transform_step.push(transform_key) - elsif transform_key == 'raw' - parsed_transform_step.push(transformation[i][key]) - else - parsed_transform_step.push("#{transform_key}#{constants.TRANSFORM_KEY_VALUE_DELIMITER}#{transformation[i][key]}") - end - end - parsed_transforms.push(parsed_transform_step.join(constants.TRANSFORM_DELIMITER)) - end - parsed_transforms.join(constants.CHAIN_TRANSFORM_DELIMITER) - end - - def get_signature_timestamp(seconds) - # this function returns either default time stamp - # or current unix time and expiry seconds to get - # signature time stamp - - if seconds.to_i == 0 - constants.DEFAULT_TIMESTAMP - else - DateTime.now.strftime("%s").to_i + seconds.to_i - end - end - - def get_signature(private_key, url, url_endpoint, expiry_timestamp) - # creates signature(hashed hex key) and returns from - # private_key, url, url_endpoint and expiry_timestamp - if expiry_timestamp==0 - expiry_timestamp=constants.DEFAULT_TIMESTAMP - end - if url_endpoint[url_endpoint.length-1]!="/" - url_endpoint+="/" - end - replaced_url=url.gsub(url_endpoint, "") - replaced_url = replaced_url + expiry_timestamp.to_s - OpenSSL::HMAC.hexdigest("SHA1", private_key, replaced_url) - end - - def extend_url_options(options) - attr_dict = {"public_key": @req_obj.public_key, - "private_key": @req_obj.private_key, - "url_endpoint": @req_obj.url_endpoint, - "transformation_position": @req_obj.transformation_position, } - # extending url options - attr_dict.merge(options) - end - - def hash_to_url(url_hash) - generated_url = url_hash.fetch(:scheme, "") + "://" + url_hash.fetch(:host, "") + url_hash.fetch(:path, "") - if url_hash[:query] != "" - generated_url = generated_url + "?" + url_hash.fetch(:query, "") - return generated_url - end - generated_url - end - - def trim_slash(str, both = true) - if str == "" - return "" - end - # remove slash from a string - # if both is not provide trims both slash - # example - '/abc/' returns 'abc' - # if both=false it will only trim end slash - # example - '/abc/' returns '/abc' - # NOTE: IT'S RECOMMENDED TO USE inbuilt .chomp('string you want to remove') - # FOR REMOVING ONLY TRAILING SLASh - if both - str[0].chomp("/") + str[1..-2] + str[-1].chomp("/") - else - str.chomp("/") - end - end - - # class Imagekit - - # end - end -end diff --git a/lib/imagekitio/utils/calculation.rb b/lib/imagekitio/utils/calculation.rb deleted file mode 100644 index 5709090d..00000000 --- a/lib/imagekitio/utils/calculation.rb +++ /dev/null @@ -1,45 +0,0 @@ -require "date" -require "securerandom" - -module ImageKitIo - module Utils - module Calculation - DEFAULT_TIME_DIFF = 60 * 30 - - module_function - - def is_valid_hex(hex_string) - # checks if hexadecimal value is valid or not - /^[[:xdigit:]]+$/ === hex_string - end - - def hamming_distance(first, second) - # Calculate Hamming distance between to hex string - unless is_valid_hex(first) && is_valid_hex(second) - raise ArgumentError, "Both argument should be hexadecimal" - end - a = first.to_i(16) - b = second.to_i(16) - (a ^ b).to_s(2).count("1") - end - - def get_authenticated_params(token, expire, private_key) - # return authenticated param - default_expire = DateTime.now.strftime("%s").to_i + DEFAULT_TIME_DIFF - token ||= SecureRandom.uuid - expire ||= default_expire - - auth_params = {'token': token, 'expire': expire, 'signature': ""} - unless private_key - return nil - end - - signature = OpenSSL::HMAC.hexdigest("SHA1", private_key, token.to_s + expire.to_s) - auth_params[:token] = token - auth_params[:expire] = expire - auth_params[:signature] = signature - auth_params - end - end - end -end diff --git a/lib/imagekitio/utils/formatter.rb b/lib/imagekitio/utils/formatter.rb deleted file mode 100644 index f86a09da..00000000 --- a/lib/imagekitio/utils/formatter.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'json' - -module ImageKitIo - module Utils - module Formatter - - module_function - def snake_to_camel(word) - word_list = word.split("_") - result = [] - word_list&.each { |i| - if i == word_list[0] - result.push(i) - else - result.push(i.capitalize) - end - } - result.join - end - - def camel_to_snake(camel_word) - # convert camel case to snake case - camel_word.to_s.gsub(/::/, "/") - .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') - .gsub(/([a-z\d])([A-Z])/, '\1_\2') - .tr("-", "_") - .downcase - end - - def request_formatter(data) - result = {} - data.each do |key, val| - result[snake_to_camel(key.to_s)] = val - end - result - end - - def format_to_json(options, key, expected_class) - options ||= {} - val = options[key] - if !val.nil? && val.is_a?(expected_class) - options[key] = options[key].to_json - end - options - end - end - end -end diff --git a/lib/imagekitio/utils/option_validator.rb b/lib/imagekitio/utils/option_validator.rb deleted file mode 100644 index 45036c60..00000000 --- a/lib/imagekitio/utils/option_validator.rb +++ /dev/null @@ -1,36 +0,0 @@ -require_relative './formatter' - -module ImageKitIo - module Utils - module OptionValidator - include Formatter - include Constantable - - module_function - - def validate_upload_options(options) - - # Validates upload value, checks if params are valid, - # changes snake to camel case which is supported by - # ImageKitIo server - - - response_list = [] - options.each do |key, val| - if constants.VALID_UPLOAD_OPTIONS.include?(key.to_s) - if val.is_a?(Array) - val = val.join(",") - end - if val.is_a?(TrueClass) || val.is_a?(FalseClass) - val = val.to_s - end - options[key] = val - else - return false - end - end - request_formatter(options) - end - end - end -end diff --git a/lib/tasks/imagekitio/imagekitio_tasks.rake b/lib/tasks/imagekitio/imagekitio_tasks.rake deleted file mode 100644 index 8d6717f2..00000000 --- a/lib/tasks/imagekitio/imagekitio_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :imagekitio do -# # Task goes here -# end diff --git a/manifest.yaml b/manifest.yaml new file mode 100644 index 00000000..556686f5 --- /dev/null +++ b/manifest.yaml @@ -0,0 +1,15 @@ +dependencies: + - English + - cgi + - date + - erb + - etc + - json + - net/http + - pathname + - rbconfig + - securerandom + - set + - stringio + - time + - uri diff --git a/rbi/imagekit/client.rbi b/rbi/imagekit/client.rbi new file mode 100644 index 00000000..f290a74d --- /dev/null +++ b/rbi/imagekit/client.rbi @@ -0,0 +1,90 @@ +# typed: strong + +module Imagekit + class Client < Imagekit::Internal::Transport::BaseClient + DEFAULT_MAX_RETRIES = 2 + + DEFAULT_TIMEOUT_IN_SECONDS = T.let(60.0, Float) + + DEFAULT_INITIAL_RETRY_DELAY = T.let(0.5, Float) + + DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float) + + # Your ImageKit private API key (it starts with `private_`). You can view and + # manage API keys in the + # [dashboard](https://imagekit.io/dashboard/developer/api-keys). + sig { returns(String) } + attr_reader :private_api_key + + # ImageKit Basic Auth only uses the username field and ignores the password. This + # field is unused. + sig { returns(T.nilable(String)) } + attr_reader :password + + sig { returns(Imagekit::Resources::CustomMetadataFields) } + attr_reader :custom_metadata_fields + + sig { returns(Imagekit::Resources::Files) } + attr_reader :files + + sig { returns(Imagekit::Resources::Assets) } + attr_reader :assets + + sig { returns(Imagekit::Resources::Cache) } + attr_reader :cache + + sig { returns(Imagekit::Resources::Folders) } + attr_reader :folders + + sig { returns(Imagekit::Resources::Accounts) } + attr_reader :accounts + + sig { returns(Imagekit::Resources::Beta) } + attr_reader :beta + + sig { returns(Imagekit::Resources::Webhooks) } + attr_reader :webhooks + + # @api private + sig { override.returns(T::Hash[String, String]) } + private def auth_headers + end + + # @api private + sig { returns(T::Boolean) } + def base_url_overridden? + end + + # Creates and returns a new client for interacting with the API. + sig do + params( + private_api_key: T.nilable(String), + password: T.nilable(String), + base_url: T.nilable(String), + max_retries: Integer, + timeout: Float, + initial_retry_delay: Float, + max_retry_delay: Float + ).returns(T.attached_class) + end + def self.new( + # Your ImageKit private API key (it starts with `private_`). You can view and + # manage API keys in the + # [dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults to + # `ENV["IMAGEKIT_PRIVATE_API_KEY"]` + private_api_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], + # ImageKit Basic Auth only uses the username field and ignores the password. This + # field is unused. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` + password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"), + # Override the default base URL for the API, e.g., + # `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]` + base_url: ENV["IMAGE_KIT_BASE_URL"], + # Max number of retries to attempt after a failed retryable request. + max_retries: Imagekit::Client::DEFAULT_MAX_RETRIES, + timeout: Imagekit::Client::DEFAULT_TIMEOUT_IN_SECONDS, + initial_retry_delay: Imagekit::Client::DEFAULT_INITIAL_RETRY_DELAY, + max_retry_delay: Imagekit::Client::DEFAULT_MAX_RETRY_DELAY + ) + end + end +end diff --git a/rbi/imagekit/errors.rbi b/rbi/imagekit/errors.rbi new file mode 100644 index 00000000..733211e0 --- /dev/null +++ b/rbi/imagekit/errors.rbi @@ -0,0 +1,178 @@ +# typed: strong + +module Imagekit + module Errors + class Error < StandardError + sig { returns(T.nilable(StandardError)) } + attr_accessor :cause + end + + class ConversionError < Imagekit::Errors::Error + sig { returns(T.nilable(StandardError)) } + def cause + end + + # @api private + sig do + params( + on: T::Class[StandardError], + method: Symbol, + target: T.anything, + value: T.anything, + cause: T.nilable(StandardError) + ).returns(T.attached_class) + end + def self.new(on:, method:, target:, value:, cause: nil) + end + end + + class APIError < Imagekit::Errors::Error + sig { returns(URI::Generic) } + attr_accessor :url + + sig { returns(T.nilable(Integer)) } + attr_accessor :status + + sig { returns(T.nilable(T.anything)) } + attr_accessor :body + + # @api private + sig do + params( + url: URI::Generic, + status: T.nilable(Integer), + body: T.nilable(Object), + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + url:, + status: nil, + body: nil, + request: nil, + response: nil, + message: nil + ) + end + end + + class APIConnectionError < Imagekit::Errors::APIError + sig { returns(NilClass) } + attr_accessor :status + + sig { returns(NilClass) } + attr_accessor :body + + # @api private + sig do + params( + url: URI::Generic, + status: NilClass, + body: NilClass, + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + url:, + status: nil, + body: nil, + request: nil, + response: nil, + message: "Connection error." + ) + end + end + + class APITimeoutError < Imagekit::Errors::APIConnectionError + # @api private + sig do + params( + url: URI::Generic, + status: NilClass, + body: NilClass, + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + url:, + status: nil, + body: nil, + request: nil, + response: nil, + message: "Request timed out." + ) + end + end + + class APIStatusError < Imagekit::Errors::APIError + # @api private + sig do + params( + url: URI::Generic, + status: Integer, + body: T.nilable(Object), + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.for(url:, status:, body:, request:, response:, message: nil) + end + + sig { returns(Integer) } + attr_accessor :status + + # @api private + sig do + params( + url: URI::Generic, + status: Integer, + body: T.nilable(Object), + request: NilClass, + response: NilClass, + message: T.nilable(String) + ).returns(T.attached_class) + end + def self.new(url:, status:, body:, request:, response:, message: nil) + end + end + + class BadRequestError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 400 + end + + class AuthenticationError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 401 + end + + class PermissionDeniedError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 403 + end + + class NotFoundError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 404 + end + + class ConflictError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 409 + end + + class UnprocessableEntityError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 422 + end + + class RateLimitError < Imagekit::Errors::APIStatusError + HTTP_STATUS = 429 + end + + class InternalServerError < Imagekit::Errors::APIStatusError + HTTP_STATUS = T.let((500..), T::Range[Integer]) + end + end +end diff --git a/rbi/imagekit/file_part.rbi b/rbi/imagekit/file_part.rbi new file mode 100644 index 00000000..6662978f --- /dev/null +++ b/rbi/imagekit/file_part.rbi @@ -0,0 +1,37 @@ +# typed: strong + +module Imagekit + class FilePart + sig { returns(T.any(Pathname, StringIO, IO, String)) } + attr_reader :content + + sig { returns(T.nilable(String)) } + attr_reader :content_type + + sig { returns(T.nilable(String)) } + attr_reader :filename + + # @api private + sig { returns(String) } + private def read + end + + sig { params(a: T.anything).returns(String) } + def to_json(*a) + end + + sig { params(a: T.anything).returns(String) } + def to_yaml(*a) + end + + sig do + params( + content: T.any(Pathname, StringIO, IO, String), + filename: T.nilable(String), + content_type: T.nilable(String) + ).returns(T.attached_class) + end + def self.new(content, filename: nil, content_type: nil) + end + end +end diff --git a/rbi/imagekit/internal.rbi b/rbi/imagekit/internal.rbi new file mode 100644 index 00000000..a32e13ca --- /dev/null +++ b/rbi/imagekit/internal.rbi @@ -0,0 +1,16 @@ +# typed: strong + +module Imagekit + module Internal + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + # Due to the current WIP status of Shapes support in Sorbet, types referencing + # this alias might be refined in the future. + AnyHash = T.type_alias { T::Hash[Symbol, T.anything] } + + FileInput = + T.type_alias { T.any(Pathname, StringIO, IO, String, Imagekit::FilePart) } + + OMIT = T.let(Object.new.freeze, T.anything) + end +end diff --git a/rbi/imagekit/internal/transport/base_client.rbi b/rbi/imagekit/internal/transport/base_client.rbi new file mode 100644 index 00000000..3e5fda85 --- /dev/null +++ b/rbi/imagekit/internal/transport/base_client.rbi @@ -0,0 +1,293 @@ +# typed: strong + +module Imagekit + module Internal + module Transport + # @api private + class BaseClient + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + abstract! + + RequestComponents = + T.type_alias do + { + method: Symbol, + path: T.any(String, T::Array[String]), + query: + T.nilable( + T::Hash[String, T.nilable(T.any(T::Array[String], String))] + ), + headers: + T.nilable( + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ] + ), + body: T.nilable(T.anything), + unwrap: + T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + page: + T.nilable( + T::Class[ + Imagekit::Internal::Type::BasePage[ + Imagekit::Internal::Type::BaseModel + ] + ] + ), + stream: T.nilable(T::Class[T.anything]), + model: T.nilable(Imagekit::Internal::Type::Converter::Input), + options: T.nilable(Imagekit::RequestOptions::OrHash) + } + end + + RequestInput = + T.type_alias do + { + method: Symbol, + url: URI::Generic, + headers: T::Hash[String, String], + body: T.anything, + max_retries: Integer, + timeout: Float + } + end + + # from whatwg fetch spec + MAX_REDIRECTS = 20 + + PLATFORM_HEADERS = T::Hash[String, String] + + class << self + # @api private + sig do + params( + req: Imagekit::Internal::Transport::BaseClient::RequestComponents + ).void + end + def validate!(req) + end + + # @api private + sig do + params( + status: Integer, + headers: T.any(T::Hash[String, String], Net::HTTPHeader) + ).returns(T::Boolean) + end + def should_retry?(status, headers:) + end + + # @api private + sig do + params( + request: Imagekit::Internal::Transport::BaseClient::RequestInput, + status: Integer, + response_headers: T.any(T::Hash[String, String], Net::HTTPHeader) + ).returns(Imagekit::Internal::Transport::BaseClient::RequestInput) + end + def follow_redirect(request, status:, response_headers:) + end + + # @api private + sig do + params( + status: T.any(Integer, Imagekit::Errors::APIConnectionError), + stream: T.nilable(T::Enumerable[String]) + ).void + end + def reap_connection!(status, stream:) + end + end + + sig { returns(URI::Generic) } + attr_reader :base_url + + sig { returns(Float) } + attr_reader :timeout + + sig { returns(Integer) } + attr_reader :max_retries + + sig { returns(Float) } + attr_reader :initial_retry_delay + + sig { returns(Float) } + attr_reader :max_retry_delay + + sig { returns(T::Hash[String, String]) } + attr_reader :headers + + sig { returns(T.nilable(String)) } + attr_reader :idempotency_header + + # @api private + sig { returns(Imagekit::Internal::Transport::PooledNetRequester) } + attr_reader :requester + + # @api private + sig do + params( + base_url: String, + timeout: Float, + max_retries: Integer, + initial_retry_delay: Float, + max_retry_delay: Float, + headers: + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ], + idempotency_header: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + base_url:, + timeout: 0.0, + max_retries: 0, + initial_retry_delay: 0.0, + max_retry_delay: 0.0, + headers: {}, + idempotency_header: nil + ) + end + + # @api private + sig { overridable.returns(T::Hash[String, String]) } + private def auth_headers + end + + # @api private + sig { returns(String) } + private def generate_idempotency_key + end + + # @api private + sig do + overridable + .params( + req: Imagekit::Internal::Transport::BaseClient::RequestComponents, + opts: Imagekit::Internal::AnyHash + ) + .returns(Imagekit::Internal::Transport::BaseClient::RequestInput) + end + private def build_request(req, opts) + end + + # @api private + sig do + params( + headers: T::Hash[String, String], + retry_count: Integer + ).returns(Float) + end + private def retry_delay(headers, retry_count:) + end + + # @api private + sig do + params( + request: Imagekit::Internal::Transport::BaseClient::RequestInput, + redirect_count: Integer, + retry_count: Integer, + send_retry_header: T::Boolean + ).returns([Integer, Net::HTTPResponse, T::Enumerable[String]]) + end + def send_request( + request, + redirect_count:, + retry_count:, + send_retry_header: + ) + end + + # Execute the request specified by `req`. This is the method that all resource + # methods call into. + # + # @overload request(method, path, query: {}, headers: {}, body: nil, unwrap: nil, page: nil, stream: nil, model: Imagekit::Internal::Type::Unknown, options: {}) + sig do + params( + method: Symbol, + path: T.any(String, T::Array[String]), + query: + T.nilable( + T::Hash[String, T.nilable(T.any(T::Array[String], String))] + ), + headers: + T.nilable( + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ] + ), + body: T.nilable(T.anything), + unwrap: + T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + page: + T.nilable( + T::Class[ + Imagekit::Internal::Type::BasePage[ + Imagekit::Internal::Type::BaseModel + ] + ] + ), + stream: T.nilable(T::Class[T.anything]), + model: T.nilable(Imagekit::Internal::Type::Converter::Input), + options: T.nilable(Imagekit::RequestOptions::OrHash) + ).returns(T.anything) + end + def request( + method, + path, + query: {}, + headers: {}, + body: nil, + unwrap: nil, + page: nil, + stream: nil, + model: Imagekit::Internal::Type::Unknown, + options: {} + ) + end + + # @api private + sig { returns(String) } + def inspect + end + end + end + end +end diff --git a/rbi/imagekit/internal/transport/pooled_net_requester.rbi b/rbi/imagekit/internal/transport/pooled_net_requester.rbi new file mode 100644 index 00000000..f5b90254 --- /dev/null +++ b/rbi/imagekit/internal/transport/pooled_net_requester.rbi @@ -0,0 +1,79 @@ +# typed: strong + +module Imagekit + module Internal + module Transport + # @api private + class PooledNetRequester + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + Request = + T.type_alias do + { + method: Symbol, + url: URI::Generic, + headers: T::Hash[String, String], + body: T.anything, + deadline: Float + } + end + + # from the golang stdlib + # https://github.com/golang/go/blob/c8eced8580028328fde7c03cbfcb720ce15b2358/src/net/http/transport.go#L49 + KEEP_ALIVE_TIMEOUT = 30 + + DEFAULT_MAX_CONNECTIONS = T.let(T.unsafe(nil), Integer) + + class << self + # @api private + sig { params(url: URI::Generic).returns(Net::HTTP) } + def connect(url) + end + + # @api private + sig { params(conn: Net::HTTP, deadline: Float).void } + def calibrate_socket_timeout(conn, deadline) + end + + # @api private + sig do + params( + request: + Imagekit::Internal::Transport::PooledNetRequester::Request, + blk: T.proc.params(arg0: String).void + ).returns([Net::HTTPGenericRequest, T.proc.void]) + end + def build_request(request, &blk) + end + end + + # @api private + sig do + params( + url: URI::Generic, + deadline: Float, + blk: T.proc.params(arg0: Net::HTTP).void + ).void + end + private def with_pool(url, deadline:, &blk) + end + + # @api private + sig do + params( + request: Imagekit::Internal::Transport::PooledNetRequester::Request + ).returns([Integer, Net::HTTPResponse, T::Enumerable[String]]) + end + def execute(request) + end + + # @api private + sig { params(size: Integer).returns(T.attached_class) } + def self.new( + size: Imagekit::Internal::Transport::PooledNetRequester::DEFAULT_MAX_CONNECTIONS + ) + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/array_of.rbi b/rbi/imagekit/internal/type/array_of.rbi new file mode 100644 index 00000000..4c739d92 --- /dev/null +++ b/rbi/imagekit/internal/type/array_of.rbi @@ -0,0 +1,104 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + # + # Array of items of a given type. + class ArrayOf + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + abstract! + + Elem = type_member(:out) + + sig do + params( + type_info: + T.any( + Imagekit::Internal::AnyHash, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: Imagekit::Internal::AnyHash + ).returns(T.attached_class) + end + def self.[](type_info, spec = {}) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + sig do + override + .params( + value: T.any(T::Array[T.anything], T.anything), + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.any(T::Array[T.anything], T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T::Array[T.anything], T.anything), + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.any(T::Array[T.anything], T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { returns(Elem) } + protected def item_type + end + + # @api private + sig { returns(T::Boolean) } + protected def nilable? + end + + # @api private + sig do + params( + type_info: + T.any( + Imagekit::Internal::AnyHash, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: Imagekit::Internal::AnyHash + ).void + end + def initialize(type_info, spec = {}) + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/base_model.rbi b/rbi/imagekit/internal/type/base_model.rbi new file mode 100644 index 00000000..b1ae616a --- /dev/null +++ b/rbi/imagekit/internal/type/base_model.rbi @@ -0,0 +1,302 @@ +# typed: strong + +module Imagekit + module Internal + module Type + class BaseModel + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + abstract! + + KnownField = + T.type_alias do + { + mode: T.nilable(Symbol), + required: T::Boolean, + nilable: T::Boolean + } + end + + OrHash = + T.type_alias do + T.any( + Imagekit::Internal::Type::BaseModel, + Imagekit::Internal::AnyHash + ) + end + + class << self + # @api private + # + # Assumes superclass fields are totally defined before fields are accessed / + # defined on subclasses. + sig { params(child: T.self_type).void } + def inherited(child) + end + + # @api private + sig do + returns( + T::Hash[ + Symbol, + T.all( + Imagekit::Internal::Type::BaseModel::KnownField, + { + type_fn: + T.proc.returns(Imagekit::Internal::Type::Converter::Input) + } + ) + ] + ) + end + def known_fields + end + + # @api private + sig do + returns( + T::Hash[ + Symbol, + T.all( + Imagekit::Internal::Type::BaseModel::KnownField, + { type: Imagekit::Internal::Type::Converter::Input } + ) + ] + ) + end + def fields + end + + # @api private + sig do + params( + name_sym: Symbol, + required: T::Boolean, + type_info: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ), + union: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ), + api_name: Symbol, + nil?: T::Boolean + }, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: Imagekit::Internal::AnyHash + ).void + end + private def add_field(name_sym, required:, type_info:, spec:) + end + + # @api private + sig do + params( + name_sym: Symbol, + type_info: + T.any( + Imagekit::Internal::AnyHash, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: Imagekit::Internal::AnyHash + ).void + end + def required(name_sym, type_info, spec = {}) + end + + # @api private + sig do + params( + name_sym: Symbol, + type_info: + T.any( + Imagekit::Internal::AnyHash, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: Imagekit::Internal::AnyHash + ).void + end + def optional(name_sym, type_info, spec = {}) + end + + # @api private + # + # `request_only` attributes not excluded from `.#coerce` when receiving responses + # even if well behaved servers should not send them + sig { params(blk: T.proc.void).void } + private def request_only(&blk) + end + + # @api private + # + # `response_only` attributes are omitted from `.#dump` when making requests + sig { params(blk: T.proc.void).void } + private def response_only(&blk) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + class << self + # @api private + sig do + override + .params( + value: + T.any( + Imagekit::Internal::Type::BaseModel, + T::Hash[T.anything, T.anything], + T.anything + ), + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.any(T.attached_class, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T.attached_class, T.anything), + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.any(T::Hash[T.anything, T.anything], T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + + class << self + # @api private + sig do + params( + model: Imagekit::Internal::Type::BaseModel, + convert: T::Boolean + ).returns(Imagekit::Internal::AnyHash) + end + def recursively_to_h(model, convert:) + end + end + + # Returns the raw value associated with the given key, if found. Otherwise, nil is + # returned. + # + # It is valid to lookup keys that are not in the API spec, for example to access + # undocumented features. This method does not parse response data into + # higher-level types. Lookup by anything other than a Symbol is an ArgumentError. + sig { params(key: Symbol).returns(T.nilable(T.anything)) } + def [](key) + end + + # Returns a Hash of the data underlying this object. O(1) + # + # Keys are Symbols and values are the raw values from the response. The return + # value indicates which values were ever set on the object. i.e. there will be a + # key in this hash if they ever were, even if the set value was nil. + # + # This method is not recursive. The returned value is shared by the object, so it + # should not be mutated. + sig { overridable.returns(Imagekit::Internal::AnyHash) } + def to_h + end + + # Returns a Hash of the data underlying this object. O(1) + # + # Keys are Symbols and values are the raw values from the response. The return + # value indicates which values were ever set on the object. i.e. there will be a + # key in this hash if they ever were, even if the set value was nil. + # + # This method is not recursive. The returned value is shared by the object, so it + # should not be mutated. + sig { overridable.returns(Imagekit::Internal::AnyHash) } + def to_hash + end + + # In addition to the behaviour of `#to_h`, this method will recursively call + # `#to_h` on nested models. + sig { overridable.returns(Imagekit::Internal::AnyHash) } + def deep_to_h + end + + sig do + params(keys: T.nilable(T::Array[Symbol])).returns( + Imagekit::Internal::AnyHash + ) + end + def deconstruct_keys(keys) + end + + sig { params(a: T.anything).returns(String) } + def to_json(*a) + end + + sig { params(a: T.anything).returns(String) } + def to_yaml(*a) + end + + # Create a new instance of a model. + sig do + params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns( + T.attached_class + ) + end + def self.new(data = {}) + end + + class << self + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + + sig { returns(String) } + def to_s + end + + # @api private + sig { returns(String) } + def inspect + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/base_page.rbi b/rbi/imagekit/internal/type/base_page.rbi new file mode 100644 index 00000000..dab911be --- /dev/null +++ b/rbi/imagekit/internal/type/base_page.rbi @@ -0,0 +1,42 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + # + # This module provides a base implementation for paginated responses in the SDK. + module BasePage + Elem = type_member(:out) + + sig { overridable.returns(T::Boolean) } + def next_page? + end + + sig { overridable.returns(T.self_type) } + def next_page + end + + sig { overridable.params(blk: T.proc.params(arg0: Elem).void).void } + def auto_paging_each(&blk) + end + + sig { returns(T::Enumerable[Elem]) } + def to_enum + end + + # @api private + sig do + params( + client: Imagekit::Internal::Transport::BaseClient, + req: Imagekit::Internal::Transport::BaseClient::RequestComponents, + headers: T.any(T::Hash[String, String], Net::HTTPHeader), + page_data: T.anything + ).void + end + def initialize(client:, req:, headers:, page_data:) + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/boolean.rbi b/rbi/imagekit/internal/type/boolean.rbi new file mode 100644 index 00000000..fd1f5df2 --- /dev/null +++ b/rbi/imagekit/internal/type/boolean.rbi @@ -0,0 +1,58 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + # + # Ruby has no Boolean class; this is something for models to refer to. + class Boolean + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + abstract! + + sig { params(other: T.anything).returns(T::Boolean) } + def self.===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def self.==(other) + end + + class << self + # @api private + # + # Coerce value to Boolean if possible, otherwise return the original value. + sig do + override + .params( + value: T.any(T::Boolean, T.anything), + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.any(T::Boolean, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T::Boolean, T.anything), + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.any(T::Boolean, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/converter.rbi b/rbi/imagekit/internal/type/converter.rbi new file mode 100644 index 00000000..34341635 --- /dev/null +++ b/rbi/imagekit/internal/type/converter.rbi @@ -0,0 +1,216 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + module Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + Input = + T.type_alias do + T.any(Imagekit::Internal::Type::Converter, T::Class[T.anything]) + end + + CoerceState = + T.type_alias do + { + translate_names: T::Boolean, + strictness: T::Boolean, + exactness: { + yes: Integer, + no: Integer, + maybe: Integer + }, + error: T::Class[StandardError], + branched: Integer + } + end + + DumpState = T.type_alias { { can_retry: T::Boolean } } + + # @api private + sig do + overridable + .params( + value: T.anything, + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.anything) + end + def coerce(value, state:) + end + + # @api private + sig do + overridable + .params( + value: T.anything, + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.anything) + end + def dump(value, state:) + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + + class << self + # @api private + sig do + params( + spec: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ), + union: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ) + }, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ) + ).returns(T.proc.returns(T.anything)) + end + def self.type_info(spec) + end + + # @api private + sig do + params( + type_info: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ), + union: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ) + }, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: + T.any( + { + const: + T.nilable( + T.any(NilClass, T::Boolean, Integer, Float, Symbol) + ), + enum: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ), + union: + T.nilable( + T.proc.returns( + Imagekit::Internal::Type::Converter::Input + ) + ) + }, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ) + ).returns(Imagekit::Internal::AnyHash) + end + def self.meta_info(type_info, spec) + end + + # @api private + sig do + params(translate_names: T::Boolean).returns( + Imagekit::Internal::Type::Converter::CoerceState + ) + end + def self.new_coerce_state(translate_names: true) + end + + # @api private + # + # Based on `target`, transform `value` into `target`, to the extent possible: + # + # 1. if the given `value` conforms to `target` already, return the given `value` + # 2. if it's possible and safe to convert the given `value` to `target`, then the + # converted value + # 3. otherwise, the given `value` unaltered + # + # The coercion process is subject to improvement between minor release versions. + # See https://docs.pydantic.dev/latest/concepts/unions/#smart-mode + sig do + params( + target: Imagekit::Internal::Type::Converter::Input, + value: T.anything, + state: Imagekit::Internal::Type::Converter::CoerceState + ).returns(T.anything) + end + def self.coerce( + target, + value, + # The `strictness` is one of `true`, `false`. This informs the coercion strategy + # when we have to decide between multiple possible conversion targets: + # + # - `true`: the conversion must be exact, with minimum coercion. + # - `false`: the conversion can be approximate, with some coercion. + # + # The `exactness` is `Hash` with keys being one of `yes`, `no`, or `maybe`. For + # any given conversion attempt, the exactness will be updated based on how closely + # the value recursively matches the target type: + # + # - `yes`: the value can be converted to the target type with minimum coercion. + # - `maybe`: the value can be converted to the target type with some reasonable + # coercion. + # - `no`: the value cannot be converted to the target type. + # + # See implementation below for more details. + state: Imagekit::Internal::Type::Converter.new_coerce_state + ) + end + + # @api private + sig do + params( + target: Imagekit::Internal::Type::Converter::Input, + value: T.anything, + state: Imagekit::Internal::Type::Converter::DumpState + ).returns(T.anything) + end + def self.dump(target, value, state: { can_retry: true }) + end + + # @api private + sig { params(target: T.anything, depth: Integer).returns(String) } + def self.inspect(target, depth:) + end + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/enum.rbi b/rbi/imagekit/internal/type/enum.rbi new file mode 100644 index 00000000..c7b354ff --- /dev/null +++ b/rbi/imagekit/internal/type/enum.rbi @@ -0,0 +1,82 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + # + # A value from among a specified list of options. OpenAPI enum values map to Ruby + # values in the SDK as follows: + # + # 1. boolean => true | false + # 2. integer => Integer + # 3. float => Float + # 4. string => Symbol + # + # We can therefore convert string values to Symbols, but can't convert other + # values safely. + module Enum + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + # All of the valid Symbol values for this enum. + sig do + overridable.returns( + T::Array[T.any(NilClass, T::Boolean, Integer, Float, Symbol)] + ) + end + def values + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + # + # Unlike with primitives, `Enum` additionally validates that the value is a member + # of the enum. + sig do + override + .params( + value: T.any(String, Symbol, T.anything), + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.any(Symbol, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(Symbol, T.anything), + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.any(Symbol, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/file_input.rbi b/rbi/imagekit/internal/type/file_input.rbi new file mode 100644 index 00000000..1982d8a2 --- /dev/null +++ b/rbi/imagekit/internal/type/file_input.rbi @@ -0,0 +1,59 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + # + # Either `Pathname` or `StringIO`, or `IO`, or + # `Imagekit::Internal::Type::FileInput`. + # + # Note: when `IO` is used, all retries are disabled, since many IO` streams are + # not rewindable. + class FileInput + extend Imagekit::Internal::Type::Converter + + abstract! + + sig { params(other: T.anything).returns(T::Boolean) } + def self.===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def self.==(other) + end + + class << self + # @api private + sig do + override + .params( + value: T.any(StringIO, String, T.anything), + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.any(StringIO, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(Pathname, StringIO, IO, String, T.anything), + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.any(Pathname, StringIO, IO, String, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/hash_of.rbi b/rbi/imagekit/internal/type/hash_of.rbi new file mode 100644 index 00000000..0d963136 --- /dev/null +++ b/rbi/imagekit/internal/type/hash_of.rbi @@ -0,0 +1,104 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + # + # Hash of items of a given type. + class HashOf + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + abstract! + + Elem = type_member(:out) + + sig do + params( + type_info: + T.any( + Imagekit::Internal::AnyHash, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: Imagekit::Internal::AnyHash + ).returns(T.attached_class) + end + def self.[](type_info, spec = {}) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + sig do + override + .params( + value: T.any(T::Hash[T.anything, T.anything], T.anything), + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.any(Imagekit::Internal::AnyHash, T.anything)) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.any(T::Hash[T.anything, T.anything], T.anything), + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.any(Imagekit::Internal::AnyHash, T.anything)) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { returns(Elem) } + protected def item_type + end + + # @api private + sig { returns(T::Boolean) } + protected def nilable? + end + + # @api private + sig do + params( + type_info: + T.any( + Imagekit::Internal::AnyHash, + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::Type::Converter::Input + ), + spec: Imagekit::Internal::AnyHash + ).void + end + def initialize(type_info, spec = {}) + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/request_parameters.rbi b/rbi/imagekit/internal/type/request_parameters.rbi new file mode 100644 index 00000000..a8f7b350 --- /dev/null +++ b/rbi/imagekit/internal/type/request_parameters.rbi @@ -0,0 +1,29 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + module RequestParameters + # Options to specify HTTP behaviour for this request. + sig { returns(Imagekit::RequestOptions) } + attr_reader :request_options + + sig { params(request_options: Imagekit::RequestOptions::OrHash).void } + attr_writer :request_options + + # @api private + module Converter + # @api private + sig do + params(params: T.anything).returns( + [T.anything, Imagekit::Internal::AnyHash] + ) + end + def dump_request(params) + end + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/union.rbi b/rbi/imagekit/internal/type/union.rbi new file mode 100644 index 00000000..1fd36045 --- /dev/null +++ b/rbi/imagekit/internal/type/union.rbi @@ -0,0 +1,128 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + module Union + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + # @api private + # + # All of the specified variant info for this union. + sig do + returns( + T::Array[ + [ + T.nilable(Symbol), + T.proc.returns(Imagekit::Internal::Type::Converter::Input), + Imagekit::Internal::AnyHash + ] + ] + ) + end + private def known_variants + end + + # @api private + sig do + returns( + T::Array[ + [T.nilable(Symbol), T.anything, Imagekit::Internal::AnyHash] + ] + ) + end + protected def derefed_variants + end + + # All of the specified variants for this union. + sig { overridable.returns(T::Array[T.anything]) } + def variants + end + + # @api private + sig { params(property: Symbol).void } + private def discriminator(property) + end + + # @api private + sig do + params( + key: + T.any( + Symbol, + Imagekit::Internal::AnyHash, + T.proc.returns(T.anything), + T.anything + ), + spec: + T.any( + Imagekit::Internal::AnyHash, + T.proc.returns(T.anything), + T.anything + ) + ).void + end + private def variant(key, spec = nil) + end + + # @api private + sig { params(value: T.anything).returns(T.nilable(T.anything)) } + private def resolve_variant(value) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def ==(other) + end + + sig { returns(Integer) } + def hash + end + + # @api private + # + # Tries to efficiently coerce the given value to one of the known variants. + # + # If the value cannot match any of the known variants, the coercion is considered + # non-viable and returns the original value. + sig do + override + .params( + value: T.anything, + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.anything) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.anything, + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.anything) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + # @api private + sig { params(depth: Integer).returns(String) } + def inspect(depth: 0) + end + end + end + end +end diff --git a/rbi/imagekit/internal/type/unknown.rbi b/rbi/imagekit/internal/type/unknown.rbi new file mode 100644 index 00000000..27d7c467 --- /dev/null +++ b/rbi/imagekit/internal/type/unknown.rbi @@ -0,0 +1,58 @@ +# typed: strong + +module Imagekit + module Internal + module Type + # @api private + # + # When we don't know what to expect for the value. + class Unknown + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + abstract! + + sig { params(other: T.anything).returns(T::Boolean) } + def self.===(other) + end + + sig { params(other: T.anything).returns(T::Boolean) } + def self.==(other) + end + + class << self + # @api private + # + # No coercion needed for Unknown type. + sig do + override + .params( + value: T.anything, + state: Imagekit::Internal::Type::Converter::CoerceState + ) + .returns(T.anything) + end + def coerce(value, state:) + end + + # @api private + sig do + override + .params( + value: T.anything, + state: Imagekit::Internal::Type::Converter::DumpState + ) + .returns(T.anything) + end + def dump(value, state:) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + end + end + end + end +end diff --git a/rbi/imagekit/internal/util.rbi b/rbi/imagekit/internal/util.rbi new file mode 100644 index 00000000..268628ae --- /dev/null +++ b/rbi/imagekit/internal/util.rbi @@ -0,0 +1,487 @@ +# typed: strong + +module Imagekit + module Internal + # @api private + module Util + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + # @api private + sig { returns(Float) } + def self.monotonic_secs + end + + # @api private + sig do + params(ns: T.any(Module, T::Class[T.anything])).returns( + T::Enumerable[T.any(Module, T::Class[T.anything])] + ) + end + def self.walk_namespaces(ns) + end + + class << self + # @api private + sig { returns(String) } + def arch + end + + # @api private + sig { returns(String) } + def os + end + end + + class << self + # @api private + sig { params(input: T.anything).returns(T::Boolean) } + def primitive?(input) + end + + # @api private + sig do + params(input: T.any(String, T::Boolean)).returns( + T.any(T::Boolean, T.anything) + ) + end + def coerce_boolean(input) + end + + # @api private + sig do + params(input: T.any(String, T::Boolean)).returns( + T.nilable(T::Boolean) + ) + end + def coerce_boolean!(input) + end + + # @api private + sig do + params(input: T.any(String, Integer)).returns( + T.any(Integer, T.anything) + ) + end + def coerce_integer(input) + end + + # @api private + sig do + params(input: T.any(String, Integer, Float)).returns( + T.any(Float, T.anything) + ) + end + def coerce_float(input) + end + + # @api private + sig do + params(input: T.anything).returns( + T.any(T::Hash[T.anything, T.anything], T.anything) + ) + end + def coerce_hash(input) + end + + # @api private + sig do + params(input: T.anything).returns( + T.nilable(T::Hash[T.anything, T.anything]) + ) + end + def coerce_hash!(input) + end + end + + class << self + # @api private + sig do + params(lhs: T.anything, rhs: T.anything, concat: T::Boolean).returns( + T.anything + ) + end + private def deep_merge_lr(lhs, rhs, concat: false) + end + + # @api private + # + # Recursively merge one hash with another. If the values at a given key are not + # both hashes, just take the new value. + sig do + params( + values: T::Array[T.anything], + sentinel: T.nilable(T.anything), + concat: T::Boolean + ).returns(T.anything) + end + def deep_merge( + *values, + # the value to return if no values are provided. + sentinel: nil, + # whether to merge sequences by concatenation. + concat: false + ) + end + + # @api private + sig do + params( + data: + T.any( + Imagekit::Internal::AnyHash, + T::Array[T.anything], + T.anything + ), + pick: + T.nilable( + T.any( + Symbol, + Integer, + T::Array[T.any(Symbol, Integer)], + T.proc.params(arg0: T.anything).returns(T.anything) + ) + ), + blk: T.nilable(T.proc.returns(T.anything)) + ).returns(T.nilable(T.anything)) + end + def dig(data, pick, &blk) + end + end + + class << self + # @api private + sig { params(uri: URI::Generic).returns(String) } + def uri_origin(uri) + end + + # @api private + sig { params(path: T.any(String, T::Array[String])).returns(String) } + def interpolate_path(path) + end + end + + class << self + # @api private + sig do + params(query: T.nilable(String)).returns( + T::Hash[String, T::Array[String]] + ) + end + def decode_query(query) + end + + # @api private + sig do + params( + query: + T.nilable( + T::Hash[String, T.nilable(T.any(T::Array[String], String))] + ) + ).returns(T.nilable(String)) + end + def encode_query(query) + end + end + + ParsedUri = + T.type_alias do + { + scheme: T.nilable(String), + host: T.nilable(String), + port: T.nilable(Integer), + path: T.nilable(String), + query: T::Hash[String, T::Array[String]] + } + end + + class << self + # @api private + sig do + params(url: T.any(URI::Generic, String)).returns( + Imagekit::Internal::Util::ParsedUri + ) + end + def parse_uri(url) + end + + # @api private + sig do + params(parsed: Imagekit::Internal::Util::ParsedUri).returns( + URI::Generic + ) + end + def unparse_uri(parsed) + end + + # @api private + sig do + params( + lhs: Imagekit::Internal::Util::ParsedUri, + rhs: Imagekit::Internal::Util::ParsedUri + ).returns(URI::Generic) + end + def join_parsed_uri(lhs, rhs) + end + end + + class << self + # @api private + sig do + params( + headers: + T::Hash[ + String, + T.nilable( + T.any( + String, + Integer, + T::Array[T.nilable(T.any(String, Integer))] + ) + ) + ] + ).returns(T::Hash[String, String]) + end + def normalized_headers(*headers) + end + end + + # @api private + # + # An adapter that satisfies the IO interface required by `::IO.copy_stream` + class ReadIOAdapter + # @api private + sig { returns(T.nilable(T::Boolean)) } + def close? + end + + # @api private + sig { void } + def close + end + + # @api private + sig { params(max_len: T.nilable(Integer)).returns(String) } + private def read_enum(max_len) + end + + # @api private + sig do + params( + max_len: T.nilable(Integer), + out_string: T.nilable(String) + ).returns(T.nilable(String)) + end + def read(max_len = nil, out_string = nil) + end + + # @api private + sig do + params( + src: T.any(String, Pathname, StringIO, T::Enumerable[String]), + blk: T.proc.params(arg0: String).void + ).returns(T.attached_class) + end + def self.new(src, &blk) + end + end + + class << self + sig do + params(blk: T.proc.params(y: Enumerator::Yielder).void).returns( + T::Enumerable[String] + ) + end + def writable_enum(&blk) + end + end + + JSON_CONTENT = + T.let(%r{^application/(?:vnd(?:\.[^.]+)*\+)?json(?!l)}, Regexp) + JSONL_CONTENT = + T.let(%r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}, Regexp) + + class << self + # @api private + sig do + params( + y: Enumerator::Yielder, + val: T.anything, + closing: T::Array[T.proc.void], + content_type: T.nilable(String) + ).void + end + private def write_multipart_content( + y, + val:, + closing:, + content_type: nil + ) + end + + # @api private + sig do + params( + y: Enumerator::Yielder, + boundary: String, + key: T.any(Symbol, String), + val: T.anything, + closing: T::Array[T.proc.void] + ).void + end + private def write_multipart_chunk(y, boundary:, key:, val:, closing:) + end + + # @api private + # + # https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content + sig do + params(body: T.anything).returns([String, T::Enumerable[String]]) + end + private def encode_multipart_streaming(body) + end + + # @api private + sig do + params(headers: T::Hash[String, String], body: T.anything).returns( + T.anything + ) + end + def encode_content(headers, body) + end + + # @api private + # + # https://www.iana.org/assignments/character-sets/character-sets.xhtml + sig { params(content_type: String, text: String).void } + def force_charset!(content_type, text:) + end + + # @api private + # + # Assumes each chunk in stream has `Encoding::BINARY`. + sig do + params( + headers: T.any(T::Hash[String, String], Net::HTTPHeader), + stream: T::Enumerable[String], + suppress_error: T::Boolean + ).returns(T.anything) + end + def decode_content(headers, stream:, suppress_error: false) + end + end + + class << self + # @api private + # + # https://doc.rust-lang.org/std/iter/trait.FusedIterator.html + sig do + params( + enum: T::Enumerable[T.anything], + external: T::Boolean, + close: T.proc.void + ).returns(T::Enumerable[T.anything]) + end + def fused_enum(enum, external: false, &close) + end + + # @api private + sig { params(enum: T.nilable(T::Enumerable[T.anything])).void } + def close_fused!(enum) + end + + # @api private + sig do + params( + enum: T.nilable(T::Enumerable[T.anything]), + blk: T.proc.params(arg0: Enumerator::Yielder).void + ).returns(T::Enumerable[T.anything]) + end + def chain_fused(enum, &blk) + end + end + + ServerSentEvent = + T.type_alias do + { + event: T.nilable(String), + data: T.nilable(String), + id: T.nilable(String), + retry: T.nilable(Integer) + } + end + + class << self + # @api private + # + # Assumes Strings have been forced into having `Encoding::BINARY`. + # + # This decoder is responsible for reassembling lines split across multiple + # fragments. + sig do + params(enum: T::Enumerable[String]).returns(T::Enumerable[String]) + end + def decode_lines(enum) + end + + # @api private + # + # https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream + # + # Assumes that `lines` has been decoded with `#decode_lines`. + sig do + params(lines: T::Enumerable[String]).returns( + T::Enumerable[Imagekit::Internal::Util::ServerSentEvent] + ) + end + def decode_sse(lines) + end + end + + # @api private + module SorbetRuntimeSupport + class MissingSorbetRuntimeError < ::RuntimeError + end + + # @api private + sig { returns(T::Hash[Symbol, T.anything]) } + private def sorbet_runtime_constants + end + + # @api private + sig { params(name: Symbol).void } + def const_missing(name) + end + + # @api private + sig { params(name: Symbol).returns(T::Boolean) } + def sorbet_constant_defined?(name) + end + + # @api private + sig { params(name: Symbol, blk: T.proc.returns(T.anything)).void } + def define_sorbet_constant!(name, &blk) + end + + # @api private + sig { returns(T.anything) } + def to_sorbet_type + end + + class << self + # @api private + sig do + params( + type: + T.any( + Imagekit::Internal::Util::SorbetRuntimeSupport, + T.anything + ) + ).returns(T.anything) + end + def to_sorbet_type(type) + end + end + end + end + end +end diff --git a/rbi/imagekit/models.rbi b/rbi/imagekit/models.rbi new file mode 100644 index 00000000..b16eec98 --- /dev/null +++ b/rbi/imagekit/models.rbi @@ -0,0 +1,121 @@ +# typed: strong + +module Imagekit + Accounts = Imagekit::Models::Accounts + + AssetListParams = Imagekit::Models::AssetListParams + + BaseOverlay = Imagekit::Models::BaseOverlay + + Beta = Imagekit::Models::Beta + + Cache = Imagekit::Models::Cache + + CustomMetadataField = Imagekit::Models::CustomMetadataField + + CustomMetadataFieldCreateParams = + Imagekit::Models::CustomMetadataFieldCreateParams + + CustomMetadataFieldDeleteParams = + Imagekit::Models::CustomMetadataFieldDeleteParams + + CustomMetadataFieldListParams = + Imagekit::Models::CustomMetadataFieldListParams + + CustomMetadataFieldUpdateParams = + Imagekit::Models::CustomMetadataFieldUpdateParams + + File = Imagekit::Models::File + + FileCopyParams = Imagekit::Models::FileCopyParams + + FileDeleteParams = Imagekit::Models::FileDeleteParams + + FileGetParams = Imagekit::Models::FileGetParams + + FileMoveParams = Imagekit::Models::FileMoveParams + + FileRenameParams = Imagekit::Models::FileRenameParams + + Files = Imagekit::Models::Files + + FileUpdateParams = Imagekit::Models::FileUpdateParams + + FileUploadParams = Imagekit::Models::FileUploadParams + + Folder = Imagekit::Models::Folder + + FolderCopyParams = Imagekit::Models::FolderCopyParams + + FolderCreateParams = Imagekit::Models::FolderCreateParams + + FolderDeleteParams = Imagekit::Models::FolderDeleteParams + + FolderMoveParams = Imagekit::Models::FolderMoveParams + + FolderRenameParams = Imagekit::Models::FolderRenameParams + + Folders = Imagekit::Models::Folders + + ImageOverlay = Imagekit::Models::ImageOverlay + + Metadata = Imagekit::Models::Metadata + + Overlay = Imagekit::Models::Overlay + + OverlayPosition = Imagekit::Models::OverlayPosition + + OverlayTiming = Imagekit::Models::OverlayTiming + + SolidColorOverlay = Imagekit::Models::SolidColorOverlay + + SolidColorOverlayTransformation = + Imagekit::Models::SolidColorOverlayTransformation + + SrcOptions = Imagekit::Models::SrcOptions + + StreamingResolution = Imagekit::Models::StreamingResolution + + SubtitleOverlay = Imagekit::Models::SubtitleOverlay + + SubtitleOverlayTransformation = + Imagekit::Models::SubtitleOverlayTransformation + + TextOverlay = Imagekit::Models::TextOverlay + + TextOverlayTransformation = Imagekit::Models::TextOverlayTransformation + + Transformation = Imagekit::Models::Transformation + + TransformationPosition = Imagekit::Models::TransformationPosition + + UnsafeUnwrapWebhookEvent = Imagekit::Models::UnsafeUnwrapWebhookEvent + + UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent + + UploadPostTransformErrorEvent = + Imagekit::Models::UploadPostTransformErrorEvent + + UploadPostTransformSuccessEvent = + Imagekit::Models::UploadPostTransformSuccessEvent + + UploadPreTransformErrorEvent = Imagekit::Models::UploadPreTransformErrorEvent + + UploadPreTransformSuccessEvent = + Imagekit::Models::UploadPreTransformSuccessEvent + + VideoOverlay = Imagekit::Models::VideoOverlay + + VideoTransformationAcceptedEvent = + Imagekit::Models::VideoTransformationAcceptedEvent + + VideoTransformationErrorEvent = + Imagekit::Models::VideoTransformationErrorEvent + + VideoTransformationReadyEvent = + Imagekit::Models::VideoTransformationReadyEvent + + WebhookUnsafeUnwrapParams = Imagekit::Models::WebhookUnsafeUnwrapParams + + WebhookUnwrapParams = Imagekit::Models::WebhookUnwrapParams +end diff --git a/rbi/imagekit/models/accounts/origin_create_params.rbi b/rbi/imagekit/models/accounts/origin_create_params.rbi new file mode 100644 index 00000000..f53d55e5 --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_create_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class OriginCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginCreateParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/origin_delete_params.rbi b/rbi/imagekit/models/accounts/origin_delete_params.rbi new file mode 100644 index 00000000..02d3f036 --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_delete_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class OriginDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginDeleteParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/origin_get_params.rbi b/rbi/imagekit/models/accounts/origin_get_params.rbi new file mode 100644 index 00000000..6ffd3f1a --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_get_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class OriginGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginGetParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/origin_list_params.rbi b/rbi/imagekit/models/accounts/origin_list_params.rbi new file mode 100644 index 00000000..8179eab0 --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_list_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class OriginListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginListParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/origin_list_response.rbi b/rbi/imagekit/models/accounts/origin_list_response.rbi new file mode 100644 index 00000000..95287046 --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_list_response.rbi @@ -0,0 +1,15 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + OriginListResponse = + T.let( + Imagekit::Internal::Type::ArrayOf[ + union: Imagekit::Accounts::OriginResponse + ], + Imagekit::Internal::Type::Converter + ) + end + end +end diff --git a/rbi/imagekit/models/accounts/origin_request.rbi b/rbi/imagekit/models/accounts/origin_request.rbi new file mode 100644 index 00000000..3de49704 --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_request.rbi @@ -0,0 +1,775 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + # Schema for origin request resources. + module OriginRequest + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::S3, + Imagekit::Accounts::OriginRequest::S3Compatible, + Imagekit::Accounts::OriginRequest::CloudinaryBackup, + Imagekit::Accounts::OriginRequest::WebFolder, + Imagekit::Accounts::OriginRequest::WebProxy, + Imagekit::Accounts::OriginRequest::Gcs, + Imagekit::Accounts::OriginRequest::AzureBlob, + Imagekit::Accounts::OriginRequest::AkeneoPim + ) + end + + class S3 < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::S3, + Imagekit::Internal::AnyHash + ) + end + + # Access key for the bucket. + sig { returns(String) } + attr_accessor :access_key + + # S3 bucket name. + sig { returns(String) } + attr_accessor :bucket + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + # Secret key for the bucket. + sig { returns(String) } + attr_accessor :secret_key + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + # Path prefix inside the bucket. + sig { returns(T.nilable(String)) } + attr_reader :prefix + + sig { params(prefix: String).void } + attr_writer :prefix + + sig do + params( + access_key: String, + bucket: String, + name: String, + secret_key: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Access key for the bucket. + access_key:, + # S3 bucket name. + bucket:, + # Display name of the origin. + name:, + # Secret key for the bucket. + secret_key:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + # Path prefix inside the bucket. + prefix: nil, + type: :S3 + ) + end + + sig do + override.returns( + { + access_key: String, + bucket: String, + name: String, + secret_key: String, + type: Symbol, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String + } + ) + end + def to_hash + end + end + + class S3Compatible < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::S3Compatible, + Imagekit::Internal::AnyHash + ) + end + + # Access key for the bucket. + sig { returns(String) } + attr_accessor :access_key + + # S3 bucket name. + sig { returns(String) } + attr_accessor :bucket + + # Custom S3-compatible endpoint. + sig { returns(String) } + attr_accessor :endpoint + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + # Secret key for the bucket. + sig { returns(String) } + attr_accessor :secret_key + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + # Path prefix inside the bucket. + sig { returns(T.nilable(String)) } + attr_reader :prefix + + sig { params(prefix: String).void } + attr_writer :prefix + + # Use path-style S3 URLs? + sig { returns(T.nilable(T::Boolean)) } + attr_reader :s3_force_path_style + + sig { params(s3_force_path_style: T::Boolean).void } + attr_writer :s3_force_path_style + + sig do + params( + access_key: String, + bucket: String, + endpoint: String, + name: String, + secret_key: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String, + s3_force_path_style: T::Boolean, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Access key for the bucket. + access_key:, + # S3 bucket name. + bucket:, + # Custom S3-compatible endpoint. + endpoint:, + # Display name of the origin. + name:, + # Secret key for the bucket. + secret_key:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + # Path prefix inside the bucket. + prefix: nil, + # Use path-style S3 URLs? + s3_force_path_style: nil, + type: :S3_COMPATIBLE + ) + end + + sig do + override.returns( + { + access_key: String, + bucket: String, + endpoint: String, + name: String, + secret_key: String, + type: Symbol, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String, + s3_force_path_style: T::Boolean + } + ) + end + def to_hash + end + end + + class CloudinaryBackup < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::CloudinaryBackup, + Imagekit::Internal::AnyHash + ) + end + + # Access key for the bucket. + sig { returns(String) } + attr_accessor :access_key + + # S3 bucket name. + sig { returns(String) } + attr_accessor :bucket + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + # Secret key for the bucket. + sig { returns(String) } + attr_accessor :secret_key + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + # Path prefix inside the bucket. + sig { returns(T.nilable(String)) } + attr_reader :prefix + + sig { params(prefix: String).void } + attr_writer :prefix + + sig do + params( + access_key: String, + bucket: String, + name: String, + secret_key: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Access key for the bucket. + access_key:, + # S3 bucket name. + bucket:, + # Display name of the origin. + name:, + # Secret key for the bucket. + secret_key:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + # Path prefix inside the bucket. + prefix: nil, + type: :CLOUDINARY_BACKUP + ) + end + + sig do + override.returns( + { + access_key: String, + bucket: String, + name: String, + secret_key: String, + type: Symbol, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String + } + ) + end + def to_hash + end + end + + class WebFolder < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::WebFolder, + Imagekit::Internal::AnyHash + ) + end + + # Root URL for the web folder origin. + sig { returns(String) } + attr_accessor :base_url + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Forward the Host header to origin? + sig { returns(T.nilable(T::Boolean)) } + attr_reader :forward_host_header_to_origin + + sig { params(forward_host_header_to_origin: T::Boolean).void } + attr_writer :forward_host_header_to_origin + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + sig do + params( + base_url: String, + name: String, + base_url_for_canonical_header: String, + forward_host_header_to_origin: T::Boolean, + include_canonical_header: T::Boolean, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Root URL for the web folder origin. + base_url:, + # Display name of the origin. + name:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Forward the Host header to origin? + forward_host_header_to_origin: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + type: :WEB_FOLDER + ) + end + + sig do + override.returns( + { + base_url: String, + name: String, + type: Symbol, + base_url_for_canonical_header: String, + forward_host_header_to_origin: T::Boolean, + include_canonical_header: T::Boolean + } + ) + end + def to_hash + end + end + + class WebProxy < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::WebProxy, + Imagekit::Internal::AnyHash + ) + end + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + sig do + params( + name: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Display name of the origin. + name:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + type: :WEB_PROXY + ) + end + + sig do + override.returns( + { + name: String, + type: Symbol, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean + } + ) + end + def to_hash + end + end + + class Gcs < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::Gcs, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :bucket + + sig { returns(String) } + attr_accessor :client_email + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(String) } + attr_accessor :private_key + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + sig { returns(T.nilable(String)) } + attr_reader :prefix + + sig { params(prefix: String).void } + attr_writer :prefix + + sig do + params( + bucket: String, + client_email: String, + name: String, + private_key: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + bucket:, + client_email:, + # Display name of the origin. + name:, + private_key:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + prefix: nil, + type: :GCS + ) + end + + sig do + override.returns( + { + bucket: String, + client_email: String, + name: String, + private_key: String, + type: Symbol, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String + } + ) + end + def to_hash + end + end + + class AzureBlob < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::AzureBlob, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :account_name + + sig { returns(String) } + attr_accessor :container + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(String) } + attr_accessor :sas_token + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + sig { returns(T.nilable(String)) } + attr_reader :prefix + + sig { params(prefix: String).void } + attr_writer :prefix + + sig do + params( + account_name: String, + container: String, + name: String, + sas_token: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + account_name:, + container:, + # Display name of the origin. + name:, + sas_token:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + prefix: nil, + type: :AZURE_BLOB + ) + end + + sig do + override.returns( + { + account_name: String, + container: String, + name: String, + sas_token: String, + type: Symbol, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + prefix: String + } + ) + end + def to_hash + end + end + + class AkeneoPim < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginRequest::AkeneoPim, + Imagekit::Internal::AnyHash + ) + end + + # Akeneo instance base URL. + sig { returns(String) } + attr_accessor :base_url + + # Akeneo API client ID. + sig { returns(String) } + attr_accessor :client_id + + # Akeneo API client secret. + sig { returns(String) } + attr_accessor :client_secret + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + # Akeneo API password. + sig { returns(String) } + attr_accessor :password + + sig { returns(Symbol) } + attr_accessor :type + + # Akeneo API username. + sig { returns(String) } + attr_accessor :username + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Whether to send a Canonical header. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_canonical_header + + sig { params(include_canonical_header: T::Boolean).void } + attr_writer :include_canonical_header + + sig do + params( + base_url: String, + client_id: String, + client_secret: String, + name: String, + password: String, + username: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Akeneo instance base URL. + base_url:, + # Akeneo API client ID. + client_id:, + # Akeneo API client secret. + client_secret:, + # Display name of the origin. + name:, + # Akeneo API password. + password:, + # Akeneo API username. + username:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + # Whether to send a Canonical header. + include_canonical_header: nil, + type: :AKENEO_PIM + ) + end + + sig do + override.returns( + { + base_url: String, + client_id: String, + client_secret: String, + name: String, + password: String, + type: Symbol, + username: String, + base_url_for_canonical_header: String, + include_canonical_header: T::Boolean + } + ) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[Imagekit::Accounts::OriginRequest::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/origin_response.rbi b/rbi/imagekit/models/accounts/origin_response.rbi new file mode 100644 index 00000000..be9fc05f --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_response.rbi @@ -0,0 +1,718 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + # Origin object as returned by the API (sensitive fields removed). + module OriginResponse + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::S3, + Imagekit::Accounts::OriginResponse::S3Compatible, + Imagekit::Accounts::OriginResponse::CloudinaryBackup, + Imagekit::Accounts::OriginResponse::WebFolder, + Imagekit::Accounts::OriginResponse::WebProxy, + Imagekit::Accounts::OriginResponse::Gcs, + Imagekit::Accounts::OriginResponse::AzureBlob, + Imagekit::Accounts::OriginResponse::AkeneoPim + ) + end + + class S3 < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::S3, + Imagekit::Internal::AnyHash + ) + end + + # S3 bucket name. + sig { returns(String) } + attr_accessor :bucket + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + # Path prefix inside the bucket. + sig { returns(String) } + attr_accessor :prefix + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + bucket: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + # S3 bucket name. + bucket:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + # Path prefix inside the bucket. + prefix:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :S3 + ) + end + + sig do + override.returns( + { + id: String, + bucket: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + class S3Compatible < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::S3Compatible, + Imagekit::Internal::AnyHash + ) + end + + # S3 bucket name. + sig { returns(String) } + attr_accessor :bucket + + # Custom S3-compatible endpoint. + sig { returns(String) } + attr_accessor :endpoint + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + # Path prefix inside the bucket. + sig { returns(String) } + attr_accessor :prefix + + # Use path-style S3 URLs? + sig { returns(T::Boolean) } + attr_accessor :s3_force_path_style + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + bucket: String, + endpoint: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + s3_force_path_style: T::Boolean, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + # S3 bucket name. + bucket:, + # Custom S3-compatible endpoint. + endpoint:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + # Path prefix inside the bucket. + prefix:, + # Use path-style S3 URLs? + s3_force_path_style:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :S3_COMPATIBLE + ) + end + + sig do + override.returns( + { + id: String, + bucket: String, + endpoint: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + s3_force_path_style: T::Boolean, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + class CloudinaryBackup < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::CloudinaryBackup, + Imagekit::Internal::AnyHash + ) + end + + # S3 bucket name. + sig { returns(String) } + attr_accessor :bucket + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + # Path prefix inside the bucket. + sig { returns(String) } + attr_accessor :prefix + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + bucket: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + # S3 bucket name. + bucket:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + # Path prefix inside the bucket. + prefix:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :CLOUDINARY_BACKUP + ) + end + + sig do + override.returns( + { + id: String, + bucket: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + class WebFolder < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::WebFolder, + Imagekit::Internal::AnyHash + ) + end + + # Root URL for the web folder origin. + sig { returns(String) } + attr_accessor :base_url + + # Forward the Host header to origin? + sig { returns(T::Boolean) } + attr_accessor :forward_host_header_to_origin + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + base_url: String, + forward_host_header_to_origin: T::Boolean, + include_canonical_header: T::Boolean, + name: String, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + # Root URL for the web folder origin. + base_url:, + # Forward the Host header to origin? + forward_host_header_to_origin:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :WEB_FOLDER + ) + end + + sig do + override.returns( + { + id: String, + base_url: String, + forward_host_header_to_origin: T::Boolean, + include_canonical_header: T::Boolean, + name: String, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + class WebProxy < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::WebProxy, + Imagekit::Internal::AnyHash + ) + end + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + include_canonical_header: T::Boolean, + name: String, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :WEB_PROXY + ) + end + + sig do + override.returns( + { + id: String, + include_canonical_header: T::Boolean, + name: String, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + class Gcs < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::Gcs, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :bucket + + sig { returns(String) } + attr_accessor :client_email + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(String) } + attr_accessor :prefix + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + bucket: String, + client_email: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + bucket:, + client_email:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + prefix:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :GCS + ) + end + + sig do + override.returns( + { + id: String, + bucket: String, + client_email: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + class AzureBlob < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::AzureBlob, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :account_name + + sig { returns(String) } + attr_accessor :container + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(String) } + attr_accessor :prefix + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + account_name: String, + container: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + account_name:, + container:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + prefix:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :AZURE_BLOB + ) + end + + sig do + override.returns( + { + id: String, + account_name: String, + container: String, + include_canonical_header: T::Boolean, + name: String, + prefix: String, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + class AkeneoPim < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginResponse::AkeneoPim, + Imagekit::Internal::AnyHash + ) + end + + # Akeneo instance base URL. + sig { returns(String) } + attr_accessor :base_url + + # Whether to send a Canonical header. + sig { returns(T::Boolean) } + attr_accessor :include_canonical_header + + # Display name of the origin. + sig { returns(String) } + attr_accessor :name + + sig { returns(Symbol) } + attr_accessor :type + + # URL used in the Canonical header (if enabled). + sig { returns(T.nilable(String)) } + attr_reader :base_url_for_canonical_header + + sig { params(base_url_for_canonical_header: String).void } + attr_writer :base_url_for_canonical_header + + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + sig { returns(String) } + attr_accessor :id + + sig do + params( + id: String, + base_url: String, + include_canonical_header: T::Boolean, + name: String, + base_url_for_canonical_header: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id:, + # Akeneo instance base URL. + base_url:, + # Whether to send a Canonical header. + include_canonical_header:, + # Display name of the origin. + name:, + # URL used in the Canonical header (if enabled). + base_url_for_canonical_header: nil, + type: :AKENEO_PIM + ) + end + + sig do + override.returns( + { + id: String, + base_url: String, + include_canonical_header: T::Boolean, + name: String, + type: Symbol, + base_url_for_canonical_header: String + } + ) + end + def to_hash + end + end + + sig do + override.returns( + T::Array[Imagekit::Accounts::OriginResponse::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/origin_update_params.rbi b/rbi/imagekit/models/accounts/origin_update_params.rbi new file mode 100644 index 00000000..51783397 --- /dev/null +++ b/rbi/imagekit/models/accounts/origin_update_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class OriginUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::OriginUpdateParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_create_params.rbi b/rbi/imagekit/models/accounts/url_endpoint_create_params.rbi new file mode 100644 index 00000000..002fe2e3 --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_create_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class URLEndpointCreateParams < Imagekit::Models::Accounts::URLEndpointRequest + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointCreateParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_delete_params.rbi b/rbi/imagekit/models/accounts/url_endpoint_delete_params.rbi new file mode 100644 index 00000000..c8952d88 --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_delete_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class URLEndpointDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointDeleteParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_get_params.rbi b/rbi/imagekit/models/accounts/url_endpoint_get_params.rbi new file mode 100644 index 00000000..2d965592 --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_get_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class URLEndpointGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointGetParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_list_params.rbi b/rbi/imagekit/models/accounts/url_endpoint_list_params.rbi new file mode 100644 index 00000000..fbf7b441 --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_list_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class URLEndpointListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointListParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_list_response.rbi b/rbi/imagekit/models/accounts/url_endpoint_list_response.rbi new file mode 100644 index 00000000..d943f0ea --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_list_response.rbi @@ -0,0 +1,15 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + URLEndpointListResponse = + T.let( + Imagekit::Internal::Type::ArrayOf[ + Imagekit::Accounts::URLEndpointResponse + ], + Imagekit::Internal::Type::Converter + ) + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_request.rbi b/rbi/imagekit/models/accounts/url_endpoint_request.rbi new file mode 100644 index 00000000..f36ad090 --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_request.rbi @@ -0,0 +1,218 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class URLEndpointRequest < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointRequest, + Imagekit::Internal::AnyHash + ) + end + + # Description of the URL endpoint. + sig { returns(String) } + attr_accessor :description + + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :origins + + sig { params(origins: T::Array[String]).void } + attr_writer :origins + + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + sig { returns(T.nilable(String)) } + attr_reader :url_prefix + + sig { params(url_prefix: String).void } + attr_writer :url_prefix + + # Configuration for third-party URL rewriting. + sig do + returns( + T.nilable( + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai + ) + ) + ) + end + attr_reader :url_rewriter + + sig do + params( + url_rewriter: + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai::OrHash + ) + ).void + end + attr_writer :url_rewriter + + # Schema for URL endpoint resource. + sig do + params( + description: String, + origins: T::Array[String], + url_prefix: String, + url_rewriter: + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + # Description of the URL endpoint. + description:, + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + origins: nil, + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + url_prefix: nil, + # Configuration for third-party URL rewriting. + url_rewriter: nil + ) + end + + sig do + override.returns( + { + description: String, + origins: T::Array[String], + url_prefix: String, + url_rewriter: + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai + ) + } + ) + end + def to_hash + end + + # Configuration for third-party URL rewriting. + module URLRewriter + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai + ) + end + + class Cloudinary < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(Symbol) } + attr_accessor :type + + # Whether to preserve `/` in the rewritten URL. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :preserve_asset_delivery_types + + sig { params(preserve_asset_delivery_types: T::Boolean).void } + attr_writer :preserve_asset_delivery_types + + sig do + params( + preserve_asset_delivery_types: T::Boolean, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Whether to preserve `/` in the rewritten URL. + preserve_asset_delivery_types: nil, + type: :CLOUDINARY + ) + end + + sig do + override.returns( + { type: Symbol, preserve_asset_delivery_types: T::Boolean } + ) + end + def to_hash + end + end + + class Imgix < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(Symbol) } + attr_accessor :type + + sig { params(type: Symbol).returns(T.attached_class) } + def self.new(type: :IMGIX) + end + + sig { override.returns({ type: Symbol }) } + def to_hash + end + end + + class Akamai < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(Symbol) } + attr_accessor :type + + sig { params(type: Symbol).returns(T.attached_class) } + def self.new(type: :AKAMAI) + end + + sig { override.returns({ type: Symbol }) } + def to_hash + end + end + + sig do + override.returns( + T::Array[ + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Variants + ] + ) + end + def self.variants + end + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_response.rbi b/rbi/imagekit/models/accounts/url_endpoint_response.rbi new file mode 100644 index 00000000..6600ca95 --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_response.rbi @@ -0,0 +1,213 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class URLEndpointResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointResponse, + Imagekit::Internal::AnyHash + ) + end + + # Description of the URL endpoint. + sig { returns(String) } + attr_accessor :description + + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + sig { returns(T::Array[String]) } + attr_accessor :origins + + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + sig { returns(String) } + attr_accessor :url_prefix + + # Configuration for third-party URL rewriting. + sig do + returns( + T.nilable( + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Variants + ) + ) + end + attr_reader :url_rewriter + + sig do + params( + url_rewriter: + T.any( + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Cloudinary::OrHash, + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Imgix::OrHash, + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Akamai::OrHash + ) + ).void + end + attr_writer :url_rewriter + + # Unique identifier for the URL-endpoint. This is generated by ImageKit when you + # create a new URL-endpoint. For the default URL-endpoint, this is always + # `default`. + sig { returns(String) } + attr_accessor :id + + # URL‑endpoint object as returned by the API. + sig do + params( + id: String, + description: String, + origins: T::Array[String], + url_prefix: String, + url_rewriter: + T.any( + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Cloudinary::OrHash, + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Imgix::OrHash, + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Akamai::OrHash + ) + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the URL-endpoint. This is generated by ImageKit when you + # create a new URL-endpoint. For the default URL-endpoint, this is always + # `default`. + id:, + # Description of the URL endpoint. + description:, + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + origins:, + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + url_prefix:, + # Configuration for third-party URL rewriting. + url_rewriter: nil + ) + end + + sig do + override.returns( + { + id: String, + description: String, + origins: T::Array[String], + url_prefix: String, + url_rewriter: + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Variants + } + ) + end + def to_hash + end + + # Configuration for third-party URL rewriting. + module URLRewriter + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Cloudinary, + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Imgix, + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Akamai + ) + end + + class Cloudinary < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Cloudinary, + Imagekit::Internal::AnyHash + ) + end + + # Whether to preserve `/` in the rewritten URL. + sig { returns(T::Boolean) } + attr_accessor :preserve_asset_delivery_types + + sig { returns(Symbol) } + attr_accessor :type + + sig do + params( + preserve_asset_delivery_types: T::Boolean, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Whether to preserve `/` in the rewritten URL. + preserve_asset_delivery_types:, + type: :CLOUDINARY + ) + end + + sig do + override.returns( + { preserve_asset_delivery_types: T::Boolean, type: Symbol } + ) + end + def to_hash + end + end + + class Imgix < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Imgix, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(Symbol) } + attr_accessor :type + + sig { params(type: Symbol).returns(T.attached_class) } + def self.new(type: :IMGIX) + end + + sig { override.returns({ type: Symbol }) } + def to_hash + end + end + + class Akamai < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Akamai, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(Symbol) } + attr_accessor :type + + sig { params(type: Symbol).returns(T.attached_class) } + def self.new(type: :AKAMAI) + end + + sig { override.returns({ type: Symbol }) } + def to_hash + end + end + + sig do + override.returns( + T::Array[ + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Variants + ] + ) + end + def self.variants + end + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/url_endpoint_update_params.rbi b/rbi/imagekit/models/accounts/url_endpoint_update_params.rbi new file mode 100644 index 00000000..91f649a0 --- /dev/null +++ b/rbi/imagekit/models/accounts/url_endpoint_update_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class URLEndpointUpdateParams < Imagekit::Models::Accounts::URLEndpointRequest + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::URLEndpointUpdateParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/usage_get_params.rbi b/rbi/imagekit/models/accounts/usage_get_params.rbi new file mode 100644 index 00000000..271e2759 --- /dev/null +++ b/rbi/imagekit/models/accounts/usage_get_params.rbi @@ -0,0 +1,60 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class UsageGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Accounts::UsageGetParams, + Imagekit::Internal::AnyHash + ) + end + + # Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + sig { returns(Date) } + attr_accessor :end_date + + # Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + sig { returns(Date) } + attr_accessor :start_date + + sig do + params( + end_date: Date, + start_date: Date, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + end_date:, + # Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + start_date:, + request_options: {} + ) + end + + sig do + override.returns( + { + end_date: Date, + start_date: Date, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/accounts/usage_get_response.rbi b/rbi/imagekit/models/accounts/usage_get_response.rbi new file mode 100644 index 00000000..b3af7603 --- /dev/null +++ b/rbi/imagekit/models/accounts/usage_get_response.rbi @@ -0,0 +1,89 @@ +# typed: strong + +module Imagekit + module Models + module Accounts + class UsageGetResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Accounts::UsageGetResponse, + Imagekit::Internal::AnyHash + ) + end + + # Amount of bandwidth used in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :bandwidth_bytes + + sig { params(bandwidth_bytes: Integer).void } + attr_writer :bandwidth_bytes + + # Number of extension units used. + sig { returns(T.nilable(Integer)) } + attr_reader :extension_units_count + + sig { params(extension_units_count: Integer).void } + attr_writer :extension_units_count + + # Storage used by media library in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :media_library_storage_bytes + + sig { params(media_library_storage_bytes: Integer).void } + attr_writer :media_library_storage_bytes + + # Storage used by the original cache in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :original_cache_storage_bytes + + sig { params(original_cache_storage_bytes: Integer).void } + attr_writer :original_cache_storage_bytes + + # Number of video processing units used. + sig { returns(T.nilable(Integer)) } + attr_reader :video_processing_units_count + + sig { params(video_processing_units_count: Integer).void } + attr_writer :video_processing_units_count + + sig do + params( + bandwidth_bytes: Integer, + extension_units_count: Integer, + media_library_storage_bytes: Integer, + original_cache_storage_bytes: Integer, + video_processing_units_count: Integer + ).returns(T.attached_class) + end + def self.new( + # Amount of bandwidth used in bytes. + bandwidth_bytes: nil, + # Number of extension units used. + extension_units_count: nil, + # Storage used by media library in bytes. + media_library_storage_bytes: nil, + # Storage used by the original cache in bytes. + original_cache_storage_bytes: nil, + # Number of video processing units used. + video_processing_units_count: nil + ) + end + + sig do + override.returns( + { + bandwidth_bytes: Integer, + extension_units_count: Integer, + media_library_storage_bytes: Integer, + original_cache_storage_bytes: Integer, + video_processing_units_count: Integer + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/asset_list_params.rbi b/rbi/imagekit/models/asset_list_params.rbi new file mode 100644 index 00000000..6e43d77a --- /dev/null +++ b/rbi/imagekit/models/asset_list_params.rbi @@ -0,0 +1,269 @@ +# typed: strong + +module Imagekit + module Models + class AssetListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::AssetListParams, Imagekit::Internal::AnyHash) + end + + # Filter results by file type. + # + # - `all` — include all file types + # - `image` — include only image files + # - `non-image` — include only non-image files (e.g., JS, CSS, video) + sig { returns(T.nilable(Imagekit::AssetListParams::FileType::OrSymbol)) } + attr_reader :file_type + + sig do + params(file_type: Imagekit::AssetListParams::FileType::OrSymbol).void + end + attr_writer :file_type + + # The maximum number of results to return in response. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # Folder path if you want to limit the search within a specific folder. For + # example, `/sales-banner/` will only search in folder sales-banner. + # + # Note : If your use case involves searching within a folder as well as its + # subfolders, you can use `path` parameter in `searchQuery` with appropriate + # operator. Checkout + # [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) + # for more information. + sig { returns(T.nilable(String)) } + attr_reader :path + + sig { params(path: String).void } + attr_writer :path + + # Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + # + # Note : When the searchQuery parameter is present, the following query parameters + # will have no effect on the result: + # + # 1. `tags` + # 2. `type` + # 3. `name` + # + # [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) + # from examples. + sig { returns(T.nilable(String)) } + attr_reader :search_query + + sig { params(search_query: String).void } + attr_writer :search_query + + # The number of results to skip before returning results. + sig { returns(T.nilable(Integer)) } + attr_reader :skip + + sig { params(skip: Integer).void } + attr_writer :skip + + # Sort the results by one of the supported fields in ascending or descending + # order. + sig { returns(T.nilable(Imagekit::AssetListParams::Sort::OrSymbol)) } + attr_reader :sort + + sig { params(sort: Imagekit::AssetListParams::Sort::OrSymbol).void } + attr_writer :sort + + # Filter results by asset type. + # + # - `file` — returns only files + # - `file-version` — returns specific file versions + # - `folder` — returns only folders + # - `all` — returns both files and folders (excludes `file-version`) + sig { returns(T.nilable(Imagekit::AssetListParams::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: Imagekit::AssetListParams::Type::OrSymbol).void } + attr_writer :type + + sig do + params( + file_type: Imagekit::AssetListParams::FileType::OrSymbol, + limit: Integer, + path: String, + search_query: String, + skip: Integer, + sort: Imagekit::AssetListParams::Sort::OrSymbol, + type: Imagekit::AssetListParams::Type::OrSymbol, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Filter results by file type. + # + # - `all` — include all file types + # - `image` — include only image files + # - `non-image` — include only non-image files (e.g., JS, CSS, video) + file_type: nil, + # The maximum number of results to return in response. + limit: nil, + # Folder path if you want to limit the search within a specific folder. For + # example, `/sales-banner/` will only search in folder sales-banner. + # + # Note : If your use case involves searching within a folder as well as its + # subfolders, you can use `path` parameter in `searchQuery` with appropriate + # operator. Checkout + # [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) + # for more information. + path: nil, + # Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + # + # Note : When the searchQuery parameter is present, the following query parameters + # will have no effect on the result: + # + # 1. `tags` + # 2. `type` + # 3. `name` + # + # [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) + # from examples. + search_query: nil, + # The number of results to skip before returning results. + skip: nil, + # Sort the results by one of the supported fields in ascending or descending + # order. + sort: nil, + # Filter results by asset type. + # + # - `file` — returns only files + # - `file-version` — returns specific file versions + # - `folder` — returns only folders + # - `all` — returns both files and folders (excludes `file-version`) + type: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + file_type: Imagekit::AssetListParams::FileType::OrSymbol, + limit: Integer, + path: String, + search_query: String, + skip: Integer, + sort: Imagekit::AssetListParams::Sort::OrSymbol, + type: Imagekit::AssetListParams::Type::OrSymbol, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + + # Filter results by file type. + # + # - `all` — include all file types + # - `image` — include only image files + # - `non-image` — include only non-image files (e.g., JS, CSS, video) + module FileType + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::AssetListParams::FileType) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ALL = T.let(:all, Imagekit::AssetListParams::FileType::TaggedSymbol) + IMAGE = T.let(:image, Imagekit::AssetListParams::FileType::TaggedSymbol) + NON_IMAGE = + T.let(:"non-image", Imagekit::AssetListParams::FileType::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::AssetListParams::FileType::TaggedSymbol] + ) + end + def self.values + end + end + + # Sort the results by one of the supported fields in ascending or descending + # order. + module Sort + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::AssetListParams::Sort) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ASC_NAME = + T.let(:ASC_NAME, Imagekit::AssetListParams::Sort::TaggedSymbol) + DESC_NAME = + T.let(:DESC_NAME, Imagekit::AssetListParams::Sort::TaggedSymbol) + ASC_CREATED = + T.let(:ASC_CREATED, Imagekit::AssetListParams::Sort::TaggedSymbol) + DESC_CREATED = + T.let(:DESC_CREATED, Imagekit::AssetListParams::Sort::TaggedSymbol) + ASC_UPDATED = + T.let(:ASC_UPDATED, Imagekit::AssetListParams::Sort::TaggedSymbol) + DESC_UPDATED = + T.let(:DESC_UPDATED, Imagekit::AssetListParams::Sort::TaggedSymbol) + ASC_HEIGHT = + T.let(:ASC_HEIGHT, Imagekit::AssetListParams::Sort::TaggedSymbol) + DESC_HEIGHT = + T.let(:DESC_HEIGHT, Imagekit::AssetListParams::Sort::TaggedSymbol) + ASC_WIDTH = + T.let(:ASC_WIDTH, Imagekit::AssetListParams::Sort::TaggedSymbol) + DESC_WIDTH = + T.let(:DESC_WIDTH, Imagekit::AssetListParams::Sort::TaggedSymbol) + ASC_SIZE = + T.let(:ASC_SIZE, Imagekit::AssetListParams::Sort::TaggedSymbol) + DESC_SIZE = + T.let(:DESC_SIZE, Imagekit::AssetListParams::Sort::TaggedSymbol) + ASC_RELEVANCE = + T.let(:ASC_RELEVANCE, Imagekit::AssetListParams::Sort::TaggedSymbol) + DESC_RELEVANCE = + T.let(:DESC_RELEVANCE, Imagekit::AssetListParams::Sort::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::AssetListParams::Sort::TaggedSymbol] + ) + end + def self.values + end + end + + # Filter results by asset type. + # + # - `file` — returns only files + # - `file-version` — returns specific file versions + # - `folder` — returns only folders + # - `all` — returns both files and folders (excludes `file-version`) + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::AssetListParams::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + FILE = T.let(:file, Imagekit::AssetListParams::Type::TaggedSymbol) + FILE_VERSION = + T.let(:"file-version", Imagekit::AssetListParams::Type::TaggedSymbol) + FOLDER = T.let(:folder, Imagekit::AssetListParams::Type::TaggedSymbol) + ALL = T.let(:all, Imagekit::AssetListParams::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::AssetListParams::Type::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/imagekit/models/asset_list_response.rbi b/rbi/imagekit/models/asset_list_response.rbi new file mode 100644 index 00000000..3f9f4f86 --- /dev/null +++ b/rbi/imagekit/models/asset_list_response.rbi @@ -0,0 +1,28 @@ +# typed: strong + +module Imagekit + module Models + # Object containing details of a file or file version. + module AssetListResponseItem + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Imagekit::Folder, Imagekit::File) } + + sig do + override.returns( + T::Array[Imagekit::Models::AssetListResponseItem::Variants] + ) + end + def self.variants + end + end + + AssetListResponse = + T.let( + Imagekit::Internal::Type::ArrayOf[ + union: Imagekit::Models::AssetListResponseItem + ], + Imagekit::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekit/models/base_overlay.rbi b/rbi/imagekit/models/base_overlay.rbi new file mode 100644 index 00000000..fc1a6eea --- /dev/null +++ b/rbi/imagekit/models/base_overlay.rbi @@ -0,0 +1,44 @@ +# typed: strong + +module Imagekit + module Models + class BaseOverlay < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::BaseOverlay, Imagekit::Internal::AnyHash) + end + + sig { returns(T.nilable(Imagekit::OverlayPosition)) } + attr_reader :position + + sig { params(position: Imagekit::OverlayPosition::OrHash).void } + attr_writer :position + + sig { returns(T.nilable(Imagekit::OverlayTiming)) } + attr_reader :timing + + sig { params(timing: Imagekit::OverlayTiming::OrHash).void } + attr_writer :timing + + sig do + params( + position: Imagekit::OverlayPosition::OrHash, + timing: Imagekit::OverlayTiming::OrHash + ).returns(T.attached_class) + end + def self.new(position: nil, timing: nil) + end + + sig do + override.returns( + { + position: Imagekit::OverlayPosition, + timing: Imagekit::OverlayTiming + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/beta/v2/file_upload_params.rbi b/rbi/imagekit/models/beta/v2/file_upload_params.rbi new file mode 100644 index 00000000..d33124a6 --- /dev/null +++ b/rbi/imagekit/models/beta/v2/file_upload_params.rbi @@ -0,0 +1,1134 @@ +# typed: strong + +module Imagekit + module Models + module Beta + module V2 + class FileUploadParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams, + Imagekit::Internal::AnyHash + ) + end + + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + sig { returns(Imagekit::Internal::FileInput) } + attr_accessor :file + + # The name with which the file has to be uploaded. + sig { returns(String) } + attr_accessor :file_name + + # This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses + # it to authenticate and check that the upload request parameters have not been + # tampered with after the token has been generated. Learn how to create the token + # on the page below. This field is only required for authentication when uploading + # a file from the client side. + # + # **Note**: Sending a JWT that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new token. + # + # **⚠️Warning**: JWT must be generated on the server-side because it is generated + # using your account's private API key. This field is required for authentication + # when uploading a file from the client-side. + sig { returns(T.nilable(String)) } + attr_reader :token + + sig { params(token: String).void } + attr_writer :token + + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks). + sig { returns(T.nilable(String)) } + attr_reader :checks + + sig { params(checks: String).void } + attr_writer :checks + + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + sig { returns(T.nilable(String)) } + attr_reader :custom_coordinates + + sig { params(custom_coordinates: String).void } + attr_writer :custom_coordinates + + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + sig do + returns( + T.nilable( + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, + Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension + ) + ] + ) + ) + end + attr_reader :extensions + + sig do + params( + extensions: + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::OrHash, + Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription::OrHash, + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::OrHash + ) + ] + ).void + end + attr_writer :extensions + + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. Using multiple `/` creates a nested + # folder. + sig { returns(T.nilable(String)) } + attr_reader :folder + + sig { params(folder: String).void } + attr_writer :folder + + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_private_file + + sig { params(is_private_file: T::Boolean).void } + attr_writer :is_private_file + + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_published + + sig { params(is_published: T::Boolean).void } + attr_writer :is_published + + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_ai_tags + + sig { params(overwrite_ai_tags: T::Boolean).void } + attr_writer :overwrite_ai_tags + + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_custom_metadata + + sig { params(overwrite_custom_metadata: T::Boolean).void } + attr_writer :overwrite_custom_metadata + + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_file + + sig { params(overwrite_file: T::Boolean).void } + attr_writer :overwrite_file + + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_tags + + sig { params(overwrite_tags: T::Boolean).void } + attr_writer :overwrite_tags + + # Array of response field keys to include in the API response body. + sig do + returns( + T.nilable( + T::Array[ + Imagekit::Beta::V2::FileUploadParams::ResponseField::OrSymbol + ] + ) + ) + end + attr_reader :response_fields + + sig do + params( + response_fields: + T::Array[ + Imagekit::Beta::V2::FileUploadParams::ResponseField::OrSymbol + ] + ).void + end + attr_writer :response_fields + + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + sig do + returns( + T.nilable(Imagekit::Beta::V2::FileUploadParams::Transformation) + ) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::Beta::V2::FileUploadParams::Transformation::OrHash + ).void + end + attr_writer :transformation + + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :use_unique_file_name + + sig { params(use_unique_file_name: T::Boolean).void } + attr_writer :use_unique_file_name + + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + sig { returns(T.nilable(String)) } + attr_reader :webhook_url + + sig { params(webhook_url: String).void } + attr_writer :webhook_url + + sig do + params( + file: Imagekit::Internal::FileInput, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::OrHash, + Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription::OrHash, + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::OrHash + ) + ], + folder: String, + is_private_file: T::Boolean, + is_published: T::Boolean, + overwrite_ai_tags: T::Boolean, + overwrite_custom_metadata: T::Boolean, + overwrite_file: T::Boolean, + overwrite_tags: T::Boolean, + response_fields: + T::Array[ + Imagekit::Beta::V2::FileUploadParams::ResponseField::OrSymbol + ], + tags: T::Array[String], + transformation: + Imagekit::Beta::V2::FileUploadParams::Transformation::OrHash, + use_unique_file_name: T::Boolean, + webhook_url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + file:, + # The name with which the file has to be uploaded. + file_name:, + # This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses + # it to authenticate and check that the upload request parameters have not been + # tampered with after the token has been generated. Learn how to create the token + # on the page below. This field is only required for authentication when uploading + # a file from the client side. + # + # **Note**: Sending a JWT that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new token. + # + # **⚠️Warning**: JWT must be generated on the server-side because it is generated + # using your account's private API key. This field is required for authentication + # when uploading a file from the client-side. + token: nil, + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks). + checks: nil, + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + custom_coordinates: nil, + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. Using multiple `/` creates a nested + # folder. + folder: nil, + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + is_private_file: nil, + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + is_published: nil, + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + overwrite_ai_tags: nil, + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + overwrite_custom_metadata: nil, + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + overwrite_file: nil, + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + overwrite_tags: nil, + # Array of response field keys to include in the API response body. + response_fields: nil, + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + tags: nil, + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + transformation: nil, + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + use_unique_file_name: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + file: Imagekit::Internal::FileInput, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, + Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension + ) + ], + folder: String, + is_private_file: T::Boolean, + is_published: T::Boolean, + overwrite_ai_tags: T::Boolean, + overwrite_custom_metadata: T::Boolean, + overwrite_file: T::Boolean, + overwrite_tags: T::Boolean, + response_fields: + T::Array[ + Imagekit::Beta::V2::FileUploadParams::ResponseField::OrSymbol + ], + tags: T::Array[String], + transformation: + Imagekit::Beta::V2::FileUploadParams::Transformation, + use_unique_file_name: T::Boolean, + webhook_url: String, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + + module Extension + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, + Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension + ) + end + + class RemoveBg < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the background removal extension. + sig { returns(Symbol) } + attr_accessor :name + + sig do + returns( + T.nilable( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options + ) + ) + end + attr_reader :options + + sig do + params( + options: + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options::OrHash + ).void + end + attr_writer :options + + sig do + params( + options: + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options::OrHash, + name: Symbol + ).returns(T.attached_class) + end + def self.new( + options: nil, + # Specifies the background removal extension. + name: :"remove-bg" + ) + end + + sig do + override.returns( + { + name: Symbol, + options: + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options + } + ) + end + def to_hash + end + + class Options < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options, + Imagekit::Internal::AnyHash + ) + end + + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :add_shadow + + sig { params(add_shadow: T::Boolean).void } + attr_writer :add_shadow + + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_color + + sig { params(bg_color: String).void } + attr_writer :bg_color + + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_image_url + + sig { params(bg_image_url: String).void } + attr_writer :bg_image_url + + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :semitransparency + + sig { params(semitransparency: T::Boolean).void } + attr_writer :semitransparency + + sig do + params( + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + add_shadow: nil, + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + bg_color: nil, + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + bg_image_url: nil, + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + semitransparency: nil + ) + end + + sig do + override.returns( + { + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + } + ) + end + def to_hash + end + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension, + Imagekit::Internal::AnyHash + ) + end + + # Maximum number of tags to attach to the asset. + sig { returns(Integer) } + attr_accessor :max_tags + + # Minimum confidence level for tags to be considered valid. + sig { returns(Integer) } + attr_accessor :min_confidence + + # Specifies the auto-tagging extension used. + sig do + returns( + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol + ) + end + attr_accessor :name + + sig do + params( + max_tags: Integer, + min_confidence: Integer, + name: + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Maximum number of tags to attach to the asset. + max_tags:, + # Minimum confidence level for tags to be considered valid. + min_confidence:, + # Specifies the auto-tagging extension used. + name: + ) + end + + sig do + override.returns( + { + max_tags: Integer, + min_confidence: Integer, + name: + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol + } + ) + end + def to_hash + end + + # Specifies the auto-tagging extension used. + module Name + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GOOGLE_AUTO_TAGGING = + T.let( + :"google-auto-tagging", + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol + ) + AWS_AUTO_TAGGING = + T.let( + :"aws-auto-tagging", + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the auto description extension. + sig { returns(Symbol) } + attr_accessor :name + + sig { params(name: Symbol).returns(T.attached_class) } + def self.new( + # Specifies the auto description extension. + name: :"ai-auto-description" + ) + end + + sig { override.returns({ name: Symbol }) } + def to_hash + end + end + + sig do + override.returns( + T::Array[ + Imagekit::Beta::V2::FileUploadParams::Extension::Variants + ] + ) + end + def self.variants + end + end + + module ResponseField + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Beta::V2::FileUploadParams::ResponseField + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TAGS = + T.let( + :tags, + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ) + CUSTOM_COORDINATES = + T.let( + :customCoordinates, + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ) + IS_PRIVATE_FILE = + T.let( + :isPrivateFile, + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ) + EMBEDDED_METADATA = + T.let( + :embeddedMetadata, + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ) + IS_PUBLISHED = + T.let( + :isPublished, + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ) + CUSTOM_METADATA = + T.let( + :customMetadata, + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ) + METADATA = + T.let( + :metadata, + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Beta::V2::FileUploadParams::ResponseField::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # List of transformations to apply _after_ the file is uploaded. + # Each item must match one of the following types: `transformation`, + # `gif-to-video`, `thumbnail`, `abs`. + sig do + returns( + T.nilable( + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs + ) + ] + ) + ) + end + attr_reader :post + + sig do + params( + post: + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation::OrHash, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo::OrHash, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail::OrHash, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::OrHash + ) + ] + ).void + end + attr_writer :post + + # Transformation string to apply before uploading the file to the Media Library. + # Useful for optimizing files at ingestion. + sig { returns(T.nilable(String)) } + attr_reader :pre + + sig { params(pre: String).void } + attr_writer :pre + + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + sig do + params( + post: + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation::OrHash, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo::OrHash, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail::OrHash, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::OrHash + ) + ], + pre: String + ).returns(T.attached_class) + end + def self.new( + # List of transformations to apply _after_ the file is uploaded. + # Each item must match one of the following types: `transformation`, + # `gif-to-video`, `thumbnail`, `abs`. + post: nil, + # Transformation string to apply before uploading the file to the Media Library. + # Useful for optimizing files at ingestion. + pre: nil + ) + end + + sig do + override.returns( + { + post: + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs + ) + ], + pre: String + } + ) + end + def to_hash + end + + module Post + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs + ) + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # Transformation type. + sig { returns(Symbol) } + attr_accessor :type + + # Transformation string (e.g. `w-200,h-200`). + # Same syntax as ImageKit URL-based transformations. + sig { returns(String) } + attr_accessor :value + + sig do + params(value: String, type: Symbol).returns(T.attached_class) + end + def self.new( + # Transformation string (e.g. `w-200,h-200`). + # Same syntax as ImageKit URL-based transformations. + value:, + # Transformation type. + type: :transformation + ) + end + + sig { override.returns({ type: Symbol, value: String }) } + def to_hash + end + end + + class GifToVideo < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::Internal::AnyHash + ) + end + + # Converts an animated GIF into an MP4. + sig { returns(Symbol) } + attr_accessor :type + + # Optional transformation string to apply to the output video. + # **Example**: `q-80` + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig do + params(value: String, type: Symbol).returns(T.attached_class) + end + def self.new( + # Optional transformation string to apply to the output video. + # **Example**: `q-80` + value: nil, + # Converts an animated GIF into an MP4. + type: :"gif-to-video" + ) + end + + sig { override.returns({ type: Symbol, value: String }) } + def to_hash + end + end + + class Thumbnail < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::Internal::AnyHash + ) + end + + # Generates a thumbnail image. + sig { returns(Symbol) } + attr_accessor :type + + # Optional transformation string. + # **Example**: `w-150,h-150` + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig do + params(value: String, type: Symbol).returns(T.attached_class) + end + def self.new( + # Optional transformation string. + # **Example**: `w-150,h-150` + value: nil, + # Generates a thumbnail image. + type: :thumbnail + ) + end + + sig { override.returns({ type: Symbol, value: String }) } + def to_hash + end + end + + class Abs < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs, + Imagekit::Internal::AnyHash + ) + end + + # Streaming protocol to use (`hls` or `dash`). + sig do + returns( + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol::OrSymbol + ) + end + attr_accessor :protocol + + # Adaptive Bitrate Streaming (ABS) setup. + sig { returns(Symbol) } + attr_accessor :type + + # List of different representations you want to create separated by an underscore. + sig { returns(String) } + attr_accessor :value + + sig do + params( + protocol: + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol::OrSymbol, + value: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Streaming protocol to use (`hls` or `dash`). + protocol:, + # List of different representations you want to create separated by an underscore. + value:, + # Adaptive Bitrate Streaming (ABS) setup. + type: :abs + ) + end + + sig do + override.returns( + { + protocol: + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol::OrSymbol, + type: Symbol, + value: String + } + ) + end + def to_hash + end + + # Streaming protocol to use (`hls` or `dash`). + module Protocol + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HLS = + T.let( + :hls, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol::TaggedSymbol + ) + DASH = + T.let( + :dash, + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + sig do + override.returns( + T::Array[ + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Variants + ] + ) + end + def self.variants + end + end + end + end + end + end + end +end diff --git a/rbi/imagekit/models/beta/v2/file_upload_response.rbi b/rbi/imagekit/models/beta/v2/file_upload_response.rbi new file mode 100644 index 00000000..ea3ffd3d --- /dev/null +++ b/rbi/imagekit/models/beta/v2/file_upload_response.rbi @@ -0,0 +1,764 @@ +# typed: strong + +module Imagekit + module Models + module Beta + module V2 + class FileUploadResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Beta::V2::FileUploadResponse, + Imagekit::Internal::AnyHash + ) + end + + # An array of tags assigned to the uploaded file by auto tagging. + sig do + returns( + T.nilable( + T::Array[Imagekit::Models::Beta::V2::FileUploadResponse::AITag] + ) + ) + end + attr_accessor :ai_tags + + # The audio codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :audio_codec + + sig { params(audio_codec: String).void } + attr_writer :audio_codec + + # The bit rate of the video in kbps (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :bit_rate + + sig { params(bit_rate: Integer).void } + attr_writer :bit_rate + + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + sig { returns(T.nilable(String)) } + attr_accessor :custom_coordinates + + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # The duration of the video in seconds (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :duration + + sig { params(duration: Integer).void } + attr_writer :duration + + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :embedded_metadata + + sig { params(embedded_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :embedded_metadata + + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + sig do + returns( + T.nilable( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus + ) + ) + end + attr_reader :extension_status + + sig do + params( + extension_status: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::OrHash + ).void + end + attr_writer :extension_status + + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + sig { returns(T.nilable(String)) } + attr_reader :file_id + + sig { params(file_id: String).void } + attr_writer :file_id + + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + sig { returns(T.nilable(String)) } + attr_reader :file_path + + sig { params(file_path: String).void } + attr_writer :file_path + + # Type of the uploaded file. Possible values are `image`, `non-image`. + sig { returns(T.nilable(String)) } + attr_reader :file_type + + sig { params(file_type: String).void } + attr_writer :file_type + + # Height of the image in pixels (Only for images) + sig { returns(T.nilable(Float)) } + attr_reader :height + + sig { params(height: Float).void } + attr_writer :height + + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_private_file + + sig { params(is_private_file: T::Boolean).void } + attr_writer :is_private_file + + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_published + + sig { params(is_published: T::Boolean).void } + attr_writer :is_published + + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + sig { returns(T.nilable(Imagekit::Metadata)) } + attr_reader :metadata + + sig { params(metadata: Imagekit::Metadata::OrHash).void } + attr_writer :metadata + + # Name of the asset. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Size of the image file in Bytes. + sig { returns(T.nilable(Float)) } + attr_reader :size + + sig { params(size: Float).void } + attr_writer :size + + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :tags + + # In the case of an image, a small thumbnail URL. + sig { returns(T.nilable(String)) } + attr_reader :thumbnail_url + + sig { params(thumbnail_url: String).void } + attr_writer :thumbnail_url + + # A publicly accessible URL of the file. + sig { returns(T.nilable(String)) } + attr_reader :url + + sig { params(url: String).void } + attr_writer :url + + # An object containing the file or file version's `id` (versionId) and `name`. + sig do + returns( + T.nilable( + Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo + ) + ) + end + attr_reader :version_info + + sig do + params( + version_info: + Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo::OrHash + ).void + end + attr_writer :version_info + + # The video codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :video_codec + + sig { params(video_codec: String).void } + attr_writer :video_codec + + # Width of the image in pixels (Only for Images) + sig { returns(T.nilable(Float)) } + attr_reader :width + + sig { params(width: Float).void } + attr_writer :width + + # Object containing details of a successful upload. + sig do + params( + ai_tags: + T.nilable( + T::Array[ + Imagekit::Models::Beta::V2::FileUploadResponse::AITag::OrHash + ] + ), + audio_codec: String, + bit_rate: Integer, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + duration: Integer, + embedded_metadata: T::Hash[Symbol, T.anything], + extension_status: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::OrHash, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + metadata: Imagekit::Metadata::OrHash, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail_url: String, + url: String, + version_info: + Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo::OrHash, + video_codec: String, + width: Float + ).returns(T.attached_class) + end + def self.new( + # An array of tags assigned to the uploaded file by auto tagging. + ai_tags: nil, + # The audio codec used in the video (only for video). + audio_codec: nil, + # The bit rate of the video in kbps (only for video). + bit_rate: nil, + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + custom_coordinates: nil, + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + custom_metadata: nil, + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + description: nil, + # The duration of the video in seconds (only for video). + duration: nil, + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + embedded_metadata: nil, + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + extension_status: nil, + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + file_id: nil, + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + file_path: nil, + # Type of the uploaded file. Possible values are `image`, `non-image`. + file_type: nil, + # Height of the image in pixels (Only for images) + height: nil, + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + is_private_file: nil, + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + is_published: nil, + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + metadata: nil, + # Name of the asset. + name: nil, + # Size of the image file in Bytes. + size: nil, + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + tags: nil, + # In the case of an image, a small thumbnail URL. + thumbnail_url: nil, + # A publicly accessible URL of the file. + url: nil, + # An object containing the file or file version's `id` (versionId) and `name`. + version_info: nil, + # The video codec used in the video (only for video). + video_codec: nil, + # Width of the image in pixels (Only for Images) + width: nil + ) + end + + sig do + override.returns( + { + ai_tags: + T.nilable( + T::Array[ + Imagekit::Models::Beta::V2::FileUploadResponse::AITag + ] + ), + audio_codec: String, + bit_rate: Integer, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + duration: Integer, + embedded_metadata: T::Hash[Symbol, T.anything], + extension_status: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail_url: String, + url: String, + version_info: + Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo, + video_codec: String, + width: Float + } + ) + end + def to_hash + end + + class AITag < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Beta::V2::FileUploadResponse::AITag, + Imagekit::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 < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + ) + end + attr_reader :ai_auto_description + + sig do + params( + ai_auto_description: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::OrSymbol + ).void + end + attr_writer :ai_auto_description + + sig do + returns( + T.nilable( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :aws_auto_tagging + + sig do + params( + aws_auto_tagging: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::OrSymbol + ).void + end + attr_writer :aws_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :google_auto_tagging + + sig do + params( + google_auto_tagging: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::OrSymbol + ).void + end + attr_writer :google_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + ) + end + attr_reader :remove_bg + + sig do + params( + remove_bg: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::OrSymbol + ).void + end + attr_writer :remove_bg + + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + sig do + params( + ai_auto_description: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::OrSymbol, + aws_auto_tagging: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::OrSymbol, + google_auto_tagging: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::OrSymbol, + remove_bg: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::OrSymbol + ).returns(T.attached_class) + end + def self.new( + ai_auto_description: nil, + aws_auto_tagging: nil, + google_auto_tagging: nil, + remove_bg: nil + ) + end + + sig do + override.returns( + { + ai_auto_description: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol, + aws_auto_tagging: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol, + google_auto_tagging: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol, + remove_bg: + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + } + ) + end + def to_hash + end + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ] + ) + end + def self.values + end + end + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class VersionInfo < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo, + Imagekit::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 + end +end diff --git a/rbi/imagekit/models/cache/invalidation_create_params.rbi b/rbi/imagekit/models/cache/invalidation_create_params.rbi new file mode 100644 index 00000000..bafcab6b --- /dev/null +++ b/rbi/imagekit/models/cache/invalidation_create_params.rbi @@ -0,0 +1,45 @@ +# typed: strong + +module Imagekit + module Models + module Cache + class InvalidationCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Cache::InvalidationCreateParams, + Imagekit::Internal::AnyHash + ) + end + + # The full URL of the file to be purged. + sig { returns(String) } + attr_accessor :url + + sig do + params( + url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # The full URL of the file to be purged. + url:, + request_options: {} + ) + end + + sig do + override.returns( + { url: String, request_options: Imagekit::RequestOptions } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/cache/invalidation_create_response.rbi b/rbi/imagekit/models/cache/invalidation_create_response.rbi new file mode 100644 index 00000000..2d6123a7 --- /dev/null +++ b/rbi/imagekit/models/cache/invalidation_create_response.rbi @@ -0,0 +1,37 @@ +# typed: strong + +module Imagekit + module Models + module Cache + class InvalidationCreateResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Cache::InvalidationCreateResponse, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the purge request. This can be used to check the status of + # the purge request. + sig { returns(T.nilable(String)) } + attr_reader :request_id + + sig { params(request_id: String).void } + attr_writer :request_id + + sig { params(request_id: String).returns(T.attached_class) } + def self.new( + # Unique identifier of the purge request. This can be used to check the status of + # the purge request. + request_id: nil + ) + end + + sig { override.returns({ request_id: String }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/cache/invalidation_get_params.rbi b/rbi/imagekit/models/cache/invalidation_get_params.rbi new file mode 100644 index 00000000..07375fb7 --- /dev/null +++ b/rbi/imagekit/models/cache/invalidation_get_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Cache + class InvalidationGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Cache::InvalidationGetParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/cache/invalidation_get_response.rbi b/rbi/imagekit/models/cache/invalidation_get_response.rbi new file mode 100644 index 00000000..c26651ef --- /dev/null +++ b/rbi/imagekit/models/cache/invalidation_get_response.rbi @@ -0,0 +1,93 @@ +# typed: strong + +module Imagekit + module Models + module Cache + class InvalidationGetResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Cache::InvalidationGetResponse, + Imagekit::Internal::AnyHash + ) + end + + # Status of the purge request. + sig do + returns( + T.nilable( + Imagekit::Models::Cache::InvalidationGetResponse::Status::TaggedSymbol + ) + ) + end + attr_reader :status + + sig do + params( + status: + Imagekit::Models::Cache::InvalidationGetResponse::Status::OrSymbol + ).void + end + attr_writer :status + + sig do + params( + status: + Imagekit::Models::Cache::InvalidationGetResponse::Status::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Status of the purge request. + status: nil + ) + end + + sig do + override.returns( + { + status: + Imagekit::Models::Cache::InvalidationGetResponse::Status::TaggedSymbol + } + ) + end + def to_hash + end + + # Status of the purge request. + module Status + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::Cache::InvalidationGetResponse::Status + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PENDING = + T.let( + :Pending, + Imagekit::Models::Cache::InvalidationGetResponse::Status::TaggedSymbol + ) + COMPLETED = + T.let( + :Completed, + Imagekit::Models::Cache::InvalidationGetResponse::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::Cache::InvalidationGetResponse::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end +end diff --git a/rbi/imagekit/models/custom_metadata_field.rbi b/rbi/imagekit/models/custom_metadata_field.rbi new file mode 100644 index 00000000..eb7b8b93 --- /dev/null +++ b/rbi/imagekit/models/custom_metadata_field.rbi @@ -0,0 +1,414 @@ +# typed: strong + +module Imagekit + module Models + class CustomMetadataField < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::CustomMetadataField, Imagekit::Internal::AnyHash) + end + + # Unique identifier for the custom metadata field. Use this to update the field. + sig { returns(String) } + attr_accessor :id + + # Human readable name of the custom metadata field. This name is displayed as form + # field label to the users while setting field value on the asset in the media + # library UI. + sig { returns(String) } + attr_accessor :label + + # API name of the custom metadata field. This becomes the key while setting + # `customMetadata` (key-value object) for an asset using upload or update API. + sig { returns(String) } + attr_accessor :name + + # An object that describes the rules for the custom metadata field value. + sig { returns(Imagekit::CustomMetadataField::Schema) } + attr_reader :schema + + sig { params(schema: Imagekit::CustomMetadataField::Schema::OrHash).void } + attr_writer :schema + + # Object containing details of a custom metadata field. + sig do + params( + id: String, + label: String, + name: String, + schema: Imagekit::CustomMetadataField::Schema::OrHash + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the custom metadata field. Use this to update the field. + id:, + # Human readable name of the custom metadata field. This name is displayed as form + # field label to the users while setting field value on the asset in the media + # library UI. + label:, + # API name of the custom metadata field. This becomes the key while setting + # `customMetadata` (key-value object) for an asset using upload or update API. + name:, + # An object that describes the rules for the custom metadata field value. + schema: + ) + end + + sig do + override.returns( + { + id: String, + label: String, + name: String, + schema: Imagekit::CustomMetadataField::Schema + } + ) + end + def to_hash + end + + class Schema < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::CustomMetadataField::Schema, + Imagekit::Internal::AnyHash + ) + end + + # Type of the custom metadata field. + sig do + returns(Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol) + end + attr_accessor :type + + # The default value for this custom metadata field. Date type of default value + # depends on the field type. + sig do + returns( + T.nilable( + Imagekit::CustomMetadataField::Schema::DefaultValue::Variants + ) + ) + end + attr_reader :default_value + + sig do + params( + default_value: + Imagekit::CustomMetadataField::Schema::DefaultValue::Variants + ).void + end + attr_writer :default_value + + # Specifies if the this 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(Imagekit::CustomMetadataField::Schema::MaxValue::Variants) + ) + end + attr_reader :max_value + + sig do + params( + max_value: Imagekit::CustomMetadataField::Schema::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(Imagekit::CustomMetadataField::Schema::MinValue::Variants) + ) + end + attr_reader :min_value + + sig do + params( + min_value: Imagekit::CustomMetadataField::Schema::MinValue::Variants + ).void + end + attr_writer :min_value + + # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + sig do + returns( + T.nilable( + T::Array[ + Imagekit::CustomMetadataField::Schema::SelectOption::Variants + ] + ) + ) + end + attr_reader :select_options + + sig do + params( + select_options: + T::Array[ + Imagekit::CustomMetadataField::Schema::SelectOption::Variants + ] + ).void + end + attr_writer :select_options + + # An object that describes the rules for the custom metadata field value. + sig do + params( + type: Imagekit::CustomMetadataField::Schema::Type::OrSymbol, + default_value: + Imagekit::CustomMetadataField::Schema::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: + Imagekit::CustomMetadataField::Schema::MaxValue::Variants, + min_length: Float, + min_value: + Imagekit::CustomMetadataField::Schema::MinValue::Variants, + select_options: + T::Array[ + Imagekit::CustomMetadataField::Schema::SelectOption::Variants + ] + ).returns(T.attached_class) + end + def self.new( + # Type of the custom metadata field. + type:, + # The default value for this custom metadata field. Date type of default value + # depends on the field type. + default_value: nil, + # Specifies if the this 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, + # An array of allowed values when field type is `SingleSelect` or `MultiSelect`. + select_options: nil + ) + end + + sig do + override.returns( + { + type: Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol, + default_value: + Imagekit::CustomMetadataField::Schema::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: + Imagekit::CustomMetadataField::Schema::MaxValue::Variants, + min_length: Float, + min_value: + Imagekit::CustomMetadataField::Schema::MinValue::Variants, + select_options: + T::Array[ + Imagekit::CustomMetadataField::Schema::SelectOption::Variants + ] + } + ) + end + def to_hash + end + + # Type of the custom metadata field. + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::CustomMetadataField::Schema::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TEXT = + T.let( + :Text, + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ) + TEXTAREA = + T.let( + :Textarea, + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ) + NUMBER = + T.let( + :Number, + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ) + DATE = + T.let( + :Date, + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ) + BOOLEAN = + T.let( + :Boolean, + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ) + SINGLE_SELECT = + T.let( + :SingleSelect, + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ) + MULTI_SELECT = + T.let( + :MultiSelect, + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataField::Schema::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + # The default value for this custom metadata field. Date type of default value + # depends on the field type. + module DefaultValue + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekit::CustomMetadataField::Schema::DefaultValue::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataField::Schema::DefaultValue::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataField::Schema::DefaultValue::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekit::Internal::Type::ArrayOf[ + union: + Imagekit::CustomMetadataField::Schema::DefaultValue::Mixed + ], + Imagekit::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 Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataField::Schema::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 Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataField::Schema::MinValue::Variants + ] + ) + end + def self.variants + end + end + + module SelectOption + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataField::Schema::SelectOption::Variants + ] + ) + end + def self.variants + end + end + end + end + end +end diff --git a/rbi/imagekit/models/custom_metadata_field_create_params.rbi b/rbi/imagekit/models/custom_metadata_field_create_params.rbi new file mode 100644 index 00000000..78abcceb --- /dev/null +++ b/rbi/imagekit/models/custom_metadata_field_create_params.rbi @@ -0,0 +1,443 @@ +# typed: strong + +module Imagekit + module Models + class CustomMetadataFieldCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::CustomMetadataFieldCreateParams, + Imagekit::Internal::AnyHash + ) + end + + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. + sig { returns(String) } + attr_accessor :label + + # API name of the custom metadata field. This should be unique across all + # (including deleted) custom metadata fields. + sig { returns(String) } + attr_accessor :name + + sig { returns(Imagekit::CustomMetadataFieldCreateParams::Schema) } + attr_reader :schema + + sig do + params( + schema: Imagekit::CustomMetadataFieldCreateParams::Schema::OrHash + ).void + end + attr_writer :schema + + sig do + params( + label: String, + name: String, + schema: Imagekit::CustomMetadataFieldCreateParams::Schema::OrHash, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. + label:, + # API name of the custom metadata field. This should be unique across all + # (including deleted) custom metadata fields. + name:, + schema:, + request_options: {} + ) + end + + sig do + override.returns( + { + label: String, + name: String, + schema: Imagekit::CustomMetadataFieldCreateParams::Schema, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + + class Schema < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::CustomMetadataFieldCreateParams::Schema, + Imagekit::Internal::AnyHash + ) + end + + # Type of the custom metadata field. + sig do + returns( + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::OrSymbol + ) + end + attr_accessor :type + + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + sig do + returns( + T.nilable( + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Variants + ) + ) + end + attr_reader :default_value + + sig do + params( + default_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Variants + ).void + end + attr_writer :default_value + + # Sets this custom metadata field as required. Setting custom metadata fields on + # an asset will throw error if the value for all required fields are not present + # in upload or update asset API request body. + 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 this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + sig do + returns( + T.nilable( + Imagekit::CustomMetadataFieldCreateParams::Schema::MaxValue::Variants + ) + ) + end + attr_reader :max_value + + sig do + params( + max_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::MaxValue::Variants + ).void + end + attr_writer :max_value + + # Minimum length of string. Only set this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + sig do + returns( + T.nilable( + Imagekit::CustomMetadataFieldCreateParams::Schema::MinValue::Variants + ) + ) + end + attr_reader :min_value + + sig do + params( + min_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::MinValue::Variants + ).void + end + attr_writer :min_value + + # An array of allowed values. This property is only required if `type` property is + # set to `SingleSelect` or `MultiSelect`. + sig do + returns( + T.nilable( + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::SelectOption::Variants + ] + ) + ) + end + attr_reader :select_options + + sig do + params( + select_options: + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::SelectOption::Variants + ] + ).void + end + attr_writer :select_options + + sig do + params( + type: + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::OrSymbol, + default_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::MaxValue::Variants, + min_length: Float, + min_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::MinValue::Variants, + select_options: + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::SelectOption::Variants + ] + ).returns(T.attached_class) + end + def self.new( + # Type of the custom metadata field. + type:, + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + default_value: nil, + # Sets this custom metadata field as required. Setting custom metadata fields on + # an asset will throw error if the value for all required fields are not present + # in upload or update asset API request body. + is_value_required: nil, + # Maximum length of string. Only set this property if `type` is set to `Text` or + # `Textarea`. + max_length: nil, + # Maximum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + max_value: nil, + # Minimum length of string. Only set this property if `type` is set to `Text` or + # `Textarea`. + min_length: nil, + # Minimum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + min_value: nil, + # An array of allowed values. This property is only required if `type` property is + # set to `SingleSelect` or `MultiSelect`. + select_options: nil + ) + end + + sig do + override.returns( + { + type: + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::OrSymbol, + default_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::MaxValue::Variants, + min_length: Float, + min_value: + Imagekit::CustomMetadataFieldCreateParams::Schema::MinValue::Variants, + select_options: + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::SelectOption::Variants + ] + } + ) + end + def to_hash + end + + # Type of the custom metadata field. + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TEXT = + T.let( + :Text, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ) + TEXTAREA = + T.let( + :Textarea, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ) + NUMBER = + T.let( + :Number, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ) + DATE = + T.let( + :Date, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ) + BOOLEAN = + T.let( + :Boolean, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ) + SINGLE_SELECT = + T.let( + :SingleSelect, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ) + MULTI_SELECT = + T.let( + :MultiSelect, + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + module DefaultValue + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekit::Internal::Type::ArrayOf[ + union: + Imagekit::CustomMetadataFieldCreateParams::Schema::DefaultValue::Mixed + ], + Imagekit::Internal::Type::Converter + ) + end + + # Maximum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + module MaxValue + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::MaxValue::Variants + ] + ) + end + def self.variants + end + end + + # Minimum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + module MinValue + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::MinValue::Variants + ] + ) + end + def self.variants + end + end + + module SelectOption + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldCreateParams::Schema::SelectOption::Variants + ] + ) + end + def self.variants + end + end + end + end + end +end diff --git a/rbi/imagekit/models/custom_metadata_field_delete_params.rbi b/rbi/imagekit/models/custom_metadata_field_delete_params.rbi new file mode 100644 index 00000000..677f0d13 --- /dev/null +++ b/rbi/imagekit/models/custom_metadata_field_delete_params.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Imagekit + module Models + class CustomMetadataFieldDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::CustomMetadataFieldDeleteParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/custom_metadata_field_delete_response.rbi b/rbi/imagekit/models/custom_metadata_field_delete_response.rbi new file mode 100644 index 00000000..1e9c8a3f --- /dev/null +++ b/rbi/imagekit/models/custom_metadata_field_delete_response.rbi @@ -0,0 +1,23 @@ +# typed: strong + +module Imagekit + module Models + class CustomMetadataFieldDeleteResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::CustomMetadataFieldDeleteResponse, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(T.attached_class) } + def self.new + end + + sig { override.returns({}) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/custom_metadata_field_list_params.rbi b/rbi/imagekit/models/custom_metadata_field_list_params.rbi new file mode 100644 index 00000000..db9f7dac --- /dev/null +++ b/rbi/imagekit/models/custom_metadata_field_list_params.rbi @@ -0,0 +1,49 @@ +# typed: strong + +module Imagekit + module Models + class CustomMetadataFieldListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::CustomMetadataFieldListParams, + Imagekit::Internal::AnyHash + ) + end + + # Set it to `true` to include deleted field objects in the API response. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_deleted + + sig { params(include_deleted: T::Boolean).void } + attr_writer :include_deleted + + sig do + params( + include_deleted: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Set it to `true` to include deleted field objects in the API response. + include_deleted: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + include_deleted: T::Boolean, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/custom_metadata_field_list_response.rbi b/rbi/imagekit/models/custom_metadata_field_list_response.rbi new file mode 100644 index 00000000..ca0368f0 --- /dev/null +++ b/rbi/imagekit/models/custom_metadata_field_list_response.rbi @@ -0,0 +1,11 @@ +# typed: strong + +module Imagekit + module Models + CustomMetadataFieldListResponse = + T.let( + Imagekit::Internal::Type::ArrayOf[Imagekit::CustomMetadataField], + Imagekit::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekit/models/custom_metadata_field_update_params.rbi b/rbi/imagekit/models/custom_metadata_field_update_params.rbi new file mode 100644 index 00000000..d94d36f6 --- /dev/null +++ b/rbi/imagekit/models/custom_metadata_field_update_params.rbi @@ -0,0 +1,376 @@ +# typed: strong + +module Imagekit + module Models + class CustomMetadataFieldUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::CustomMetadataFieldUpdateParams, + Imagekit::Internal::AnyHash + ) + end + + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. This parameter is required if `schema` is not provided. + sig { returns(T.nilable(String)) } + attr_reader :label + + sig { params(label: String).void } + attr_writer :label + + # An object that describes the rules for the custom metadata key. This parameter + # is required if `label` is not provided. Note: `type` cannot be updated and will + # be ignored if sent with the `schema`. The schema will be validated as per the + # existing `type`. + sig do + returns(T.nilable(Imagekit::CustomMetadataFieldUpdateParams::Schema)) + end + attr_reader :schema + + sig do + params( + schema: Imagekit::CustomMetadataFieldUpdateParams::Schema::OrHash + ).void + end + attr_writer :schema + + sig do + params( + label: String, + schema: Imagekit::CustomMetadataFieldUpdateParams::Schema::OrHash, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. This parameter is required if `schema` is not provided. + label: nil, + # An object that describes the rules for the custom metadata key. This parameter + # is required if `label` is not provided. Note: `type` cannot be updated and will + # be ignored if sent with the `schema`. The schema will be validated as per the + # existing `type`. + schema: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + label: String, + schema: Imagekit::CustomMetadataFieldUpdateParams::Schema, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + + class Schema < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::CustomMetadataFieldUpdateParams::Schema, + Imagekit::Internal::AnyHash + ) + end + + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + sig do + returns( + T.nilable( + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Variants + ) + ) + end + attr_reader :default_value + + sig do + params( + default_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Variants + ).void + end + attr_writer :default_value + + # Sets this custom metadata field as required. Setting custom metadata fields on + # an asset will throw error if the value for all required fields are not present + # in upload or update asset API request body. + 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 this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + sig do + returns( + T.nilable( + Imagekit::CustomMetadataFieldUpdateParams::Schema::MaxValue::Variants + ) + ) + end + attr_reader :max_value + + sig do + params( + max_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::MaxValue::Variants + ).void + end + attr_writer :max_value + + # Minimum length of string. Only set this property 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 this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + sig do + returns( + T.nilable( + Imagekit::CustomMetadataFieldUpdateParams::Schema::MinValue::Variants + ) + ) + end + attr_reader :min_value + + sig do + params( + min_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::MinValue::Variants + ).void + end + attr_writer :min_value + + # An array of allowed values. This property is only required if `type` property is + # set to `SingleSelect` or `MultiSelect`. + sig do + returns( + T.nilable( + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::SelectOption::Variants + ] + ) + ) + end + attr_reader :select_options + + sig do + params( + select_options: + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::SelectOption::Variants + ] + ).void + end + attr_writer :select_options + + # An object that describes the rules for the custom metadata key. This parameter + # is required if `label` is not provided. Note: `type` cannot be updated and will + # be ignored if sent with the `schema`. The schema will be validated as per the + # existing `type`. + sig do + params( + default_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::MaxValue::Variants, + min_length: Float, + min_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::MinValue::Variants, + select_options: + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::SelectOption::Variants + ] + ).returns(T.attached_class) + end + def self.new( + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + default_value: nil, + # Sets this custom metadata field as required. Setting custom metadata fields on + # an asset will throw error if the value for all required fields are not present + # in upload or update asset API request body. + is_value_required: nil, + # Maximum length of string. Only set this property if `type` is set to `Text` or + # `Textarea`. + max_length: nil, + # Maximum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + max_value: nil, + # Minimum length of string. Only set this property if `type` is set to `Text` or + # `Textarea`. + min_length: nil, + # Minimum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + min_value: nil, + # An array of allowed values. This property is only required if `type` property is + # set to `SingleSelect` or `MultiSelect`. + select_options: nil + ) + end + + sig do + override.returns( + { + default_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Variants, + is_value_required: T::Boolean, + max_length: Float, + max_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::MaxValue::Variants, + min_length: Float, + min_value: + Imagekit::CustomMetadataFieldUpdateParams::Schema::MinValue::Variants, + select_options: + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::SelectOption::Variants + ] + } + ) + end + def to_hash + end + + # The default value for this custom metadata field. This property is only required + # if `isValueRequired` property is set to `true`. The value should match the + # `type` of custom metadata field. + module DefaultValue + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + String, + Float, + T::Boolean, + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Mixed::Variants + ] + ) + end + + module Mixed + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Mixed::Variants + ] + ) + end + def self.variants + end + end + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Variants + ] + ) + end + def self.variants + end + + MixedArray = + T.let( + Imagekit::Internal::Type::ArrayOf[ + union: + Imagekit::CustomMetadataFieldUpdateParams::Schema::DefaultValue::Mixed + ], + Imagekit::Internal::Type::Converter + ) + end + + # Maximum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + module MaxValue + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::MaxValue::Variants + ] + ) + end + def self.variants + end + end + + # Minimum value of the field. Only set this property if field type is `Date` or + # `Number`. For `Date` type field, set the minimum date in ISO8601 string format. + # For `Number` type field, set the minimum numeric value. + module MinValue + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::MinValue::Variants + ] + ) + end + def self.variants + end + end + + module SelectOption + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(String, Float, T::Boolean) } + + sig do + override.returns( + T::Array[ + Imagekit::CustomMetadataFieldUpdateParams::Schema::SelectOption::Variants + ] + ) + end + def self.variants + end + end + end + end + end +end diff --git a/rbi/imagekit/models/file.rbi b/rbi/imagekit/models/file.rbi new file mode 100644 index 00000000..4d68e344 --- /dev/null +++ b/rbi/imagekit/models/file.rbi @@ -0,0 +1,379 @@ +# typed: strong + +module Imagekit + module Models + class File < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Imagekit::File, Imagekit::Internal::AnyHash) } + + # An array of tags assigned to the file by auto tagging. + sig { returns(T.nilable(T::Array[Imagekit::File::AITag])) } + attr_accessor :ai_tags + + # Date and time when the file was uploaded. The date and time is in ISO8601 + # format. + sig { returns(T.nilable(Time)) } + attr_reader :created_at + + sig { params(created_at: Time).void } + attr_writer :created_at + + # An string with custom coordinates of the file. + sig { returns(T.nilable(String)) } + attr_accessor :custom_coordinates + + # An object with custom metadata for the file. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Unique identifier of the asset. + sig { returns(T.nilable(String)) } + attr_reader :file_id + + sig { params(file_id: String).void } + attr_writer :file_id + + # Path of the file. This is the path you would use in the URL to access the file. + # For example, if the file is at the root of the media library, the path will be + # `/file.jpg`. If the file is inside a folder named `images`, the path will be + # `/images/file.jpg`. + sig { returns(T.nilable(String)) } + attr_reader :file_path + + sig { params(file_path: String).void } + attr_writer :file_path + + # Type of the file. Possible values are `image`, `non-image`. + sig { returns(T.nilable(String)) } + attr_reader :file_type + + sig { params(file_type: String).void } + attr_writer :file_type + + # Specifies if the image has an alpha channel. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :has_alpha + + sig { params(has_alpha: T::Boolean).void } + attr_writer :has_alpha + + # Height of the file. + sig { returns(T.nilable(Float)) } + attr_reader :height + + sig { params(height: Float).void } + attr_writer :height + + # Specifies if the file is private or not. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_private_file + + sig { params(is_private_file: T::Boolean).void } + attr_writer :is_private_file + + # Specifies if the file is published or not. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_published + + sig { params(is_published: T::Boolean).void } + attr_writer :is_published + + # MIME type of the file. + sig { returns(T.nilable(String)) } + attr_reader :mime + + sig { params(mime: String).void } + attr_writer :mime + + # Name of the asset. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Size of the file in bytes. + sig { returns(T.nilable(Float)) } + attr_reader :size + + sig { params(size: Float).void } + attr_writer :size + + # An array of tags assigned to the file. Tags are used to search files in the + # media library. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :tags + + # URL of the thumbnail image. This URL is used to access the thumbnail image of + # the file in the media library. + sig { returns(T.nilable(String)) } + attr_reader :thumbnail + + sig { params(thumbnail: String).void } + attr_writer :thumbnail + + # Type of the asset. + sig { returns(T.nilable(Imagekit::File::Type::TaggedSymbol)) } + attr_reader :type + + sig { params(type: Imagekit::File::Type::OrSymbol).void } + attr_writer :type + + # Date and time when the file was last updated. The date and time is in ISO8601 + # format. + sig { returns(T.nilable(Time)) } + attr_reader :updated_at + + sig { params(updated_at: Time).void } + attr_writer :updated_at + + # URL of the file. + sig { returns(T.nilable(String)) } + attr_reader :url + + sig { params(url: String).void } + attr_writer :url + + # An object with details of the file version. + sig { returns(T.nilable(Imagekit::File::VersionInfo)) } + attr_reader :version_info + + sig { params(version_info: Imagekit::File::VersionInfo::OrHash).void } + attr_writer :version_info + + # Width of the file. + sig { returns(T.nilable(Float)) } + attr_reader :width + + sig { params(width: Float).void } + attr_writer :width + + # Object containing details of a file or file version. + sig do + params( + ai_tags: T.nilable(T::Array[Imagekit::File::AITag::OrHash]), + created_at: Time, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + file_id: String, + file_path: String, + file_type: String, + has_alpha: T::Boolean, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + mime: String, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail: String, + type: Imagekit::File::Type::OrSymbol, + updated_at: Time, + url: String, + version_info: Imagekit::File::VersionInfo::OrHash, + width: Float + ).returns(T.attached_class) + end + def self.new( + # An array of tags assigned to the file by auto tagging. + ai_tags: nil, + # Date and time when the file was uploaded. The date and time is in ISO8601 + # format. + created_at: nil, + # An string with custom coordinates of the file. + custom_coordinates: nil, + # An object with custom metadata for the file. + custom_metadata: nil, + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + description: nil, + # Unique identifier of the asset. + file_id: nil, + # Path of the file. This is the path you would use in the URL to access the file. + # For example, if the file is at the root of the media library, the path will be + # `/file.jpg`. If the file is inside a folder named `images`, the path will be + # `/images/file.jpg`. + file_path: nil, + # Type of the file. Possible values are `image`, `non-image`. + file_type: nil, + # Specifies if the image has an alpha channel. + has_alpha: nil, + # Height of the file. + height: nil, + # Specifies if the file is private or not. + is_private_file: nil, + # Specifies if the file is published or not. + is_published: nil, + # MIME type of the file. + mime: nil, + # Name of the asset. + name: nil, + # Size of the file in bytes. + size: nil, + # An array of tags assigned to the file. Tags are used to search files in the + # media library. + tags: nil, + # URL of the thumbnail image. This URL is used to access the thumbnail image of + # the file in the media library. + thumbnail: nil, + # Type of the asset. + type: nil, + # Date and time when the file was last updated. The date and time is in ISO8601 + # format. + updated_at: nil, + # URL of the file. + url: nil, + # An object with details of the file version. + version_info: nil, + # Width of the file. + width: nil + ) + end + + sig do + override.returns( + { + ai_tags: T.nilable(T::Array[Imagekit::File::AITag]), + created_at: Time, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + file_id: String, + file_path: String, + file_type: String, + has_alpha: T::Boolean, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + mime: String, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail: String, + type: Imagekit::File::Type::TaggedSymbol, + updated_at: Time, + url: String, + version_info: Imagekit::File::VersionInfo, + width: Float + } + ) + end + def to_hash + end + + class AITag < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::File::AITag, Imagekit::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 + + # Type of the asset. + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, Imagekit::File::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + FILE = T.let(:file, Imagekit::File::Type::TaggedSymbol) + FILE_VERSION = + T.let(:"file-version", Imagekit::File::Type::TaggedSymbol) + + sig { override.returns(T::Array[Imagekit::File::Type::TaggedSymbol]) } + def self.values + end + end + + class VersionInfo < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::File::VersionInfo, Imagekit::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/imagekit/models/file_copy_params.rbi b/rbi/imagekit/models/file_copy_params.rbi new file mode 100644 index 00000000..61987f96 --- /dev/null +++ b/rbi/imagekit/models/file_copy_params.rbi @@ -0,0 +1,66 @@ +# typed: strong + +module Imagekit + module Models + class FileCopyParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FileCopyParams, Imagekit::Internal::AnyHash) + end + + # Full path to the folder you want to copy the above file into. + sig { returns(String) } + attr_accessor :destination_path + + # The full path of the file you want to copy. + sig { returns(String) } + attr_accessor :source_file_path + + # Option to copy all versions of a file. By default, only the current version of + # the file is copied. When set to true, all versions of the file will be copied. + # Default value - `false`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_file_versions + + sig { params(include_file_versions: T::Boolean).void } + attr_writer :include_file_versions + + sig do + params( + destination_path: String, + source_file_path: String, + include_file_versions: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Full path to the folder you want to copy the above file into. + destination_path:, + # The full path of the file you want to copy. + source_file_path:, + # Option to copy all versions of a file. By default, only the current version of + # the file is copied. When set to true, all versions of the file will be copied. + # Default value - `false`. + include_file_versions: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + destination_path: String, + source_file_path: String, + include_file_versions: T::Boolean, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_copy_response.rbi b/rbi/imagekit/models/file_copy_response.rbi new file mode 100644 index 00000000..74ff699c --- /dev/null +++ b/rbi/imagekit/models/file_copy_response.rbi @@ -0,0 +1,20 @@ +# typed: strong + +module Imagekit + module Models + class FileCopyResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::Models::FileCopyResponse, Imagekit::Internal::AnyHash) + end + + sig { returns(T.attached_class) } + def self.new + end + + sig { override.returns({}) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_delete_params.rbi b/rbi/imagekit/models/file_delete_params.rbi new file mode 100644 index 00000000..9573cf16 --- /dev/null +++ b/rbi/imagekit/models/file_delete_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Imagekit + module Models + class FileDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FileDeleteParams, Imagekit::Internal::AnyHash) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_get_params.rbi b/rbi/imagekit/models/file_get_params.rbi new file mode 100644 index 00000000..f6b5b068 --- /dev/null +++ b/rbi/imagekit/models/file_get_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Imagekit + module Models + class FileGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FileGetParams, Imagekit::Internal::AnyHash) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_move_params.rbi b/rbi/imagekit/models/file_move_params.rbi new file mode 100644 index 00000000..eed54bf2 --- /dev/null +++ b/rbi/imagekit/models/file_move_params.rbi @@ -0,0 +1,51 @@ +# typed: strong + +module Imagekit + module Models + class FileMoveParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FileMoveParams, Imagekit::Internal::AnyHash) + end + + # Full path to the folder you want to move the above file into. + sig { returns(String) } + attr_accessor :destination_path + + # The full path of the file you want to move. + sig { returns(String) } + attr_accessor :source_file_path + + sig do + params( + destination_path: String, + source_file_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Full path to the folder you want to move the above file into. + destination_path:, + # The full path of the file you want to move. + source_file_path:, + request_options: {} + ) + end + + sig do + override.returns( + { + destination_path: String, + source_file_path: String, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_move_response.rbi b/rbi/imagekit/models/file_move_response.rbi new file mode 100644 index 00000000..d59ff9bd --- /dev/null +++ b/rbi/imagekit/models/file_move_response.rbi @@ -0,0 +1,20 @@ +# typed: strong + +module Imagekit + module Models + class FileMoveResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::Models::FileMoveResponse, Imagekit::Internal::AnyHash) + end + + sig { returns(T.attached_class) } + def self.new + end + + sig { override.returns({}) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_rename_params.rbi b/rbi/imagekit/models/file_rename_params.rbi new file mode 100644 index 00000000..a69d0af0 --- /dev/null +++ b/rbi/imagekit/models/file_rename_params.rbi @@ -0,0 +1,102 @@ +# typed: strong + +module Imagekit + module Models + class FileRenameParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FileRenameParams, Imagekit::Internal::AnyHash) + end + + # The full path of the file you want to rename. + sig { returns(String) } + attr_accessor :file_path + + # The new name of the file. A filename can contain: + # + # Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, + # and numerals in other languages). Special Characters: `.`, `_`, and `-`. + # + # Any other character, including space, will be replaced by `_`. + sig { returns(String) } + attr_accessor :new_file_name + + # Option to purge cache for the old file and its versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove cached content of old file and its versions. This purge request is + # counted against your monthly purge quota. + # + # Note: If the old file were accessible at + # `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be + # issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard + # at the end). It will remove the file and its versions' URLs and any + # transformations made using query parameters on this file or its versions. + # However, the cache for file transformations made using path parameters will + # persist. You can purge them using the purge API. For more details, refer to the + # purge API documentation. + # + # Default value - `false` + sig { returns(T.nilable(T::Boolean)) } + attr_reader :purge_cache + + sig { params(purge_cache: T::Boolean).void } + attr_writer :purge_cache + + sig do + params( + file_path: String, + new_file_name: String, + purge_cache: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # The full path of the file you want to rename. + file_path:, + # The new name of the file. A filename can contain: + # + # Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, + # and numerals in other languages). Special Characters: `.`, `_`, and `-`. + # + # Any other character, including space, will be replaced by `_`. + new_file_name:, + # Option to purge cache for the old file and its versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove cached content of old file and its versions. This purge request is + # counted against your monthly purge quota. + # + # Note: If the old file were accessible at + # `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be + # issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard + # at the end). It will remove the file and its versions' URLs and any + # transformations made using query parameters on this file or its versions. + # However, the cache for file transformations made using path parameters will + # persist. You can purge them using the purge API. For more details, refer to the + # purge API documentation. + # + # Default value - `false` + purge_cache: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + file_path: String, + new_file_name: String, + purge_cache: T::Boolean, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_rename_response.rbi b/rbi/imagekit/models/file_rename_response.rbi new file mode 100644 index 00000000..2140d23b --- /dev/null +++ b/rbi/imagekit/models/file_rename_response.rbi @@ -0,0 +1,35 @@ +# typed: strong + +module Imagekit + module Models + class FileRenameResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FileRenameResponse, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the purge request. This can be used to check the status of + # the purge request. + sig { returns(T.nilable(String)) } + attr_reader :purge_request_id + + sig { params(purge_request_id: String).void } + attr_writer :purge_request_id + + sig { params(purge_request_id: String).returns(T.attached_class) } + def self.new( + # Unique identifier of the purge request. This can be used to check the status of + # the purge request. + purge_request_id: nil + ) + end + + sig { override.returns({ purge_request_id: String }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/file_update_params.rbi b/rbi/imagekit/models/file_update_params.rbi new file mode 100644 index 00000000..bbe71faf --- /dev/null +++ b/rbi/imagekit/models/file_update_params.rbi @@ -0,0 +1,656 @@ +# typed: strong + +module Imagekit + module Models + class FileUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FileUpdateParams, Imagekit::Internal::AnyHash) + end + + sig do + returns( + T.nilable( + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails, + Imagekit::FileUpdateParams::Update::ChangePublicationStatus + ) + ) + ) + end + attr_reader :update + + sig do + params( + update: + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::OrHash, + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::OrHash + ) + ).void + end + attr_writer :update + + sig do + params( + update: + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::OrHash, + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(update: nil, request_options: {}) + end + + sig do + override.returns( + { + update: + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails, + Imagekit::FileUpdateParams::Update::ChangePublicationStatus + ), + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + + module Update + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails, + Imagekit::FileUpdateParams::Update::ChangePublicationStatus + ) + end + + class UpdateFileDetails < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails, + Imagekit::Internal::AnyHash + ) + end + + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + sig { returns(T.nilable(String)) } + attr_accessor :custom_coordinates + + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + sig do + returns( + T.nilable( + T::Array[ + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension + ) + ] + ) + ) + end + attr_reader :extensions + + sig do + params( + extensions: + T::Array[ + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::OrHash, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription::OrHash, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::OrHash + ) + ] + ).void + end + attr_writer :extensions + + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + sig { returns(T.nilable(T.any(T::Array[String], Symbol))) } + attr_reader :remove_ai_tags + + sig { params(remove_ai_tags: T.any(T::Array[String], Symbol)).void } + attr_writer :remove_ai_tags + + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :tags + + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + sig { returns(T.nilable(String)) } + attr_reader :webhook_url + + sig { params(webhook_url: String).void } + attr_writer :webhook_url + + sig do + params( + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::OrHash, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription::OrHash, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::OrHash + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String + ).returns(T.attached_class) + end + def self.new( + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + custom_coordinates: nil, + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + remove_ai_tags: nil, + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + tags: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil + ) + end + + sig do + override.returns( + { + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String + } + ) + end + def to_hash + end + + module Extension + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension + ) + end + + class RemoveBg < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the background removal extension. + sig { returns(Symbol) } + attr_accessor :name + + sig do + returns( + T.nilable( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options + ) + ) + end + attr_reader :options + + sig do + params( + options: + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options::OrHash + ).void + end + attr_writer :options + + sig do + params( + options: + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options::OrHash, + name: Symbol + ).returns(T.attached_class) + end + def self.new( + options: nil, + # Specifies the background removal extension. + name: :"remove-bg" + ) + end + + sig do + override.returns( + { + name: Symbol, + options: + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options + } + ) + end + def to_hash + end + + class Options < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options, + Imagekit::Internal::AnyHash + ) + end + + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :add_shadow + + sig { params(add_shadow: T::Boolean).void } + attr_writer :add_shadow + + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_color + + sig { params(bg_color: String).void } + attr_writer :bg_color + + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_image_url + + sig { params(bg_image_url: String).void } + attr_writer :bg_image_url + + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :semitransparency + + sig { params(semitransparency: T::Boolean).void } + attr_writer :semitransparency + + sig do + params( + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + add_shadow: nil, + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + bg_color: nil, + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + bg_image_url: nil, + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + semitransparency: nil + ) + end + + sig do + override.returns( + { + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + } + ) + end + def to_hash + end + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension, + Imagekit::Internal::AnyHash + ) + end + + # Maximum number of tags to attach to the asset. + sig { returns(Integer) } + attr_accessor :max_tags + + # Minimum confidence level for tags to be considered valid. + sig { returns(Integer) } + attr_accessor :min_confidence + + # Specifies the auto-tagging extension used. + sig do + returns( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::OrSymbol + ) + end + attr_accessor :name + + sig do + params( + max_tags: Integer, + min_confidence: Integer, + name: + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Maximum number of tags to attach to the asset. + max_tags:, + # Minimum confidence level for tags to be considered valid. + min_confidence:, + # Specifies the auto-tagging extension used. + name: + ) + end + + sig do + override.returns( + { + max_tags: Integer, + min_confidence: Integer, + name: + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::OrSymbol + } + ) + end + def to_hash + end + + # Specifies the auto-tagging extension used. + module Name + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GOOGLE_AUTO_TAGGING = + T.let( + :"google-auto-tagging", + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::TaggedSymbol + ) + AWS_AUTO_TAGGING = + T.let( + :"aws-auto-tagging", + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the auto description extension. + sig { returns(Symbol) } + attr_accessor :name + + sig { params(name: Symbol).returns(T.attached_class) } + def self.new( + # Specifies the auto description extension. + name: :"ai-auto-description" + ) + end + + sig { override.returns({ name: Symbol }) } + def to_hash + end + end + + sig do + override.returns( + T::Array[ + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::Variants + ] + ) + end + def self.variants + end + end + + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + module RemoveAITags + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Array[String], Symbol) } + + sig do + override.returns( + T::Array[ + Imagekit::FileUpdateParams::Update::UpdateFileDetails::RemoveAITags::Variants + ] + ) + end + def self.variants + end + + StringArray = + T.let( + Imagekit::Internal::Type::ArrayOf[String], + Imagekit::Internal::Type::Converter + ) + end + end + + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::ChangePublicationStatus, + Imagekit::Internal::AnyHash + ) + end + + # Configure the publication status of a file and its versions. + sig do + returns( + T.nilable( + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + ) + ) + end + attr_reader :publish + + sig do + params( + publish: + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish::OrHash + ).void + end + attr_writer :publish + + sig do + params( + publish: + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish::OrHash + ).returns(T.attached_class) + end + def self.new( + # Configure the publication status of a file and its versions. + publish: nil + ) + end + + sig do + override.returns( + { + publish: + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + } + ) + end + def to_hash + end + + class Publish < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish, + Imagekit::Internal::AnyHash + ) + end + + # Set to `true` to publish the file. Set to `false` to unpublish the file. + sig { returns(T::Boolean) } + attr_accessor :is_published + + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_file_versions + + sig { params(include_file_versions: T::Boolean).void } + attr_writer :include_file_versions + + # Configure the publication status of a file and its versions. + sig do + params( + is_published: T::Boolean, + include_file_versions: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Set to `true` to publish the file. Set to `false` to unpublish the file. + is_published:, + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + include_file_versions: nil + ) + end + + sig do + override.returns( + { is_published: T::Boolean, include_file_versions: T::Boolean } + ) + end + def to_hash + end + end + end + + sig do + override.returns( + T::Array[Imagekit::FileUpdateParams::Update::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/file_update_response.rbi b/rbi/imagekit/models/file_update_response.rbi new file mode 100644 index 00000000..92dba923 --- /dev/null +++ b/rbi/imagekit/models/file_update_response.rbi @@ -0,0 +1,322 @@ +# typed: strong + +module Imagekit + module Models + class FileUpdateResponse < Imagekit::Models::File + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FileUpdateResponse, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable(Imagekit::Models::FileUpdateResponse::ExtensionStatus) + ) + end + attr_reader :extension_status + + sig do + params( + extension_status: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::OrHash + ).void + end + attr_writer :extension_status + + # Object containing details of a file or file version. + sig do + params( + extension_status: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::OrHash + ).returns(T.attached_class) + end + def self.new(extension_status: nil) + end + + sig do + override.returns( + { + extension_status: + Imagekit::Models::FileUpdateResponse::ExtensionStatus + } + ) + end + def to_hash + end + + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FileUpdateResponse::ExtensionStatus, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + ) + end + attr_reader :ai_auto_description + + sig do + params( + ai_auto_description: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::OrSymbol + ).void + end + attr_writer :ai_auto_description + + sig do + returns( + T.nilable( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :aws_auto_tagging + + sig do + params( + aws_auto_tagging: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::OrSymbol + ).void + end + attr_writer :aws_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :google_auto_tagging + + sig do + params( + google_auto_tagging: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::OrSymbol + ).void + end + attr_writer :google_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + ) + end + attr_reader :remove_bg + + sig do + params( + remove_bg: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::OrSymbol + ).void + end + attr_writer :remove_bg + + sig do + params( + ai_auto_description: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::OrSymbol, + aws_auto_tagging: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::OrSymbol, + google_auto_tagging: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::OrSymbol, + remove_bg: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::OrSymbol + ).returns(T.attached_class) + end + def self.new( + ai_auto_description: nil, + aws_auto_tagging: nil, + google_auto_tagging: nil, + remove_bg: nil + ) + end + + sig do + override.returns( + { + ai_auto_description: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol, + aws_auto_tagging: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol, + google_auto_tagging: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol, + remove_bg: + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::TaggedSymbol + } + ) + end + def to_hash + end + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ] + ) + end + def self.values + end + end + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUpdateResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUpdateResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUpdateResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end +end diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi new file mode 100644 index 00000000..4d836828 --- /dev/null +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -0,0 +1,1165 @@ +# typed: strong + +module Imagekit + module Models + class FileUploadParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FileUploadParams, Imagekit::Internal::AnyHash) + end + + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + sig { returns(Imagekit::Internal::FileInput) } + attr_accessor :file + + # The name with which the file has to be uploaded. The file name can contain: + # + # - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`. + # - Special Characters: `.`, `-` + # + # Any other character including space will be replaced by `_` + sig { returns(String) } + attr_accessor :file_name + + # A unique value that the ImageKit.io server will use to recognize and prevent + # subsequent retries for the same request. We suggest using V4 UUIDs, or another + # random string with enough entropy to avoid collisions. This field is only + # required for authentication when uploading a file from the client side. + # + # **Note**: Sending a value that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new value for this field. + sig { returns(T.nilable(String)) } + attr_reader :token + + sig { params(token: String).void } + attr_writer :token + + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks). + sig { returns(T.nilable(String)) } + attr_reader :checks + + sig { params(checks: String).void } + attr_writer :checks + + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + sig { returns(T.nilable(String)) } + attr_reader :custom_coordinates + + sig { params(custom_coordinates: String).void } + attr_writer :custom_coordinates + + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # The time until your signature is valid. It must be a + # [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into + # the future. It should be in seconds. This field is only required for + # authentication when uploading a file from the client side. + sig { returns(T.nilable(Integer)) } + attr_reader :expire + + sig { params(expire: Integer).void } + attr_writer :expire + + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + sig do + returns( + T.nilable( + T::Array[ + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg, + Imagekit::FileUploadParams::Extension::AIAutoDescription, + Imagekit::FileUploadParams::Extension::AutoTaggingExtension + ) + ] + ) + ) + end + attr_reader :extensions + + sig do + params( + extensions: + T::Array[ + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg::OrHash, + Imagekit::FileUploadParams::Extension::AIAutoDescription::OrHash, + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::OrHash + ) + ] + ).void + end + attr_writer :extensions + + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. + # + # The folder name can contain: + # + # - Alphanumeric Characters: `a-z` , `A-Z` , `0-9` + # - Special Characters: `/` , `_` , `-` + # + # Using multiple `/` creates a nested folder. + sig { returns(T.nilable(String)) } + attr_reader :folder + + sig { params(folder: String).void } + attr_writer :folder + + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_private_file + + sig { params(is_private_file: T::Boolean).void } + attr_writer :is_private_file + + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_published + + sig { params(is_published: T::Boolean).void } + attr_writer :is_published + + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_ai_tags + + sig { params(overwrite_ai_tags: T::Boolean).void } + attr_writer :overwrite_ai_tags + + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_custom_metadata + + sig { params(overwrite_custom_metadata: T::Boolean).void } + attr_writer :overwrite_custom_metadata + + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_file + + sig { params(overwrite_file: T::Boolean).void } + attr_writer :overwrite_file + + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :overwrite_tags + + sig { params(overwrite_tags: T::Boolean).void } + attr_writer :overwrite_tags + + # Your ImageKit.io public key. This field is only required for authentication when + # uploading a file from the client side. + sig { returns(T.nilable(String)) } + attr_reader :public_key + + sig { params(public_key: String).void } + attr_writer :public_key + + # Array of response field keys to include in the API response body. + sig do + returns( + T.nilable( + T::Array[Imagekit::FileUploadParams::ResponseField::OrSymbol] + ) + ) + end + attr_reader :response_fields + + sig do + params( + response_fields: + T::Array[Imagekit::FileUploadParams::ResponseField::OrSymbol] + ).void + end + attr_writer :response_fields + + # HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + # key. Learn how to create a signature on the page below. This should be in + # lowercase. + # + # Signature must be calculated on the server-side. This field is only required for + # authentication when uploading a file from the client side. + sig { returns(T.nilable(String)) } + attr_reader :signature + + sig { params(signature: String).void } + attr_writer :signature + + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :tags + + sig { params(tags: T::Array[String]).void } + attr_writer :tags + + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + sig { returns(T.nilable(Imagekit::FileUploadParams::Transformation)) } + attr_reader :transformation + + sig do + params( + transformation: Imagekit::FileUploadParams::Transformation::OrHash + ).void + end + attr_writer :transformation + + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :use_unique_file_name + + sig { params(use_unique_file_name: T::Boolean).void } + attr_writer :use_unique_file_name + + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + sig { returns(T.nilable(String)) } + attr_reader :webhook_url + + sig { params(webhook_url: String).void } + attr_writer :webhook_url + + sig do + params( + file: Imagekit::Internal::FileInput, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + expire: Integer, + extensions: + T::Array[ + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg::OrHash, + Imagekit::FileUploadParams::Extension::AIAutoDescription::OrHash, + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::OrHash + ) + ], + folder: String, + is_private_file: T::Boolean, + is_published: T::Boolean, + overwrite_ai_tags: T::Boolean, + overwrite_custom_metadata: T::Boolean, + overwrite_file: T::Boolean, + overwrite_tags: T::Boolean, + public_key: String, + response_fields: + T::Array[Imagekit::FileUploadParams::ResponseField::OrSymbol], + signature: String, + tags: T::Array[String], + transformation: Imagekit::FileUploadParams::Transformation::OrHash, + use_unique_file_name: T::Boolean, + webhook_url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + file:, + # The name with which the file has to be uploaded. The file name can contain: + # + # - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`. + # - Special Characters: `.`, `-` + # + # Any other character including space will be replaced by `_` + file_name:, + # A unique value that the ImageKit.io server will use to recognize and prevent + # subsequent retries for the same request. We suggest using V4 UUIDs, or another + # random string with enough entropy to avoid collisions. This field is only + # required for authentication when uploading a file from the client side. + # + # **Note**: Sending a value that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new value for this field. + token: nil, + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks). + checks: nil, + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + custom_coordinates: nil, + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # The time until your signature is valid. It must be a + # [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into + # the future. It should be in seconds. This field is only required for + # authentication when uploading a file from the client side. + expire: nil, + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. + # + # The folder name can contain: + # + # - Alphanumeric Characters: `a-z` , `A-Z` , `0-9` + # - Special Characters: `/` , `_` , `-` + # + # Using multiple `/` creates a nested folder. + folder: nil, + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + is_private_file: nil, + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + is_published: nil, + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + overwrite_ai_tags: nil, + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + overwrite_custom_metadata: nil, + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + overwrite_file: nil, + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + overwrite_tags: nil, + # Your ImageKit.io public key. This field is only required for authentication when + # uploading a file from the client side. + public_key: nil, + # Array of response field keys to include in the API response body. + response_fields: nil, + # HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + # key. Learn how to create a signature on the page below. This should be in + # lowercase. + # + # Signature must be calculated on the server-side. This field is only required for + # authentication when uploading a file from the client side. + signature: nil, + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + tags: nil, + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + transformation: nil, + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + use_unique_file_name: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + file: Imagekit::Internal::FileInput, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + expire: Integer, + extensions: + T::Array[ + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg, + Imagekit::FileUploadParams::Extension::AIAutoDescription, + Imagekit::FileUploadParams::Extension::AutoTaggingExtension + ) + ], + folder: String, + is_private_file: T::Boolean, + is_published: T::Boolean, + overwrite_ai_tags: T::Boolean, + overwrite_custom_metadata: T::Boolean, + overwrite_file: T::Boolean, + overwrite_tags: T::Boolean, + public_key: String, + response_fields: + T::Array[Imagekit::FileUploadParams::ResponseField::OrSymbol], + signature: String, + tags: T::Array[String], + transformation: Imagekit::FileUploadParams::Transformation, + use_unique_file_name: T::Boolean, + webhook_url: String, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + + module Extension + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg, + Imagekit::FileUploadParams::Extension::AIAutoDescription, + Imagekit::FileUploadParams::Extension::AutoTaggingExtension + ) + end + + class RemoveBg < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the background removal extension. + sig { returns(Symbol) } + attr_accessor :name + + sig do + returns( + T.nilable( + Imagekit::FileUploadParams::Extension::RemoveBg::Options + ) + ) + end + attr_reader :options + + sig do + params( + options: + Imagekit::FileUploadParams::Extension::RemoveBg::Options::OrHash + ).void + end + attr_writer :options + + sig do + params( + options: + Imagekit::FileUploadParams::Extension::RemoveBg::Options::OrHash, + name: Symbol + ).returns(T.attached_class) + end + def self.new( + options: nil, + # Specifies the background removal extension. + name: :"remove-bg" + ) + end + + sig do + override.returns( + { + name: Symbol, + options: + Imagekit::FileUploadParams::Extension::RemoveBg::Options + } + ) + end + def to_hash + end + + class Options < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg::Options, + Imagekit::Internal::AnyHash + ) + end + + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :add_shadow + + sig { params(add_shadow: T::Boolean).void } + attr_writer :add_shadow + + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_color + + sig { params(bg_color: String).void } + attr_writer :bg_color + + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_image_url + + sig { params(bg_image_url: String).void } + attr_writer :bg_image_url + + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :semitransparency + + sig { params(semitransparency: T::Boolean).void } + attr_writer :semitransparency + + sig do + params( + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + add_shadow: nil, + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + bg_color: nil, + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + bg_image_url: nil, + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + semitransparency: nil + ) + end + + sig do + override.returns( + { + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + } + ) + end + def to_hash + end + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Extension::AutoTaggingExtension, + Imagekit::Internal::AnyHash + ) + end + + # Maximum number of tags to attach to the asset. + sig { returns(Integer) } + attr_accessor :max_tags + + # Minimum confidence level for tags to be considered valid. + sig { returns(Integer) } + attr_accessor :min_confidence + + # Specifies the auto-tagging extension used. + sig do + returns( + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol + ) + end + attr_accessor :name + + sig do + params( + max_tags: Integer, + min_confidence: Integer, + name: + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Maximum number of tags to attach to the asset. + max_tags:, + # Minimum confidence level for tags to be considered valid. + min_confidence:, + # Specifies the auto-tagging extension used. + name: + ) + end + + sig do + override.returns( + { + max_tags: Integer, + min_confidence: Integer, + name: + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol + } + ) + end + def to_hash + end + + # Specifies the auto-tagging extension used. + module Name + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GOOGLE_AUTO_TAGGING = + T.let( + :"google-auto-tagging", + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol + ) + AWS_AUTO_TAGGING = + T.let( + :"aws-auto-tagging", + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Extension::AIAutoDescription, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the auto description extension. + sig { returns(Symbol) } + attr_accessor :name + + sig { params(name: Symbol).returns(T.attached_class) } + def self.new( + # Specifies the auto description extension. + name: :"ai-auto-description" + ) + end + + sig { override.returns({ name: Symbol }) } + def to_hash + end + end + + sig do + override.returns( + T::Array[Imagekit::FileUploadParams::Extension::Variants] + ) + end + def self.variants + end + end + + module ResponseField + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::FileUploadParams::ResponseField) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TAGS = + T.let(:tags, Imagekit::FileUploadParams::ResponseField::TaggedSymbol) + CUSTOM_COORDINATES = + T.let( + :customCoordinates, + Imagekit::FileUploadParams::ResponseField::TaggedSymbol + ) + IS_PRIVATE_FILE = + T.let( + :isPrivateFile, + Imagekit::FileUploadParams::ResponseField::TaggedSymbol + ) + EMBEDDED_METADATA = + T.let( + :embeddedMetadata, + Imagekit::FileUploadParams::ResponseField::TaggedSymbol + ) + IS_PUBLISHED = + T.let( + :isPublished, + Imagekit::FileUploadParams::ResponseField::TaggedSymbol + ) + CUSTOM_METADATA = + T.let( + :customMetadata, + Imagekit::FileUploadParams::ResponseField::TaggedSymbol + ) + METADATA = + T.let( + :metadata, + Imagekit::FileUploadParams::ResponseField::TaggedSymbol + ) + + sig do + override.returns( + T::Array[Imagekit::FileUploadParams::ResponseField::TaggedSymbol] + ) + end + def self.values + end + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # List of transformations to apply _after_ the file is uploaded. + # Each item must match one of the following types: `transformation`, + # `gif-to-video`, `thumbnail`, `abs`. + sig do + returns( + T.nilable( + T::Array[ + T.any( + Imagekit::FileUploadParams::Transformation::Post::Transformation, + Imagekit::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::FileUploadParams::Transformation::Post::Abs + ) + ] + ) + ) + end + attr_reader :post + + sig do + params( + post: + T::Array[ + T.any( + Imagekit::FileUploadParams::Transformation::Post::Transformation::OrHash, + Imagekit::FileUploadParams::Transformation::Post::GifToVideo::OrHash, + Imagekit::FileUploadParams::Transformation::Post::Thumbnail::OrHash, + Imagekit::FileUploadParams::Transformation::Post::Abs::OrHash + ) + ] + ).void + end + attr_writer :post + + # Transformation string to apply before uploading the file to the Media Library. + # Useful for optimizing files at ingestion. + sig { returns(T.nilable(String)) } + attr_reader :pre + + sig { params(pre: String).void } + attr_writer :pre + + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + sig do + params( + post: + T::Array[ + T.any( + Imagekit::FileUploadParams::Transformation::Post::Transformation::OrHash, + Imagekit::FileUploadParams::Transformation::Post::GifToVideo::OrHash, + Imagekit::FileUploadParams::Transformation::Post::Thumbnail::OrHash, + Imagekit::FileUploadParams::Transformation::Post::Abs::OrHash + ) + ], + pre: String + ).returns(T.attached_class) + end + def self.new( + # List of transformations to apply _after_ the file is uploaded. + # Each item must match one of the following types: `transformation`, + # `gif-to-video`, `thumbnail`, `abs`. + post: nil, + # Transformation string to apply before uploading the file to the Media Library. + # Useful for optimizing files at ingestion. + pre: nil + ) + end + + sig do + override.returns( + { + post: + T::Array[ + T.any( + Imagekit::FileUploadParams::Transformation::Post::Transformation, + Imagekit::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::FileUploadParams::Transformation::Post::Abs + ) + ], + pre: String + } + ) + end + def to_hash + end + + module Post + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Transformation::Post::Transformation, + Imagekit::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::FileUploadParams::Transformation::Post::Abs + ) + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Transformation::Post::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # Transformation type. + sig { returns(Symbol) } + attr_accessor :type + + # Transformation string (e.g. `w-200,h-200`). + # Same syntax as ImageKit URL-based transformations. + sig { returns(String) } + attr_accessor :value + + sig do + params(value: String, type: Symbol).returns(T.attached_class) + end + def self.new( + # Transformation string (e.g. `w-200,h-200`). + # Same syntax as ImageKit URL-based transformations. + value:, + # Transformation type. + type: :transformation + ) + end + + sig { override.returns({ type: Symbol, value: String }) } + def to_hash + end + end + + class GifToVideo < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Transformation::Post::GifToVideo, + Imagekit::Internal::AnyHash + ) + end + + # Converts an animated GIF into an MP4. + sig { returns(Symbol) } + attr_accessor :type + + # Optional transformation string to apply to the output video. + # **Example**: `q-80` + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig do + params(value: String, type: Symbol).returns(T.attached_class) + end + def self.new( + # Optional transformation string to apply to the output video. + # **Example**: `q-80` + value: nil, + # Converts an animated GIF into an MP4. + type: :"gif-to-video" + ) + end + + sig { override.returns({ type: Symbol, value: String }) } + def to_hash + end + end + + class Thumbnail < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Transformation::Post::Thumbnail, + Imagekit::Internal::AnyHash + ) + end + + # Generates a thumbnail image. + sig { returns(Symbol) } + attr_accessor :type + + # Optional transformation string. + # **Example**: `w-150,h-150` + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig do + params(value: String, type: Symbol).returns(T.attached_class) + end + def self.new( + # Optional transformation string. + # **Example**: `w-150,h-150` + value: nil, + # Generates a thumbnail image. + type: :thumbnail + ) + end + + sig { override.returns({ type: Symbol, value: String }) } + def to_hash + end + end + + class Abs < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUploadParams::Transformation::Post::Abs, + Imagekit::Internal::AnyHash + ) + end + + # Streaming protocol to use (`hls` or `dash`). + sig do + returns( + Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol::OrSymbol + ) + end + attr_accessor :protocol + + # Adaptive Bitrate Streaming (ABS) setup. + sig { returns(Symbol) } + attr_accessor :type + + # List of different representations you want to create separated by an underscore. + sig { returns(String) } + attr_accessor :value + + sig do + params( + protocol: + Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol::OrSymbol, + value: String, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Streaming protocol to use (`hls` or `dash`). + protocol:, + # List of different representations you want to create separated by an underscore. + value:, + # Adaptive Bitrate Streaming (ABS) setup. + type: :abs + ) + end + + sig do + override.returns( + { + protocol: + Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol::OrSymbol, + type: Symbol, + value: String + } + ) + end + def to_hash + end + + # Streaming protocol to use (`hls` or `dash`). + module Protocol + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HLS = + T.let( + :hls, + Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol::TaggedSymbol + ) + DASH = + T.let( + :dash, + Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::FileUploadParams::Transformation::Post::Abs::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + sig do + override.returns( + T::Array[ + Imagekit::FileUploadParams::Transformation::Post::Variants + ] + ) + end + def self.variants + end + end + end + end + end +end diff --git a/rbi/imagekit/models/file_upload_response.rbi b/rbi/imagekit/models/file_upload_response.rbi new file mode 100644 index 00000000..aa46ceb4 --- /dev/null +++ b/rbi/imagekit/models/file_upload_response.rbi @@ -0,0 +1,743 @@ +# typed: strong + +module Imagekit + module Models + class FileUploadResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FileUploadResponse, + Imagekit::Internal::AnyHash + ) + end + + # An array of tags assigned to the uploaded file by auto tagging. + sig do + returns( + T.nilable(T::Array[Imagekit::Models::FileUploadResponse::AITag]) + ) + end + attr_accessor :ai_tags + + # The audio codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :audio_codec + + sig { params(audio_codec: String).void } + attr_writer :audio_codec + + # The bit rate of the video in kbps (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :bit_rate + + sig { params(bit_rate: Integer).void } + attr_writer :bit_rate + + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + sig { returns(T.nilable(String)) } + attr_accessor :custom_coordinates + + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # The duration of the video in seconds (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :duration + + sig { params(duration: Integer).void } + attr_writer :duration + + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :embedded_metadata + + sig { params(embedded_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :embedded_metadata + + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + sig do + returns( + T.nilable(Imagekit::Models::FileUploadResponse::ExtensionStatus) + ) + end + attr_reader :extension_status + + sig do + params( + extension_status: + Imagekit::Models::FileUploadResponse::ExtensionStatus::OrHash + ).void + end + attr_writer :extension_status + + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + sig { returns(T.nilable(String)) } + attr_reader :file_id + + sig { params(file_id: String).void } + attr_writer :file_id + + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + sig { returns(T.nilable(String)) } + attr_reader :file_path + + sig { params(file_path: String).void } + attr_writer :file_path + + # Type of the uploaded file. Possible values are `image`, `non-image`. + sig { returns(T.nilable(String)) } + attr_reader :file_type + + sig { params(file_type: String).void } + attr_writer :file_type + + # Height of the image in pixels (Only for images) + sig { returns(T.nilable(Float)) } + attr_reader :height + + sig { params(height: Float).void } + attr_writer :height + + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_private_file + + sig { params(is_private_file: T::Boolean).void } + attr_writer :is_private_file + + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_published + + sig { params(is_published: T::Boolean).void } + attr_writer :is_published + + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + sig { returns(T.nilable(Imagekit::Metadata)) } + attr_reader :metadata + + sig { params(metadata: Imagekit::Metadata::OrHash).void } + attr_writer :metadata + + # Name of the asset. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Size of the image file in Bytes. + sig { returns(T.nilable(Float)) } + attr_reader :size + + sig { params(size: Float).void } + attr_writer :size + + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :tags + + # In the case of an image, a small thumbnail URL. + sig { returns(T.nilable(String)) } + attr_reader :thumbnail_url + + sig { params(thumbnail_url: String).void } + attr_writer :thumbnail_url + + # A publicly accessible URL of the file. + sig { returns(T.nilable(String)) } + attr_reader :url + + sig { params(url: String).void } + attr_writer :url + + # An object containing the file or file version's `id` (versionId) and `name`. + sig do + returns(T.nilable(Imagekit::Models::FileUploadResponse::VersionInfo)) + end + attr_reader :version_info + + sig do + params( + version_info: + Imagekit::Models::FileUploadResponse::VersionInfo::OrHash + ).void + end + attr_writer :version_info + + # The video codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :video_codec + + sig { params(video_codec: String).void } + attr_writer :video_codec + + # Width of the image in pixels (Only for Images) + sig { returns(T.nilable(Float)) } + attr_reader :width + + sig { params(width: Float).void } + attr_writer :width + + # Object containing details of a successful upload. + sig do + params( + ai_tags: + T.nilable( + T::Array[Imagekit::Models::FileUploadResponse::AITag::OrHash] + ), + audio_codec: String, + bit_rate: Integer, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + duration: Integer, + embedded_metadata: T::Hash[Symbol, T.anything], + extension_status: + Imagekit::Models::FileUploadResponse::ExtensionStatus::OrHash, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + metadata: Imagekit::Metadata::OrHash, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail_url: String, + url: String, + version_info: + Imagekit::Models::FileUploadResponse::VersionInfo::OrHash, + video_codec: String, + width: Float + ).returns(T.attached_class) + end + def self.new( + # An array of tags assigned to the uploaded file by auto tagging. + ai_tags: nil, + # The audio codec used in the video (only for video). + audio_codec: nil, + # The bit rate of the video in kbps (only for video). + bit_rate: nil, + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + custom_coordinates: nil, + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + custom_metadata: nil, + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + description: nil, + # The duration of the video in seconds (only for video). + duration: nil, + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + embedded_metadata: nil, + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + extension_status: nil, + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + file_id: nil, + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + file_path: nil, + # Type of the uploaded file. Possible values are `image`, `non-image`. + file_type: nil, + # Height of the image in pixels (Only for images) + height: nil, + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + is_private_file: nil, + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + is_published: nil, + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + metadata: nil, + # Name of the asset. + name: nil, + # Size of the image file in Bytes. + size: nil, + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + tags: nil, + # In the case of an image, a small thumbnail URL. + thumbnail_url: nil, + # A publicly accessible URL of the file. + url: nil, + # An object containing the file or file version's `id` (versionId) and `name`. + version_info: nil, + # The video codec used in the video (only for video). + video_codec: nil, + # Width of the image in pixels (Only for Images) + width: nil + ) + end + + sig do + override.returns( + { + ai_tags: + T.nilable(T::Array[Imagekit::Models::FileUploadResponse::AITag]), + audio_codec: String, + bit_rate: Integer, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + duration: Integer, + embedded_metadata: T::Hash[Symbol, T.anything], + extension_status: + Imagekit::Models::FileUploadResponse::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail_url: String, + url: String, + version_info: Imagekit::Models::FileUploadResponse::VersionInfo, + video_codec: String, + width: Float + } + ) + end + def to_hash + end + + class AITag < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FileUploadResponse::AITag, + Imagekit::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 < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FileUploadResponse::ExtensionStatus, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + ) + end + attr_reader :ai_auto_description + + sig do + params( + ai_auto_description: + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::OrSymbol + ).void + end + attr_writer :ai_auto_description + + sig do + returns( + T.nilable( + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :aws_auto_tagging + + sig do + params( + aws_auto_tagging: + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::OrSymbol + ).void + end + attr_writer :aws_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :google_auto_tagging + + sig do + params( + google_auto_tagging: + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::OrSymbol + ).void + end + attr_writer :google_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + ) + end + attr_reader :remove_bg + + sig do + params( + remove_bg: + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::OrSymbol + ).void + end + attr_writer :remove_bg + + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + sig do + params( + ai_auto_description: + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::OrSymbol, + aws_auto_tagging: + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::OrSymbol, + google_auto_tagging: + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::OrSymbol, + remove_bg: + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::OrSymbol + ).returns(T.attached_class) + end + def self.new( + ai_auto_description: nil, + aws_auto_tagging: nil, + google_auto_tagging: nil, + remove_bg: nil + ) + end + + sig do + override.returns( + { + ai_auto_description: + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol, + aws_auto_tagging: + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol, + google_auto_tagging: + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol, + remove_bg: + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + } + ) + end + def to_hash + end + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUploadResponse::ExtensionStatus::AIAutoDescription::TaggedSymbol + ] + ) + end + def self.values + end + end + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUploadResponse::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUploadResponse::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::FileUploadResponse::ExtensionStatus::RemoveBg::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class VersionInfo < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FileUploadResponse::VersionInfo, + Imagekit::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/imagekit/models/files/bulk_add_tags_params.rbi b/rbi/imagekit/models/files/bulk_add_tags_params.rbi new file mode 100644 index 00000000..6825f8f1 --- /dev/null +++ b/rbi/imagekit/models/files/bulk_add_tags_params.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkAddTagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::BulkAddTagsParams, + Imagekit::Internal::AnyHash + ) + end + + # An array of fileIds to which you want to add tags. + sig { returns(T::Array[String]) } + attr_accessor :file_ids + + # An array of tags that you want to add to the files. + sig { returns(T::Array[String]) } + attr_accessor :tags + + sig do + params( + file_ids: T::Array[String], + tags: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # An array of fileIds to which you want to add tags. + file_ids:, + # An array of tags that you want to add to the files. + tags:, + request_options: {} + ) + end + + sig do + override.returns( + { + file_ids: T::Array[String], + tags: T::Array[String], + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/bulk_add_tags_response.rbi b/rbi/imagekit/models/files/bulk_add_tags_response.rbi new file mode 100644 index 00000000..a33291a4 --- /dev/null +++ b/rbi/imagekit/models/files/bulk_add_tags_response.rbi @@ -0,0 +1,41 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkAddTagsResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Files::BulkAddTagsResponse, + Imagekit::Internal::AnyHash + ) + end + + # An array of fileIds that in which tags were successfully added. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :successfully_updated_file_ids + + sig { params(successfully_updated_file_ids: T::Array[String]).void } + attr_writer :successfully_updated_file_ids + + sig do + params(successfully_updated_file_ids: T::Array[String]).returns( + T.attached_class + ) + end + def self.new( + # An array of fileIds that in which tags were successfully added. + successfully_updated_file_ids: nil + ) + end + + sig do + override.returns({ successfully_updated_file_ids: T::Array[String] }) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/bulk_delete_params.rbi b/rbi/imagekit/models/files/bulk_delete_params.rbi new file mode 100644 index 00000000..6aa1de5f --- /dev/null +++ b/rbi/imagekit/models/files/bulk_delete_params.rbi @@ -0,0 +1,48 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::BulkDeleteParams, + Imagekit::Internal::AnyHash + ) + end + + # An array of fileIds which you want to delete. + sig { returns(T::Array[String]) } + attr_accessor :file_ids + + sig do + params( + file_ids: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # An array of fileIds which you want to delete. + file_ids:, + request_options: {} + ) + end + + sig do + override.returns( + { + file_ids: T::Array[String], + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/bulk_delete_response.rbi b/rbi/imagekit/models/files/bulk_delete_response.rbi new file mode 100644 index 00000000..28ce486e --- /dev/null +++ b/rbi/imagekit/models/files/bulk_delete_response.rbi @@ -0,0 +1,41 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkDeleteResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Files::BulkDeleteResponse, + Imagekit::Internal::AnyHash + ) + end + + # An array of fileIds that were successfully deleted. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :successfully_deleted_file_ids + + sig { params(successfully_deleted_file_ids: T::Array[String]).void } + attr_writer :successfully_deleted_file_ids + + sig do + params(successfully_deleted_file_ids: T::Array[String]).returns( + T.attached_class + ) + end + def self.new( + # An array of fileIds that were successfully deleted. + successfully_deleted_file_ids: nil + ) + end + + sig do + override.returns({ successfully_deleted_file_ids: T::Array[String] }) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/bulk_remove_ai_tags_params.rbi b/rbi/imagekit/models/files/bulk_remove_ai_tags_params.rbi new file mode 100644 index 00000000..b28187ea --- /dev/null +++ b/rbi/imagekit/models/files/bulk_remove_ai_tags_params.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkRemoveAITagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::BulkRemoveAITagsParams, + Imagekit::Internal::AnyHash + ) + end + + # An array of AITags that you want to remove from the files. + sig { returns(T::Array[String]) } + attr_accessor :ai_tags + + # An array of fileIds from which you want to remove AITags. + sig { returns(T::Array[String]) } + attr_accessor :file_ids + + sig do + params( + ai_tags: T::Array[String], + file_ids: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # An array of AITags that you want to remove from the files. + ai_tags:, + # An array of fileIds from which you want to remove AITags. + file_ids:, + request_options: {} + ) + end + + sig do + override.returns( + { + ai_tags: T::Array[String], + file_ids: T::Array[String], + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/bulk_remove_ai_tags_response.rbi b/rbi/imagekit/models/files/bulk_remove_ai_tags_response.rbi new file mode 100644 index 00000000..404fb021 --- /dev/null +++ b/rbi/imagekit/models/files/bulk_remove_ai_tags_response.rbi @@ -0,0 +1,41 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkRemoveAITagsResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Files::BulkRemoveAITagsResponse, + Imagekit::Internal::AnyHash + ) + end + + # An array of fileIds that in which AITags were successfully removed. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :successfully_updated_file_ids + + sig { params(successfully_updated_file_ids: T::Array[String]).void } + attr_writer :successfully_updated_file_ids + + sig do + params(successfully_updated_file_ids: T::Array[String]).returns( + T.attached_class + ) + end + def self.new( + # An array of fileIds that in which AITags were successfully removed. + successfully_updated_file_ids: nil + ) + end + + sig do + override.returns({ successfully_updated_file_ids: T::Array[String] }) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/bulk_remove_tags_params.rbi b/rbi/imagekit/models/files/bulk_remove_tags_params.rbi new file mode 100644 index 00000000..bbbaeebe --- /dev/null +++ b/rbi/imagekit/models/files/bulk_remove_tags_params.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkRemoveTagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::BulkRemoveTagsParams, + Imagekit::Internal::AnyHash + ) + end + + # An array of fileIds from which you want to remove tags. + sig { returns(T::Array[String]) } + attr_accessor :file_ids + + # An array of tags that you want to remove from the files. + sig { returns(T::Array[String]) } + attr_accessor :tags + + sig do + params( + file_ids: T::Array[String], + tags: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # An array of fileIds from which you want to remove tags. + file_ids:, + # An array of tags that you want to remove from the files. + tags:, + request_options: {} + ) + end + + sig do + override.returns( + { + file_ids: T::Array[String], + tags: T::Array[String], + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/bulk_remove_tags_response.rbi b/rbi/imagekit/models/files/bulk_remove_tags_response.rbi new file mode 100644 index 00000000..68d16d5d --- /dev/null +++ b/rbi/imagekit/models/files/bulk_remove_tags_response.rbi @@ -0,0 +1,41 @@ +# typed: strong + +module Imagekit + module Models + module Files + class BulkRemoveTagsResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Files::BulkRemoveTagsResponse, + Imagekit::Internal::AnyHash + ) + end + + # An array of fileIds that in which tags were successfully removed. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :successfully_updated_file_ids + + sig { params(successfully_updated_file_ids: T::Array[String]).void } + attr_writer :successfully_updated_file_ids + + sig do + params(successfully_updated_file_ids: T::Array[String]).returns( + T.attached_class + ) + end + def self.new( + # An array of fileIds that in which tags were successfully removed. + successfully_updated_file_ids: nil + ) + end + + sig do + override.returns({ successfully_updated_file_ids: T::Array[String] }) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/metadata_get_from_url_params.rbi b/rbi/imagekit/models/files/metadata_get_from_url_params.rbi new file mode 100644 index 00000000..b22de2f1 --- /dev/null +++ b/rbi/imagekit/models/files/metadata_get_from_url_params.rbi @@ -0,0 +1,47 @@ +# typed: strong + +module Imagekit + module Models + module Files + class MetadataGetFromURLParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::MetadataGetFromURLParams, + Imagekit::Internal::AnyHash + ) + end + + # Should be a valid file URL. It should be accessible using your ImageKit.io + # account. + sig { returns(String) } + attr_accessor :url + + sig do + params( + url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Should be a valid file URL. It should be accessible using your ImageKit.io + # account. + url:, + request_options: {} + ) + end + + sig do + override.returns( + { url: String, request_options: Imagekit::RequestOptions } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/metadata_get_params.rbi b/rbi/imagekit/models/files/metadata_get_params.rbi new file mode 100644 index 00000000..af5861ac --- /dev/null +++ b/rbi/imagekit/models/files/metadata_get_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Files + class MetadataGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::MetadataGetParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/version_delete_params.rbi b/rbi/imagekit/models/files/version_delete_params.rbi new file mode 100644 index 00000000..ba925a21 --- /dev/null +++ b/rbi/imagekit/models/files/version_delete_params.rbi @@ -0,0 +1,40 @@ +# typed: strong + +module Imagekit + module Models + module Files + class VersionDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::VersionDeleteParams, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :file_id + + sig do + params( + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(file_id:, request_options: {}) + end + + sig do + override.returns( + { file_id: String, request_options: Imagekit::RequestOptions } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/version_delete_response.rbi b/rbi/imagekit/models/files/version_delete_response.rbi new file mode 100644 index 00000000..6d0f6ab9 --- /dev/null +++ b/rbi/imagekit/models/files/version_delete_response.rbi @@ -0,0 +1,25 @@ +# typed: strong + +module Imagekit + module Models + module Files + class VersionDeleteResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Files::VersionDeleteResponse, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(T.attached_class) } + def self.new + end + + sig { override.returns({}) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/version_get_params.rbi b/rbi/imagekit/models/files/version_get_params.rbi new file mode 100644 index 00000000..107a03d0 --- /dev/null +++ b/rbi/imagekit/models/files/version_get_params.rbi @@ -0,0 +1,40 @@ +# typed: strong + +module Imagekit + module Models + module Files + class VersionGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::VersionGetParams, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :file_id + + sig do + params( + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(file_id:, request_options: {}) + end + + sig do + override.returns( + { file_id: String, request_options: Imagekit::RequestOptions } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/version_list_params.rbi b/rbi/imagekit/models/files/version_list_params.rbi new file mode 100644 index 00000000..496f70bb --- /dev/null +++ b/rbi/imagekit/models/files/version_list_params.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module Imagekit + module Models + module Files + class VersionListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::VersionListParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/files/version_list_response.rbi b/rbi/imagekit/models/files/version_list_response.rbi new file mode 100644 index 00000000..8ac552c7 --- /dev/null +++ b/rbi/imagekit/models/files/version_list_response.rbi @@ -0,0 +1,13 @@ +# typed: strong + +module Imagekit + module Models + module Files + VersionListResponse = + T.let( + Imagekit::Internal::Type::ArrayOf[Imagekit::File], + Imagekit::Internal::Type::Converter + ) + end + end +end diff --git a/rbi/imagekit/models/files/version_restore_params.rbi b/rbi/imagekit/models/files/version_restore_params.rbi new file mode 100644 index 00000000..c4b466fd --- /dev/null +++ b/rbi/imagekit/models/files/version_restore_params.rbi @@ -0,0 +1,40 @@ +# typed: strong + +module Imagekit + module Models + module Files + class VersionRestoreParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::Files::VersionRestoreParams, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :file_id + + sig do + params( + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new(file_id:, request_options: {}) + end + + sig do + override.returns( + { file_id: String, request_options: Imagekit::RequestOptions } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/folder.rbi b/rbi/imagekit/models/folder.rbi new file mode 100644 index 00000000..ae0620c3 --- /dev/null +++ b/rbi/imagekit/models/folder.rbi @@ -0,0 +1,117 @@ +# typed: strong + +module Imagekit + module Models + class Folder < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Imagekit::Folder, Imagekit::Internal::AnyHash) } + + # Date and time when the folder was created. The date and time is in ISO8601 + # format. + sig { returns(T.nilable(Time)) } + attr_reader :created_at + + sig { params(created_at: Time).void } + attr_writer :created_at + + # Unique identifier of the asset. + sig { returns(T.nilable(String)) } + attr_reader :folder_id + + sig { params(folder_id: String).void } + attr_writer :folder_id + + # Path of the folder. This is the path you would use in the URL to access the + # folder. For example, if the folder is at the root of the media library, the path + # will be /folder. If the folder is inside another folder named images, the path + # will be /images/folder. + sig { returns(T.nilable(String)) } + attr_reader :folder_path + + sig { params(folder_path: String).void } + attr_writer :folder_path + + # Name of the asset. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Type of the asset. + sig { returns(T.nilable(Imagekit::Folder::Type::TaggedSymbol)) } + attr_reader :type + + sig { params(type: Imagekit::Folder::Type::OrSymbol).void } + attr_writer :type + + # Date and time when the folder was last updated. The date and time is in ISO8601 + # format. + sig { returns(T.nilable(Time)) } + attr_reader :updated_at + + sig { params(updated_at: Time).void } + attr_writer :updated_at + + sig do + params( + created_at: Time, + folder_id: String, + folder_path: String, + name: String, + type: Imagekit::Folder::Type::OrSymbol, + updated_at: Time + ).returns(T.attached_class) + end + def self.new( + # Date and time when the folder was created. The date and time is in ISO8601 + # format. + created_at: nil, + # Unique identifier of the asset. + folder_id: nil, + # Path of the folder. This is the path you would use in the URL to access the + # folder. For example, if the folder is at the root of the media library, the path + # will be /folder. If the folder is inside another folder named images, the path + # will be /images/folder. + folder_path: nil, + # Name of the asset. + name: nil, + # Type of the asset. + type: nil, + # Date and time when the folder was last updated. The date and time is in ISO8601 + # format. + updated_at: nil + ) + end + + sig do + override.returns( + { + created_at: Time, + folder_id: String, + folder_path: String, + name: String, + type: Imagekit::Folder::Type::TaggedSymbol, + updated_at: Time + } + ) + end + def to_hash + end + + # Type of the asset. + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, Imagekit::Folder::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + FOLDER = T.let(:folder, Imagekit::Folder::Type::TaggedSymbol) + + sig { override.returns(T::Array[Imagekit::Folder::Type::TaggedSymbol]) } + def self.values + end + end + end + end +end diff --git a/rbi/imagekit/models/folder_copy_params.rbi b/rbi/imagekit/models/folder_copy_params.rbi new file mode 100644 index 00000000..b73945bc --- /dev/null +++ b/rbi/imagekit/models/folder_copy_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module Imagekit + module Models + class FolderCopyParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FolderCopyParams, Imagekit::Internal::AnyHash) + end + + # Full path to the destination folder where you want to copy the source folder + # into. + sig { returns(String) } + attr_accessor :destination_path + + # The full path to the source folder you want to copy. + sig { returns(String) } + attr_accessor :source_folder_path + + # Option to copy all versions of files that are nested inside the selected folder. + # By default, only the current version of each file will be copied. When set to + # true, all versions of each file will be copied. Default value - `false`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_versions + + sig { params(include_versions: T::Boolean).void } + attr_writer :include_versions + + sig do + params( + destination_path: String, + source_folder_path: String, + include_versions: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Full path to the destination folder where you want to copy the source folder + # into. + destination_path:, + # The full path to the source folder you want to copy. + source_folder_path:, + # Option to copy all versions of files that are nested inside the selected folder. + # By default, only the current version of each file will be copied. When set to + # true, all versions of each file will be copied. Default value - `false`. + include_versions: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + destination_path: String, + source_folder_path: String, + include_versions: T::Boolean, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_copy_response.rbi b/rbi/imagekit/models/folder_copy_response.rbi new file mode 100644 index 00000000..f294ad91 --- /dev/null +++ b/rbi/imagekit/models/folder_copy_response.rbi @@ -0,0 +1,33 @@ +# typed: strong + +module Imagekit + module Models + class FolderCopyResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FolderCopyResponse, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + sig { returns(String) } + attr_accessor :job_id + + # Job submitted successfully. A `jobId` will be returned. + sig { params(job_id: String).returns(T.attached_class) } + def self.new( + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + job_id: + ) + end + + sig { override.returns({ job_id: String }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_create_params.rbi b/rbi/imagekit/models/folder_create_params.rbi new file mode 100644 index 00000000..c33e9c28 --- /dev/null +++ b/rbi/imagekit/models/folder_create_params.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module Imagekit + module Models + class FolderCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FolderCreateParams, Imagekit::Internal::AnyHash) + end + + # The folder will be created with this name. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) will be replaced by an underscore i.e. + # `_`. + sig { returns(String) } + attr_accessor :folder_name + + # The folder where the new folder should be created, for root use `/` else the + # path e.g. `containing/folder/`. + # + # Note: If any folder(s) is not present in the parentFolderPath parameter, it will + # be automatically created. For example, if you pass `/product/images/summer`, + # then `product`, `images`, and `summer` folders will be created if they don't + # already exist. + sig { returns(String) } + attr_accessor :parent_folder_path + + sig do + params( + folder_name: String, + parent_folder_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # The folder will be created with this name. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) will be replaced by an underscore i.e. + # `_`. + folder_name:, + # The folder where the new folder should be created, for root use `/` else the + # path e.g. `containing/folder/`. + # + # Note: If any folder(s) is not present in the parentFolderPath parameter, it will + # be automatically created. For example, if you pass `/product/images/summer`, + # then `product`, `images`, and `summer` folders will be created if they don't + # already exist. + parent_folder_path:, + request_options: {} + ) + end + + sig do + override.returns( + { + folder_name: String, + parent_folder_path: String, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_create_response.rbi b/rbi/imagekit/models/folder_create_response.rbi new file mode 100644 index 00000000..f3d143f9 --- /dev/null +++ b/rbi/imagekit/models/folder_create_response.rbi @@ -0,0 +1,23 @@ +# typed: strong + +module Imagekit + module Models + class FolderCreateResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FolderCreateResponse, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(T.attached_class) } + def self.new + end + + sig { override.returns({}) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_delete_params.rbi b/rbi/imagekit/models/folder_delete_params.rbi new file mode 100644 index 00000000..09e1c54c --- /dev/null +++ b/rbi/imagekit/models/folder_delete_params.rbi @@ -0,0 +1,40 @@ +# typed: strong + +module Imagekit + module Models + class FolderDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FolderDeleteParams, Imagekit::Internal::AnyHash) + end + + # Full path to the folder you want to delete. For example `/folder/to/delete/`. + sig { returns(String) } + attr_accessor :folder_path + + sig do + params( + folder_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Full path to the folder you want to delete. For example `/folder/to/delete/`. + folder_path:, + request_options: {} + ) + end + + sig do + override.returns( + { folder_path: String, request_options: Imagekit::RequestOptions } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_delete_response.rbi b/rbi/imagekit/models/folder_delete_response.rbi new file mode 100644 index 00000000..74f9d60b --- /dev/null +++ b/rbi/imagekit/models/folder_delete_response.rbi @@ -0,0 +1,23 @@ +# typed: strong + +module Imagekit + module Models + class FolderDeleteResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FolderDeleteResponse, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(T.attached_class) } + def self.new + end + + sig { override.returns({}) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_move_params.rbi b/rbi/imagekit/models/folder_move_params.rbi new file mode 100644 index 00000000..c8bb4036 --- /dev/null +++ b/rbi/imagekit/models/folder_move_params.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module Imagekit + module Models + class FolderMoveParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FolderMoveParams, Imagekit::Internal::AnyHash) + end + + # Full path to the destination folder where you want to move the source folder + # into. + sig { returns(String) } + attr_accessor :destination_path + + # The full path to the source folder you want to move. + sig { returns(String) } + attr_accessor :source_folder_path + + sig do + params( + destination_path: String, + source_folder_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Full path to the destination folder where you want to move the source folder + # into. + destination_path:, + # The full path to the source folder you want to move. + source_folder_path:, + request_options: {} + ) + end + + sig do + override.returns( + { + destination_path: String, + source_folder_path: String, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_move_response.rbi b/rbi/imagekit/models/folder_move_response.rbi new file mode 100644 index 00000000..e19ca456 --- /dev/null +++ b/rbi/imagekit/models/folder_move_response.rbi @@ -0,0 +1,33 @@ +# typed: strong + +module Imagekit + module Models + class FolderMoveResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FolderMoveResponse, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + sig { returns(String) } + attr_accessor :job_id + + # Job submitted successfully. A `jobId` will be returned. + sig { params(job_id: String).returns(T.attached_class) } + def self.new( + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + job_id: + ) + end + + sig { override.returns({ job_id: String }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_rename_params.rbi b/rbi/imagekit/models/folder_rename_params.rbi new file mode 100644 index 00000000..3de0ef79 --- /dev/null +++ b/rbi/imagekit/models/folder_rename_params.rbi @@ -0,0 +1,98 @@ +# typed: strong + +module Imagekit + module Models + class FolderRenameParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::FolderRenameParams, Imagekit::Internal::AnyHash) + end + + # The full path to the folder you want to rename. + sig { returns(String) } + attr_accessor :folder_path + + # The new name for the folder. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) and `-` will be replaced by an + # underscore i.e. `_`. + sig { returns(String) } + attr_accessor :new_folder_name + + # Option to purge cache for the old nested files and their versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove the cached content of the old nested files and their versions. There will + # only be one purge request for all the nested files, which will be counted + # against your monthly purge quota. + # + # Note: A purge cache request will be issued against + # `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This + # will remove all nested files, their versions' URLs, and any transformations made + # using query parameters on these files or their versions. However, the cache for + # file transformations made using path parameters will persist. You can purge them + # using the purge API. For more details, refer to the purge API documentation. + # + # Default value - `false` + sig { returns(T.nilable(T::Boolean)) } + attr_reader :purge_cache + + sig { params(purge_cache: T::Boolean).void } + attr_writer :purge_cache + + sig do + params( + folder_path: String, + new_folder_name: String, + purge_cache: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # The full path to the folder you want to rename. + folder_path:, + # The new name for the folder. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) and `-` will be replaced by an + # underscore i.e. `_`. + new_folder_name:, + # Option to purge cache for the old nested files and their versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove the cached content of the old nested files and their versions. There will + # only be one purge request for all the nested files, which will be counted + # against your monthly purge quota. + # + # Note: A purge cache request will be issued against + # `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This + # will remove all nested files, their versions' URLs, and any transformations made + # using query parameters on these files or their versions. However, the cache for + # file transformations made using path parameters will persist. You can purge them + # using the purge API. For more details, refer to the purge API documentation. + # + # Default value - `false` + purge_cache: nil, + request_options: {} + ) + end + + sig do + override.returns( + { + folder_path: String, + new_folder_name: String, + purge_cache: T::Boolean, + request_options: Imagekit::RequestOptions + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folder_rename_response.rbi b/rbi/imagekit/models/folder_rename_response.rbi new file mode 100644 index 00000000..5fad09f4 --- /dev/null +++ b/rbi/imagekit/models/folder_rename_response.rbi @@ -0,0 +1,33 @@ +# typed: strong + +module Imagekit + module Models + class FolderRenameResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::FolderRenameResponse, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + sig { returns(String) } + attr_accessor :job_id + + # Job submitted successfully. A `jobId` will be returned. + sig { params(job_id: String).returns(T.attached_class) } + def self.new( + # Unique identifier of the bulk job. This can be used to check the status of the + # bulk job. + job_id: + ) + end + + sig { override.returns({ job_id: String }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/folders/job_get_params.rbi b/rbi/imagekit/models/folders/job_get_params.rbi new file mode 100644 index 00000000..5dc84db4 --- /dev/null +++ b/rbi/imagekit/models/folders/job_get_params.rbi @@ -0,0 +1,29 @@ +# typed: strong + +module Imagekit + module Models + module Folders + class JobGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::Folders::JobGetParams, Imagekit::Internal::AnyHash) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/folders/job_get_response.rbi b/rbi/imagekit/models/folders/job_get_response.rbi new file mode 100644 index 00000000..518392e0 --- /dev/null +++ b/rbi/imagekit/models/folders/job_get_response.rbi @@ -0,0 +1,171 @@ +# typed: strong + +module Imagekit + module Models + module Folders + class JobGetResponse < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Models::Folders::JobGetResponse, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the bulk job. + sig { returns(T.nilable(String)) } + attr_reader :job_id + + sig { params(job_id: String).void } + attr_writer :job_id + + # Unique identifier of the purge request. This will be present only if + # `purgeCache` is set to `true` in the rename folder API request. + sig { returns(T.nilable(String)) } + attr_reader :purge_request_id + + sig { params(purge_request_id: String).void } + attr_writer :purge_request_id + + # Status of the bulk job. + sig do + returns( + T.nilable( + Imagekit::Models::Folders::JobGetResponse::Status::TaggedSymbol + ) + ) + end + attr_reader :status + + sig do + params( + status: Imagekit::Models::Folders::JobGetResponse::Status::OrSymbol + ).void + end + attr_writer :status + + # Type of the bulk job. + sig do + returns( + T.nilable( + Imagekit::Models::Folders::JobGetResponse::Type::TaggedSymbol + ) + ) + end + attr_reader :type + + sig do + params( + type: Imagekit::Models::Folders::JobGetResponse::Type::OrSymbol + ).void + end + attr_writer :type + + sig do + params( + job_id: String, + purge_request_id: String, + status: Imagekit::Models::Folders::JobGetResponse::Status::OrSymbol, + type: Imagekit::Models::Folders::JobGetResponse::Type::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier of the bulk job. + job_id: nil, + # Unique identifier of the purge request. This will be present only if + # `purgeCache` is set to `true` in the rename folder API request. + purge_request_id: nil, + # Status of the bulk job. + status: nil, + # Type of the bulk job. + type: nil + ) + end + + sig do + override.returns( + { + job_id: String, + purge_request_id: String, + status: + Imagekit::Models::Folders::JobGetResponse::Status::TaggedSymbol, + type: + Imagekit::Models::Folders::JobGetResponse::Type::TaggedSymbol + } + ) + end + def to_hash + end + + # Status of the bulk job. + module Status + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::Models::Folders::JobGetResponse::Status) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PENDING = + T.let( + :Pending, + Imagekit::Models::Folders::JobGetResponse::Status::TaggedSymbol + ) + COMPLETED = + T.let( + :Completed, + Imagekit::Models::Folders::JobGetResponse::Status::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::Folders::JobGetResponse::Status::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Type of the bulk job. + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::Models::Folders::JobGetResponse::Type) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + COPY_FOLDER = + T.let( + :COPY_FOLDER, + Imagekit::Models::Folders::JobGetResponse::Type::TaggedSymbol + ) + MOVE_FOLDER = + T.let( + :MOVE_FOLDER, + Imagekit::Models::Folders::JobGetResponse::Type::TaggedSymbol + ) + RENAME_FOLDER = + T.let( + :RENAME_FOLDER, + Imagekit::Models::Folders::JobGetResponse::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::Models::Folders::JobGetResponse::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end +end diff --git a/rbi/imagekit/models/image_overlay.rbi b/rbi/imagekit/models/image_overlay.rbi new file mode 100644 index 00000000..409aa105 --- /dev/null +++ b/rbi/imagekit/models/image_overlay.rbi @@ -0,0 +1,106 @@ +# typed: strong + +module Imagekit + module Models + class ImageOverlay < Imagekit::Models::BaseOverlay + OrHash = + T.type_alias do + T.any(Imagekit::ImageOverlay, Imagekit::Internal::AnyHash) + end + + # Specifies the relative path to the image used as an overlay. + sig { returns(String) } + attr_accessor :input + + sig { returns(Symbol) } + attr_accessor :type + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + sig { returns(T.nilable(Imagekit::ImageOverlay::Encoding::OrSymbol)) } + attr_reader :encoding + + sig { params(encoding: Imagekit::ImageOverlay::Encoding::OrSymbol).void } + attr_writer :encoding + + # Array of transformations to be applied to the overlay image. Supported + # transformations depends on the base/parent asset. See overlays on + # [Images](https://imagekit.io/docs/add-overlays-on-images#list-of-supported-image-transformations-in-image-layers) + # and + # [Videos](https://imagekit.io/docs/add-overlays-on-videos#list-of-transformations-supported-on-image-overlay). + sig { returns(T.nilable(T::Array[Imagekit::Transformation])) } + attr_reader :transformation + + sig { params(transformation: T::Array[Imagekit::Transformation]).void } + attr_writer :transformation + + sig do + params( + input: String, + encoding: Imagekit::ImageOverlay::Encoding::OrSymbol, + transformation: T::Array[Imagekit::Transformation], + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Specifies the relative path to the image used as an overlay. + input:, + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + encoding: nil, + # Array of transformations to be applied to the overlay image. Supported + # transformations depends on the base/parent asset. See overlays on + # [Images](https://imagekit.io/docs/add-overlays-on-images#list-of-supported-image-transformations-in-image-layers) + # and + # [Videos](https://imagekit.io/docs/add-overlays-on-videos#list-of-transformations-supported-on-image-overlay). + transformation: nil, + type: :image + ) + end + + sig do + override.returns( + { + input: String, + type: Symbol, + encoding: Imagekit::ImageOverlay::Encoding::OrSymbol, + transformation: T::Array[Imagekit::Transformation] + } + ) + end + def to_hash + end + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::ImageOverlay::Encoding) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, Imagekit::ImageOverlay::Encoding::TaggedSymbol) + PLAIN = T.let(:plain, Imagekit::ImageOverlay::Encoding::TaggedSymbol) + BASE64 = T.let(:base64, Imagekit::ImageOverlay::Encoding::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::ImageOverlay::Encoding::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/imagekit/models/metadata.rbi b/rbi/imagekit/models/metadata.rbi new file mode 100644 index 00000000..53bea104 --- /dev/null +++ b/rbi/imagekit/models/metadata.rbi @@ -0,0 +1,804 @@ +# typed: strong + +module Imagekit + module Models + class Metadata < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias { T.any(Imagekit::Metadata, Imagekit::Internal::AnyHash) } + + # The audio codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :audio_codec + + sig { params(audio_codec: String).void } + attr_writer :audio_codec + + # The bit rate of the video in kbps (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :bit_rate + + sig { params(bit_rate: Integer).void } + attr_writer :bit_rate + + # The density of the image in DPI. + sig { returns(T.nilable(Integer)) } + attr_reader :density + + sig { params(density: Integer).void } + attr_writer :density + + # The duration of the video in seconds (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :duration + + sig { params(duration: Integer).void } + attr_writer :duration + + sig { returns(T.nilable(Imagekit::Metadata::Exif)) } + attr_reader :exif + + sig { params(exif: Imagekit::Metadata::Exif::OrHash).void } + attr_writer :exif + + # The format of the file (e.g., 'jpg', 'mp4'). + sig { returns(T.nilable(String)) } + attr_reader :format_ + + sig { params(format_: String).void } + attr_writer :format_ + + # Indicates if the image has a color profile. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :has_color_profile + + sig { params(has_color_profile: T::Boolean).void } + attr_writer :has_color_profile + + # Indicates if the image contains transparent areas. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :has_transparency + + sig { params(has_transparency: T::Boolean).void } + attr_writer :has_transparency + + # The height of the image or video in pixels. + sig { returns(T.nilable(Integer)) } + attr_reader :height + + sig { params(height: Integer).void } + attr_writer :height + + # Perceptual hash of the image. + sig { returns(T.nilable(String)) } + attr_reader :p_hash + + sig { params(p_hash: String).void } + attr_writer :p_hash + + # The quality indicator of the image. + sig { returns(T.nilable(Integer)) } + attr_reader :quality + + sig { params(quality: Integer).void } + attr_writer :quality + + # The file size in bytes. + sig { returns(T.nilable(Integer)) } + attr_reader :size + + sig { params(size: Integer).void } + attr_writer :size + + # The video codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :video_codec + + sig { params(video_codec: String).void } + attr_writer :video_codec + + # The width of the image or video in pixels. + sig { returns(T.nilable(Integer)) } + attr_reader :width + + sig { params(width: Integer).void } + attr_writer :width + + # JSON object containing metadata. + sig do + params( + audio_codec: String, + bit_rate: Integer, + density: Integer, + duration: Integer, + exif: Imagekit::Metadata::Exif::OrHash, + format_: String, + has_color_profile: T::Boolean, + has_transparency: T::Boolean, + height: Integer, + p_hash: String, + quality: Integer, + size: Integer, + video_codec: String, + width: Integer + ).returns(T.attached_class) + end + def self.new( + # The audio codec used in the video (only for video). + audio_codec: nil, + # The bit rate of the video in kbps (only for video). + bit_rate: nil, + # The density of the image in DPI. + density: nil, + # The duration of the video in seconds (only for video). + duration: nil, + exif: nil, + # The format of the file (e.g., 'jpg', 'mp4'). + format_: nil, + # Indicates if the image has a color profile. + has_color_profile: nil, + # Indicates if the image contains transparent areas. + has_transparency: nil, + # The height of the image or video in pixels. + height: nil, + # Perceptual hash of the image. + p_hash: nil, + # The quality indicator of the image. + quality: nil, + # The file size in bytes. + size: nil, + # The video codec used in the video (only for video). + video_codec: nil, + # The width of the image or video in pixels. + width: nil + ) + end + + sig do + override.returns( + { + audio_codec: String, + bit_rate: Integer, + density: Integer, + duration: Integer, + exif: Imagekit::Metadata::Exif, + format_: String, + has_color_profile: T::Boolean, + has_transparency: T::Boolean, + height: Integer, + p_hash: String, + quality: Integer, + size: Integer, + video_codec: String, + width: Integer + } + ) + end + def to_hash + end + + class Exif < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::Metadata::Exif, Imagekit::Internal::AnyHash) + end + + # Object containing Exif details. + sig { returns(T.nilable(Imagekit::Metadata::Exif::Exif)) } + attr_reader :exif + + sig { params(exif: Imagekit::Metadata::Exif::Exif::OrHash).void } + attr_writer :exif + + # Object containing GPS information. + sig { returns(T.nilable(Imagekit::Metadata::Exif::Gps)) } + attr_reader :gps + + sig { params(gps: Imagekit::Metadata::Exif::Gps::OrHash).void } + attr_writer :gps + + # Object containing EXIF image information. + sig { returns(T.nilable(Imagekit::Metadata::Exif::Image)) } + attr_reader :image + + sig { params(image: Imagekit::Metadata::Exif::Image::OrHash).void } + attr_writer :image + + # JSON object. + sig { returns(T.nilable(Imagekit::Metadata::Exif::Interoperability)) } + attr_reader :interoperability + + sig do + params( + interoperability: Imagekit::Metadata::Exif::Interoperability::OrHash + ).void + end + attr_writer :interoperability + + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :makernote + + sig { params(makernote: T::Hash[Symbol, T.anything]).void } + attr_writer :makernote + + # Object containing Thumbnail information. + sig { returns(T.nilable(Imagekit::Metadata::Exif::Thumbnail)) } + attr_reader :thumbnail + + sig do + params(thumbnail: Imagekit::Metadata::Exif::Thumbnail::OrHash).void + end + attr_writer :thumbnail + + sig do + params( + exif: Imagekit::Metadata::Exif::Exif::OrHash, + gps: Imagekit::Metadata::Exif::Gps::OrHash, + image: Imagekit::Metadata::Exif::Image::OrHash, + interoperability: + Imagekit::Metadata::Exif::Interoperability::OrHash, + makernote: T::Hash[Symbol, T.anything], + thumbnail: Imagekit::Metadata::Exif::Thumbnail::OrHash + ).returns(T.attached_class) + end + def self.new( + # Object containing Exif details. + exif: nil, + # Object containing GPS information. + gps: nil, + # Object containing EXIF image information. + image: nil, + # JSON object. + interoperability: nil, + makernote: nil, + # Object containing Thumbnail information. + thumbnail: nil + ) + end + + sig do + override.returns( + { + exif: Imagekit::Metadata::Exif::Exif, + gps: Imagekit::Metadata::Exif::Gps, + image: Imagekit::Metadata::Exif::Image, + interoperability: Imagekit::Metadata::Exif::Interoperability, + makernote: T::Hash[Symbol, T.anything], + thumbnail: Imagekit::Metadata::Exif::Thumbnail + } + ) + end + def to_hash + end + + class Exif < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::Metadata::Exif::Exif, Imagekit::Internal::AnyHash) + end + + sig { returns(T.nilable(Float)) } + attr_reader :aperture_value + + sig { params(aperture_value: Float).void } + attr_writer :aperture_value + + sig { returns(T.nilable(Integer)) } + attr_reader :color_space + + sig { params(color_space: Integer).void } + attr_writer :color_space + + sig { returns(T.nilable(String)) } + attr_reader :create_date + + sig { params(create_date: String).void } + attr_writer :create_date + + sig { returns(T.nilable(Integer)) } + attr_reader :custom_rendered + + sig { params(custom_rendered: Integer).void } + attr_writer :custom_rendered + + sig { returns(T.nilable(String)) } + attr_reader :date_time_original + + sig { params(date_time_original: String).void } + attr_writer :date_time_original + + sig { returns(T.nilable(Integer)) } + attr_reader :exif_image_height + + sig { params(exif_image_height: Integer).void } + attr_writer :exif_image_height + + sig { returns(T.nilable(Integer)) } + attr_reader :exif_image_width + + sig { params(exif_image_width: Integer).void } + attr_writer :exif_image_width + + sig { returns(T.nilable(String)) } + attr_reader :exif_version + + sig { params(exif_version: String).void } + attr_writer :exif_version + + sig { returns(T.nilable(Float)) } + attr_reader :exposure_compensation + + sig { params(exposure_compensation: Float).void } + attr_writer :exposure_compensation + + sig { returns(T.nilable(Integer)) } + attr_reader :exposure_mode + + sig { params(exposure_mode: Integer).void } + attr_writer :exposure_mode + + sig { returns(T.nilable(Integer)) } + attr_reader :exposure_program + + sig { params(exposure_program: Integer).void } + attr_writer :exposure_program + + sig { returns(T.nilable(Float)) } + attr_reader :exposure_time + + sig { params(exposure_time: Float).void } + attr_writer :exposure_time + + sig { returns(T.nilable(Integer)) } + attr_reader :flash + + sig { params(flash: Integer).void } + attr_writer :flash + + sig { returns(T.nilable(String)) } + attr_reader :flashpix_version + + sig { params(flashpix_version: String).void } + attr_writer :flashpix_version + + sig { returns(T.nilable(Float)) } + attr_reader :f_number + + sig { params(f_number: Float).void } + attr_writer :f_number + + sig { returns(T.nilable(Integer)) } + attr_reader :focal_length + + sig { params(focal_length: Integer).void } + attr_writer :focal_length + + sig { returns(T.nilable(Integer)) } + attr_reader :focal_plane_resolution_unit + + sig { params(focal_plane_resolution_unit: Integer).void } + attr_writer :focal_plane_resolution_unit + + sig { returns(T.nilable(Float)) } + attr_reader :focal_plane_x_resolution + + sig { params(focal_plane_x_resolution: Float).void } + attr_writer :focal_plane_x_resolution + + sig { returns(T.nilable(Float)) } + attr_reader :focal_plane_y_resolution + + sig { params(focal_plane_y_resolution: Float).void } + attr_writer :focal_plane_y_resolution + + sig { returns(T.nilable(Integer)) } + attr_reader :interop_offset + + sig { params(interop_offset: Integer).void } + attr_writer :interop_offset + + sig { returns(T.nilable(Integer)) } + attr_reader :iso + + sig { params(iso: Integer).void } + attr_writer :iso + + sig { returns(T.nilable(Integer)) } + attr_reader :metering_mode + + sig { params(metering_mode: Integer).void } + attr_writer :metering_mode + + sig { returns(T.nilable(Integer)) } + attr_reader :scene_capture_type + + sig { params(scene_capture_type: Integer).void } + attr_writer :scene_capture_type + + sig { returns(T.nilable(Float)) } + attr_reader :shutter_speed_value + + sig { params(shutter_speed_value: Float).void } + attr_writer :shutter_speed_value + + sig { returns(T.nilable(String)) } + attr_reader :sub_sec_time + + sig { params(sub_sec_time: String).void } + attr_writer :sub_sec_time + + sig { returns(T.nilable(Integer)) } + attr_reader :white_balance + + sig { params(white_balance: Integer).void } + attr_writer :white_balance + + # Object containing Exif details. + sig do + params( + aperture_value: Float, + color_space: Integer, + create_date: String, + custom_rendered: Integer, + date_time_original: String, + exif_image_height: Integer, + exif_image_width: Integer, + exif_version: String, + exposure_compensation: Float, + exposure_mode: Integer, + exposure_program: Integer, + exposure_time: Float, + flash: Integer, + flashpix_version: String, + f_number: Float, + focal_length: Integer, + focal_plane_resolution_unit: Integer, + focal_plane_x_resolution: Float, + focal_plane_y_resolution: Float, + interop_offset: Integer, + iso: Integer, + metering_mode: Integer, + scene_capture_type: Integer, + shutter_speed_value: Float, + sub_sec_time: String, + white_balance: Integer + ).returns(T.attached_class) + end + def self.new( + aperture_value: nil, + color_space: nil, + create_date: nil, + custom_rendered: nil, + date_time_original: nil, + exif_image_height: nil, + exif_image_width: nil, + exif_version: nil, + exposure_compensation: nil, + exposure_mode: nil, + exposure_program: nil, + exposure_time: nil, + flash: nil, + flashpix_version: nil, + f_number: nil, + focal_length: nil, + focal_plane_resolution_unit: nil, + focal_plane_x_resolution: nil, + focal_plane_y_resolution: nil, + interop_offset: nil, + iso: nil, + metering_mode: nil, + scene_capture_type: nil, + shutter_speed_value: nil, + sub_sec_time: nil, + white_balance: nil + ) + end + + sig do + override.returns( + { + aperture_value: Float, + color_space: Integer, + create_date: String, + custom_rendered: Integer, + date_time_original: String, + exif_image_height: Integer, + exif_image_width: Integer, + exif_version: String, + exposure_compensation: Float, + exposure_mode: Integer, + exposure_program: Integer, + exposure_time: Float, + flash: Integer, + flashpix_version: String, + f_number: Float, + focal_length: Integer, + focal_plane_resolution_unit: Integer, + focal_plane_x_resolution: Float, + focal_plane_y_resolution: Float, + interop_offset: Integer, + iso: Integer, + metering_mode: Integer, + scene_capture_type: Integer, + shutter_speed_value: Float, + sub_sec_time: String, + white_balance: Integer + } + ) + end + def to_hash + end + end + + class Gps < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::Metadata::Exif::Gps, Imagekit::Internal::AnyHash) + end + + sig { returns(T.nilable(T::Array[Integer])) } + attr_reader :gps_version_id + + sig { params(gps_version_id: T::Array[Integer]).void } + attr_writer :gps_version_id + + # Object containing GPS information. + sig do + params(gps_version_id: T::Array[Integer]).returns(T.attached_class) + end + def self.new(gps_version_id: nil) + end + + sig { override.returns({ gps_version_id: T::Array[Integer] }) } + def to_hash + end + end + + class Image < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Metadata::Exif::Image, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :exif_offset + + sig { params(exif_offset: Integer).void } + attr_writer :exif_offset + + sig { returns(T.nilable(Integer)) } + attr_reader :gps_info + + sig { params(gps_info: Integer).void } + attr_writer :gps_info + + sig { returns(T.nilable(String)) } + attr_reader :make + + sig { params(make: String).void } + attr_writer :make + + sig { returns(T.nilable(String)) } + attr_reader :model + + sig { params(model: String).void } + attr_writer :model + + sig { returns(T.nilable(String)) } + attr_reader :modify_date + + sig { params(modify_date: String).void } + attr_writer :modify_date + + sig { returns(T.nilable(Integer)) } + attr_reader :orientation + + sig { params(orientation: Integer).void } + attr_writer :orientation + + sig { returns(T.nilable(Integer)) } + attr_reader :resolution_unit + + sig { params(resolution_unit: Integer).void } + attr_writer :resolution_unit + + sig { returns(T.nilable(String)) } + attr_reader :software + + sig { params(software: String).void } + attr_writer :software + + sig { returns(T.nilable(Integer)) } + attr_reader :x_resolution + + sig { params(x_resolution: Integer).void } + attr_writer :x_resolution + + sig { returns(T.nilable(Integer)) } + attr_reader :y_cb_cr_positioning + + sig { params(y_cb_cr_positioning: Integer).void } + attr_writer :y_cb_cr_positioning + + sig { returns(T.nilable(Integer)) } + attr_reader :y_resolution + + sig { params(y_resolution: Integer).void } + attr_writer :y_resolution + + # Object containing EXIF image information. + sig do + params( + exif_offset: Integer, + gps_info: Integer, + make: String, + model: String, + modify_date: String, + orientation: Integer, + resolution_unit: Integer, + software: String, + x_resolution: Integer, + y_cb_cr_positioning: Integer, + y_resolution: Integer + ).returns(T.attached_class) + end + def self.new( + exif_offset: nil, + gps_info: nil, + make: nil, + model: nil, + modify_date: nil, + orientation: nil, + resolution_unit: nil, + software: nil, + x_resolution: nil, + y_cb_cr_positioning: nil, + y_resolution: nil + ) + end + + sig do + override.returns( + { + exif_offset: Integer, + gps_info: Integer, + make: String, + model: String, + modify_date: String, + orientation: Integer, + resolution_unit: Integer, + software: String, + x_resolution: Integer, + y_cb_cr_positioning: Integer, + y_resolution: Integer + } + ) + end + def to_hash + end + end + + class Interoperability < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Metadata::Exif::Interoperability, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(T.nilable(String)) } + attr_reader :interop_index + + sig { params(interop_index: String).void } + attr_writer :interop_index + + sig { returns(T.nilable(String)) } + attr_reader :interop_version + + sig { params(interop_version: String).void } + attr_writer :interop_version + + # JSON object. + sig do + params(interop_index: String, interop_version: String).returns( + T.attached_class + ) + end + def self.new(interop_index: nil, interop_version: nil) + end + + sig do + override.returns({ interop_index: String, interop_version: String }) + end + def to_hash + end + end + + class Thumbnail < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::Metadata::Exif::Thumbnail, + Imagekit::Internal::AnyHash + ) + end + + sig { returns(T.nilable(Integer)) } + attr_reader :compression + + sig { params(compression: Integer).void } + attr_writer :compression + + sig { returns(T.nilable(Integer)) } + attr_reader :resolution_unit + + sig { params(resolution_unit: Integer).void } + attr_writer :resolution_unit + + sig { returns(T.nilable(Integer)) } + attr_reader :thumbnail_length + + sig { params(thumbnail_length: Integer).void } + attr_writer :thumbnail_length + + sig { returns(T.nilable(Integer)) } + attr_reader :thumbnail_offset + + sig { params(thumbnail_offset: Integer).void } + attr_writer :thumbnail_offset + + sig { returns(T.nilable(Integer)) } + attr_reader :x_resolution + + sig { params(x_resolution: Integer).void } + attr_writer :x_resolution + + sig { returns(T.nilable(Integer)) } + attr_reader :y_resolution + + sig { params(y_resolution: Integer).void } + attr_writer :y_resolution + + # Object containing Thumbnail information. + sig do + params( + compression: Integer, + resolution_unit: Integer, + thumbnail_length: Integer, + thumbnail_offset: Integer, + x_resolution: Integer, + y_resolution: Integer + ).returns(T.attached_class) + end + def self.new( + compression: nil, + resolution_unit: nil, + thumbnail_length: nil, + thumbnail_offset: nil, + x_resolution: nil, + y_resolution: nil + ) + end + + sig do + override.returns( + { + compression: Integer, + resolution_unit: Integer, + thumbnail_length: Integer, + thumbnail_offset: Integer, + x_resolution: Integer, + y_resolution: Integer + } + ) + end + def to_hash + end + end + end + end + end +end diff --git a/rbi/imagekit/models/overlay.rbi b/rbi/imagekit/models/overlay.rbi new file mode 100644 index 00000000..59e0e042 --- /dev/null +++ b/rbi/imagekit/models/overlay.rbi @@ -0,0 +1,28 @@ +# typed: strong + +module Imagekit + module Models + # Specifies an overlay to be applied on the parent image or video. ImageKit + # supports overlays including images, text, videos, subtitles, and solid colors. + # See + # [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers). + module Overlay + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::TextOverlay, + Imagekit::ImageOverlay, + Imagekit::VideoOverlay, + Imagekit::SubtitleOverlay, + Imagekit::SolidColorOverlay + ) + end + + sig { override.returns(T::Array[Imagekit::Overlay::Variants]) } + def self.variants + end + end + end +end diff --git a/rbi/imagekit/models/overlay_position.rbi b/rbi/imagekit/models/overlay_position.rbi new file mode 100644 index 00000000..96202b12 --- /dev/null +++ b/rbi/imagekit/models/overlay_position.rbi @@ -0,0 +1,146 @@ +# typed: strong + +module Imagekit + module Models + class OverlayPosition < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::OverlayPosition, Imagekit::Internal::AnyHash) + end + + # Specifies the position of the overlay relative to the parent image or video. + # Maps to `lfo` in the URL. + sig { returns(T.nilable(Imagekit::OverlayPosition::Focus::OrSymbol)) } + attr_reader :focus + + sig { params(focus: Imagekit::OverlayPosition::Focus::OrSymbol).void } + attr_writer :focus + + # Specifies the x-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bw_mul_0.4` or `bw_sub_cw`. Maps to `lx` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + sig { returns(T.nilable(Imagekit::OverlayPosition::X::Variants)) } + attr_reader :x + + sig { params(x: Imagekit::OverlayPosition::X::Variants).void } + attr_writer :x + + # Specifies the y-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bh_mul_0.4` or `bh_sub_ch`. Maps to `ly` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + sig { returns(T.nilable(Imagekit::OverlayPosition::Y::Variants)) } + attr_reader :y_ + + sig { params(y_: Imagekit::OverlayPosition::Y::Variants).void } + attr_writer :y_ + + sig do + params( + focus: Imagekit::OverlayPosition::Focus::OrSymbol, + x: Imagekit::OverlayPosition::X::Variants, + y_: Imagekit::OverlayPosition::Y::Variants + ).returns(T.attached_class) + end + def self.new( + # Specifies the position of the overlay relative to the parent image or video. + # Maps to `lfo` in the URL. + focus: nil, + # Specifies the x-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bw_mul_0.4` or `bw_sub_cw`. Maps to `lx` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + x: nil, + # Specifies the y-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bh_mul_0.4` or `bh_sub_ch`. Maps to `ly` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + y_: nil + ) + end + + sig do + override.returns( + { + focus: Imagekit::OverlayPosition::Focus::OrSymbol, + x: Imagekit::OverlayPosition::X::Variants, + y_: Imagekit::OverlayPosition::Y::Variants + } + ) + end + def to_hash + end + + # Specifies the position of the overlay relative to the parent image or video. + # Maps to `lfo` in the URL. + module Focus + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::OverlayPosition::Focus) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + CENTER = T.let(:center, Imagekit::OverlayPosition::Focus::TaggedSymbol) + TOP = T.let(:top, Imagekit::OverlayPosition::Focus::TaggedSymbol) + LEFT = T.let(:left, Imagekit::OverlayPosition::Focus::TaggedSymbol) + BOTTOM = T.let(:bottom, Imagekit::OverlayPosition::Focus::TaggedSymbol) + RIGHT = T.let(:right, Imagekit::OverlayPosition::Focus::TaggedSymbol) + TOP_LEFT = + T.let(:top_left, Imagekit::OverlayPosition::Focus::TaggedSymbol) + TOP_RIGHT = + T.let(:top_right, Imagekit::OverlayPosition::Focus::TaggedSymbol) + BOTTOM_LEFT = + T.let(:bottom_left, Imagekit::OverlayPosition::Focus::TaggedSymbol) + BOTTOM_RIGHT = + T.let(:bottom_right, Imagekit::OverlayPosition::Focus::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::OverlayPosition::Focus::TaggedSymbol] + ) + end + def self.values + end + end + + # Specifies the x-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bw_mul_0.4` or `bw_sub_cw`. Maps to `lx` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + module X + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::OverlayPosition::X::Variants]) + end + def self.variants + end + end + + # Specifies the y-coordinate of the top-left corner of the base asset where the + # overlay's top-left corner will be positioned. It also accepts arithmetic + # expressions such as `bh_mul_0.4` or `bh_sub_ch`. Maps to `ly` in the URL. Learn + # about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + module Y + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::OverlayPosition::Y::Variants]) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/overlay_timing.rbi b/rbi/imagekit/models/overlay_timing.rbi new file mode 100644 index 00000000..50d25cae --- /dev/null +++ b/rbi/imagekit/models/overlay_timing.rbi @@ -0,0 +1,133 @@ +# typed: strong + +module Imagekit + module Models + class OverlayTiming < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::OverlayTiming, Imagekit::Internal::AnyHash) + end + + # Specifies the duration (in seconds) during which the overlay should appear on + # the base video. Accepts a positive number up to two decimal places (e.g., `20` + # or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `ldu` in the URL. + sig { returns(T.nilable(Imagekit::OverlayTiming::Duration::Variants)) } + attr_reader :duration + + sig { params(duration: Imagekit::OverlayTiming::Duration::Variants).void } + attr_writer :duration + + # Specifies the end time (in seconds) for when the overlay should disappear from + # the base video. If both end and duration are provided, duration is ignored. + # Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and + # arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if + # the base asset is a video. Maps to `leo` in the URL. + sig { returns(T.nilable(Imagekit::OverlayTiming::End::Variants)) } + attr_reader :end_ + + sig { params(end_: Imagekit::OverlayTiming::End::Variants).void } + attr_writer :end_ + + # Specifies the start time (in seconds) for when the overlay should appear on the + # base video. Accepts a positive number up to two decimal places (e.g., `20` or + # `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `lso` in the URL. + sig { returns(T.nilable(Imagekit::OverlayTiming::Start::Variants)) } + attr_reader :start + + sig { params(start: Imagekit::OverlayTiming::Start::Variants).void } + attr_writer :start + + sig do + params( + duration: Imagekit::OverlayTiming::Duration::Variants, + end_: Imagekit::OverlayTiming::End::Variants, + start: Imagekit::OverlayTiming::Start::Variants + ).returns(T.attached_class) + end + def self.new( + # Specifies the duration (in seconds) during which the overlay should appear on + # the base video. Accepts a positive number up to two decimal places (e.g., `20` + # or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `ldu` in the URL. + duration: nil, + # Specifies the end time (in seconds) for when the overlay should disappear from + # the base video. If both end and duration are provided, duration is ignored. + # Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and + # arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if + # the base asset is a video. Maps to `leo` in the URL. + end_: nil, + # Specifies the start time (in seconds) for when the overlay should appear on the + # base video. Accepts a positive number up to two decimal places (e.g., `20` or + # `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `lso` in the URL. + start: nil + ) + end + + sig do + override.returns( + { + duration: Imagekit::OverlayTiming::Duration::Variants, + end_: Imagekit::OverlayTiming::End::Variants, + start: Imagekit::OverlayTiming::Start::Variants + } + ) + end + def to_hash + end + + # Specifies the duration (in seconds) during which the overlay should appear on + # the base video. Accepts a positive number up to two decimal places (e.g., `20` + # or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `ldu` in the URL. + module Duration + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::OverlayTiming::Duration::Variants] + ) + end + def self.variants + end + end + + # Specifies the end time (in seconds) for when the overlay should disappear from + # the base video. If both end and duration are provided, duration is ignored. + # Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and + # arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if + # the base asset is a video. Maps to `leo` in the URL. + module End + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::OverlayTiming::End::Variants]) + end + def self.variants + end + end + + # Specifies the start time (in seconds) for when the overlay should appear on the + # base video. Accepts a positive number up to two decimal places (e.g., `20` or + # `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + # Applies only if the base asset is a video. Maps to `lso` in the URL. + module Start + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::OverlayTiming::Start::Variants]) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/solid_color_overlay.rbi b/rbi/imagekit/models/solid_color_overlay.rbi new file mode 100644 index 00000000..54cbbac7 --- /dev/null +++ b/rbi/imagekit/models/solid_color_overlay.rbi @@ -0,0 +1,76 @@ +# typed: strong + +module Imagekit + module Models + class SolidColorOverlay < Imagekit::Models::BaseOverlay + OrHash = + T.type_alias do + T.any(Imagekit::SolidColorOverlay, Imagekit::Internal::AnyHash) + end + + # Specifies the color of the block using an RGB hex code (e.g., `FF0000`), an RGBA + # code (e.g., `FFAABB50`), or a color name (e.g., `red`). If an 8-character value + # is provided, the last two characters represent the opacity level (from `00` for + # 0.00 to `99` for 0.99). + sig { returns(String) } + attr_accessor :color + + sig { returns(Symbol) } + attr_accessor :type + + # Control width and height of the solid color overlay. Supported transformations + # depend on the base/parent asset. See overlays on + # [Images](https://imagekit.io/docs/add-overlays-on-images#apply-transformation-on-solid-color-overlay) + # and + # [Videos](https://imagekit.io/docs/add-overlays-on-videos#apply-transformations-on-solid-color-block-overlay). + sig do + returns(T.nilable(T::Array[Imagekit::SolidColorOverlayTransformation])) + end + attr_reader :transformation + + sig do + params( + transformation: + T::Array[Imagekit::SolidColorOverlayTransformation::OrHash] + ).void + end + attr_writer :transformation + + sig do + params( + color: String, + transformation: + T::Array[Imagekit::SolidColorOverlayTransformation::OrHash], + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Specifies the color of the block using an RGB hex code (e.g., `FF0000`), an RGBA + # code (e.g., `FFAABB50`), or a color name (e.g., `red`). If an 8-character value + # is provided, the last two characters represent the opacity level (from `00` for + # 0.00 to `99` for 0.99). + color:, + # Control width and height of the solid color overlay. Supported transformations + # depend on the base/parent asset. See overlays on + # [Images](https://imagekit.io/docs/add-overlays-on-images#apply-transformation-on-solid-color-overlay) + # and + # [Videos](https://imagekit.io/docs/add-overlays-on-videos#apply-transformations-on-solid-color-block-overlay). + transformation: nil, + type: :solidColor + ) + end + + sig do + override.returns( + { + color: String, + type: Symbol, + transformation: T::Array[Imagekit::SolidColorOverlayTransformation] + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/solid_color_overlay_transformation.rbi b/rbi/imagekit/models/solid_color_overlay_transformation.rbi new file mode 100644 index 00000000..698a29f6 --- /dev/null +++ b/rbi/imagekit/models/solid_color_overlay_transformation.rbi @@ -0,0 +1,211 @@ +# typed: strong + +module Imagekit + module Models + class SolidColorOverlayTransformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::SolidColorOverlayTransformation, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the transparency level of the solid color overlay. Accepts integers + # from `1` to `9`. + sig { returns(T.nilable(Float)) } + attr_reader :alpha + + sig { params(alpha: Float).void } + attr_writer :alpha + + # Specifies the background color of the solid color overlay. Accepts an RGB hex + # code (e.g., `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. + sig { returns(T.nilable(String)) } + attr_reader :background + + sig { params(background: String).void } + attr_writer :background + + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. Only works if the base asset is an + # image. See + # [gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + sig { returns(T.nilable(T.any(T::Boolean, String))) } + attr_reader :gradient + + sig { params(gradient: T.any(T::Boolean, String)).void } + attr_writer :gradient + + # Controls the height of the solid color overlay. Accepts a numeric value or an + # arithmetic expression. Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + sig do + returns( + T.nilable(Imagekit::SolidColorOverlayTransformation::Height::Variants) + ) + end + attr_reader :height + + sig do + params( + height: Imagekit::SolidColorOverlayTransformation::Height::Variants + ).void + end + attr_writer :height + + # Specifies the corner radius of the solid color overlay. Set to `max` for + # circular or oval shape. See + # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + sig { returns(T.nilable(T.any(Float, Symbol))) } + attr_reader :radius + + sig { params(radius: T.any(Float, Symbol)).void } + attr_writer :radius + + # Controls the width of the solid color overlay. Accepts a numeric value or an + # arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + sig do + returns( + T.nilable(Imagekit::SolidColorOverlayTransformation::Width::Variants) + ) + end + attr_reader :width + + sig do + params( + width: Imagekit::SolidColorOverlayTransformation::Width::Variants + ).void + end + attr_writer :width + + sig do + params( + alpha: Float, + background: String, + gradient: T.any(T::Boolean, String), + height: Imagekit::SolidColorOverlayTransformation::Height::Variants, + radius: T.any(Float, Symbol), + width: Imagekit::SolidColorOverlayTransformation::Width::Variants + ).returns(T.attached_class) + end + def self.new( + # Specifies the transparency level of the solid color overlay. Accepts integers + # from `1` to `9`. + alpha: nil, + # Specifies the background color of the solid color overlay. Accepts an RGB hex + # code (e.g., `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. + background: nil, + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. Only works if the base asset is an + # image. See + # [gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + gradient: nil, + # Controls the height of the solid color overlay. Accepts a numeric value or an + # arithmetic expression. Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + height: nil, + # Specifies the corner radius of the solid color overlay. Set to `max` for + # circular or oval shape. See + # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + radius: nil, + # Controls the width of the solid color overlay. Accepts a numeric value or an + # arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + width: nil + ) + end + + sig do + override.returns( + { + alpha: Float, + background: String, + gradient: T.any(T::Boolean, String), + height: Imagekit::SolidColorOverlayTransformation::Height::Variants, + radius: T.any(Float, Symbol), + width: Imagekit::SolidColorOverlayTransformation::Width::Variants + } + ) + end + def to_hash + end + + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. Only works if the base asset is an + # image. See + # [gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + module Gradient + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Boolean, String) } + + sig do + override.returns( + T::Array[ + Imagekit::SolidColorOverlayTransformation::Gradient::Variants + ] + ) + end + def self.variants + end + end + + # Controls the height of the solid color overlay. Accepts a numeric value or an + # arithmetic expression. Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + module Height + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[ + Imagekit::SolidColorOverlayTransformation::Height::Variants + ] + ) + end + def self.variants + end + end + + # Specifies the corner radius of the solid color overlay. Set to `max` for + # circular or oval shape. See + # [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + module Radius + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, Symbol) } + + sig do + override.returns( + T::Array[ + Imagekit::SolidColorOverlayTransformation::Radius::Variants + ] + ) + end + def self.variants + end + end + + # Controls the width of the solid color overlay. Accepts a numeric value or an + # arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + module Width + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::SolidColorOverlayTransformation::Width::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/src_options.rbi b/rbi/imagekit/models/src_options.rbi new file mode 100644 index 00000000..30c5cdaf --- /dev/null +++ b/rbi/imagekit/models/src_options.rbi @@ -0,0 +1,156 @@ +# typed: strong + +module Imagekit + module Models + class SrcOptions < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::SrcOptions, Imagekit::Internal::AnyHash) + end + + # Accepts a relative or absolute path of the resource. If a relative path is + # provided, it is appended to the `urlEndpoint`. If an absolute path is provided, + # `urlEndpoint` is ignored. + sig { returns(String) } + attr_accessor :src + + # Get your urlEndpoint from the + # [ImageKit dashboard](https://imagekit.io/dashboard/url-endpoints). + sig { returns(String) } + attr_accessor :url_endpoint + + # When you want the signed URL to expire, specified in seconds. If `expiresIn` is + # anything above 0, the URL will always be signed even if `signed` is set to + # false. If not specified and `signed` is `true`, the signed URL will not expire + # (valid indefinitely). + # + # Example: Setting `expiresIn: 3600` will make the URL expire 1 hour from + # generation time. After the expiry time, the signed URL will no longer be valid + # and ImageKit will return a 401 Unauthorized status code. + # + # [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + sig { returns(T.nilable(Float)) } + attr_reader :expires_in + + sig { params(expires_in: Float).void } + attr_writer :expires_in + + # These are additional query parameters that you want to add to the final URL. + # They can be any query parameters and not necessarily related to ImageKit. This + # is especially useful if you want to add a versioning parameter to your URLs. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_reader :query_parameters + + sig { params(query_parameters: T::Hash[Symbol, String]).void } + attr_writer :query_parameters + + # Whether to sign the URL or not. Set this to `true` if you want to generate a + # signed URL. If `signed` is `true` and `expiresIn` is not specified, the signed + # URL will not expire (valid indefinitely). Note: If `expiresIn` is set to any + # value above 0, the URL will always be signed regardless of this setting. + # [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :signed + + sig { params(signed: T::Boolean).void } + attr_writer :signed + + # An array of objects specifying the transformations to be applied in the URL. If + # more than one transformation is specified, they are applied in the order they + # are specified as chained transformations. See + # [Chained transformations](https://imagekit.io/docs/transformations#chained-transformations). + sig { returns(T.nilable(T::Array[Imagekit::Transformation])) } + attr_reader :transformation + + sig do + params(transformation: T::Array[Imagekit::Transformation::OrHash]).void + end + attr_writer :transformation + + # By default, the transformation string is added as a query parameter in the URL, + # e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the + # path of the URL, set this to `path`. Learn more in the + # [Transformations guide](https://imagekit.io/docs/transformations). + sig { returns(T.nilable(Imagekit::TransformationPosition::OrSymbol)) } + attr_reader :transformation_position + + sig do + params( + transformation_position: Imagekit::TransformationPosition::OrSymbol + ).void + end + attr_writer :transformation_position + + # Options for generating ImageKit URLs with transformations. See the + # [Transformations guide](https://imagekit.io/docs/transformations). + sig do + params( + src: String, + url_endpoint: String, + expires_in: Float, + query_parameters: T::Hash[Symbol, String], + signed: T::Boolean, + transformation: T::Array[Imagekit::Transformation::OrHash], + transformation_position: Imagekit::TransformationPosition::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Accepts a relative or absolute path of the resource. If a relative path is + # provided, it is appended to the `urlEndpoint`. If an absolute path is provided, + # `urlEndpoint` is ignored. + src:, + # Get your urlEndpoint from the + # [ImageKit dashboard](https://imagekit.io/dashboard/url-endpoints). + url_endpoint:, + # When you want the signed URL to expire, specified in seconds. If `expiresIn` is + # anything above 0, the URL will always be signed even if `signed` is set to + # false. If not specified and `signed` is `true`, the signed URL will not expire + # (valid indefinitely). + # + # Example: Setting `expiresIn: 3600` will make the URL expire 1 hour from + # generation time. After the expiry time, the signed URL will no longer be valid + # and ImageKit will return a 401 Unauthorized status code. + # + # [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + expires_in: nil, + # These are additional query parameters that you want to add to the final URL. + # They can be any query parameters and not necessarily related to ImageKit. This + # is especially useful if you want to add a versioning parameter to your URLs. + query_parameters: nil, + # Whether to sign the URL or not. Set this to `true` if you want to generate a + # signed URL. If `signed` is `true` and `expiresIn` is not specified, the signed + # URL will not expire (valid indefinitely). Note: If `expiresIn` is set to any + # value above 0, the URL will always be signed regardless of this setting. + # [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + signed: nil, + # An array of objects specifying the transformations to be applied in the URL. If + # more than one transformation is specified, they are applied in the order they + # are specified as chained transformations. See + # [Chained transformations](https://imagekit.io/docs/transformations#chained-transformations). + transformation: nil, + # By default, the transformation string is added as a query parameter in the URL, + # e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the + # path of the URL, set this to `path`. Learn more in the + # [Transformations guide](https://imagekit.io/docs/transformations). + transformation_position: nil + ) + end + + sig do + override.returns( + { + src: String, + url_endpoint: String, + expires_in: Float, + query_parameters: T::Hash[Symbol, String], + signed: T::Boolean, + transformation: T::Array[Imagekit::Transformation], + transformation_position: Imagekit::TransformationPosition::OrSymbol + } + ) + end + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/streaming_resolution.rbi b/rbi/imagekit/models/streaming_resolution.rbi new file mode 100644 index 00000000..d64a122e --- /dev/null +++ b/rbi/imagekit/models/streaming_resolution.rbi @@ -0,0 +1,36 @@ +# typed: strong + +module Imagekit + module Models + # Available streaming resolutions for + # [adaptive bitrate streaming](https://imagekit.io/docs/adaptive-bitrate-streaming) + module StreamingResolution + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::StreamingResolution) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + STREAMING_RESOLUTION_240 = + T.let(:"240", Imagekit::StreamingResolution::TaggedSymbol) + STREAMING_RESOLUTION_360 = + T.let(:"360", Imagekit::StreamingResolution::TaggedSymbol) + STREAMING_RESOLUTION_480 = + T.let(:"480", Imagekit::StreamingResolution::TaggedSymbol) + STREAMING_RESOLUTION_720 = + T.let(:"720", Imagekit::StreamingResolution::TaggedSymbol) + STREAMING_RESOLUTION_1080 = + T.let(:"1080", Imagekit::StreamingResolution::TaggedSymbol) + STREAMING_RESOLUTION_1440 = + T.let(:"1440", Imagekit::StreamingResolution::TaggedSymbol) + STREAMING_RESOLUTION_2160 = + T.let(:"2160", Imagekit::StreamingResolution::TaggedSymbol) + + sig do + override.returns(T::Array[Imagekit::StreamingResolution::TaggedSymbol]) + end + def self.values + end + end + end +end diff --git a/rbi/imagekit/models/subtitle_overlay.rbi b/rbi/imagekit/models/subtitle_overlay.rbi new file mode 100644 index 00000000..baa166f0 --- /dev/null +++ b/rbi/imagekit/models/subtitle_overlay.rbi @@ -0,0 +1,111 @@ +# typed: strong + +module Imagekit + module Models + class SubtitleOverlay < Imagekit::Models::BaseOverlay + OrHash = + T.type_alias do + T.any(Imagekit::SubtitleOverlay, Imagekit::Internal::AnyHash) + end + + # Specifies the relative path to the subtitle file used as an overlay. + sig { returns(String) } + attr_accessor :input + + sig { returns(Symbol) } + attr_accessor :type + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + sig { returns(T.nilable(Imagekit::SubtitleOverlay::Encoding::OrSymbol)) } + attr_reader :encoding + + sig do + params(encoding: Imagekit::SubtitleOverlay::Encoding::OrSymbol).void + end + attr_writer :encoding + + # Control styling of the subtitle. See + # [Styling subtitles](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer). + sig do + returns(T.nilable(T::Array[Imagekit::SubtitleOverlayTransformation])) + end + attr_reader :transformation + + sig do + params( + transformation: + T::Array[Imagekit::SubtitleOverlayTransformation::OrHash] + ).void + end + attr_writer :transformation + + sig do + params( + input: String, + encoding: Imagekit::SubtitleOverlay::Encoding::OrSymbol, + transformation: + T::Array[Imagekit::SubtitleOverlayTransformation::OrHash], + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Specifies the relative path to the subtitle file used as an overlay. + input:, + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + encoding: nil, + # Control styling of the subtitle. See + # [Styling subtitles](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer). + transformation: nil, + type: :subtitle + ) + end + + sig do + override.returns( + { + input: String, + type: Symbol, + encoding: Imagekit::SubtitleOverlay::Encoding::OrSymbol, + transformation: T::Array[Imagekit::SubtitleOverlayTransformation] + } + ) + end + def to_hash + end + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::SubtitleOverlay::Encoding) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, Imagekit::SubtitleOverlay::Encoding::TaggedSymbol) + PLAIN = T.let(:plain, Imagekit::SubtitleOverlay::Encoding::TaggedSymbol) + BASE64 = + T.let(:base64, Imagekit::SubtitleOverlay::Encoding::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::SubtitleOverlay::Encoding::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/imagekit/models/subtitle_overlay_transformation.rbi b/rbi/imagekit/models/subtitle_overlay_transformation.rbi new file mode 100644 index 00000000..3ad34a2b --- /dev/null +++ b/rbi/imagekit/models/subtitle_overlay_transformation.rbi @@ -0,0 +1,215 @@ +# typed: strong + +module Imagekit + module Models + class SubtitleOverlayTransformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::SubtitleOverlayTransformation, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the subtitle background color using a standard color name, an RGB + # color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + sig { returns(T.nilable(String)) } + attr_reader :background + + sig { params(background: String).void } + attr_writer :background + + # Sets the font color of the subtitle text using a standard color name, an RGB + # color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + sig { returns(T.nilable(String)) } + attr_reader :color + + sig { params(color: String).void } + attr_writer :color + + # Font family for subtitles. Refer to the + # [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list). + sig { returns(T.nilable(String)) } + attr_reader :font_family + + sig { params(font_family: String).void } + attr_writer :font_family + + # Sets the font outline of the subtitle text. Requires the outline width (an + # integer) and the outline color (as an RGB color code, RGBA color code, or + # standard web color name) separated by an underscore. Example: `fol-2_blue` + # (outline width of 2px and outline color blue), `fol-2_A1CCDD` (outline width of + # 2px and outline color `#A1CCDD`) and `fol-2_A1CCDD50` (outline width of 2px and + # outline color `#A1CCDD` at 50% opacity). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + sig { returns(T.nilable(String)) } + attr_reader :font_outline + + sig { params(font_outline: String).void } + attr_writer :font_outline + + # Sets the font shadow for the subtitle text. Requires the shadow color (as an RGB + # color code, RGBA color code, or standard web color name) and shadow indent (an + # integer) separated by an underscore. Example: `fsh-blue_2` (shadow color blue, + # indent of 2px), `fsh-A1CCDD_3` (shadow color `#A1CCDD`, indent of 3px), + # `fsh-A1CCDD50_3` (shadow color `#A1CCDD` at 50% opacity, indent of 3px). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + sig { returns(T.nilable(String)) } + attr_reader :font_shadow + + sig { params(font_shadow: String).void } + attr_writer :font_shadow + + # Sets the font size of subtitle text. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + sig { returns(T.nilable(Float)) } + attr_reader :font_size + + sig { params(font_size: Float).void } + attr_writer :font_size + + # Sets the typography style of the subtitle text. Supports values are `b` for + # bold, `i` for italics, and `b_i` for bold with italics. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + sig do + returns( + T.nilable( + Imagekit::SubtitleOverlayTransformation::Typography::OrSymbol + ) + ) + end + attr_reader :typography + + sig do + params( + typography: + Imagekit::SubtitleOverlayTransformation::Typography::OrSymbol + ).void + end + attr_writer :typography + + # Subtitle styling options. + # [Learn more](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + # from the docs. + sig do + params( + background: String, + color: String, + font_family: String, + font_outline: String, + font_shadow: String, + font_size: Float, + typography: + Imagekit::SubtitleOverlayTransformation::Typography::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Specifies the subtitle background color using a standard color name, an RGB + # color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + background: nil, + # Sets the font color of the subtitle text using a standard color name, an RGB + # color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + color: nil, + # Font family for subtitles. Refer to the + # [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list). + font_family: nil, + # Sets the font outline of the subtitle text. Requires the outline width (an + # integer) and the outline color (as an RGB color code, RGBA color code, or + # standard web color name) separated by an underscore. Example: `fol-2_blue` + # (outline width of 2px and outline color blue), `fol-2_A1CCDD` (outline width of + # 2px and outline color `#A1CCDD`) and `fol-2_A1CCDD50` (outline width of 2px and + # outline color `#A1CCDD` at 50% opacity). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + font_outline: nil, + # Sets the font shadow for the subtitle text. Requires the shadow color (as an RGB + # color code, RGBA color code, or standard web color name) and shadow indent (an + # integer) separated by an underscore. Example: `fsh-blue_2` (shadow color blue, + # indent of 2px), `fsh-A1CCDD_3` (shadow color `#A1CCDD`, indent of 3px), + # `fsh-A1CCDD50_3` (shadow color `#A1CCDD` at 50% opacity, indent of 3px). + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + font_shadow: nil, + # Sets the font size of subtitle text. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + font_size: nil, + # Sets the typography style of the subtitle text. Supports values are `b` for + # bold, `i` for italics, and `b_i` for bold with italics. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + typography: nil + ) + end + + sig do + override.returns( + { + background: String, + color: String, + font_family: String, + font_outline: String, + font_shadow: String, + font_size: Float, + typography: + Imagekit::SubtitleOverlayTransformation::Typography::OrSymbol + } + ) + end + def to_hash + end + + # Sets the typography style of the subtitle text. Supports values are `b` for + # bold, `i` for italics, and `b_i` for bold with italics. + # + # [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + module Typography + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::SubtitleOverlayTransformation::Typography) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + B = + T.let( + :b, + Imagekit::SubtitleOverlayTransformation::Typography::TaggedSymbol + ) + I = + T.let( + :i, + Imagekit::SubtitleOverlayTransformation::Typography::TaggedSymbol + ) + B_I = + T.let( + :b_i, + Imagekit::SubtitleOverlayTransformation::Typography::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::SubtitleOverlayTransformation::Typography::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/imagekit/models/text_overlay.rbi b/rbi/imagekit/models/text_overlay.rbi new file mode 100644 index 00000000..9ee9cb98 --- /dev/null +++ b/rbi/imagekit/models/text_overlay.rbi @@ -0,0 +1,106 @@ +# typed: strong + +module Imagekit + module Models + class TextOverlay < Imagekit::Models::BaseOverlay + OrHash = + T.type_alias do + T.any(Imagekit::TextOverlay, Imagekit::Internal::AnyHash) + end + + # Specifies the text to be displayed in the overlay. The SDK automatically handles + # special characters and encoding. + sig { returns(String) } + attr_accessor :text + + sig { returns(Symbol) } + attr_accessor :type + + # Text can be included in the layer as either `i-{input}` (plain text) or + # `ie-{base64_encoded_input}` (base64). By default, the SDK selects the + # appropriate format based on the input text. To always use base64 + # (`ie-{base64}`), set this parameter to `base64`. To always use plain text + # (`i-{input}`), set it to `plain`. + sig { returns(T.nilable(Imagekit::TextOverlay::Encoding::OrSymbol)) } + attr_reader :encoding + + sig { params(encoding: Imagekit::TextOverlay::Encoding::OrSymbol).void } + attr_writer :encoding + + # Control styling of the text overlay. See + # [Text overlays](https://imagekit.io/docs/add-overlays-on-images#text-overlay). + sig { returns(T.nilable(T::Array[Imagekit::TextOverlayTransformation])) } + attr_reader :transformation + + sig do + params( + transformation: T::Array[Imagekit::TextOverlayTransformation::OrHash] + ).void + end + attr_writer :transformation + + sig do + params( + text: String, + encoding: Imagekit::TextOverlay::Encoding::OrSymbol, + transformation: T::Array[Imagekit::TextOverlayTransformation::OrHash], + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Specifies the text to be displayed in the overlay. The SDK automatically handles + # special characters and encoding. + text:, + # Text can be included in the layer as either `i-{input}` (plain text) or + # `ie-{base64_encoded_input}` (base64). By default, the SDK selects the + # appropriate format based on the input text. To always use base64 + # (`ie-{base64}`), set this parameter to `base64`. To always use plain text + # (`i-{input}`), set it to `plain`. + encoding: nil, + # Control styling of the text overlay. See + # [Text overlays](https://imagekit.io/docs/add-overlays-on-images#text-overlay). + transformation: nil, + type: :text + ) + end + + sig do + override.returns( + { + text: String, + type: Symbol, + encoding: Imagekit::TextOverlay::Encoding::OrSymbol, + transformation: T::Array[Imagekit::TextOverlayTransformation] + } + ) + end + def to_hash + end + + # Text can be included in the layer as either `i-{input}` (plain text) or + # `ie-{base64_encoded_input}` (base64). By default, the SDK selects the + # appropriate format based on the input text. To always use base64 + # (`ie-{base64}`), set this parameter to `base64`. To always use plain text + # (`i-{input}`), set it to `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::TextOverlay::Encoding) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, Imagekit::TextOverlay::Encoding::TaggedSymbol) + PLAIN = T.let(:plain, Imagekit::TextOverlay::Encoding::TaggedSymbol) + BASE64 = T.let(:base64, Imagekit::TextOverlay::Encoding::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::TextOverlay::Encoding::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/imagekit/models/text_overlay_transformation.rbi b/rbi/imagekit/models/text_overlay_transformation.rbi new file mode 100644 index 00000000..a2ea165d --- /dev/null +++ b/rbi/imagekit/models/text_overlay_transformation.rbi @@ -0,0 +1,441 @@ +# typed: strong + +module Imagekit + module Models + class TextOverlayTransformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::TextOverlayTransformation, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the transparency level of the text overlay. Accepts integers from `1` + # to `9`. + sig { returns(T.nilable(Float)) } + attr_reader :alpha + + sig { params(alpha: Float).void } + attr_writer :alpha + + # Specifies the background color of the text overlay. Accepts an RGB hex code, an + # RGBA code, or a color name. + sig { returns(T.nilable(String)) } + attr_reader :background + + sig { params(background: String).void } + attr_writer :background + + # Flip the text overlay horizontally, vertically, or both. + sig do + returns(T.nilable(Imagekit::TextOverlayTransformation::Flip::OrSymbol)) + end + attr_reader :flip + + sig do + params(flip: Imagekit::TextOverlayTransformation::Flip::OrSymbol).void + end + attr_writer :flip + + # Specifies the font color of the overlaid text. Accepts an RGB hex code (e.g., + # `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. + sig { returns(T.nilable(String)) } + attr_reader :font_color + + sig { params(font_color: String).void } + attr_writer :font_color + + # Specifies the font family of the overlaid text. Choose from the supported fonts + # list or use a custom font. See + # [Supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list) + # and + # [Custom font](https://imagekit.io/docs/add-overlays-on-images#change-font-family-in-text-overlay). + sig { returns(T.nilable(String)) } + attr_reader :font_family + + sig { params(font_family: String).void } + attr_writer :font_family + + # Specifies the font size of the overlaid text. Accepts a numeric value or an + # arithmetic expression. + sig do + returns( + T.nilable(Imagekit::TextOverlayTransformation::FontSize::Variants) + ) + end + attr_reader :font_size + + sig do + params( + font_size: Imagekit::TextOverlayTransformation::FontSize::Variants + ).void + end + attr_writer :font_size + + # Specifies the inner alignment of the text when width is more than the text + # length. + sig do + returns( + T.nilable( + Imagekit::TextOverlayTransformation::InnerAlignment::OrSymbol + ) + ) + end + attr_reader :inner_alignment + + sig do + params( + inner_alignment: + Imagekit::TextOverlayTransformation::InnerAlignment::OrSymbol + ).void + end + attr_writer :inner_alignment + + # Specifies the line height of the text overlay. Accepts integer values + # representing line height in points. It can also accept + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) + # such as `bw_mul_0.2`, or `bh_div_20`. + sig do + returns( + T.nilable(Imagekit::TextOverlayTransformation::LineHeight::Variants) + ) + end + attr_reader :line_height + + sig do + params( + line_height: Imagekit::TextOverlayTransformation::LineHeight::Variants + ).void + end + attr_writer :line_height + + # Specifies the padding around the overlaid text. Can be provided as a single + # positive integer or multiple values separated by underscores (following CSS + # shorthand order). Arithmetic expressions are also accepted. + sig do + returns( + T.nilable(Imagekit::TextOverlayTransformation::Padding::Variants) + ) + end + attr_reader :padding + + sig do + params( + padding: Imagekit::TextOverlayTransformation::Padding::Variants + ).void + end + attr_writer :padding + + # Specifies the corner radius of the text overlay. Set to `max` to achieve a + # circular or oval shape. + sig { returns(T.nilable(T.any(Float, Symbol))) } + attr_reader :radius + + sig { params(radius: T.any(Float, Symbol)).void } + attr_writer :radius + + # Specifies the rotation angle of the text overlay. Accepts a numeric value for + # clockwise rotation or a string prefixed with "N" for counter-clockwise rotation. + sig do + returns( + T.nilable(Imagekit::TextOverlayTransformation::Rotation::Variants) + ) + end + attr_reader :rotation + + sig do + params( + rotation: Imagekit::TextOverlayTransformation::Rotation::Variants + ).void + end + attr_writer :rotation + + # Specifies the typography style of the text. Supported values: + # + # - Single styles: `b` (bold), `i` (italic), `strikethrough`. + # - Combinations: Any combination separated by underscores, e.g., `b_i`, + # `b_i_strikethrough`. + sig { returns(T.nilable(String)) } + attr_reader :typography + + sig { params(typography: String).void } + attr_writer :typography + + # Specifies the maximum width (in pixels) of the overlaid text. The text wraps + # automatically, and arithmetic expressions (e.g., `bw_mul_0.2` or `bh_div_2`) are + # supported. Useful when used in conjunction with the `background`. Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + sig do + returns(T.nilable(Imagekit::TextOverlayTransformation::Width::Variants)) + end + attr_reader :width + + sig do + params(width: Imagekit::TextOverlayTransformation::Width::Variants).void + end + attr_writer :width + + sig do + params( + alpha: Float, + background: String, + flip: Imagekit::TextOverlayTransformation::Flip::OrSymbol, + font_color: String, + font_family: String, + font_size: Imagekit::TextOverlayTransformation::FontSize::Variants, + inner_alignment: + Imagekit::TextOverlayTransformation::InnerAlignment::OrSymbol, + line_height: + Imagekit::TextOverlayTransformation::LineHeight::Variants, + padding: Imagekit::TextOverlayTransformation::Padding::Variants, + radius: T.any(Float, Symbol), + rotation: Imagekit::TextOverlayTransformation::Rotation::Variants, + typography: String, + width: Imagekit::TextOverlayTransformation::Width::Variants + ).returns(T.attached_class) + end + def self.new( + # Specifies the transparency level of the text overlay. Accepts integers from `1` + # to `9`. + alpha: nil, + # Specifies the background color of the text overlay. Accepts an RGB hex code, an + # RGBA code, or a color name. + background: nil, + # Flip the text overlay horizontally, vertically, or both. + flip: nil, + # Specifies the font color of the overlaid text. Accepts an RGB hex code (e.g., + # `FF0000`), an RGBA code (e.g., `FFAABB50`), or a color name. + font_color: nil, + # Specifies the font family of the overlaid text. Choose from the supported fonts + # list or use a custom font. See + # [Supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list) + # and + # [Custom font](https://imagekit.io/docs/add-overlays-on-images#change-font-family-in-text-overlay). + font_family: nil, + # Specifies the font size of the overlaid text. Accepts a numeric value or an + # arithmetic expression. + font_size: nil, + # Specifies the inner alignment of the text when width is more than the text + # length. + inner_alignment: nil, + # Specifies the line height of the text overlay. Accepts integer values + # representing line height in points. It can also accept + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) + # such as `bw_mul_0.2`, or `bh_div_20`. + line_height: nil, + # Specifies the padding around the overlaid text. Can be provided as a single + # positive integer or multiple values separated by underscores (following CSS + # shorthand order). Arithmetic expressions are also accepted. + padding: nil, + # Specifies the corner radius of the text overlay. Set to `max` to achieve a + # circular or oval shape. + radius: nil, + # Specifies the rotation angle of the text overlay. Accepts a numeric value for + # clockwise rotation or a string prefixed with "N" for counter-clockwise rotation. + rotation: nil, + # Specifies the typography style of the text. Supported values: + # + # - Single styles: `b` (bold), `i` (italic), `strikethrough`. + # - Combinations: Any combination separated by underscores, e.g., `b_i`, + # `b_i_strikethrough`. + typography: nil, + # Specifies the maximum width (in pixels) of the overlaid text. The text wraps + # automatically, and arithmetic expressions (e.g., `bw_mul_0.2` or `bh_div_2`) are + # supported. Useful when used in conjunction with the `background`. Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + width: nil + ) + end + + sig do + override.returns( + { + alpha: Float, + background: String, + flip: Imagekit::TextOverlayTransformation::Flip::OrSymbol, + font_color: String, + font_family: String, + font_size: Imagekit::TextOverlayTransformation::FontSize::Variants, + inner_alignment: + Imagekit::TextOverlayTransformation::InnerAlignment::OrSymbol, + line_height: + Imagekit::TextOverlayTransformation::LineHeight::Variants, + padding: Imagekit::TextOverlayTransformation::Padding::Variants, + radius: T.any(Float, Symbol), + rotation: Imagekit::TextOverlayTransformation::Rotation::Variants, + typography: String, + width: Imagekit::TextOverlayTransformation::Width::Variants + } + ) + end + def to_hash + end + + # Flip the text overlay horizontally, vertically, or both. + module Flip + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::TextOverlayTransformation::Flip) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + H = T.let(:h, Imagekit::TextOverlayTransformation::Flip::TaggedSymbol) + V = T.let(:v, Imagekit::TextOverlayTransformation::Flip::TaggedSymbol) + H_V = + T.let(:h_v, Imagekit::TextOverlayTransformation::Flip::TaggedSymbol) + V_H = + T.let(:v_h, Imagekit::TextOverlayTransformation::Flip::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::TextOverlayTransformation::Flip::TaggedSymbol] + ) + end + def self.values + end + end + + # Specifies the font size of the overlaid text. Accepts a numeric value or an + # arithmetic expression. + module FontSize + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::TextOverlayTransformation::FontSize::Variants] + ) + end + def self.variants + end + end + + # Specifies the inner alignment of the text when width is more than the text + # length. + module InnerAlignment + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::TextOverlayTransformation::InnerAlignment) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LEFT = + T.let( + :left, + Imagekit::TextOverlayTransformation::InnerAlignment::TaggedSymbol + ) + RIGHT = + T.let( + :right, + Imagekit::TextOverlayTransformation::InnerAlignment::TaggedSymbol + ) + CENTER = + T.let( + :center, + Imagekit::TextOverlayTransformation::InnerAlignment::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::TextOverlayTransformation::InnerAlignment::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Specifies the line height of the text overlay. Accepts integer values + # representing line height in points. It can also accept + # [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) + # such as `bw_mul_0.2`, or `bh_div_20`. + module LineHeight + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::TextOverlayTransformation::LineHeight::Variants] + ) + end + def self.variants + end + end + + # Specifies the padding around the overlaid text. Can be provided as a single + # positive integer or multiple values separated by underscores (following CSS + # shorthand order). Arithmetic expressions are also accepted. + module Padding + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::TextOverlayTransformation::Padding::Variants] + ) + end + def self.variants + end + end + + # Specifies the corner radius of the text overlay. Set to `max` to achieve a + # circular or oval shape. + module Radius + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, Symbol) } + + sig do + override.returns( + T::Array[Imagekit::TextOverlayTransformation::Radius::Variants] + ) + end + def self.variants + end + end + + # Specifies the rotation angle of the text overlay. Accepts a numeric value for + # clockwise rotation or a string prefixed with "N" for counter-clockwise rotation. + module Rotation + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::TextOverlayTransformation::Rotation::Variants] + ) + end + def self.variants + end + end + + # Specifies the maximum width (in pixels) of the overlaid text. The text wraps + # automatically, and arithmetic expressions (e.g., `bw_mul_0.2` or `bh_div_2`) are + # supported. Useful when used in conjunction with the `background`. Learn about + # [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + module Width + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::TextOverlayTransformation::Width::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/transformation.rbi b/rbi/imagekit/models/transformation.rbi new file mode 100644 index 00000000..2c0f7137 --- /dev/null +++ b/rbi/imagekit/models/transformation.rbi @@ -0,0 +1,1600 @@ +# typed: strong + +module Imagekit + module Models + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::Transformation, Imagekit::Internal::AnyHash) + end + + # Uses AI to change the background. Provide a text prompt or a base64-encoded + # prompt, e.g., `prompt-snow road` or `prompte-[urlencoded_base64_encoded_text]`. + # Not supported inside overlay. See + # [AI Change Background](https://imagekit.io/docs/ai-transformations#change-background-e-changebg). + sig { returns(T.nilable(String)) } + attr_reader :ai_change_background + + sig { params(ai_change_background: String).void } + attr_writer :ai_change_background + + # Adds an AI-based drop shadow around a foreground object on a transparent or + # removed background. Optionally, control the direction, elevation, and saturation + # of the light source (e.g., `az-45` to change light direction). Pass `true` for + # the default drop shadow, or provide a string for a custom drop shadow. Supported + # inside overlay. See + # [AI Drop Shadow](https://imagekit.io/docs/ai-transformations#ai-drop-shadow-e-dropshadow). + sig { returns(T.nilable(T.any(T::Boolean, String))) } + attr_reader :ai_drop_shadow + + sig { params(ai_drop_shadow: T.any(T::Boolean, String)).void } + attr_writer :ai_drop_shadow + + # Uses AI to edit images based on a text prompt. Provide a text prompt or a + # base64-encoded prompt, e.g., `prompt-snow road` or + # `prompte-[urlencoded_base64_encoded_text]`. Not supported inside overlay. + # See [AI Edit](https://imagekit.io/docs/ai-transformations#edit-image-e-edit). + sig { returns(T.nilable(String)) } + attr_reader :ai_edit + + sig { params(ai_edit: String).void } + attr_writer :ai_edit + + # Applies ImageKit's in-house background removal. Supported inside overlay. See + # [AI Background Removal](https://imagekit.io/docs/ai-transformations#imagekit-background-removal-e-bgremove). + sig do + returns( + T.nilable(Imagekit::Transformation::AIRemoveBackground::OrBoolean) + ) + end + attr_reader :ai_remove_background + + sig do + params( + ai_remove_background: + Imagekit::Transformation::AIRemoveBackground::OrBoolean + ).void + end + attr_writer :ai_remove_background + + # Uses third-party background removal. Note: It is recommended to use + # aiRemoveBackground, ImageKit's in-house solution, which is more cost-effective. + # Supported inside overlay. See + # [External Background Removal](https://imagekit.io/docs/ai-transformations#background-removal-e-removedotbg). + sig do + returns( + T.nilable( + Imagekit::Transformation::AIRemoveBackgroundExternal::OrBoolean + ) + ) + end + attr_reader :ai_remove_background_external + + sig do + params( + ai_remove_background_external: + Imagekit::Transformation::AIRemoveBackgroundExternal::OrBoolean + ).void + end + attr_writer :ai_remove_background_external + + # Performs AI-based retouching to improve faces or product shots. Not supported + # inside overlay. See + # [AI Retouch](https://imagekit.io/docs/ai-transformations#retouch-e-retouch). + sig { returns(T.nilable(Imagekit::Transformation::AIRetouch::OrBoolean)) } + attr_reader :ai_retouch + + sig do + params(ai_retouch: Imagekit::Transformation::AIRetouch::OrBoolean).void + end + attr_writer :ai_retouch + + # Upscales images beyond their original dimensions using AI. Not supported inside + # overlay. See + # [AI Upscale](https://imagekit.io/docs/ai-transformations#upscale-e-upscale). + sig { returns(T.nilable(Imagekit::Transformation::AIUpscale::OrBoolean)) } + attr_reader :ai_upscale + + sig do + params(ai_upscale: Imagekit::Transformation::AIUpscale::OrBoolean).void + end + attr_writer :ai_upscale + + # Generates a variation of an image using AI. This produces a new image with + # slight variations from the original, such as changes in color, texture, and + # other visual elements, while preserving the structure and essence of the + # original image. Not supported inside overlay. See + # [AI Generate Variations](https://imagekit.io/docs/ai-transformations#generate-variations-of-an-image-e-genvar). + sig do + returns(T.nilable(Imagekit::Transformation::AIVariation::OrBoolean)) + end + attr_reader :ai_variation + + sig do + params( + ai_variation: Imagekit::Transformation::AIVariation::OrBoolean + ).void + end + attr_writer :ai_variation + + # Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with + # either width or height (but not both). For example: aspectRatio = `4:3`, `4_3`, + # or an expression like `iar_div_2`. See + # [Image resize and crop – Aspect ratio](https://imagekit.io/docs/image-resize-and-crop#aspect-ratio---ar). + sig do + returns(T.nilable(Imagekit::Transformation::AspectRatio::Variants)) + end + attr_reader :aspect_ratio + + sig do + params( + aspect_ratio: Imagekit::Transformation::AspectRatio::Variants + ).void + end + attr_writer :aspect_ratio + + # Specifies the audio codec, e.g., `aac`, `opus`, or `none`. See + # [Audio codec](https://imagekit.io/docs/video-optimization#audio-codec---ac). + sig { returns(T.nilable(Imagekit::Transformation::AudioCodec::OrSymbol)) } + attr_reader :audio_codec + + sig do + params(audio_codec: Imagekit::Transformation::AudioCodec::OrSymbol).void + end + attr_writer :audio_codec + + # Specifies the background to be used in conjunction with certain cropping + # strategies when resizing an image. + # + # - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See + # [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background). + # - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See + # [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background). + # - Expand the image boundaries using generative fill: `genfill`. Not supported + # inside overlay. Optionally, control the background scene by passing a text + # prompt: `genfill[:-prompt-${text}]` or + # `genfill[:-prompte-${urlencoded_base64_encoded_text}]`. See + # [Generative fill background](https://imagekit.io/docs/ai-transformations#generative-fill-bg-genfill). + sig { returns(T.nilable(String)) } + attr_reader :background + + sig { params(background: String).void } + attr_writer :background + + # Specifies the Gaussian blur level. Accepts an integer value between 1 and 100, + # or an expression like `bl-10`. See + # [Blur](https://imagekit.io/docs/effects-and-enhancements#blur---bl). + sig { returns(T.nilable(Float)) } + attr_reader :blur + + sig { params(blur: Float).void } + attr_writer :blur + + # Adds a border to the output media. Accepts a string in the format + # `_` (e.g., `5_FFF000` for a 5px yellow border), or an + # expression like `ih_div_20_FF00FF`. See + # [Border](https://imagekit.io/docs/effects-and-enhancements#border---b). + sig { returns(T.nilable(String)) } + attr_reader :border + + sig { params(border: String).void } + attr_writer :border + + # Indicates whether the output image should retain the original color profile. See + # [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :color_profile + + sig { params(color_profile: T::Boolean).void } + attr_writer :color_profile + + # Automatically enhances the contrast of an image (contrast stretch). See + # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). + sig do + returns(T.nilable(Imagekit::Transformation::ContrastStretch::OrBoolean)) + end + attr_reader :contrast_stretch + + sig do + params( + contrast_stretch: Imagekit::Transformation::ContrastStretch::OrBoolean + ).void + end + attr_writer :contrast_stretch + + # Crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + sig { returns(T.nilable(Imagekit::Transformation::Crop::OrSymbol)) } + attr_reader :crop + + sig { params(crop: Imagekit::Transformation::Crop::OrSymbol).void } + attr_writer :crop + + # Additional crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + sig { returns(T.nilable(Imagekit::Transformation::CropMode::OrSymbol)) } + attr_reader :crop_mode + + sig do + params(crop_mode: Imagekit::Transformation::CropMode::OrSymbol).void + end + attr_writer :crop_mode + + # Specifies a fallback image if the resource is not found, e.g., a URL or file + # path. See + # [Default image](https://imagekit.io/docs/image-transformation#default-image---di). + sig { returns(T.nilable(String)) } + attr_reader :default_image + + sig { params(default_image: String).void } + attr_writer :default_image + + # Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio + # (DPR) calculation. See + # [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). + sig { returns(T.nilable(Float)) } + attr_reader :dpr + + sig { params(dpr: Float).void } + attr_writer :dpr + + # Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to indicate the length from the start offset. + # Arithmetic expressions are supported. See + # [Trim videos – Duration](https://imagekit.io/docs/trim-videos#duration---du). + sig { returns(T.nilable(Imagekit::Transformation::Duration::Variants)) } + attr_reader :duration + + sig do + params(duration: Imagekit::Transformation::Duration::Variants).void + end + attr_writer :duration + + # Specifies the end offset (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to define a time window. Arithmetic expressions + # are supported. See + # [Trim videos – End offset](https://imagekit.io/docs/trim-videos#end-offset---eo). + sig { returns(T.nilable(Imagekit::Transformation::EndOffset::Variants)) } + attr_reader :end_offset + + sig do + params(end_offset: Imagekit::Transformation::EndOffset::Variants).void + end + attr_writer :end_offset + + # Flips or mirrors an image either horizontally, vertically, or both. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. See [Flip](https://imagekit.io/docs/effects-and-enhancements#flip---fl). + sig { returns(T.nilable(Imagekit::Transformation::Flip::OrSymbol)) } + attr_reader :flip + + sig { params(flip: Imagekit::Transformation::Flip::OrSymbol).void } + attr_writer :flip + + # Refines padding and cropping behavior for pad resize, maintain ratio, and + # extract crop modes. Supports manual positions and coordinate-based focus. With + # AI-based cropping, you can automatically keep key subjects in frame—such as + # faces or detected objects (e.g., `fo-face`, `fo-person`, `fo-car`)— while + # resizing. + # + # - See [Focus](https://imagekit.io/docs/image-resize-and-crop#focus---fo). + # - [Object aware cropping](https://imagekit.io/docs/image-resize-and-crop#object-aware-cropping---fo-object-name) + sig { returns(T.nilable(String)) } + attr_reader :focus + + sig { params(focus: String).void } + attr_writer :focus + + # Specifies the output format for images or videos, e.g., `jpg`, `png`, `webp`, + # `mp4`, or `auto`. You can also pass `orig` for images to return the original + # format. ImageKit automatically delivers images and videos in the optimal format + # based on device support unless overridden by the dashboard settings or the + # format parameter. See + # [Image format](https://imagekit.io/docs/image-optimization#format---f) and + # [Video format](https://imagekit.io/docs/video-optimization#format---f). + sig { returns(T.nilable(Imagekit::Transformation::Format::OrSymbol)) } + attr_reader :format_ + + sig { params(format_: Imagekit::Transformation::Format::OrSymbol).void } + attr_writer :format_ + + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. See + # [Gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + sig { returns(T.nilable(T.any(T::Boolean, String))) } + attr_reader :gradient + + sig { params(gradient: T.any(T::Boolean, String)).void } + attr_writer :gradient + + # Enables a grayscale effect for images. See + # [Grayscale](https://imagekit.io/docs/effects-and-enhancements#grayscale---e-grayscale). + sig { returns(T.nilable(Imagekit::Transformation::Grayscale::OrBoolean)) } + attr_reader :grayscale + + sig do + params(grayscale: Imagekit::Transformation::Grayscale::OrBoolean).void + end + attr_writer :grayscale + + # Specifies the height of the output. If a value between 0 and 1 is provided, it + # is treated as a percentage (e.g., `0.5` represents 50% of the original height). + # You can also supply arithmetic expressions (e.g., `ih_mul_0.5`). Height + # transformation – + # [Images](https://imagekit.io/docs/image-resize-and-crop#height---h) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#height---h) + sig { returns(T.nilable(Imagekit::Transformation::Height::Variants)) } + attr_reader :height + + sig { params(height: Imagekit::Transformation::Height::Variants).void } + attr_writer :height + + # Specifies whether the output image (in JPEG or PNG) should be compressed + # losslessly. See + # [Lossless compression](https://imagekit.io/docs/image-optimization#lossless-webp-and-png---lo). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :lossless + + sig { params(lossless: T::Boolean).void } + attr_writer :lossless + + # By default, ImageKit removes all metadata during automatic image compression. + # Set this to true to preserve metadata. See + # [Image metadata](https://imagekit.io/docs/image-optimization#image-metadata---md). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :metadata + + sig { params(metadata: T::Boolean).void } + attr_writer :metadata + + # Named transformation reference. See + # [Named transformations](https://imagekit.io/docs/transformations#named-transformations). + sig { returns(T.nilable(String)) } + attr_reader :named + + sig { params(named: String).void } + attr_writer :named + + # Specifies the opacity level of the output image. See + # [Opacity](https://imagekit.io/docs/effects-and-enhancements#opacity---o). + sig { returns(T.nilable(Float)) } + attr_reader :opacity + + sig { params(opacity: Float).void } + attr_writer :opacity + + # If set to true, serves the original file without applying any transformations. + # See + # [Deliver original file as-is](https://imagekit.io/docs/core-delivery-features#deliver-original-file-as-is---orig-true). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :original + + sig { params(original: T::Boolean).void } + attr_writer :original + + # Specifies an overlay to be applied on the parent image or video. ImageKit + # supports overlays including images, text, videos, subtitles, and solid colors. + # See + # [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers). + sig { returns(T.nilable(Imagekit::Overlay)) } + attr_reader :overlay + + sig { params(overlay: Imagekit::Overlay).void } + attr_writer :overlay + + # Extracts a specific page or frame from multi-page or layered files (PDF, PSD, + # AI). For example, specify by number (e.g., `2`), a range (e.g., `3-4` for the + # 2nd and 3rd layers), or by name (e.g., `name-layer-4` for a PSD layer). See + # [Thumbnail extraction](https://imagekit.io/docs/vector-and-animated-images#get-thumbnail-from-psd-pdf-ai-eps-and-animated-files). + sig { returns(T.nilable(Imagekit::Transformation::Page::Variants)) } + attr_reader :page + + sig { params(page: Imagekit::Transformation::Page::Variants).void } + attr_writer :page + + # Specifies whether the output JPEG image should be rendered progressively. + # Progressive loading begins with a low-quality, pixelated version of the full + # image, which gradually improves to provide a faster perceived load time. See + # [Progressive images](https://imagekit.io/docs/image-optimization#progressive-image---pr). + sig { returns(T.nilable(T::Boolean)) } + attr_reader :progressive + + sig { params(progressive: T::Boolean).void } + attr_writer :progressive + + # Specifies the quality of the output image for lossy formats such as JPEG, WebP, + # and AVIF. A higher quality value results in a larger file size with better + # quality, while a lower value produces a smaller file size with reduced quality. + # See [Quality](https://imagekit.io/docs/image-optimization#quality---q). + sig { returns(T.nilable(Float)) } + attr_reader :quality + + sig { params(quality: Float).void } + attr_writer :quality + + # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular + # or oval shape. See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + sig { returns(T.nilable(T.any(Float, Symbol))) } + attr_reader :radius + + sig { params(radius: T.any(Float, Symbol)).void } + attr_writer :radius + + # Pass any transformation not directly supported by the SDK. This transformation + # string is appended to the URL as provided. + sig { returns(T.nilable(String)) } + attr_reader :raw + + sig { params(raw: String).void } + attr_writer :raw + + # Specifies the rotation angle in degrees. Positive values rotate the image + # clockwise; you can also use, for example, `N40` for counterclockwise rotation or + # `auto` to use the orientation specified in the image's EXIF data. For videos, + # only the following values are supported: 0, 90, 180, 270, or 360. See + # [Rotate](https://imagekit.io/docs/effects-and-enhancements#rotate---rt). + sig { returns(T.nilable(Imagekit::Transformation::Rotation::Variants)) } + attr_reader :rotation + + sig do + params(rotation: Imagekit::Transformation::Rotation::Variants).void + end + attr_writer :rotation + + # Adds a shadow beneath solid objects in an image with a transparent background. + # For AI-based drop shadows, refer to aiDropShadow. Pass `true` for a default + # shadow, or provide a string for a custom shadow. See + # [Shadow](https://imagekit.io/docs/effects-and-enhancements#shadow---e-shadow). + sig { returns(T.nilable(T.any(T::Boolean, String))) } + attr_reader :shadow + + sig { params(shadow: T.any(T::Boolean, String)).void } + attr_writer :shadow + + # Sharpens the input image, highlighting edges and finer details. Pass `true` for + # default sharpening, or provide a numeric value for custom sharpening. See + # [Sharpen](https://imagekit.io/docs/effects-and-enhancements#sharpen---e-sharpen). + sig { returns(T.nilable(T.any(T::Boolean, Float))) } + attr_reader :sharpen + + sig { params(sharpen: T.any(T::Boolean, Float)).void } + attr_writer :sharpen + + # Specifies the start offset (in seconds) for trimming videos, e.g., `5` or + # `10.5`. Arithmetic expressions are also supported. See + # [Trim videos – Start offset](https://imagekit.io/docs/trim-videos#start-offset---so). + sig do + returns(T.nilable(Imagekit::Transformation::StartOffset::Variants)) + end + attr_reader :start_offset + + sig do + params( + start_offset: Imagekit::Transformation::StartOffset::Variants + ).void + end + attr_writer :start_offset + + # An array of resolutions for adaptive bitrate streaming, e.g., [`240`, `360`, + # `480`, `720`, `1080`]. See + # [Adaptive Bitrate Streaming](https://imagekit.io/docs/adaptive-bitrate-streaming). + sig do + returns(T.nilable(T::Array[Imagekit::StreamingResolution::OrSymbol])) + end + attr_reader :streaming_resolutions + + sig do + params( + streaming_resolutions: + T::Array[Imagekit::StreamingResolution::OrSymbol] + ).void + end + attr_writer :streaming_resolutions + + # Useful for images with a solid or nearly solid background and a central object. + # This parameter trims the background, leaving only the central object in the + # output image. See + # [Trim edges](https://imagekit.io/docs/effects-and-enhancements#trim-edges---t). + sig { returns(T.nilable(T.any(T::Boolean, Float))) } + attr_reader :trim + + sig { params(trim: T.any(T::Boolean, Float)).void } + attr_writer :trim + + # Applies Unsharp Masking (USM), an image sharpening technique. Pass `true` for a + # default unsharp mask, or provide a string for a custom unsharp mask. See + # [Unsharp Mask](https://imagekit.io/docs/effects-and-enhancements#unsharp-mask---e-usm). + sig { returns(T.nilable(T.any(T::Boolean, String))) } + attr_reader :unsharp_mask + + sig { params(unsharp_mask: T.any(T::Boolean, String)).void } + attr_writer :unsharp_mask + + # Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. See + # [Video codec](https://imagekit.io/docs/video-optimization#video-codec---vc). + sig { returns(T.nilable(Imagekit::Transformation::VideoCodec::OrSymbol)) } + attr_reader :video_codec + + sig do + params(video_codec: Imagekit::Transformation::VideoCodec::OrSymbol).void + end + attr_writer :video_codec + + # Specifies the width of the output. If a value between 0 and 1 is provided, it is + # treated as a percentage (e.g., `0.4` represents 40% of the original width). You + # can also supply arithmetic expressions (e.g., `iw_div_2`). Width transformation + # – [Images](https://imagekit.io/docs/image-resize-and-crop#width---w) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#width---w) + sig { returns(T.nilable(Imagekit::Transformation::Width::Variants)) } + attr_reader :width + + sig { params(width: Imagekit::Transformation::Width::Variants).void } + attr_writer :width + + # Focus using cropped image coordinates - X coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + sig { returns(T.nilable(Imagekit::Transformation::X::Variants)) } + attr_reader :x + + sig { params(x: Imagekit::Transformation::X::Variants).void } + attr_writer :x + + # Focus using cropped image coordinates - X center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + sig { returns(T.nilable(Imagekit::Transformation::XCenter::Variants)) } + attr_reader :x_center + + sig { params(x_center: Imagekit::Transformation::XCenter::Variants).void } + attr_writer :x_center + + # Focus using cropped image coordinates - Y coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + sig { returns(T.nilable(Imagekit::Transformation::Y::Variants)) } + attr_reader :y_ + + sig { params(y_: Imagekit::Transformation::Y::Variants).void } + attr_writer :y_ + + # Focus using cropped image coordinates - Y center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + sig { returns(T.nilable(Imagekit::Transformation::YCenter::Variants)) } + attr_reader :y_center + + sig { params(y_center: Imagekit::Transformation::YCenter::Variants).void } + attr_writer :y_center + + # Accepts a numeric value that determines how much to zoom in or out of the + # cropped area. It should be used in conjunction with fo-face or fo-. + # See [Zoom](https://imagekit.io/docs/image-resize-and-crop#zoom---z). + sig { returns(T.nilable(Float)) } + attr_reader :zoom + + sig { params(zoom: Float).void } + attr_writer :zoom + + # The SDK provides easy-to-use names for transformations. These names are + # converted to the corresponding transformation string before being added to the + # URL. SDKs are updated regularly to support new transformations. If you want to + # use a transformation that is not supported by the SDK, You can use the `raw` + # parameter to pass the transformation string directly. See the + # [Transformations documentation](https://imagekit.io/docs/transformations). + sig do + params( + ai_change_background: String, + ai_drop_shadow: T.any(T::Boolean, String), + ai_edit: String, + ai_remove_background: + Imagekit::Transformation::AIRemoveBackground::OrBoolean, + ai_remove_background_external: + Imagekit::Transformation::AIRemoveBackgroundExternal::OrBoolean, + ai_retouch: Imagekit::Transformation::AIRetouch::OrBoolean, + ai_upscale: Imagekit::Transformation::AIUpscale::OrBoolean, + ai_variation: Imagekit::Transformation::AIVariation::OrBoolean, + aspect_ratio: Imagekit::Transformation::AspectRatio::Variants, + audio_codec: Imagekit::Transformation::AudioCodec::OrSymbol, + background: String, + blur: Float, + border: String, + color_profile: T::Boolean, + contrast_stretch: + Imagekit::Transformation::ContrastStretch::OrBoolean, + crop: Imagekit::Transformation::Crop::OrSymbol, + crop_mode: Imagekit::Transformation::CropMode::OrSymbol, + default_image: String, + dpr: Float, + duration: Imagekit::Transformation::Duration::Variants, + end_offset: Imagekit::Transformation::EndOffset::Variants, + flip: Imagekit::Transformation::Flip::OrSymbol, + focus: String, + format_: Imagekit::Transformation::Format::OrSymbol, + gradient: T.any(T::Boolean, String), + grayscale: Imagekit::Transformation::Grayscale::OrBoolean, + height: Imagekit::Transformation::Height::Variants, + lossless: T::Boolean, + metadata: T::Boolean, + named: String, + opacity: Float, + original: T::Boolean, + overlay: Imagekit::Overlay, + page: Imagekit::Transformation::Page::Variants, + progressive: T::Boolean, + quality: Float, + radius: T.any(Float, Symbol), + raw: String, + rotation: Imagekit::Transformation::Rotation::Variants, + shadow: T.any(T::Boolean, String), + sharpen: T.any(T::Boolean, Float), + start_offset: Imagekit::Transformation::StartOffset::Variants, + streaming_resolutions: + T::Array[Imagekit::StreamingResolution::OrSymbol], + trim: T.any(T::Boolean, Float), + unsharp_mask: T.any(T::Boolean, String), + video_codec: Imagekit::Transformation::VideoCodec::OrSymbol, + width: Imagekit::Transformation::Width::Variants, + x: Imagekit::Transformation::X::Variants, + x_center: Imagekit::Transformation::XCenter::Variants, + y_: Imagekit::Transformation::Y::Variants, + y_center: Imagekit::Transformation::YCenter::Variants, + zoom: Float + ).returns(T.attached_class) + end + def self.new( + # Uses AI to change the background. Provide a text prompt or a base64-encoded + # prompt, e.g., `prompt-snow road` or `prompte-[urlencoded_base64_encoded_text]`. + # Not supported inside overlay. See + # [AI Change Background](https://imagekit.io/docs/ai-transformations#change-background-e-changebg). + ai_change_background: nil, + # Adds an AI-based drop shadow around a foreground object on a transparent or + # removed background. Optionally, control the direction, elevation, and saturation + # of the light source (e.g., `az-45` to change light direction). Pass `true` for + # the default drop shadow, or provide a string for a custom drop shadow. Supported + # inside overlay. See + # [AI Drop Shadow](https://imagekit.io/docs/ai-transformations#ai-drop-shadow-e-dropshadow). + ai_drop_shadow: nil, + # Uses AI to edit images based on a text prompt. Provide a text prompt or a + # base64-encoded prompt, e.g., `prompt-snow road` or + # `prompte-[urlencoded_base64_encoded_text]`. Not supported inside overlay. + # See [AI Edit](https://imagekit.io/docs/ai-transformations#edit-image-e-edit). + ai_edit: nil, + # Applies ImageKit's in-house background removal. Supported inside overlay. See + # [AI Background Removal](https://imagekit.io/docs/ai-transformations#imagekit-background-removal-e-bgremove). + ai_remove_background: nil, + # Uses third-party background removal. Note: It is recommended to use + # aiRemoveBackground, ImageKit's in-house solution, which is more cost-effective. + # Supported inside overlay. See + # [External Background Removal](https://imagekit.io/docs/ai-transformations#background-removal-e-removedotbg). + ai_remove_background_external: nil, + # Performs AI-based retouching to improve faces or product shots. Not supported + # inside overlay. See + # [AI Retouch](https://imagekit.io/docs/ai-transformations#retouch-e-retouch). + ai_retouch: nil, + # Upscales images beyond their original dimensions using AI. Not supported inside + # overlay. See + # [AI Upscale](https://imagekit.io/docs/ai-transformations#upscale-e-upscale). + ai_upscale: nil, + # Generates a variation of an image using AI. This produces a new image with + # slight variations from the original, such as changes in color, texture, and + # other visual elements, while preserving the structure and essence of the + # original image. Not supported inside overlay. See + # [AI Generate Variations](https://imagekit.io/docs/ai-transformations#generate-variations-of-an-image-e-genvar). + ai_variation: nil, + # Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with + # either width or height (but not both). For example: aspectRatio = `4:3`, `4_3`, + # or an expression like `iar_div_2`. See + # [Image resize and crop – Aspect ratio](https://imagekit.io/docs/image-resize-and-crop#aspect-ratio---ar). + aspect_ratio: nil, + # Specifies the audio codec, e.g., `aac`, `opus`, or `none`. See + # [Audio codec](https://imagekit.io/docs/video-optimization#audio-codec---ac). + audio_codec: nil, + # Specifies the background to be used in conjunction with certain cropping + # strategies when resizing an image. + # + # - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See + # [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background). + # - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See + # [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background). + # - Expand the image boundaries using generative fill: `genfill`. Not supported + # inside overlay. Optionally, control the background scene by passing a text + # prompt: `genfill[:-prompt-${text}]` or + # `genfill[:-prompte-${urlencoded_base64_encoded_text}]`. See + # [Generative fill background](https://imagekit.io/docs/ai-transformations#generative-fill-bg-genfill). + background: nil, + # Specifies the Gaussian blur level. Accepts an integer value between 1 and 100, + # or an expression like `bl-10`. See + # [Blur](https://imagekit.io/docs/effects-and-enhancements#blur---bl). + blur: nil, + # Adds a border to the output media. Accepts a string in the format + # `_` (e.g., `5_FFF000` for a 5px yellow border), or an + # expression like `ih_div_20_FF00FF`. See + # [Border](https://imagekit.io/docs/effects-and-enhancements#border---b). + border: nil, + # Indicates whether the output image should retain the original color profile. See + # [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). + color_profile: nil, + # Automatically enhances the contrast of an image (contrast stretch). See + # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). + contrast_stretch: nil, + # Crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + crop: nil, + # Additional crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + crop_mode: nil, + # Specifies a fallback image if the resource is not found, e.g., a URL or file + # path. See + # [Default image](https://imagekit.io/docs/image-transformation#default-image---di). + default_image: nil, + # Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio + # (DPR) calculation. See + # [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). + dpr: nil, + # Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to indicate the length from the start offset. + # Arithmetic expressions are supported. See + # [Trim videos – Duration](https://imagekit.io/docs/trim-videos#duration---du). + duration: nil, + # Specifies the end offset (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to define a time window. Arithmetic expressions + # are supported. See + # [Trim videos – End offset](https://imagekit.io/docs/trim-videos#end-offset---eo). + end_offset: nil, + # Flips or mirrors an image either horizontally, vertically, or both. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. See [Flip](https://imagekit.io/docs/effects-and-enhancements#flip---fl). + flip: nil, + # Refines padding and cropping behavior for pad resize, maintain ratio, and + # extract crop modes. Supports manual positions and coordinate-based focus. With + # AI-based cropping, you can automatically keep key subjects in frame—such as + # faces or detected objects (e.g., `fo-face`, `fo-person`, `fo-car`)— while + # resizing. + # + # - See [Focus](https://imagekit.io/docs/image-resize-and-crop#focus---fo). + # - [Object aware cropping](https://imagekit.io/docs/image-resize-and-crop#object-aware-cropping---fo-object-name) + focus: nil, + # Specifies the output format for images or videos, e.g., `jpg`, `png`, `webp`, + # `mp4`, or `auto`. You can also pass `orig` for images to return the original + # format. ImageKit automatically delivers images and videos in the optimal format + # based on device support unless overridden by the dashboard settings or the + # format parameter. See + # [Image format](https://imagekit.io/docs/image-optimization#format---f) and + # [Video format](https://imagekit.io/docs/video-optimization#format---f). + format_: nil, + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. See + # [Gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + gradient: nil, + # Enables a grayscale effect for images. See + # [Grayscale](https://imagekit.io/docs/effects-and-enhancements#grayscale---e-grayscale). + grayscale: nil, + # Specifies the height of the output. If a value between 0 and 1 is provided, it + # is treated as a percentage (e.g., `0.5` represents 50% of the original height). + # You can also supply arithmetic expressions (e.g., `ih_mul_0.5`). Height + # transformation – + # [Images](https://imagekit.io/docs/image-resize-and-crop#height---h) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#height---h) + height: nil, + # Specifies whether the output image (in JPEG or PNG) should be compressed + # losslessly. See + # [Lossless compression](https://imagekit.io/docs/image-optimization#lossless-webp-and-png---lo). + lossless: nil, + # By default, ImageKit removes all metadata during automatic image compression. + # Set this to true to preserve metadata. See + # [Image metadata](https://imagekit.io/docs/image-optimization#image-metadata---md). + metadata: nil, + # Named transformation reference. See + # [Named transformations](https://imagekit.io/docs/transformations#named-transformations). + named: nil, + # Specifies the opacity level of the output image. See + # [Opacity](https://imagekit.io/docs/effects-and-enhancements#opacity---o). + opacity: nil, + # If set to true, serves the original file without applying any transformations. + # See + # [Deliver original file as-is](https://imagekit.io/docs/core-delivery-features#deliver-original-file-as-is---orig-true). + original: nil, + # Specifies an overlay to be applied on the parent image or video. ImageKit + # supports overlays including images, text, videos, subtitles, and solid colors. + # See + # [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers). + overlay: nil, + # Extracts a specific page or frame from multi-page or layered files (PDF, PSD, + # AI). For example, specify by number (e.g., `2`), a range (e.g., `3-4` for the + # 2nd and 3rd layers), or by name (e.g., `name-layer-4` for a PSD layer). See + # [Thumbnail extraction](https://imagekit.io/docs/vector-and-animated-images#get-thumbnail-from-psd-pdf-ai-eps-and-animated-files). + page: nil, + # Specifies whether the output JPEG image should be rendered progressively. + # Progressive loading begins with a low-quality, pixelated version of the full + # image, which gradually improves to provide a faster perceived load time. See + # [Progressive images](https://imagekit.io/docs/image-optimization#progressive-image---pr). + progressive: nil, + # Specifies the quality of the output image for lossy formats such as JPEG, WebP, + # and AVIF. A higher quality value results in a larger file size with better + # quality, while a lower value produces a smaller file size with reduced quality. + # See [Quality](https://imagekit.io/docs/image-optimization#quality---q). + quality: nil, + # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular + # or oval shape. See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + radius: nil, + # Pass any transformation not directly supported by the SDK. This transformation + # string is appended to the URL as provided. + raw: nil, + # Specifies the rotation angle in degrees. Positive values rotate the image + # clockwise; you can also use, for example, `N40` for counterclockwise rotation or + # `auto` to use the orientation specified in the image's EXIF data. For videos, + # only the following values are supported: 0, 90, 180, 270, or 360. See + # [Rotate](https://imagekit.io/docs/effects-and-enhancements#rotate---rt). + rotation: nil, + # Adds a shadow beneath solid objects in an image with a transparent background. + # For AI-based drop shadows, refer to aiDropShadow. Pass `true` for a default + # shadow, or provide a string for a custom shadow. See + # [Shadow](https://imagekit.io/docs/effects-and-enhancements#shadow---e-shadow). + shadow: nil, + # Sharpens the input image, highlighting edges and finer details. Pass `true` for + # default sharpening, or provide a numeric value for custom sharpening. See + # [Sharpen](https://imagekit.io/docs/effects-and-enhancements#sharpen---e-sharpen). + sharpen: nil, + # Specifies the start offset (in seconds) for trimming videos, e.g., `5` or + # `10.5`. Arithmetic expressions are also supported. See + # [Trim videos – Start offset](https://imagekit.io/docs/trim-videos#start-offset---so). + start_offset: nil, + # An array of resolutions for adaptive bitrate streaming, e.g., [`240`, `360`, + # `480`, `720`, `1080`]. See + # [Adaptive Bitrate Streaming](https://imagekit.io/docs/adaptive-bitrate-streaming). + streaming_resolutions: nil, + # Useful for images with a solid or nearly solid background and a central object. + # This parameter trims the background, leaving only the central object in the + # output image. See + # [Trim edges](https://imagekit.io/docs/effects-and-enhancements#trim-edges---t). + trim: nil, + # Applies Unsharp Masking (USM), an image sharpening technique. Pass `true` for a + # default unsharp mask, or provide a string for a custom unsharp mask. See + # [Unsharp Mask](https://imagekit.io/docs/effects-and-enhancements#unsharp-mask---e-usm). + unsharp_mask: nil, + # Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. See + # [Video codec](https://imagekit.io/docs/video-optimization#video-codec---vc). + video_codec: nil, + # Specifies the width of the output. If a value between 0 and 1 is provided, it is + # treated as a percentage (e.g., `0.4` represents 40% of the original width). You + # can also supply arithmetic expressions (e.g., `iw_div_2`). Width transformation + # – [Images](https://imagekit.io/docs/image-resize-and-crop#width---w) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#width---w) + width: nil, + # Focus using cropped image coordinates - X coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + x: nil, + # Focus using cropped image coordinates - X center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + x_center: nil, + # Focus using cropped image coordinates - Y coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + y_: nil, + # Focus using cropped image coordinates - Y center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + y_center: nil, + # Accepts a numeric value that determines how much to zoom in or out of the + # cropped area. It should be used in conjunction with fo-face or fo-. + # See [Zoom](https://imagekit.io/docs/image-resize-and-crop#zoom---z). + zoom: nil + ) + end + + sig do + override.returns( + { + ai_change_background: String, + ai_drop_shadow: T.any(T::Boolean, String), + ai_edit: String, + ai_remove_background: + Imagekit::Transformation::AIRemoveBackground::OrBoolean, + ai_remove_background_external: + Imagekit::Transformation::AIRemoveBackgroundExternal::OrBoolean, + ai_retouch: Imagekit::Transformation::AIRetouch::OrBoolean, + ai_upscale: Imagekit::Transformation::AIUpscale::OrBoolean, + ai_variation: Imagekit::Transformation::AIVariation::OrBoolean, + aspect_ratio: Imagekit::Transformation::AspectRatio::Variants, + audio_codec: Imagekit::Transformation::AudioCodec::OrSymbol, + background: String, + blur: Float, + border: String, + color_profile: T::Boolean, + contrast_stretch: + Imagekit::Transformation::ContrastStretch::OrBoolean, + crop: Imagekit::Transformation::Crop::OrSymbol, + crop_mode: Imagekit::Transformation::CropMode::OrSymbol, + default_image: String, + dpr: Float, + duration: Imagekit::Transformation::Duration::Variants, + end_offset: Imagekit::Transformation::EndOffset::Variants, + flip: Imagekit::Transformation::Flip::OrSymbol, + focus: String, + format_: Imagekit::Transformation::Format::OrSymbol, + gradient: T.any(T::Boolean, String), + grayscale: Imagekit::Transformation::Grayscale::OrBoolean, + height: Imagekit::Transformation::Height::Variants, + lossless: T::Boolean, + metadata: T::Boolean, + named: String, + opacity: Float, + original: T::Boolean, + overlay: Imagekit::Overlay, + page: Imagekit::Transformation::Page::Variants, + progressive: T::Boolean, + quality: Float, + radius: T.any(Float, Symbol), + raw: String, + rotation: Imagekit::Transformation::Rotation::Variants, + shadow: T.any(T::Boolean, String), + sharpen: T.any(T::Boolean, Float), + start_offset: Imagekit::Transformation::StartOffset::Variants, + streaming_resolutions: + T::Array[Imagekit::StreamingResolution::OrSymbol], + trim: T.any(T::Boolean, Float), + unsharp_mask: T.any(T::Boolean, String), + video_codec: Imagekit::Transformation::VideoCodec::OrSymbol, + width: Imagekit::Transformation::Width::Variants, + x: Imagekit::Transformation::X::Variants, + x_center: Imagekit::Transformation::XCenter::Variants, + y_: Imagekit::Transformation::Y::Variants, + y_center: Imagekit::Transformation::YCenter::Variants, + zoom: Float + } + ) + end + def to_hash + end + + # Adds an AI-based drop shadow around a foreground object on a transparent or + # removed background. Optionally, control the direction, elevation, and saturation + # of the light source (e.g., `az-45` to change light direction). Pass `true` for + # the default drop shadow, or provide a string for a custom drop shadow. Supported + # inside overlay. See + # [AI Drop Shadow](https://imagekit.io/docs/ai-transformations#ai-drop-shadow-e-dropshadow). + module AIDropShadow + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Boolean, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::AIDropShadow::Variants] + ) + end + def self.variants + end + end + + # Applies ImageKit's in-house background removal. Supported inside overlay. See + # [AI Background Removal](https://imagekit.io/docs/ai-transformations#imagekit-background-removal-e-bgremove). + module AIRemoveBackground + extend Imagekit::Internal::Type::Enum + + TaggedBoolean = + T.type_alias do + T.all(T::Boolean, Imagekit::Transformation::AIRemoveBackground) + end + OrBoolean = T.type_alias { T::Boolean } + + TRUE = + T.let( + true, + Imagekit::Transformation::AIRemoveBackground::TaggedBoolean + ) + + sig do + override.returns( + T::Array[ + Imagekit::Transformation::AIRemoveBackground::TaggedBoolean + ] + ) + end + def self.values + end + end + + # Uses third-party background removal. Note: It is recommended to use + # aiRemoveBackground, ImageKit's in-house solution, which is more cost-effective. + # Supported inside overlay. See + # [External Background Removal](https://imagekit.io/docs/ai-transformations#background-removal-e-removedotbg). + module AIRemoveBackgroundExternal + extend Imagekit::Internal::Type::Enum + + TaggedBoolean = + T.type_alias do + T.all( + T::Boolean, + Imagekit::Transformation::AIRemoveBackgroundExternal + ) + end + OrBoolean = T.type_alias { T::Boolean } + + TRUE = + T.let( + true, + Imagekit::Transformation::AIRemoveBackgroundExternal::TaggedBoolean + ) + + sig do + override.returns( + T::Array[ + Imagekit::Transformation::AIRemoveBackgroundExternal::TaggedBoolean + ] + ) + end + def self.values + end + end + + # Performs AI-based retouching to improve faces or product shots. Not supported + # inside overlay. See + # [AI Retouch](https://imagekit.io/docs/ai-transformations#retouch-e-retouch). + module AIRetouch + extend Imagekit::Internal::Type::Enum + + TaggedBoolean = + T.type_alias do + T.all(T::Boolean, Imagekit::Transformation::AIRetouch) + end + OrBoolean = T.type_alias { T::Boolean } + + TRUE = T.let(true, Imagekit::Transformation::AIRetouch::TaggedBoolean) + + sig do + override.returns( + T::Array[Imagekit::Transformation::AIRetouch::TaggedBoolean] + ) + end + def self.values + end + end + + # Upscales images beyond their original dimensions using AI. Not supported inside + # overlay. See + # [AI Upscale](https://imagekit.io/docs/ai-transformations#upscale-e-upscale). + module AIUpscale + extend Imagekit::Internal::Type::Enum + + TaggedBoolean = + T.type_alias do + T.all(T::Boolean, Imagekit::Transformation::AIUpscale) + end + OrBoolean = T.type_alias { T::Boolean } + + TRUE = T.let(true, Imagekit::Transformation::AIUpscale::TaggedBoolean) + + sig do + override.returns( + T::Array[Imagekit::Transformation::AIUpscale::TaggedBoolean] + ) + end + def self.values + end + end + + # Generates a variation of an image using AI. This produces a new image with + # slight variations from the original, such as changes in color, texture, and + # other visual elements, while preserving the structure and essence of the + # original image. Not supported inside overlay. See + # [AI Generate Variations](https://imagekit.io/docs/ai-transformations#generate-variations-of-an-image-e-genvar). + module AIVariation + extend Imagekit::Internal::Type::Enum + + TaggedBoolean = + T.type_alias do + T.all(T::Boolean, Imagekit::Transformation::AIVariation) + end + OrBoolean = T.type_alias { T::Boolean } + + TRUE = T.let(true, Imagekit::Transformation::AIVariation::TaggedBoolean) + + sig do + override.returns( + T::Array[Imagekit::Transformation::AIVariation::TaggedBoolean] + ) + end + def self.values + end + end + + # Specifies the aspect ratio for the output, e.g., "ar-4-3". Typically used with + # either width or height (but not both). For example: aspectRatio = `4:3`, `4_3`, + # or an expression like `iar_div_2`. See + # [Image resize and crop – Aspect ratio](https://imagekit.io/docs/image-resize-and-crop#aspect-ratio---ar). + module AspectRatio + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::AspectRatio::Variants] + ) + end + def self.variants + end + end + + # Specifies the audio codec, e.g., `aac`, `opus`, or `none`. See + # [Audio codec](https://imagekit.io/docs/video-optimization#audio-codec---ac). + module AudioCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::Transformation::AudioCodec) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AAC = T.let(:aac, Imagekit::Transformation::AudioCodec::TaggedSymbol) + OPUS = T.let(:opus, Imagekit::Transformation::AudioCodec::TaggedSymbol) + NONE = T.let(:none, Imagekit::Transformation::AudioCodec::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::Transformation::AudioCodec::TaggedSymbol] + ) + end + def self.values + end + end + + # Automatically enhances the contrast of an image (contrast stretch). See + # [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). + module ContrastStretch + extend Imagekit::Internal::Type::Enum + + TaggedBoolean = + T.type_alias do + T.all(T::Boolean, Imagekit::Transformation::ContrastStretch) + end + OrBoolean = T.type_alias { T::Boolean } + + TRUE = + T.let(true, Imagekit::Transformation::ContrastStretch::TaggedBoolean) + + sig do + override.returns( + T::Array[Imagekit::Transformation::ContrastStretch::TaggedBoolean] + ) + end + def self.values + end + end + + # Crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + module Crop + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::Transformation::Crop) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + FORCE = T.let(:force, Imagekit::Transformation::Crop::TaggedSymbol) + AT_MAX = T.let(:at_max, Imagekit::Transformation::Crop::TaggedSymbol) + AT_MAX_ENLARGE = + T.let(:at_max_enlarge, Imagekit::Transformation::Crop::TaggedSymbol) + AT_LEAST = + T.let(:at_least, Imagekit::Transformation::Crop::TaggedSymbol) + MAINTAIN_RATIO = + T.let(:maintain_ratio, Imagekit::Transformation::Crop::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::Transformation::Crop::TaggedSymbol] + ) + end + def self.values + end + end + + # Additional crop modes for image resizing. See + # [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + module CropMode + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::Transformation::CropMode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PAD_RESIZE = + T.let(:pad_resize, Imagekit::Transformation::CropMode::TaggedSymbol) + EXTRACT = + T.let(:extract, Imagekit::Transformation::CropMode::TaggedSymbol) + PAD_EXTRACT = + T.let(:pad_extract, Imagekit::Transformation::CropMode::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::Transformation::CropMode::TaggedSymbol] + ) + end + def self.values + end + end + + # Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to indicate the length from the start offset. + # Arithmetic expressions are supported. See + # [Trim videos – Duration](https://imagekit.io/docs/trim-videos#duration---du). + module Duration + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::Duration::Variants] + ) + end + def self.variants + end + end + + # Specifies the end offset (in seconds) for trimming videos, e.g., `5` or `10.5`. + # Typically used with startOffset to define a time window. Arithmetic expressions + # are supported. See + # [Trim videos – End offset](https://imagekit.io/docs/trim-videos#end-offset---eo). + module EndOffset + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::EndOffset::Variants] + ) + end + def self.variants + end + end + + # Flips or mirrors an image either horizontally, vertically, or both. Acceptable + # values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or + # `v_h`. See [Flip](https://imagekit.io/docs/effects-and-enhancements#flip---fl). + module Flip + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::Transformation::Flip) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + H = T.let(:h, Imagekit::Transformation::Flip::TaggedSymbol) + V = T.let(:v, Imagekit::Transformation::Flip::TaggedSymbol) + H_V = T.let(:h_v, Imagekit::Transformation::Flip::TaggedSymbol) + V_H = T.let(:v_h, Imagekit::Transformation::Flip::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::Transformation::Flip::TaggedSymbol] + ) + end + def self.values + end + end + + # Specifies the output format for images or videos, e.g., `jpg`, `png`, `webp`, + # `mp4`, or `auto`. You can also pass `orig` for images to return the original + # format. ImageKit automatically delivers images and videos in the optimal format + # based on device support unless overridden by the dashboard settings or the + # format parameter. See + # [Image format](https://imagekit.io/docs/image-optimization#format---f) and + # [Video format](https://imagekit.io/docs/video-optimization#format---f). + module Format + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::Transformation::Format) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, Imagekit::Transformation::Format::TaggedSymbol) + WEBP = T.let(:webp, Imagekit::Transformation::Format::TaggedSymbol) + JPG = T.let(:jpg, Imagekit::Transformation::Format::TaggedSymbol) + JPEG = T.let(:jpeg, Imagekit::Transformation::Format::TaggedSymbol) + PNG = T.let(:png, Imagekit::Transformation::Format::TaggedSymbol) + GIF = T.let(:gif, Imagekit::Transformation::Format::TaggedSymbol) + SVG = T.let(:svg, Imagekit::Transformation::Format::TaggedSymbol) + MP4 = T.let(:mp4, Imagekit::Transformation::Format::TaggedSymbol) + WEBM = T.let(:webm, Imagekit::Transformation::Format::TaggedSymbol) + AVIF = T.let(:avif, Imagekit::Transformation::Format::TaggedSymbol) + ORIG = T.let(:orig, Imagekit::Transformation::Format::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::Transformation::Format::TaggedSymbol] + ) + end + def self.values + end + end + + # Creates a linear gradient with two colors. Pass `true` for a default gradient, + # or provide a string for a custom gradient. See + # [Gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + module Gradient + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Boolean, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::Gradient::Variants] + ) + end + def self.variants + end + end + + # Enables a grayscale effect for images. See + # [Grayscale](https://imagekit.io/docs/effects-and-enhancements#grayscale---e-grayscale). + module Grayscale + extend Imagekit::Internal::Type::Enum + + TaggedBoolean = + T.type_alias do + T.all(T::Boolean, Imagekit::Transformation::Grayscale) + end + OrBoolean = T.type_alias { T::Boolean } + + TRUE = T.let(true, Imagekit::Transformation::Grayscale::TaggedBoolean) + + sig do + override.returns( + T::Array[Imagekit::Transformation::Grayscale::TaggedBoolean] + ) + end + def self.values + end + end + + # Specifies the height of the output. If a value between 0 and 1 is provided, it + # is treated as a percentage (e.g., `0.5` represents 50% of the original height). + # You can also supply arithmetic expressions (e.g., `ih_mul_0.5`). Height + # transformation – + # [Images](https://imagekit.io/docs/image-resize-and-crop#height---h) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#height---h) + module Height + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::Transformation::Height::Variants]) + end + def self.variants + end + end + + # Extracts a specific page or frame from multi-page or layered files (PDF, PSD, + # AI). For example, specify by number (e.g., `2`), a range (e.g., `3-4` for the + # 2nd and 3rd layers), or by name (e.g., `name-layer-4` for a PSD layer). See + # [Thumbnail extraction](https://imagekit.io/docs/vector-and-animated-images#get-thumbnail-from-psd-pdf-ai-eps-and-animated-files). + module Page + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::Transformation::Page::Variants]) + end + def self.variants + end + end + + # Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular + # or oval shape. See + # [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + module Radius + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, Symbol) } + + sig do + override.returns(T::Array[Imagekit::Transformation::Radius::Variants]) + end + def self.variants + end + end + + # Specifies the rotation angle in degrees. Positive values rotate the image + # clockwise; you can also use, for example, `N40` for counterclockwise rotation or + # `auto` to use the orientation specified in the image's EXIF data. For videos, + # only the following values are supported: 0, 90, 180, 270, or 360. See + # [Rotate](https://imagekit.io/docs/effects-and-enhancements#rotate---rt). + module Rotation + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::Rotation::Variants] + ) + end + def self.variants + end + end + + # Adds a shadow beneath solid objects in an image with a transparent background. + # For AI-based drop shadows, refer to aiDropShadow. Pass `true` for a default + # shadow, or provide a string for a custom shadow. See + # [Shadow](https://imagekit.io/docs/effects-and-enhancements#shadow---e-shadow). + module Shadow + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Boolean, String) } + + sig do + override.returns(T::Array[Imagekit::Transformation::Shadow::Variants]) + end + def self.variants + end + end + + # Sharpens the input image, highlighting edges and finer details. Pass `true` for + # default sharpening, or provide a numeric value for custom sharpening. See + # [Sharpen](https://imagekit.io/docs/effects-and-enhancements#sharpen---e-sharpen). + module Sharpen + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Boolean, Float) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::Sharpen::Variants] + ) + end + def self.variants + end + end + + # Specifies the start offset (in seconds) for trimming videos, e.g., `5` or + # `10.5`. Arithmetic expressions are also supported. See + # [Trim videos – Start offset](https://imagekit.io/docs/trim-videos#start-offset---so). + module StartOffset + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::StartOffset::Variants] + ) + end + def self.variants + end + end + + # Useful for images with a solid or nearly solid background and a central object. + # This parameter trims the background, leaving only the central object in the + # output image. See + # [Trim edges](https://imagekit.io/docs/effects-and-enhancements#trim-edges---t). + module Trim + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Boolean, Float) } + + sig do + override.returns(T::Array[Imagekit::Transformation::Trim::Variants]) + end + def self.variants + end + end + + # Applies Unsharp Masking (USM), an image sharpening technique. Pass `true` for a + # default unsharp mask, or provide a string for a custom unsharp mask. See + # [Unsharp Mask](https://imagekit.io/docs/effects-and-enhancements#unsharp-mask---e-usm). + module UnsharpMask + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Boolean, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::UnsharpMask::Variants] + ) + end + def self.variants + end + end + + # Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. See + # [Video codec](https://imagekit.io/docs/video-optimization#video-codec---vc). + module VideoCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::Transformation::VideoCodec) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + H264 = T.let(:h264, Imagekit::Transformation::VideoCodec::TaggedSymbol) + VP9 = T.let(:vp9, Imagekit::Transformation::VideoCodec::TaggedSymbol) + AV1 = T.let(:av1, Imagekit::Transformation::VideoCodec::TaggedSymbol) + NONE = T.let(:none, Imagekit::Transformation::VideoCodec::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::Transformation::VideoCodec::TaggedSymbol] + ) + end + def self.values + end + end + + # Specifies the width of the output. If a value between 0 and 1 is provided, it is + # treated as a percentage (e.g., `0.4` represents 40% of the original width). You + # can also supply arithmetic expressions (e.g., `iw_div_2`). Width transformation + # – [Images](https://imagekit.io/docs/image-resize-and-crop#width---w) · + # [Videos](https://imagekit.io/docs/video-resize-and-crop#width---w) + module Width + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::Transformation::Width::Variants]) + end + def self.variants + end + end + + # Focus using cropped image coordinates - X coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + module X + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::Transformation::X::Variants]) + end + def self.variants + end + end + + # Focus using cropped image coordinates - X center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + module XCenter + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::XCenter::Variants] + ) + end + def self.variants + end + end + + # Focus using cropped image coordinates - Y coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + module Y + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns(T::Array[Imagekit::Transformation::Y::Variants]) + end + def self.variants + end + end + + # Focus using cropped image coordinates - Y center coordinate. See + # [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + module YCenter + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(Float, String) } + + sig do + override.returns( + T::Array[Imagekit::Transformation::YCenter::Variants] + ) + end + def self.variants + end + end + end + end +end diff --git a/rbi/imagekit/models/transformation_position.rbi b/rbi/imagekit/models/transformation_position.rbi new file mode 100644 index 00000000..603588e6 --- /dev/null +++ b/rbi/imagekit/models/transformation_position.rbi @@ -0,0 +1,28 @@ +# typed: strong + +module Imagekit + module Models + # By default, the transformation string is added as a query parameter in the URL, + # e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the + # path of the URL, set this to `path`. Learn more in the + # [Transformations guide](https://imagekit.io/docs/transformations). + module TransformationPosition + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::TransformationPosition) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PATH = T.let(:path, Imagekit::TransformationPosition::TaggedSymbol) + QUERY = T.let(:query, Imagekit::TransformationPosition::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::TransformationPosition::TaggedSymbol] + ) + end + def self.values + end + end + end +end diff --git a/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi b/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi new file mode 100644 index 00000000..4dbc761c --- /dev/null +++ b/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi @@ -0,0 +1,31 @@ +# typed: strong + +module Imagekit + module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. + module UnsafeUnwrapWebhookEvent + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent, + Imagekit::VideoTransformationReadyEvent, + Imagekit::VideoTransformationErrorEvent, + Imagekit::UploadPreTransformSuccessEvent, + Imagekit::UploadPreTransformErrorEvent, + Imagekit::UploadPostTransformSuccessEvent, + Imagekit::UploadPostTransformErrorEvent + ) + end + + sig do + override.returns(T::Array[Imagekit::UnsafeUnwrapWebhookEvent::Variants]) + end + def self.variants + end + end + end +end diff --git a/rbi/imagekit/models/unwrap_webhook_event.rbi b/rbi/imagekit/models/unwrap_webhook_event.rbi new file mode 100644 index 00000000..b94a7e27 --- /dev/null +++ b/rbi/imagekit/models/unwrap_webhook_event.rbi @@ -0,0 +1,29 @@ +# typed: strong + +module Imagekit + module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. + module UnwrapWebhookEvent + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent, + Imagekit::VideoTransformationReadyEvent, + Imagekit::VideoTransformationErrorEvent, + Imagekit::UploadPreTransformSuccessEvent, + Imagekit::UploadPreTransformErrorEvent, + Imagekit::UploadPostTransformSuccessEvent, + Imagekit::UploadPostTransformErrorEvent + ) + end + + sig { override.returns(T::Array[Imagekit::UnwrapWebhookEvent::Variants]) } + def self.variants + end + end + end +end diff --git a/rbi/imagekit/models/upload_post_transform_error_event.rbi b/rbi/imagekit/models/upload_post_transform_error_event.rbi new file mode 100644 index 00000000..a2fd2772 --- /dev/null +++ b/rbi/imagekit/models/upload_post_transform_error_event.rbi @@ -0,0 +1,438 @@ +# typed: strong + +module Imagekit + module Models + class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformErrorEvent, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekit::UploadPostTransformErrorEvent::Data) } + attr_reader :data + + sig do + params(data: Imagekit::UploadPostTransformErrorEvent::Data::OrHash).void + end + attr_writer :data + + sig { returns(Imagekit::UploadPostTransformErrorEvent::Request) } + attr_reader :request + + sig do + params( + request: Imagekit::UploadPostTransformErrorEvent::Request::OrHash + ).void + end + attr_writer :request + + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a post-transformation fails. The original file remains available, + # but the requested transformation could not be generated. + sig do + params( + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformErrorEvent::Data::OrHash, + request: Imagekit::UploadPostTransformErrorEvent::Request::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the event. + id:, + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + data:, + request:, + type: :"upload.post-transform.error" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformErrorEvent::Data, + request: Imagekit::UploadPostTransformErrorEvent::Request, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformErrorEvent::Data, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the originally uploaded file. + sig { returns(String) } + attr_accessor :file_id + + # Name of the file. + sig { returns(String) } + attr_accessor :name + + # Path of the file. + sig { returns(String) } + attr_accessor :path + + sig do + returns(Imagekit::UploadPostTransformErrorEvent::Data::Transformation) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::UploadPostTransformErrorEvent::Data::Transformation::OrHash + ).void + end + attr_writer :transformation + + # URL of the attempted post-transformation. + sig { returns(String) } + attr_accessor :url + + sig do + params( + file_id: String, + name: String, + path: String, + transformation: + Imagekit::UploadPostTransformErrorEvent::Data::Transformation::OrHash, + url: String + ).returns(T.attached_class) + end + def self.new( + # Unique identifier of the originally uploaded file. + file_id:, + # Name of the file. + name:, + # Path of the file. + path:, + transformation:, + # URL of the attempted post-transformation. + url: + ) + end + + sig do + override.returns( + { + file_id: String, + name: String, + path: String, + transformation: + Imagekit::UploadPostTransformErrorEvent::Data::Transformation, + url: String + } + ) + end + def to_hash + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformErrorEvent::Data::Transformation, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error + ) + end + attr_reader :error + + sig do + params( + error: + Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error::OrHash + ).void + end + attr_writer :error + + sig do + params( + error: + Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error::OrHash + ).returns(T.attached_class) + end + def self.new(error:) + end + + sig do + override.returns( + { + error: + Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error + } + ) + end + def to_hash + end + + class Error < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error, + Imagekit::Internal::AnyHash + ) + end + + # Reason for the post-transformation failure. + sig { returns(String) } + attr_accessor :reason + + sig { params(reason: String).returns(T.attached_class) } + def self.new( + # Reason for the post-transformation failure. + reason: + ) + end + + sig { override.returns({ reason: String }) } + def to_hash + end + end + end + end + + class Request < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformErrorEvent::Request, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + Imagekit::UploadPostTransformErrorEvent::Request::Transformation + ) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::OrHash + ).void + end + attr_writer :transformation + + # Unique identifier for the originating request. + sig { returns(String) } + attr_accessor :x_request_id + + sig do + params( + transformation: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::OrHash, + x_request_id: String + ).returns(T.attached_class) + end + def self.new( + transformation:, + # Unique identifier for the originating request. + x_request_id: + ) + end + + sig do + override.returns( + { + transformation: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation, + x_request_id: String + } + ) + end + def to_hash + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformErrorEvent::Request::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # Type of the requested post-transformation. + sig do + returns( + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::TaggedSymbol + ) + end + attr_accessor :type + + # Only applicable if transformation type is 'abs'. Streaming protocol used. + sig do + returns( + T.nilable( + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol::TaggedSymbol + ) + ) + end + attr_reader :protocol + + sig do + params( + protocol: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol::OrSymbol + ).void + end + attr_writer :protocol + + # Value for the requested transformation type. + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig do + params( + type: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::OrSymbol, + protocol: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol::OrSymbol, + value: String + ).returns(T.attached_class) + end + def self.new( + # Type of the requested post-transformation. + type:, + # Only applicable if transformation type is 'abs'. Streaming protocol used. + protocol: nil, + # Value for the requested transformation type. + value: nil + ) + end + + sig do + override.returns( + { + type: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::TaggedSymbol, + protocol: + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol::TaggedSymbol, + value: String + } + ) + end + def to_hash + end + + # Type of the requested post-transformation. + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSFORMATION = + T.let( + :transformation, + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::TaggedSymbol + ) + ABS = + T.let( + :abs, + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::TaggedSymbol + ) + GIF_TO_VIDEO = + T.let( + :"gif-to-video", + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::TaggedSymbol + ) + THUMBNAIL = + T.let( + :thumbnail, + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Only applicable if transformation type is 'abs'. Streaming protocol used. + module Protocol + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HLS = + T.let( + :hls, + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol::TaggedSymbol + ) + DASH = + T.let( + :dash, + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPostTransformErrorEvent::Request::Transformation::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end + end +end diff --git a/rbi/imagekit/models/upload_post_transform_success_event.rbi b/rbi/imagekit/models/upload_post_transform_success_event.rbi new file mode 100644 index 00000000..189c4ad9 --- /dev/null +++ b/rbi/imagekit/models/upload_post_transform_success_event.rbi @@ -0,0 +1,335 @@ +# typed: strong + +module Imagekit + module Models + class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformSuccessEvent, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekit::UploadPostTransformSuccessEvent::Data) } + attr_reader :data + + sig do + params( + data: Imagekit::UploadPostTransformSuccessEvent::Data::OrHash + ).void + end + attr_writer :data + + sig { returns(Imagekit::UploadPostTransformSuccessEvent::Request) } + attr_reader :request + + sig do + params( + request: Imagekit::UploadPostTransformSuccessEvent::Request::OrHash + ).void + end + attr_writer :request + + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a post-transformation completes successfully. The transformed + # version of the file is now ready and can be accessed via the provided URL. Note + # that each post-transformation generates a separate webhook event. + sig do + params( + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformSuccessEvent::Data::OrHash, + request: Imagekit::UploadPostTransformSuccessEvent::Request::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the event. + id:, + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + data:, + request:, + type: :"upload.post-transform.success" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformSuccessEvent::Data, + request: Imagekit::UploadPostTransformSuccessEvent::Request, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformSuccessEvent::Data, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier of the originally uploaded file. + sig { returns(String) } + attr_accessor :file_id + + # Name of the file. + sig { returns(String) } + attr_accessor :name + + # URL of the generated post-transformation. + sig { returns(String) } + attr_accessor :url + + sig do + params(file_id: String, name: String, url: String).returns( + T.attached_class + ) + end + def self.new( + # Unique identifier of the originally uploaded file. + file_id:, + # Name of the file. + name:, + # URL of the generated post-transformation. + url: + ) + end + + sig { override.returns({ file_id: String, name: String, url: String }) } + def to_hash + end + end + + class Request < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformSuccessEvent::Request, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation + ) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::OrHash + ).void + end + attr_writer :transformation + + # Unique identifier for the originating request. + sig { returns(String) } + attr_accessor :x_request_id + + sig do + params( + transformation: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::OrHash, + x_request_id: String + ).returns(T.attached_class) + end + def self.new( + transformation:, + # Unique identifier for the originating request. + x_request_id: + ) + end + + sig do + override.returns( + { + transformation: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation, + x_request_id: String + } + ) + end + def to_hash + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # Type of the requested post-transformation. + sig do + returns( + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::TaggedSymbol + ) + end + attr_accessor :type + + # Only applicable if transformation type is 'abs'. Streaming protocol used. + sig do + returns( + T.nilable( + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol::TaggedSymbol + ) + ) + end + attr_reader :protocol + + sig do + params( + protocol: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol::OrSymbol + ).void + end + attr_writer :protocol + + # Value for the requested transformation type. + sig { returns(T.nilable(String)) } + attr_reader :value + + sig { params(value: String).void } + attr_writer :value + + sig do + params( + type: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::OrSymbol, + protocol: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol::OrSymbol, + value: String + ).returns(T.attached_class) + end + def self.new( + # Type of the requested post-transformation. + type:, + # Only applicable if transformation type is 'abs'. Streaming protocol used. + protocol: nil, + # Value for the requested transformation type. + value: nil + ) + end + + sig do + override.returns( + { + type: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::TaggedSymbol, + protocol: + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol::TaggedSymbol, + value: String + } + ) + end + def to_hash + end + + # Type of the requested post-transformation. + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + TRANSFORMATION = + T.let( + :transformation, + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::TaggedSymbol + ) + ABS = + T.let( + :abs, + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::TaggedSymbol + ) + GIF_TO_VIDEO = + T.let( + :"gif-to-video", + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::TaggedSymbol + ) + THUMBNAIL = + T.let( + :thumbnail, + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Only applicable if transformation type is 'abs'. Streaming protocol used. + module Protocol + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HLS = + T.let( + :hls, + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol::TaggedSymbol + ) + DASH = + T.let( + :dash, + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPostTransformSuccessEvent::Request::Transformation::Protocol::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end + end +end diff --git a/rbi/imagekit/models/upload_pre_transform_error_event.rbi b/rbi/imagekit/models/upload_pre_transform_error_event.rbi new file mode 100644 index 00000000..a6338f83 --- /dev/null +++ b/rbi/imagekit/models/upload_pre_transform_error_event.rbi @@ -0,0 +1,248 @@ +# typed: strong + +module Imagekit + module Models + class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformErrorEvent, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekit::UploadPreTransformErrorEvent::Data) } + attr_reader :data + + sig do + params(data: Imagekit::UploadPreTransformErrorEvent::Data::OrHash).void + end + attr_writer :data + + sig { returns(Imagekit::UploadPreTransformErrorEvent::Request) } + attr_reader :request + + sig do + params( + request: Imagekit::UploadPreTransformErrorEvent::Request::OrHash + ).void + end + attr_writer :request + + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a pre-transformation fails. The file upload may have been + # accepted, but the requested transformation could not be applied. + sig do + params( + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformErrorEvent::Data::OrHash, + request: Imagekit::UploadPreTransformErrorEvent::Request::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the event. + id:, + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + data:, + request:, + type: :"upload.pre-transform.error" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformErrorEvent::Data, + request: Imagekit::UploadPreTransformErrorEvent::Request, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformErrorEvent::Data, + Imagekit::Internal::AnyHash + ) + end + + # Name of the file. + sig { returns(String) } + attr_accessor :name + + # Path of the file. + sig { returns(String) } + attr_accessor :path + + sig do + returns(Imagekit::UploadPreTransformErrorEvent::Data::Transformation) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::UploadPreTransformErrorEvent::Data::Transformation::OrHash + ).void + end + attr_writer :transformation + + sig do + params( + name: String, + path: String, + transformation: + Imagekit::UploadPreTransformErrorEvent::Data::Transformation::OrHash + ).returns(T.attached_class) + end + def self.new( + # Name of the file. + name:, + # Path of the file. + path:, + transformation: + ) + end + + sig do + override.returns( + { + name: String, + path: String, + transformation: + Imagekit::UploadPreTransformErrorEvent::Data::Transformation + } + ) + end + def to_hash + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformErrorEvent::Data::Transformation, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error + ) + end + attr_reader :error + + sig do + params( + error: + Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error::OrHash + ).void + end + attr_writer :error + + sig do + params( + error: + Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error::OrHash + ).returns(T.attached_class) + end + def self.new(error:) + end + + sig do + override.returns( + { + error: + Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error + } + ) + end + def to_hash + end + + class Error < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error, + Imagekit::Internal::AnyHash + ) + end + + # Reason for the pre-transformation failure. + sig { returns(String) } + attr_accessor :reason + + sig { params(reason: String).returns(T.attached_class) } + def self.new( + # Reason for the pre-transformation failure. + reason: + ) + end + + sig { override.returns({ reason: String }) } + def to_hash + end + end + end + end + + class Request < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformErrorEvent::Request, + Imagekit::Internal::AnyHash + ) + end + + # The requested pre-transformation string. + sig { returns(String) } + attr_accessor :transformation + + # Unique identifier for the originating request. + sig { returns(String) } + attr_accessor :x_request_id + + sig do + params(transformation: String, x_request_id: String).returns( + T.attached_class + ) + end + def self.new( + # The requested pre-transformation string. + transformation:, + # Unique identifier for the originating request. + x_request_id: + ) + end + + sig do + override.returns({ transformation: String, x_request_id: String }) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/upload_pre_transform_success_event.rbi b/rbi/imagekit/models/upload_pre_transform_success_event.rbi new file mode 100644 index 00000000..92358f5d --- /dev/null +++ b/rbi/imagekit/models/upload_pre_transform_success_event.rbi @@ -0,0 +1,877 @@ +# typed: strong + +module Imagekit + module Models + class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformSuccessEvent, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # Timestamp of when the event occurred in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + # Object containing details of a successful upload. + sig { returns(Imagekit::UploadPreTransformSuccessEvent::Data) } + attr_reader :data + + sig do + params( + data: Imagekit::UploadPreTransformSuccessEvent::Data::OrHash + ).void + end + attr_writer :data + + sig { returns(Imagekit::UploadPreTransformSuccessEvent::Request) } + attr_reader :request + + sig do + params( + request: Imagekit::UploadPreTransformSuccessEvent::Request::OrHash + ).void + end + attr_writer :request + + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a pre-transformation completes successfully. The file has been + # processed with the requested transformation and is now available in the Media + # Library. + sig do + params( + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformSuccessEvent::Data::OrHash, + request: Imagekit::UploadPreTransformSuccessEvent::Request::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the event. + id:, + # Timestamp of when the event occurred in ISO8601 format. + created_at:, + # Object containing details of a successful upload. + data:, + request:, + type: :"upload.pre-transform.success" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformSuccessEvent::Data, + request: Imagekit::UploadPreTransformSuccessEvent::Request, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformSuccessEvent::Data, + Imagekit::Internal::AnyHash + ) + end + + # An array of tags assigned to the uploaded file by auto tagging. + sig do + returns( + T.nilable( + T::Array[Imagekit::UploadPreTransformSuccessEvent::Data::AITag] + ) + ) + end + attr_accessor :ai_tags + + # The audio codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :audio_codec + + sig { params(audio_codec: String).void } + attr_writer :audio_codec + + # The bit rate of the video in kbps (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :bit_rate + + sig { params(bit_rate: Integer).void } + attr_writer :bit_rate + + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + sig { returns(T.nilable(String)) } + attr_accessor :custom_coordinates + + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # The duration of the video in seconds (only for video). + sig { returns(T.nilable(Integer)) } + attr_reader :duration + + sig { params(duration: Integer).void } + attr_writer :duration + + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :embedded_metadata + + sig { params(embedded_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :embedded_metadata + + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + sig do + returns( + T.nilable( + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus + ) + ) + end + attr_reader :extension_status + + sig do + params( + extension_status: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::OrHash + ).void + end + attr_writer :extension_status + + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + sig { returns(T.nilable(String)) } + attr_reader :file_id + + sig { params(file_id: String).void } + attr_writer :file_id + + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + sig { returns(T.nilable(String)) } + attr_reader :file_path + + sig { params(file_path: String).void } + attr_writer :file_path + + # Type of the uploaded file. Possible values are `image`, `non-image`. + sig { returns(T.nilable(String)) } + attr_reader :file_type + + sig { params(file_type: String).void } + attr_writer :file_type + + # Height of the image in pixels (Only for images) + sig { returns(T.nilable(Float)) } + attr_reader :height + + sig { params(height: Float).void } + attr_writer :height + + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_private_file + + sig { params(is_private_file: T::Boolean).void } + attr_writer :is_private_file + + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :is_published + + sig { params(is_published: T::Boolean).void } + attr_writer :is_published + + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + sig { returns(T.nilable(Imagekit::Metadata)) } + attr_reader :metadata + + sig { params(metadata: Imagekit::Metadata::OrHash).void } + attr_writer :metadata + + # Name of the asset. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + # Size of the image file in Bytes. + sig { returns(T.nilable(Float)) } + attr_reader :size + + sig { params(size: Float).void } + attr_writer :size + + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :tags + + # In the case of an image, a small thumbnail URL. + sig { returns(T.nilable(String)) } + attr_reader :thumbnail_url + + sig { params(thumbnail_url: String).void } + attr_writer :thumbnail_url + + # A publicly accessible URL of the file. + sig { returns(T.nilable(String)) } + attr_reader :url + + sig { params(url: String).void } + attr_writer :url + + # An object containing the file or file version's `id` (versionId) and `name`. + sig do + returns( + T.nilable( + Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo + ) + ) + end + attr_reader :version_info + + sig do + params( + version_info: + Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo::OrHash + ).void + end + attr_writer :version_info + + # The video codec used in the video (only for video). + sig { returns(T.nilable(String)) } + attr_reader :video_codec + + sig { params(video_codec: String).void } + attr_writer :video_codec + + # Width of the image in pixels (Only for Images) + sig { returns(T.nilable(Float)) } + attr_reader :width + + sig { params(width: Float).void } + attr_writer :width + + # Object containing details of a successful upload. + sig do + params( + ai_tags: + T.nilable( + T::Array[ + Imagekit::UploadPreTransformSuccessEvent::Data::AITag::OrHash + ] + ), + audio_codec: String, + bit_rate: Integer, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + duration: Integer, + embedded_metadata: T::Hash[Symbol, T.anything], + extension_status: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::OrHash, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + metadata: Imagekit::Metadata::OrHash, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail_url: String, + url: String, + version_info: + Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo::OrHash, + video_codec: String, + width: Float + ).returns(T.attached_class) + end + def self.new( + # An array of tags assigned to the uploaded file by auto tagging. + ai_tags: nil, + # The audio codec used in the video (only for video). + audio_codec: nil, + # The bit rate of the video in kbps (only for video). + bit_rate: nil, + # Value of custom coordinates associated with the image in the format + # `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + # Send `customCoordinates` in `responseFields` in API request to get the value of + # this field. + custom_coordinates: nil, + # A key-value data associated with the asset. Use `responseField` in API request + # to get `customMetadata` in the upload API response. Before setting any custom + # metadata on an asset, you have to create the field using custom metadata fields + # API. Send `customMetadata` in `responseFields` in API request to get the value + # of this field. + custom_metadata: nil, + # Optional text to describe the contents of the file. Can be set by the user or + # the ai-auto-description extension. + description: nil, + # The duration of the video in seconds (only for video). + duration: nil, + # Consolidated embedded metadata associated with the file. It includes exif, iptc, + # and xmp data. Send `embeddedMetadata` in `responseFields` in API request to get + # embeddedMetadata in the upload API response. + embedded_metadata: nil, + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + extension_status: nil, + # Unique fileId. Store this fileld in your database, as this will be used to + # perform update action on this file. + file_id: nil, + # The relative path of the file in the media library e.g. + # `/marketing-assets/new-banner.jpg`. + file_path: nil, + # Type of the uploaded file. Possible values are `image`, `non-image`. + file_type: nil, + # Height of the image in pixels (Only for images) + height: nil, + # Is the file marked as private. It can be either `true` or `false`. Send + # `isPrivateFile` in `responseFields` in API request to get the value of this + # field. + is_private_file: nil, + # Is the file published or in draft state. It can be either `true` or `false`. + # Send `isPublished` in `responseFields` in API request to get the value of this + # field. + is_published: nil, + # Legacy metadata. Send `metadata` in `responseFields` in API request to get + # metadata in the upload API response. + metadata: nil, + # Name of the asset. + name: nil, + # Size of the image file in Bytes. + size: nil, + # The array of tags associated with the asset. If no tags are set, it will be + # `null`. Send `tags` in `responseFields` in API request to get the value of this + # field. + tags: nil, + # In the case of an image, a small thumbnail URL. + thumbnail_url: nil, + # A publicly accessible URL of the file. + url: nil, + # An object containing the file or file version's `id` (versionId) and `name`. + version_info: nil, + # The video codec used in the video (only for video). + video_codec: nil, + # Width of the image in pixels (Only for Images) + width: nil + ) + end + + sig do + override.returns( + { + ai_tags: + T.nilable( + T::Array[ + Imagekit::UploadPreTransformSuccessEvent::Data::AITag + ] + ), + audio_codec: String, + bit_rate: Integer, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + duration: Integer, + embedded_metadata: T::Hash[Symbol, T.anything], + extension_status: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: T::Boolean, + is_published: T::Boolean, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: T.nilable(T::Array[String]), + thumbnail_url: String, + url: String, + version_info: + Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo, + video_codec: String, + width: Float + } + ) + end + def to_hash + end + + class AITag < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformSuccessEvent::Data::AITag, + Imagekit::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 < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus, + Imagekit::Internal::AnyHash + ) + end + + sig do + returns( + T.nilable( + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + ) + end + attr_reader :ai_auto_description + + sig do + params( + ai_auto_description: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::OrSymbol + ).void + end + attr_writer :ai_auto_description + + sig do + returns( + T.nilable( + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :aws_auto_tagging + + sig do + params( + aws_auto_tagging: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::OrSymbol + ).void + end + attr_writer :aws_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + ) + end + attr_reader :google_auto_tagging + + sig do + params( + google_auto_tagging: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::OrSymbol + ).void + end + attr_writer :google_auto_tagging + + sig do + returns( + T.nilable( + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::TaggedSymbol + ) + ) + end + attr_reader :remove_bg + + sig do + params( + remove_bg: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::OrSymbol + ).void + end + attr_writer :remove_bg + + # Extension names with their processing status at the time of completion of the + # request. It could have one of the following status values: + # + # `success`: The extension has been successfully applied. `failed`: The extension + # has failed and will not be retried. `pending`: The extension will finish + # processing in some time. On completion, the final status (success / failed) will + # be sent to the `webhookUrl` provided. + # + # If no extension was requested, then this parameter is not returned. + sig do + params( + ai_auto_description: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::OrSymbol, + aws_auto_tagging: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::OrSymbol, + google_auto_tagging: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::OrSymbol, + remove_bg: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::OrSymbol + ).returns(T.attached_class) + end + def self.new( + ai_auto_description: nil, + aws_auto_tagging: nil, + google_auto_tagging: nil, + remove_bg: nil + ) + end + + sig do + override.returns( + { + ai_auto_description: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::TaggedSymbol, + aws_auto_tagging: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::TaggedSymbol, + google_auto_tagging: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::TaggedSymbol, + remove_bg: + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::TaggedSymbol + } + ) + end + def to_hash + end + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AIAutoDescription::TaggedSymbol + ] + ) + end + def self.values + end + end + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::AwsAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::GoogleAutoTagging::TaggedSymbol + ] + ) + end + def self.values + end + end + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SUCCESS = + T.let( + :success, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::TaggedSymbol + ) + PENDING = + T.let( + :pending, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::TaggedSymbol + ) + FAILED = + T.let( + :failed, + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus::RemoveBg::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class VersionInfo < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo, + Imagekit::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 < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UploadPreTransformSuccessEvent::Request, + Imagekit::Internal::AnyHash + ) + end + + # The requested pre-transformation string. + sig { returns(String) } + attr_accessor :transformation + + # Unique identifier for the originating request. + sig { returns(String) } + attr_accessor :x_request_id + + sig do + params(transformation: String, x_request_id: String).returns( + T.attached_class + ) + end + def self.new( + # The requested pre-transformation string. + transformation:, + # Unique identifier for the originating request. + x_request_id: + ) + end + + sig do + override.returns({ transformation: String, x_request_id: String }) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/video_overlay.rbi b/rbi/imagekit/models/video_overlay.rbi new file mode 100644 index 00000000..84c9aaed --- /dev/null +++ b/rbi/imagekit/models/video_overlay.rbi @@ -0,0 +1,102 @@ +# typed: strong + +module Imagekit + module Models + class VideoOverlay < Imagekit::Models::BaseOverlay + OrHash = + T.type_alias do + T.any(Imagekit::VideoOverlay, Imagekit::Internal::AnyHash) + end + + # Specifies the relative path to the video used as an overlay. + sig { returns(String) } + attr_accessor :input + + sig { returns(Symbol) } + attr_accessor :type + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + sig { returns(T.nilable(Imagekit::VideoOverlay::Encoding::OrSymbol)) } + attr_reader :encoding + + sig { params(encoding: Imagekit::VideoOverlay::Encoding::OrSymbol).void } + attr_writer :encoding + + # Array of transformation to be applied to the overlay video. Except + # `streamingResolutions`, all other video transformations are supported. See + # [Video transformations](https://imagekit.io/docs/video-transformation). + sig { returns(T.nilable(T::Array[Imagekit::Transformation])) } + attr_reader :transformation + + sig { params(transformation: T::Array[Imagekit::Transformation]).void } + attr_writer :transformation + + sig do + params( + input: String, + encoding: Imagekit::VideoOverlay::Encoding::OrSymbol, + transformation: T::Array[Imagekit::Transformation], + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Specifies the relative path to the video used as an overlay. + input:, + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + encoding: nil, + # Array of transformation to be applied to the overlay video. Except + # `streamingResolutions`, all other video transformations are supported. See + # [Video transformations](https://imagekit.io/docs/video-transformation). + transformation: nil, + type: :video + ) + end + + sig do + override.returns( + { + input: String, + type: Symbol, + encoding: Imagekit::VideoOverlay::Encoding::OrSymbol, + transformation: T::Array[Imagekit::Transformation] + } + ) + end + def to_hash + end + + # The input path can be included in the layer as either `i-{input}` or + # `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + # format automatically. To always use base64 encoding (`ie-{base64}`), set this + # parameter to `base64`. To always use plain text (`i-{input}`), set it to + # `plain`. + module Encoding + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Imagekit::VideoOverlay::Encoding) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, Imagekit::VideoOverlay::Encoding::TaggedSymbol) + PLAIN = T.let(:plain, Imagekit::VideoOverlay::Encoding::TaggedSymbol) + BASE64 = T.let(:base64, Imagekit::VideoOverlay::Encoding::TaggedSymbol) + + sig do + override.returns( + T::Array[Imagekit::VideoOverlay::Encoding::TaggedSymbol] + ) + end + def self.values + end + end + end + end +end diff --git a/rbi/imagekit/models/video_transformation_accepted_event.rbi b/rbi/imagekit/models/video_transformation_accepted_event.rbi new file mode 100644 index 00000000..a7b609fc --- /dev/null +++ b/rbi/imagekit/models/video_transformation_accepted_event.rbi @@ -0,0 +1,664 @@ +# typed: strong + +module Imagekit + module Models + class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # Timestamp when the event was created in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekit::VideoTransformationAcceptedEvent::Data) } + attr_reader :data + + sig do + params( + data: Imagekit::VideoTransformationAcceptedEvent::Data::OrHash + ).void + end + attr_writer :data + + # Information about the original request that triggered the video transformation. + sig { returns(Imagekit::VideoTransformationAcceptedEvent::Request) } + attr_reader :request + + sig do + params( + request: Imagekit::VideoTransformationAcceptedEvent::Request::OrHash + ).void + end + attr_writer :request + + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. + sig do + params( + id: String, + created_at: Time, + data: Imagekit::VideoTransformationAcceptedEvent::Data::OrHash, + request: Imagekit::VideoTransformationAcceptedEvent::Request::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the event. + id:, + # Timestamp when the event was created in ISO8601 format. + created_at:, + data:, + # Information about the original request that triggered the video transformation. + request:, + type: :"video.transformation.accepted" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationAcceptedEvent::Data, + request: Imagekit::VideoTransformationAcceptedEvent::Request, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent::Data, + Imagekit::Internal::AnyHash + ) + end + + # Information about the source video asset being transformed. + sig { returns(Imagekit::VideoTransformationAcceptedEvent::Data::Asset) } + attr_reader :asset + + sig do + params( + asset: + Imagekit::VideoTransformationAcceptedEvent::Data::Asset::OrHash + ).void + end + attr_writer :asset + + # Base information about a video transformation request. + sig do + returns( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation + ) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::OrHash + ).void + end + attr_writer :transformation + + sig do + params( + asset: + Imagekit::VideoTransformationAcceptedEvent::Data::Asset::OrHash, + transformation: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::OrHash + ).returns(T.attached_class) + end + def self.new( + # Information about the source video asset being transformed. + asset:, + # Base information about a video transformation request. + transformation: + ) + end + + sig do + override.returns( + { + asset: Imagekit::VideoTransformationAcceptedEvent::Data::Asset, + transformation: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation + } + ) + end + def to_hash + end + + class Asset < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent::Data::Asset, + Imagekit::Internal::AnyHash + ) + end + + # URL to download or access the source video file. + sig { returns(String) } + attr_accessor :url + + # Information about the source video asset being transformed. + sig { params(url: String).returns(T.attached_class) } + def self.new( + # URL to download or access the source video file. + url: + ) + end + + sig { override.returns({ url: String }) } + def to_hash + end + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + sig do + returns( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type::TaggedSymbol + ) + end + attr_accessor :type + + # Configuration options for video transformations. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options + ) + ) + end + attr_reader :options + + sig do + params( + options: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::OrHash + ).void + end + attr_writer :options + + # Base information about a video transformation request. + sig do + params( + type: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type::OrSymbol, + options: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::OrHash + ).returns(T.attached_class) + end + def self.new( + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + type:, + # Configuration options for video transformations. + options: nil + ) + end + + sig do + override.returns( + { + type: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type::TaggedSymbol, + options: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options + } + ) + end + def to_hash + end + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VIDEO_TRANSFORMATION = + T.let( + :"video-transformation", + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type::TaggedSymbol + ) + GIF_TO_VIDEO = + T.let( + :"gif-to-video", + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type::TaggedSymbol + ) + VIDEO_THUMBNAIL = + T.let( + :"video-thumbnail", + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Options < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options, + Imagekit::Internal::AnyHash + ) + end + + # Audio codec used for encoding (aac or opus). + sig do + returns( + T.nilable( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + ) + end + attr_reader :audio_codec + + sig do + params( + audio_codec: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec::OrSymbol + ).void + end + attr_writer :audio_codec + + # Whether to automatically rotate the video based on metadata. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :auto_rotate + + sig { params(auto_rotate: T::Boolean).void } + attr_writer :auto_rotate + + # Output format for the transformed video or thumbnail. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + ) + end + attr_reader :format_ + + sig do + params( + format_: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::OrSymbol + ).void + end + attr_writer :format_ + + # Quality setting for the output video. + sig { returns(T.nilable(Integer)) } + attr_reader :quality + + sig { params(quality: Integer).void } + attr_writer :quality + + # Streaming protocol for adaptive bitrate streaming. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + ) + end + attr_reader :stream_protocol + + sig do + params( + stream_protocol: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol::OrSymbol + ).void + end + attr_writer :stream_protocol + + # Array of quality representations for adaptive bitrate streaming. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :variants + + sig { params(variants: T::Array[String]).void } + attr_writer :variants + + # Video codec used for encoding (h264, vp9, or av1). + sig do + returns( + T.nilable( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + ) + end + attr_reader :video_codec + + sig do + params( + video_codec: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::OrSymbol + ).void + end + attr_writer :video_codec + + # Configuration options for video transformations. + sig do + params( + audio_codec: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec::OrSymbol, + auto_rotate: T::Boolean, + format_: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::OrSymbol, + quality: Integer, + stream_protocol: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol::OrSymbol, + variants: T::Array[String], + video_codec: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Audio codec used for encoding (aac or opus). + audio_codec: nil, + # Whether to automatically rotate the video based on metadata. + auto_rotate: nil, + # Output format for the transformed video or thumbnail. + format_: nil, + # Quality setting for the output video. + quality: nil, + # Streaming protocol for adaptive bitrate streaming. + stream_protocol: nil, + # Array of quality representations for adaptive bitrate streaming. + variants: nil, + # Video codec used for encoding (h264, vp9, or av1). + video_codec: nil + ) + end + + sig do + override.returns( + { + audio_codec: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol, + auto_rotate: T::Boolean, + format_: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol, + quality: Integer, + stream_protocol: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol, + variants: T::Array[String], + video_codec: + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + } + ) + end + def to_hash + end + + # Audio codec used for encoding (aac or opus). + module AudioCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AAC = + T.let( + :aac, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + OPUS = + T.let( + :opus, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Output format for the transformed video or thumbnail. + module Format + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MP4 = + T.let( + :mp4, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + WEBM = + T.let( + :webm, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + JPG = + T.let( + :jpg, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + PNG = + T.let( + :png, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + WEBP = + T.let( + :webp, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::Format::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Streaming protocol for adaptive bitrate streaming. + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HLS = + T.let( + :HLS, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + DASH = + T.let( + :DASH, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Video codec used for encoding (h264, vp9, or av1). + module VideoCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + H264 = + T.let( + :h264, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + VP9 = + T.let( + :vp9, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + AV1 = + T.let( + :av1, + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end + + class Request < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationAcceptedEvent::Request, + Imagekit::Internal::AnyHash + ) + end + + # Full URL of the transformation request that was submitted. + sig { returns(String) } + attr_accessor :url + + # Unique identifier for the originating transformation request. + sig { returns(String) } + attr_accessor :x_request_id + + # User-Agent header from the original request that triggered the transformation. + sig { returns(T.nilable(String)) } + attr_reader :user_agent + + sig { params(user_agent: String).void } + attr_writer :user_agent + + # Information about the original request that triggered the video transformation. + sig do + params(url: String, x_request_id: String, user_agent: String).returns( + T.attached_class + ) + end + def self.new( + # Full URL of the transformation request that was submitted. + url:, + # Unique identifier for the originating transformation request. + x_request_id:, + # User-Agent header from the original request that triggered the transformation. + user_agent: nil + ) + end + + sig do + override.returns( + { url: String, x_request_id: String, user_agent: String } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/video_transformation_error_event.rbi b/rbi/imagekit/models/video_transformation_error_event.rbi new file mode 100644 index 00000000..8b6b316d --- /dev/null +++ b/rbi/imagekit/models/video_transformation_error_event.rbi @@ -0,0 +1,774 @@ +# typed: strong + +module Imagekit + module Models + class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationErrorEvent, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # Timestamp when the event was created in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekit::VideoTransformationErrorEvent::Data) } + attr_reader :data + + sig do + params(data: Imagekit::VideoTransformationErrorEvent::Data::OrHash).void + end + attr_writer :data + + # Information about the original request that triggered the video transformation. + sig { returns(Imagekit::VideoTransformationErrorEvent::Request) } + attr_reader :request + + sig do + params( + request: Imagekit::VideoTransformationErrorEvent::Request::OrHash + ).void + end + attr_writer :request + + sig { returns(Symbol) } + attr_accessor :type + + # Triggered when an error occurs during video encoding. Listen to this webhook to + # log error reasons and debug issues. Check your origin and URL endpoint settings + # if the reason is related to download failure. For other errors, contact ImageKit + # support. + sig do + params( + id: String, + created_at: Time, + data: Imagekit::VideoTransformationErrorEvent::Data::OrHash, + request: Imagekit::VideoTransformationErrorEvent::Request::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the event. + id:, + # Timestamp when the event was created in ISO8601 format. + created_at:, + data:, + # Information about the original request that triggered the video transformation. + request:, + type: :"video.transformation.error" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationErrorEvent::Data, + request: Imagekit::VideoTransformationErrorEvent::Request, + type: Symbol + } + ) + end + def to_hash + end + + class Data < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationErrorEvent::Data, + Imagekit::Internal::AnyHash + ) + end + + # Information about the source video asset being transformed. + sig { returns(Imagekit::VideoTransformationErrorEvent::Data::Asset) } + attr_reader :asset + + sig do + params( + asset: Imagekit::VideoTransformationErrorEvent::Data::Asset::OrHash + ).void + end + attr_writer :asset + + sig do + returns(Imagekit::VideoTransformationErrorEvent::Data::Transformation) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::OrHash + ).void + end + attr_writer :transformation + + sig do + params( + asset: Imagekit::VideoTransformationErrorEvent::Data::Asset::OrHash, + transformation: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::OrHash + ).returns(T.attached_class) + end + def self.new( + # Information about the source video asset being transformed. + asset:, + transformation: + ) + end + + sig do + override.returns( + { + asset: Imagekit::VideoTransformationErrorEvent::Data::Asset, + transformation: + Imagekit::VideoTransformationErrorEvent::Data::Transformation + } + ) + end + def to_hash + end + + class Asset < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationErrorEvent::Data::Asset, + Imagekit::Internal::AnyHash + ) + end + + # URL to download or access the source video file. + sig { returns(String) } + attr_accessor :url + + # Information about the source video asset being transformed. + sig { params(url: String).returns(T.attached_class) } + def self.new( + # URL to download or access the source video file. + url: + ) + end + + sig { override.returns({ url: String }) } + def to_hash + end + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationErrorEvent::Data::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + sig do + returns( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type::TaggedSymbol + ) + end + attr_accessor :type + + # Details about the transformation error. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error + ) + ) + end + attr_reader :error + + sig do + params( + error: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::OrHash + ).void + end + attr_writer :error + + # Configuration options for video transformations. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options + ) + ) + end + attr_reader :options + + sig do + params( + options: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::OrHash + ).void + end + attr_writer :options + + sig do + params( + type: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type::OrSymbol, + error: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::OrHash, + options: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::OrHash + ).returns(T.attached_class) + end + def self.new( + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + type:, + # Details about the transformation error. + error: nil, + # Configuration options for video transformations. + options: nil + ) + end + + sig do + override.returns( + { + type: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type::TaggedSymbol, + error: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error, + options: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options + } + ) + end + def to_hash + end + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VIDEO_TRANSFORMATION = + T.let( + :"video-transformation", + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type::TaggedSymbol + ) + GIF_TO_VIDEO = + T.let( + :"gif-to-video", + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type::TaggedSymbol + ) + VIDEO_THUMBNAIL = + T.let( + :"video-thumbnail", + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Error < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error, + Imagekit::Internal::AnyHash + ) + end + + # Specific reason for the transformation failure: + # + # - `encoding_failed`: Error during video encoding process + # - `download_failed`: Could not download source video + # - `internal_server_error`: Unexpected server error + sig do + returns( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason::TaggedSymbol + ) + end + attr_accessor :reason + + # Details about the transformation error. + sig do + params( + reason: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Specific reason for the transformation failure: + # + # - `encoding_failed`: Error during video encoding process + # - `download_failed`: Could not download source video + # - `internal_server_error`: Unexpected server error + reason: + ) + end + + sig do + override.returns( + { + reason: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason::TaggedSymbol + } + ) + end + def to_hash + end + + # Specific reason for the transformation failure: + # + # - `encoding_failed`: Error during video encoding process + # - `download_failed`: Could not download source video + # - `internal_server_error`: Unexpected server error + module Reason + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ENCODING_FAILED = + T.let( + :encoding_failed, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason::TaggedSymbol + ) + DOWNLOAD_FAILED = + T.let( + :download_failed, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason::TaggedSymbol + ) + INTERNAL_SERVER_ERROR = + T.let( + :internal_server_error, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error::Reason::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Options < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options, + Imagekit::Internal::AnyHash + ) + end + + # Audio codec used for encoding (aac or opus). + sig do + returns( + T.nilable( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + ) + end + attr_reader :audio_codec + + sig do + params( + audio_codec: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec::OrSymbol + ).void + end + attr_writer :audio_codec + + # Whether to automatically rotate the video based on metadata. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :auto_rotate + + sig { params(auto_rotate: T::Boolean).void } + attr_writer :auto_rotate + + # Output format for the transformed video or thumbnail. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + ) + end + attr_reader :format_ + + sig do + params( + format_: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::OrSymbol + ).void + end + attr_writer :format_ + + # Quality setting for the output video. + sig { returns(T.nilable(Integer)) } + attr_reader :quality + + sig { params(quality: Integer).void } + attr_writer :quality + + # Streaming protocol for adaptive bitrate streaming. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + ) + end + attr_reader :stream_protocol + + sig do + params( + stream_protocol: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol::OrSymbol + ).void + end + attr_writer :stream_protocol + + # Array of quality representations for adaptive bitrate streaming. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :variants + + sig { params(variants: T::Array[String]).void } + attr_writer :variants + + # Video codec used for encoding (h264, vp9, or av1). + sig do + returns( + T.nilable( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + ) + end + attr_reader :video_codec + + sig do + params( + video_codec: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::OrSymbol + ).void + end + attr_writer :video_codec + + # Configuration options for video transformations. + sig do + params( + audio_codec: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec::OrSymbol, + auto_rotate: T::Boolean, + format_: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::OrSymbol, + quality: Integer, + stream_protocol: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol::OrSymbol, + variants: T::Array[String], + video_codec: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Audio codec used for encoding (aac or opus). + audio_codec: nil, + # Whether to automatically rotate the video based on metadata. + auto_rotate: nil, + # Output format for the transformed video or thumbnail. + format_: nil, + # Quality setting for the output video. + quality: nil, + # Streaming protocol for adaptive bitrate streaming. + stream_protocol: nil, + # Array of quality representations for adaptive bitrate streaming. + variants: nil, + # Video codec used for encoding (h264, vp9, or av1). + video_codec: nil + ) + end + + sig do + override.returns( + { + audio_codec: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol, + auto_rotate: T::Boolean, + format_: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol, + quality: Integer, + stream_protocol: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol, + variants: T::Array[String], + video_codec: + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + } + ) + end + def to_hash + end + + # Audio codec used for encoding (aac or opus). + module AudioCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AAC = + T.let( + :aac, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + OPUS = + T.let( + :opus, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Output format for the transformed video or thumbnail. + module Format + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MP4 = + T.let( + :mp4, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + WEBM = + T.let( + :webm, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + JPG = + T.let( + :jpg, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + PNG = + T.let( + :png, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + WEBP = + T.let( + :webp, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::Format::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Streaming protocol for adaptive bitrate streaming. + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HLS = + T.let( + :HLS, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + DASH = + T.let( + :DASH, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Video codec used for encoding (h264, vp9, or av1). + module VideoCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + H264 = + T.let( + :h264, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + VP9 = + T.let( + :vp9, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + AV1 = + T.let( + :av1, + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ] + ) + end + def self.values + end + end + end + end + end + + class Request < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationErrorEvent::Request, + Imagekit::Internal::AnyHash + ) + end + + # Full URL of the transformation request that was submitted. + sig { returns(String) } + attr_accessor :url + + # Unique identifier for the originating transformation request. + sig { returns(String) } + attr_accessor :x_request_id + + # User-Agent header from the original request that triggered the transformation. + sig { returns(T.nilable(String)) } + attr_reader :user_agent + + sig { params(user_agent: String).void } + attr_writer :user_agent + + # Information about the original request that triggered the video transformation. + sig do + params(url: String, x_request_id: String, user_agent: String).returns( + T.attached_class + ) + end + def self.new( + # Full URL of the transformation request that was submitted. + url:, + # Unique identifier for the originating transformation request. + x_request_id:, + # User-Agent header from the original request that triggered the transformation. + user_agent: nil + ) + end + + sig do + override.returns( + { url: String, x_request_id: String, user_agent: String } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/video_transformation_ready_event.rbi b/rbi/imagekit/models/video_transformation_ready_event.rbi new file mode 100644 index 00000000..3b8c06d0 --- /dev/null +++ b/rbi/imagekit/models/video_transformation_ready_event.rbi @@ -0,0 +1,866 @@ +# typed: strong + +module Imagekit + module Models + class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent, + Imagekit::Internal::AnyHash + ) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # Timestamp when the event was created in ISO8601 format. + sig { returns(Time) } + attr_accessor :created_at + + sig { returns(Imagekit::VideoTransformationReadyEvent::Data) } + attr_reader :data + + sig do + params(data: Imagekit::VideoTransformationReadyEvent::Data::OrHash).void + end + attr_writer :data + + # Information about the original request that triggered the video transformation. + sig { returns(Imagekit::VideoTransformationReadyEvent::Request) } + attr_reader :request + + sig do + params( + request: Imagekit::VideoTransformationReadyEvent::Request::OrHash + ).void + end + attr_writer :request + + sig { returns(Symbol) } + attr_accessor :type + + # Performance metrics for the transformation process. + sig do + returns(T.nilable(Imagekit::VideoTransformationReadyEvent::Timings)) + end + attr_reader :timings + + sig do + params( + timings: Imagekit::VideoTransformationReadyEvent::Timings::OrHash + ).void + end + attr_writer :timings + + # Triggered when video encoding is finished and the transformed resource is ready + # to be served. This is the key event to listen for - update your database or CMS + # flags when you receive this so your application can start showing the + # transformed video to users. + sig do + params( + id: String, + created_at: Time, + data: Imagekit::VideoTransformationReadyEvent::Data::OrHash, + request: Imagekit::VideoTransformationReadyEvent::Request::OrHash, + timings: Imagekit::VideoTransformationReadyEvent::Timings::OrHash, + type: Symbol + ).returns(T.attached_class) + end + def self.new( + # Unique identifier for the event. + id:, + # Timestamp when the event was created in ISO8601 format. + created_at:, + data:, + # Information about the original request that triggered the video transformation. + request:, + # Performance metrics for the transformation process. + timings: nil, + type: :"video.transformation.ready" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationReadyEvent::Data, + request: Imagekit::VideoTransformationReadyEvent::Request, + type: Symbol, + timings: Imagekit::VideoTransformationReadyEvent::Timings + } + ) + end + def to_hash + end + + class Data < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Data, + Imagekit::Internal::AnyHash + ) + end + + # Information about the source video asset being transformed. + sig { returns(Imagekit::VideoTransformationReadyEvent::Data::Asset) } + attr_reader :asset + + sig do + params( + asset: Imagekit::VideoTransformationReadyEvent::Data::Asset::OrHash + ).void + end + attr_writer :asset + + sig do + returns(Imagekit::VideoTransformationReadyEvent::Data::Transformation) + end + attr_reader :transformation + + sig do + params( + transformation: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::OrHash + ).void + end + attr_writer :transformation + + sig do + params( + asset: Imagekit::VideoTransformationReadyEvent::Data::Asset::OrHash, + transformation: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::OrHash + ).returns(T.attached_class) + end + def self.new( + # Information about the source video asset being transformed. + asset:, + transformation: + ) + end + + sig do + override.returns( + { + asset: Imagekit::VideoTransformationReadyEvent::Data::Asset, + transformation: + Imagekit::VideoTransformationReadyEvent::Data::Transformation + } + ) + end + def to_hash + end + + class Asset < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Data::Asset, + Imagekit::Internal::AnyHash + ) + end + + # URL to download or access the source video file. + sig { returns(String) } + attr_accessor :url + + # Information about the source video asset being transformed. + sig { params(url: String).returns(T.attached_class) } + def self.new( + # URL to download or access the source video file. + url: + ) + end + + sig { override.returns({ url: String }) } + def to_hash + end + end + + class Transformation < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Data::Transformation, + Imagekit::Internal::AnyHash + ) + end + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + sig do + returns( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type::TaggedSymbol + ) + end + attr_accessor :type + + # Configuration options for video transformations. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options + ) + ) + end + attr_reader :options + + sig do + params( + options: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::OrHash + ).void + end + attr_writer :options + + # Information about the transformed output video. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output + ) + ) + end + attr_reader :output + + sig do + params( + output: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::OrHash + ).void + end + attr_writer :output + + sig do + params( + type: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type::OrSymbol, + options: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::OrHash, + output: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::OrHash + ).returns(T.attached_class) + end + def self.new( + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + type:, + # Configuration options for video transformations. + options: nil, + # Information about the transformed output video. + output: nil + ) + end + + sig do + override.returns( + { + type: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type::TaggedSymbol, + options: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options, + output: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output + } + ) + end + def to_hash + end + + # Type of video transformation: + # + # - `video-transformation`: Standard video processing (resize, format conversion, + # etc.) + # - `gif-to-video`: Convert animated GIF to video format + # - `video-thumbnail`: Generate thumbnail image from video + module Type + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + VIDEO_TRANSFORMATION = + T.let( + :"video-transformation", + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type::TaggedSymbol + ) + GIF_TO_VIDEO = + T.let( + :"gif-to-video", + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type::TaggedSymbol + ) + VIDEO_THUMBNAIL = + T.let( + :"video-thumbnail", + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Type::TaggedSymbol + ] + ) + end + def self.values + end + end + + class Options < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options, + Imagekit::Internal::AnyHash + ) + end + + # Audio codec used for encoding (aac or opus). + sig do + returns( + T.nilable( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + ) + end + attr_reader :audio_codec + + sig do + params( + audio_codec: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec::OrSymbol + ).void + end + attr_writer :audio_codec + + # Whether to automatically rotate the video based on metadata. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :auto_rotate + + sig { params(auto_rotate: T::Boolean).void } + attr_writer :auto_rotate + + # Output format for the transformed video or thumbnail. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + ) + end + attr_reader :format_ + + sig do + params( + format_: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::OrSymbol + ).void + end + attr_writer :format_ + + # Quality setting for the output video. + sig { returns(T.nilable(Integer)) } + attr_reader :quality + + sig { params(quality: Integer).void } + attr_writer :quality + + # Streaming protocol for adaptive bitrate streaming. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + ) + end + attr_reader :stream_protocol + + sig do + params( + stream_protocol: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol::OrSymbol + ).void + end + attr_writer :stream_protocol + + # Array of quality representations for adaptive bitrate streaming. + sig { returns(T.nilable(T::Array[String])) } + attr_reader :variants + + sig { params(variants: T::Array[String]).void } + attr_writer :variants + + # Video codec used for encoding (h264, vp9, or av1). + sig do + returns( + T.nilable( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + ) + end + attr_reader :video_codec + + sig do + params( + video_codec: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::OrSymbol + ).void + end + attr_writer :video_codec + + # Configuration options for video transformations. + sig do + params( + audio_codec: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec::OrSymbol, + auto_rotate: T::Boolean, + format_: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::OrSymbol, + quality: Integer, + stream_protocol: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol::OrSymbol, + variants: T::Array[String], + video_codec: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Audio codec used for encoding (aac or opus). + audio_codec: nil, + # Whether to automatically rotate the video based on metadata. + auto_rotate: nil, + # Output format for the transformed video or thumbnail. + format_: nil, + # Quality setting for the output video. + quality: nil, + # Streaming protocol for adaptive bitrate streaming. + stream_protocol: nil, + # Array of quality representations for adaptive bitrate streaming. + variants: nil, + # Video codec used for encoding (h264, vp9, or av1). + video_codec: nil + ) + end + + sig do + override.returns( + { + audio_codec: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol, + auto_rotate: T::Boolean, + format_: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol, + quality: Integer, + stream_protocol: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol, + variants: T::Array[String], + video_codec: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + } + ) + end + def to_hash + end + + # Audio codec used for encoding (aac or opus). + module AudioCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AAC = + T.let( + :aac, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + OPUS = + T.let( + :opus, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::AudioCodec::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Output format for the transformed video or thumbnail. + module Format + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MP4 = + T.let( + :mp4, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + WEBM = + T.let( + :webm, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + JPG = + T.let( + :jpg, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + PNG = + T.let( + :png, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + WEBP = + T.let( + :webp, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::Format::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Streaming protocol for adaptive bitrate streaming. + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + HLS = + T.let( + :HLS, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + DASH = + T.let( + :DASH, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::StreamProtocol::TaggedSymbol + ] + ) + end + def self.values + end + end + + # Video codec used for encoding (h264, vp9, or av1). + module VideoCodec + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all( + Symbol, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec + ) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + H264 = + T.let( + :h264, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + VP9 = + T.let( + :vp9, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + AV1 = + T.let( + :av1, + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options::VideoCodec::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class Output < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output, + Imagekit::Internal::AnyHash + ) + end + + # URL to access the transformed video. + sig { returns(String) } + attr_accessor :url + + # Metadata of the output video file. + sig do + returns( + T.nilable( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata + ) + ) + end + attr_reader :video_metadata + + sig do + params( + video_metadata: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata::OrHash + ).void + end + attr_writer :video_metadata + + # Information about the transformed output video. + sig do + params( + url: String, + video_metadata: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata::OrHash + ).returns(T.attached_class) + end + def self.new( + # URL to access the transformed video. + url:, + # Metadata of the output video file. + video_metadata: nil + ) + end + + sig do + override.returns( + { + url: String, + video_metadata: + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata + } + ) + end + def to_hash + end + + class VideoMetadata < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata, + Imagekit::Internal::AnyHash + ) + end + + # Bitrate of the output video in bits per second. + sig { returns(Integer) } + attr_accessor :bitrate + + # Duration of the output video in seconds. + sig { returns(Float) } + attr_accessor :duration + + # Height of the output video in pixels. + sig { returns(Integer) } + attr_accessor :height + + # Width of the output video in pixels. + sig { returns(Integer) } + attr_accessor :width + + # Metadata of the output video file. + sig do + params( + bitrate: Integer, + duration: Float, + height: Integer, + width: Integer + ).returns(T.attached_class) + end + def self.new( + # Bitrate of the output video in bits per second. + bitrate:, + # Duration of the output video in seconds. + duration:, + # Height of the output video in pixels. + height:, + # Width of the output video in pixels. + width: + ) + end + + sig do + override.returns( + { + bitrate: Integer, + duration: Float, + height: Integer, + width: Integer + } + ) + end + def to_hash + end + end + end + end + end + + class Request < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Request, + Imagekit::Internal::AnyHash + ) + end + + # Full URL of the transformation request that was submitted. + sig { returns(String) } + attr_accessor :url + + # Unique identifier for the originating transformation request. + sig { returns(String) } + attr_accessor :x_request_id + + # User-Agent header from the original request that triggered the transformation. + sig { returns(T.nilable(String)) } + attr_reader :user_agent + + sig { params(user_agent: String).void } + attr_writer :user_agent + + # Information about the original request that triggered the video transformation. + sig do + params(url: String, x_request_id: String, user_agent: String).returns( + T.attached_class + ) + end + def self.new( + # Full URL of the transformation request that was submitted. + url:, + # Unique identifier for the originating transformation request. + x_request_id:, + # User-Agent header from the original request that triggered the transformation. + user_agent: nil + ) + end + + sig do + override.returns( + { url: String, x_request_id: String, user_agent: String } + ) + end + def to_hash + end + end + + class Timings < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::VideoTransformationReadyEvent::Timings, + Imagekit::Internal::AnyHash + ) + end + + # Time spent downloading the source video from your origin or media library, in + # milliseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :download_duration + + sig { params(download_duration: Integer).void } + attr_writer :download_duration + + # Time spent encoding the video, in milliseconds. + sig { returns(T.nilable(Integer)) } + attr_reader :encoding_duration + + sig { params(encoding_duration: Integer).void } + attr_writer :encoding_duration + + # Performance metrics for the transformation process. + sig do + params( + download_duration: Integer, + encoding_duration: Integer + ).returns(T.attached_class) + end + def self.new( + # Time spent downloading the source video from your origin or media library, in + # milliseconds. + download_duration: nil, + # Time spent encoding the video, in milliseconds. + encoding_duration: nil + ) + end + + sig do + override.returns( + { download_duration: Integer, encoding_duration: Integer } + ) + end + def to_hash + end + end + end + end +end diff --git a/rbi/imagekit/models/webhook_unsafe_unwrap_params.rbi b/rbi/imagekit/models/webhook_unsafe_unwrap_params.rbi new file mode 100644 index 00000000..60cbea60 --- /dev/null +++ b/rbi/imagekit/models/webhook_unsafe_unwrap_params.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module Imagekit + module Models + class WebhookUnsafeUnwrapParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any( + Imagekit::WebhookUnsafeUnwrapParams, + Imagekit::Internal::AnyHash + ) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/webhook_unwrap_params.rbi b/rbi/imagekit/models/webhook_unwrap_params.rbi new file mode 100644 index 00000000..b3db3d7b --- /dev/null +++ b/rbi/imagekit/models/webhook_unwrap_params.rbi @@ -0,0 +1,27 @@ +# typed: strong + +module Imagekit + module Models + class WebhookUnwrapParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + OrHash = + T.type_alias do + T.any(Imagekit::WebhookUnwrapParams, Imagekit::Internal::AnyHash) + end + + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class + ) + end + def self.new(request_options: {}) + end + + sig { override.returns({ request_options: Imagekit::RequestOptions }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/request_options.rbi b/rbi/imagekit/request_options.rbi new file mode 100644 index 00000000..8f934bd4 --- /dev/null +++ b/rbi/imagekit/request_options.rbi @@ -0,0 +1,59 @@ +# typed: strong + +module Imagekit + # Specify HTTP behaviour to use for a specific request. These options supplement + # or override those provided at the client level. + # + # When making a request, you can pass an actual {RequestOptions} instance, or + # simply pass a Hash with symbol keys matching the attributes on this class. + class RequestOptions < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::RequestOptions, Imagekit::Internal::AnyHash) + end + + # @api private + sig { params(opts: Imagekit::RequestOptions::OrHash).void } + def self.validate!(opts) + end + + # Idempotency key to send with request and all associated retries. Will only be + # sent for write requests. + sig { returns(T.nilable(String)) } + attr_accessor :idempotency_key + + # Extra query params to send with the request. These are `.merge`’d into any + # `query` given at the client level. + sig do + returns( + T.nilable(T::Hash[String, T.nilable(T.any(T::Array[String], String))]) + ) + end + attr_accessor :extra_query + + # Extra headers to send with the request. These are `.merged`’d into any + # `extra_headers` given at the client level. + sig { returns(T.nilable(T::Hash[String, T.nilable(String)])) } + attr_accessor :extra_headers + + # Extra data to send with the request. These are deep merged into any data + # generated as part of the normal request. + sig { returns(T.nilable(T.anything)) } + attr_accessor :extra_body + + # Maximum number of retries to attempt after a failed initial request. + sig { returns(T.nilable(Integer)) } + attr_accessor :max_retries + + # Request timeout in seconds. + sig { returns(T.nilable(Float)) } + attr_accessor :timeout + + # Returns a new instance of RequestOptions. + sig do + params(values: Imagekit::Internal::AnyHash).returns(T.attached_class) + end + def self.new(values = {}) + end + end +end diff --git a/rbi/imagekit/resources/accounts.rbi b/rbi/imagekit/resources/accounts.rbi new file mode 100644 index 00000000..6a50dd49 --- /dev/null +++ b/rbi/imagekit/resources/accounts.rbi @@ -0,0 +1,21 @@ +# typed: strong + +module Imagekit + module Resources + class Accounts + sig { returns(Imagekit::Resources::Accounts::Usage) } + attr_reader :usage + + sig { returns(Imagekit::Resources::Accounts::Origins) } + attr_reader :origins + + sig { returns(Imagekit::Resources::Accounts::URLEndpoints) } + attr_reader :url_endpoints + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/resources/accounts/origins.rbi b/rbi/imagekit/resources/accounts/origins.rbi new file mode 100644 index 00000000..5eb4899b --- /dev/null +++ b/rbi/imagekit/resources/accounts/origins.rbi @@ -0,0 +1,111 @@ +# typed: strong + +module Imagekit + module Resources + class Accounts + class Origins + # **Note:** This API is currently in beta. + # Creates a new origin and returns the origin object. + sig do + params( + origin: + T.any( + Imagekit::Accounts::OriginRequest::S3::OrHash, + Imagekit::Accounts::OriginRequest::S3Compatible::OrHash, + Imagekit::Accounts::OriginRequest::CloudinaryBackup::OrHash, + Imagekit::Accounts::OriginRequest::WebFolder::OrHash, + Imagekit::Accounts::OriginRequest::WebProxy::OrHash, + Imagekit::Accounts::OriginRequest::Gcs::OrHash, + Imagekit::Accounts::OriginRequest::AzureBlob::OrHash, + Imagekit::Accounts::OriginRequest::AkeneoPim::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Accounts::OriginResponse::Variants) + end + def create( + # Schema for origin request resources. + origin:, + request_options: {} + ) + end + + # **Note:** This API is currently in beta. + # Updates the origin identified by `id` and returns the updated origin object. + sig do + params( + id: String, + origin: + T.any( + Imagekit::Accounts::OriginRequest::S3::OrHash, + Imagekit::Accounts::OriginRequest::S3Compatible::OrHash, + Imagekit::Accounts::OriginRequest::CloudinaryBackup::OrHash, + Imagekit::Accounts::OriginRequest::WebFolder::OrHash, + Imagekit::Accounts::OriginRequest::WebProxy::OrHash, + Imagekit::Accounts::OriginRequest::Gcs::OrHash, + Imagekit::Accounts::OriginRequest::AzureBlob::OrHash, + Imagekit::Accounts::OriginRequest::AkeneoPim::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Accounts::OriginResponse::Variants) + end + def update( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id, + # Schema for origin request resources. + origin:, + request_options: {} + ) + end + + # **Note:** This API is currently in beta. + # Returns an array of all configured origins for the current account. + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T::Array[Imagekit::Accounts::OriginResponse::Variants] + ) + end + def list(request_options: {}) + end + + # **Note:** This API is currently in beta. + # Permanently removes the origin identified by `id`. If the origin is in use by + # any URL‑endpoints, the API will return an error. + sig do + params( + id: String, + request_options: Imagekit::RequestOptions::OrHash + ).void + end + def delete( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id, + request_options: {} + ) + end + + # **Note:** This API is currently in beta. + # Retrieves the origin identified by `id`. + sig do + params( + id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Accounts::OriginResponse::Variants) + end + def get( + # Unique identifier for the origin. This is generated by ImageKit when you create + # a new origin. + id, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/accounts/url_endpoints.rbi b/rbi/imagekit/resources/accounts/url_endpoints.rbi new file mode 100644 index 00000000..46a2a571 --- /dev/null +++ b/rbi/imagekit/resources/accounts/url_endpoints.rbi @@ -0,0 +1,129 @@ +# typed: strong + +module Imagekit + module Resources + class Accounts + class URLEndpoints + # **Note:** This API is currently in beta. + # Creates a new URL‑endpoint and returns the resulting object. + sig do + params( + description: String, + origins: T::Array[String], + url_prefix: String, + url_rewriter: + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Accounts::URLEndpointResponse) + end + def create( + # Description of the URL endpoint. + description:, + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + origins: nil, + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + url_prefix: nil, + # Configuration for third-party URL rewriting. + url_rewriter: nil, + request_options: {} + ) + end + + # **Note:** This API is currently in beta. + # Updates the URL‑endpoint identified by `id` and returns the updated object. + sig do + params( + id: String, + description: String, + origins: T::Array[String], + url_prefix: String, + url_rewriter: + T.any( + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix::OrHash, + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Accounts::URLEndpointResponse) + end + def update( + # Unique identifier for the URL-endpoint. This is generated by ImageKit when you + # create a new URL-endpoint. For the default URL-endpoint, this is always + # `default`. + id, + # Description of the URL endpoint. + description:, + # Ordered list of origin IDs to try when the file isn’t in the Media Library; + # ImageKit checks them in the sequence provided. Origin must be created before it + # can be used in a URL endpoint. + origins: nil, + # Path segment appended to your base URL to form the endpoint (letters, digits, + # and hyphens only — or empty for the default endpoint). + url_prefix: nil, + # Configuration for third-party URL rewriting. + url_rewriter: nil, + request_options: {} + ) + end + + # **Note:** This API is currently in beta. + # Returns an array of all URL‑endpoints configured including the default + # URL-endpoint generated by ImageKit during account creation. + sig do + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T::Array[Imagekit::Accounts::URLEndpointResponse] + ) + end + def list(request_options: {}) + end + + # **Note:** This API is currently in beta. + # Deletes the URL‑endpoint identified by `id`. You cannot delete the default + # URL‑endpoint created by ImageKit during account creation. + sig do + params( + id: String, + request_options: Imagekit::RequestOptions::OrHash + ).void + end + def delete( + # Unique identifier for the URL-endpoint. This is generated by ImageKit when you + # create a new URL-endpoint. For the default URL-endpoint, this is always + # `default`. + id, + request_options: {} + ) + end + + # **Note:** This API is currently in beta. + # Retrieves the URL‑endpoint identified by `id`. + sig do + params( + id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Accounts::URLEndpointResponse) + end + def get( + # Unique identifier for the URL-endpoint. This is generated by ImageKit when you + # create a new URL-endpoint. For the default URL-endpoint, this is always + # `default`. + id, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/accounts/usage.rbi b/rbi/imagekit/resources/accounts/usage.rbi new file mode 100644 index 00000000..9efefba7 --- /dev/null +++ b/rbi/imagekit/resources/accounts/usage.rbi @@ -0,0 +1,36 @@ +# typed: strong + +module Imagekit + module Resources + class Accounts + class Usage + # Get the account usage information between two dates. Note that the API response + # includes data from the start date while excluding data from the end date. In + # other words, the data covers the period starting from the specified start date + # up to, but not including, the end date. + sig do + params( + end_date: Date, + start_date: Date, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Accounts::UsageGetResponse) + end + def get( + # Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + end_date:, + # Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + # The difference between `startDate` and `endDate` should be less than 90 days. + start_date:, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/assets.rbi b/rbi/imagekit/resources/assets.rbi new file mode 100644 index 00000000..52e5efc0 --- /dev/null +++ b/rbi/imagekit/resources/assets.rbi @@ -0,0 +1,74 @@ +# typed: strong + +module Imagekit + module Resources + class Assets + # This API can list all the uploaded files and folders in your ImageKit.io media + # library. In addition, you can fine-tune your query by specifying various filters + # by generating a query string in a Lucene-like syntax and provide this generated + # string as the value of the `searchQuery`. + sig do + params( + file_type: Imagekit::AssetListParams::FileType::OrSymbol, + limit: Integer, + path: String, + search_query: String, + skip: Integer, + sort: Imagekit::AssetListParams::Sort::OrSymbol, + type: Imagekit::AssetListParams::Type::OrSymbol, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T::Array[Imagekit::Models::AssetListResponseItem::Variants]) + end + def list( + # Filter results by file type. + # + # - `all` — include all file types + # - `image` — include only image files + # - `non-image` — include only non-image files (e.g., JS, CSS, video) + file_type: nil, + # The maximum number of results to return in response. + limit: nil, + # Folder path if you want to limit the search within a specific folder. For + # example, `/sales-banner/` will only search in folder sales-banner. + # + # Note : If your use case involves searching within a folder as well as its + # subfolders, you can use `path` parameter in `searchQuery` with appropriate + # operator. Checkout + # [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) + # for more information. + path: nil, + # Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + # + # Note : When the searchQuery parameter is present, the following query parameters + # will have no effect on the result: + # + # 1. `tags` + # 2. `type` + # 3. `name` + # + # [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) + # from examples. + search_query: nil, + # The number of results to skip before returning results. + skip: nil, + # Sort the results by one of the supported fields in ascending or descending + # order. + sort: nil, + # Filter results by asset type. + # + # - `file` — returns only files + # - `file-version` — returns specific file versions + # - `folder` — returns only folders + # - `all` — returns both files and folders (excludes `file-version`) + type: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/resources/beta.rbi b/rbi/imagekit/resources/beta.rbi new file mode 100644 index 00000000..6accb5af --- /dev/null +++ b/rbi/imagekit/resources/beta.rbi @@ -0,0 +1,15 @@ +# typed: strong + +module Imagekit + module Resources + class Beta + sig { returns(Imagekit::Resources::Beta::V2) } + attr_reader :v2 + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/resources/beta/v2.rbi b/rbi/imagekit/resources/beta/v2.rbi new file mode 100644 index 00000000..829675dc --- /dev/null +++ b/rbi/imagekit/resources/beta/v2.rbi @@ -0,0 +1,17 @@ +# typed: strong + +module Imagekit + module Resources + class Beta + class V2 + sig { returns(Imagekit::Resources::Beta::V2::Files) } + attr_reader :files + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/beta/v2/files.rbi b/rbi/imagekit/resources/beta/v2/files.rbi new file mode 100644 index 00000000..9c757f11 --- /dev/null +++ b/rbi/imagekit/resources/beta/v2/files.rbi @@ -0,0 +1,193 @@ +# typed: strong + +module Imagekit + module Resources + class Beta + class V2 + class Files + # The V2 API enhances security by verifying the entire payload using JWT. This API + # is in beta. + # + # ImageKit.io allows you to upload files directly from both the server and client + # sides. For server-side uploads, private API key authentication is used. For + # client-side uploads, generate a one-time `token` from your secure backend using + # private API. + # [Learn more](/docs/api-reference/upload-file/upload-file-v2#how-to-implement-secure-client-side-file-upload) + # about how to implement secure client-side file upload. + # + # **File size limit** \ + # On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + # files, and 100MB for videos. On the paid plan, these limits increase to 40MB for + # images, audio, and raw files, and 2GB for videos. These limits can be further increased + # with higher-tier plans. + # + # **Version limit** \ + # A file can have a maximum of 100 versions. + # + # **Demo applications** + # + # - A full-fledged + # [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + # supporting file selections from local storage, URL, Dropbox, Google Drive, + # Instagram, and more. + # - [Quick start guides](/docs/quick-start-guides) for various frameworks and + # technologies. + sig do + params( + file: Imagekit::Internal::FileInput, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::OrHash, + Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription::OrHash, + Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::OrHash + ) + ], + folder: String, + is_private_file: T::Boolean, + is_published: T::Boolean, + overwrite_ai_tags: T::Boolean, + overwrite_custom_metadata: T::Boolean, + overwrite_file: T::Boolean, + overwrite_tags: T::Boolean, + response_fields: + T::Array[ + Imagekit::Beta::V2::FileUploadParams::ResponseField::OrSymbol + ], + tags: T::Array[String], + transformation: + Imagekit::Beta::V2::FileUploadParams::Transformation::OrHash, + use_unique_file_name: T::Boolean, + webhook_url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Beta::V2::FileUploadResponse) + end + def upload( + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + file:, + # The name with which the file has to be uploaded. + file_name:, + # This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses + # it to authenticate and check that the upload request parameters have not been + # tampered with after the token has been generated. Learn how to create the token + # on the page below. This field is only required for authentication when uploading + # a file from the client side. + # + # **Note**: Sending a JWT that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new token. + # + # **⚠️Warning**: JWT must be generated on the server-side because it is generated + # using your account's private API key. This field is required for authentication + # when uploading a file from the client-side. + token: nil, + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks). + checks: nil, + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + custom_coordinates: nil, + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. Using multiple `/` creates a nested + # folder. + folder: nil, + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + is_private_file: nil, + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + is_published: nil, + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + overwrite_ai_tags: nil, + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + overwrite_custom_metadata: nil, + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + overwrite_file: nil, + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + overwrite_tags: nil, + # Array of response field keys to include in the API response body. + response_fields: nil, + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + tags: nil, + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + transformation: nil, + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + use_unique_file_name: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end + end +end diff --git a/rbi/imagekit/resources/cache.rbi b/rbi/imagekit/resources/cache.rbi new file mode 100644 index 00000000..5d9aa111 --- /dev/null +++ b/rbi/imagekit/resources/cache.rbi @@ -0,0 +1,15 @@ +# typed: strong + +module Imagekit + module Resources + class Cache + sig { returns(Imagekit::Resources::Cache::Invalidation) } + attr_reader :invalidation + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/resources/cache/invalidation.rbi b/rbi/imagekit/resources/cache/invalidation.rbi new file mode 100644 index 00000000..e0aa6e8b --- /dev/null +++ b/rbi/imagekit/resources/cache/invalidation.rbi @@ -0,0 +1,44 @@ +# typed: strong + +module Imagekit + module Resources + class Cache + class Invalidation + # This API will purge CDN cache and ImageKit.io's internal cache for a file. Note: + # Purge cache is an asynchronous process and it may take some time to reflect the + # changes. + sig do + params( + url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Cache::InvalidationCreateResponse) + end + def create( + # The full URL of the file to be purged. + url:, + request_options: {} + ) + end + + # This API returns the status of a purge cache request. + sig do + params( + request_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Cache::InvalidationGetResponse) + end + def get( + # Should be a valid requestId. + request_id, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/custom_metadata_fields.rbi b/rbi/imagekit/resources/custom_metadata_fields.rbi new file mode 100644 index 00000000..ed2578c3 --- /dev/null +++ b/rbi/imagekit/resources/custom_metadata_fields.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module Imagekit + module Resources + class CustomMetadataFields + # This API creates a new custom metadata field. Once a custom metadata field is + # created either through this API or using the dashboard UI, its value can be set + # on the assets. The value of a field for an asset can be set using the media + # library UI or programmatically through upload or update assets API. + sig do + params( + label: String, + name: String, + schema: Imagekit::CustomMetadataFieldCreateParams::Schema::OrHash, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::CustomMetadataField) + end + def create( + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. + label:, + # API name of the custom metadata field. This should be unique across all + # (including deleted) custom metadata fields. + name:, + schema:, + request_options: {} + ) + end + + # This API updates the label or schema of an existing custom metadata field. + sig do + params( + id: String, + label: String, + schema: Imagekit::CustomMetadataFieldUpdateParams::Schema::OrHash, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::CustomMetadataField) + end + def update( + # Should be a valid custom metadata field id. + id, + # Human readable name of the custom metadata field. This should be unique across + # all non deleted custom metadata fields. This name is displayed as form field + # label to the users while setting field value on an asset in the media library + # UI. This parameter is required if `schema` is not provided. + label: nil, + # An object that describes the rules for the custom metadata key. This parameter + # is required if `label` is not provided. Note: `type` cannot be updated and will + # be ignored if sent with the `schema`. The schema will be validated as per the + # existing `type`. + schema: nil, + request_options: {} + ) + end + + # This API returns the array of created custom metadata field objects. By default + # the API returns only non deleted field objects, but you can include deleted + # fields in the API response. + sig do + params( + include_deleted: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T::Array[Imagekit::CustomMetadataField]) + end + def list( + # Set it to `true` to include deleted field objects in the API response. + include_deleted: nil, + request_options: {} + ) + end + + # This API deletes a custom metadata field. Even after deleting a custom metadata + # field, you cannot create any new custom metadata field with the same name. + sig do + params( + id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::CustomMetadataFieldDeleteResponse) + end + def delete( + # Should be a valid custom metadata field id. + id, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi new file mode 100644 index 00000000..9d1db383 --- /dev/null +++ b/rbi/imagekit/resources/files.rbi @@ -0,0 +1,367 @@ +# typed: strong + +module Imagekit + module Resources + class Files + sig { returns(Imagekit::Resources::Files::Bulk) } + attr_reader :bulk + + sig { returns(Imagekit::Resources::Files::Versions) } + attr_reader :versions + + sig { returns(Imagekit::Resources::Files::Metadata) } + attr_reader :metadata + + # This API updates the details or attributes of the current version of the file. + # You can update `tags`, `customCoordinates`, `customMetadata`, publication + # status, remove existing `AITags` and apply extensions using this API. + sig do + params( + file_id: String, + update: + T.any( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::OrHash, + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FileUpdateResponse) + end + def update( + # The unique `fileId` of the uploaded file. `fileId` is returned in list and + # search assets API and upload API. + file_id, + update: nil, + request_options: {} + ) + end + + # This API deletes the file and all its file versions permanently. + # + # Note: If a file or specific transformation has been requested in the past, then + # the response is cached. Deleting a file does not purge the cache. You can purge + # the cache using purge cache API. + sig do + params( + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).void + end + def delete( + # The unique `fileId` of the uploaded file. `fileId` is returned in list and + # search assets API and upload API. + file_id, + request_options: {} + ) + end + + # This will copy a file from one folder to another. + # + # Note: If any file at the destination has the same name as the source file, then + # the source file and its versions (if `includeFileVersions` is set to true) will + # be appended to the destination file version history. + sig do + params( + destination_path: String, + source_file_path: String, + include_file_versions: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FileCopyResponse) + end + def copy( + # Full path to the folder you want to copy the above file into. + destination_path:, + # The full path of the file you want to copy. + source_file_path:, + # Option to copy all versions of a file. By default, only the current version of + # the file is copied. When set to true, all versions of the file will be copied. + # Default value - `false`. + include_file_versions: nil, + request_options: {} + ) + end + + # This API returns an object with details or attributes about the current version + # of the file. + sig do + params( + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::File) + end + def get( + # The unique `fileId` of the uploaded file. `fileId` is returned in the list and + # search assets API and upload API. + file_id, + request_options: {} + ) + end + + # This will move a file and all its versions from one folder to another. + # + # Note: If any file at the destination has the same name as the source file, then + # the source file and its versions will be appended to the destination file. + sig do + params( + destination_path: String, + source_file_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FileMoveResponse) + end + def move( + # Full path to the folder you want to move the above file into. + destination_path:, + # The full path of the file you want to move. + source_file_path:, + request_options: {} + ) + end + + # You can rename an already existing file in the media library using rename file + # API. This operation would rename all file versions of the file. + # + # Note: The old URLs will stop working. The file/file version URLs cached on CDN + # will continue to work unless a purge is requested. + sig do + params( + file_path: String, + new_file_name: String, + purge_cache: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FileRenameResponse) + end + def rename( + # The full path of the file you want to rename. + file_path:, + # The new name of the file. A filename can contain: + # + # Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, + # and numerals in other languages). Special Characters: `.`, `_`, and `-`. + # + # Any other character, including space, will be replaced by `_`. + new_file_name:, + # Option to purge cache for the old file and its versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove cached content of old file and its versions. This purge request is + # counted against your monthly purge quota. + # + # Note: If the old file were accessible at + # `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be + # issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard + # at the end). It will remove the file and its versions' URLs and any + # transformations made using query parameters on this file or its versions. + # However, the cache for file transformations made using path parameters will + # persist. You can purge them using the purge API. For more details, refer to the + # purge API documentation. + # + # Default value - `false` + purge_cache: nil, + request_options: {} + ) + end + + # ImageKit.io allows you to upload files directly from both the server and client + # sides. For server-side uploads, private API key authentication is used. For + # client-side uploads, generate a one-time `token`, `signature`, and `expire` from + # your secure backend using private API. + # [Learn more](/docs/api-reference/upload-file/upload-file#how-to-implement-client-side-file-upload) + # about how to implement client-side file upload. + # + # The [V2 API](/docs/api-reference/upload-file/upload-file-v2) enhances security + # by verifying the entire payload using JWT. + # + # **File size limit** \ + # On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + # files and 100MB for videos. On the paid plan, these limits increase to 40MB for images, + # audio, and raw files and 2GB for videos. These limits can be further increased with + # higher-tier plans. + # + # **Version limit** \ + # A file can have a maximum of 100 versions. + # + # **Demo applications** + # + # - A full-fledged + # [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + # supporting file selections from local storage, URL, Dropbox, Google Drive, + # Instagram, and more. + # - [Quick start guides](/docs/quick-start-guides) for various frameworks and + # technologies. + sig do + params( + file: Imagekit::Internal::FileInput, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + expire: Integer, + extensions: + T::Array[ + T.any( + Imagekit::FileUploadParams::Extension::RemoveBg::OrHash, + Imagekit::FileUploadParams::Extension::AIAutoDescription::OrHash, + Imagekit::FileUploadParams::Extension::AutoTaggingExtension::OrHash + ) + ], + folder: String, + is_private_file: T::Boolean, + is_published: T::Boolean, + overwrite_ai_tags: T::Boolean, + overwrite_custom_metadata: T::Boolean, + overwrite_file: T::Boolean, + overwrite_tags: T::Boolean, + public_key: String, + response_fields: + T::Array[Imagekit::FileUploadParams::ResponseField::OrSymbol], + signature: String, + tags: T::Array[String], + transformation: Imagekit::FileUploadParams::Transformation::OrHash, + use_unique_file_name: T::Boolean, + webhook_url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FileUploadResponse) + end + def upload( + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + file:, + # The name with which the file has to be uploaded. The file name can contain: + # + # - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`. + # - Special Characters: `.`, `-` + # + # Any other character including space will be replaced by `_` + file_name:, + # A unique value that the ImageKit.io server will use to recognize and prevent + # subsequent retries for the same request. We suggest using V4 UUIDs, or another + # random string with enough entropy to avoid collisions. This field is only + # required for authentication when uploading a file from the client side. + # + # **Note**: Sending a value that has been used in the past will result in a + # validation error. Even if your previous request resulted in an error, you should + # always send a new value for this field. + token: nil, + # Server-side checks to run on the asset. Read more about + # [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks). + checks: nil, + # Define an important area in the image. This is only relevant for image type + # files. + # + # - To be passed as a string with the x and y coordinates of the top-left corner, + # and width and height of the area of interest in the format `x,y,width,height`. + # For example - `10,10,100,100` + # - Can be used with fo-customtransformation. + # - If this field is not specified and the file is overwritten, then + # customCoordinates will be removed. + custom_coordinates: nil, + # JSON key-value pairs to associate with the asset. Create the custom metadata + # fields before setting these values. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # The time until your signature is valid. It must be a + # [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into + # the future. It should be in seconds. This field is only required for + # authentication when uploading a file from the client side. + expire: nil, + # Array of extensions to be applied to the image. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # The folder path in which the image has to be uploaded. If the folder(s) didn't + # exist before, a new folder(s) is created. + # + # The folder name can contain: + # + # - Alphanumeric Characters: `a-z` , `A-Z` , `0-9` + # - Special Characters: `/` , `_` , `-` + # + # Using multiple `/` creates a nested folder. + folder: nil, + # Whether to mark the file as private or not. + # + # If `true`, the file is marked as private and is accessible only using named + # transformation or signed URL. + is_private_file: nil, + # Whether to upload file as published or not. + # + # If `false`, the file is marked as unpublished, which restricts access to the + # file only via the media library. Files in draft or unpublished state can only be + # publicly accessed after being published. + # + # The option to upload in draft state is only available in custom enterprise + # pricing plans. + is_published: nil, + # If set to `true` and a file already exists at the exact location, its AITags + # will be removed. Set `overwriteAITags` to `false` to preserve AITags. + overwrite_ai_tags: nil, + # If the request does not have `customMetadata`, and a file already exists at the + # exact location, existing customMetadata will be removed. + overwrite_custom_metadata: nil, + # If `false` and `useUniqueFileName` is also `false`, and a file already exists at + # the exact location, upload API will return an error immediately. + overwrite_file: nil, + # If the request does not have `tags`, and a file already exists at the exact + # location, existing tags will be removed. + overwrite_tags: nil, + # Your ImageKit.io public key. This field is only required for authentication when + # uploading a file from the client side. + public_key: nil, + # Array of response field keys to include in the API response body. + response_fields: nil, + # HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + # key. Learn how to create a signature on the page below. This should be in + # lowercase. + # + # Signature must be calculated on the server-side. This field is only required for + # authentication when uploading a file from the client side. + signature: nil, + # Set the tags while uploading the file. Provide an array of tag strings (e.g. + # `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + # exceed 500, and the `%` character is not allowed. If this field is not specified + # and the file is overwritten, the existing tags will be removed. + tags: nil, + # Configure pre-processing (`pre`) and post-processing (`post`) transformations. + # + # - `pre` — applied before the file is uploaded to the Media Library. + # Useful for reducing file size or applying basic optimizations upfront (e.g., + # resize, compress). + # + # - `post` — applied immediately after upload. + # Ideal for generating transformed versions (like video encodes or thumbnails) + # in advance, so they're ready for delivery without delay. + # + # You can mix and match any combination of post-processing types. + transformation: nil, + # Whether to use a unique filename for this file or not. + # + # If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + # a unique filename. + # + # If `false`, then the image is uploaded with the provided filename parameter, and + # any existing file with the same name is replaced. + use_unique_file_name: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/resources/files/bulk.rbi b/rbi/imagekit/resources/files/bulk.rbi new file mode 100644 index 00000000..44af2dfe --- /dev/null +++ b/rbi/imagekit/resources/files/bulk.rbi @@ -0,0 +1,88 @@ +# typed: strong + +module Imagekit + module Resources + class Files + class Bulk + # This API deletes multiple files and all their file versions permanently. + # + # Note: If a file or specific transformation has been requested in the past, then + # the response is cached. Deleting a file does not purge the cache. You can purge + # the cache using purge cache API. + # + # A maximum of 100 files can be deleted at a time. + sig do + params( + file_ids: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Files::BulkDeleteResponse) + end + def delete( + # An array of fileIds which you want to delete. + file_ids:, + request_options: {} + ) + end + + # This API adds tags to multiple files in bulk. A maximum of 50 files can be + # specified at a time. + sig do + params( + file_ids: T::Array[String], + tags: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Files::BulkAddTagsResponse) + end + def add_tags( + # An array of fileIds to which you want to add tags. + file_ids:, + # An array of tags that you want to add to the files. + tags:, + request_options: {} + ) + end + + # This API removes AITags from multiple files in bulk. A maximum of 50 files can + # be specified at a time. + sig do + params( + ai_tags: T::Array[String], + file_ids: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Files::BulkRemoveAITagsResponse) + end + def remove_ai_tags( + # An array of AITags that you want to remove from the files. + ai_tags:, + # An array of fileIds from which you want to remove AITags. + file_ids:, + request_options: {} + ) + end + + # This API removes tags from multiple files in bulk. A maximum of 50 files can be + # specified at a time. + sig do + params( + file_ids: T::Array[String], + tags: T::Array[String], + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Files::BulkRemoveTagsResponse) + end + def remove_tags( + # An array of fileIds from which you want to remove tags. + file_ids:, + # An array of tags that you want to remove from the files. + tags:, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/files/metadata.rbi b/rbi/imagekit/resources/files/metadata.rbi new file mode 100644 index 00000000..34ecc601 --- /dev/null +++ b/rbi/imagekit/resources/files/metadata.rbi @@ -0,0 +1,49 @@ +# typed: strong + +module Imagekit + module Resources + class Files + class Metadata + # You can programmatically get image EXIF, pHash, and other metadata for uploaded + # files in the ImageKit.io media library using this API. + # + # You can also get the metadata in upload API response by passing `metadata` in + # `responseFields` parameter. + sig do + params( + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Metadata) + end + def get( + # The unique `fileId` of the uploaded file. `fileId` is returned in the list and + # search assets API and upload API. + file_id, + request_options: {} + ) + end + + # Get image EXIF, pHash, and other metadata from ImageKit.io powered remote URL + # using this API. + sig do + params( + url: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Metadata) + end + def get_from_url( + # Should be a valid file URL. It should be accessible using your ImageKit.io + # account. + url:, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/files/versions.rbi b/rbi/imagekit/resources/files/versions.rbi new file mode 100644 index 00000000..c27aff5d --- /dev/null +++ b/rbi/imagekit/resources/files/versions.rbi @@ -0,0 +1,89 @@ +# typed: strong + +module Imagekit + module Resources + class Files + class Versions + # This API returns details of all versions of a file. + sig do + params( + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(T::Array[Imagekit::File]) + end + def list( + # The unique `fileId` of the uploaded file. `fileId` is returned in list and + # search assets API and upload API. + file_id, + request_options: {} + ) + end + + # This API deletes a non-current file version permanently. The API returns an + # empty response. + # + # Note: If you want to delete all versions of a file, use the delete file API. + sig do + params( + version_id: String, + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Files::VersionDeleteResponse) + end + def delete( + # The unique `versionId` of the uploaded file. `versionId` is returned in list and + # search assets API and upload API. + version_id, + # The unique `fileId` of the uploaded file. `fileId` is returned in list and + # search assets API and upload API. + file_id:, + request_options: {} + ) + end + + # This API returns an object with details or attributes of a file version. + sig do + params( + version_id: String, + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::File) + end + def get( + # The unique `versionId` of the uploaded file. `versionId` is returned in list and + # search assets API and upload API. + version_id, + # The unique `fileId` of the uploaded file. `fileId` is returned in list and + # search assets API and upload API. + file_id:, + request_options: {} + ) + end + + # This API restores a file version as the current file version. + sig do + params( + version_id: String, + file_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::File) + end + def restore( + # The unique `versionId` of the uploaded file. `versionId` is returned in list and + # search assets API and upload API. + version_id, + # The unique `fileId` of the uploaded file. `fileId` is returned in list and + # search assets API and upload API. + file_id:, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/folders.rbi b/rbi/imagekit/resources/folders.rbi new file mode 100644 index 00000000..3fd9afd7 --- /dev/null +++ b/rbi/imagekit/resources/folders.rbi @@ -0,0 +1,146 @@ +# typed: strong + +module Imagekit + module Resources + class Folders + sig { returns(Imagekit::Resources::Folders::Job) } + attr_reader :job + + # This will create a new folder. You can specify the folder name and location of + # the parent folder where this new folder should be created. + sig do + params( + folder_name: String, + parent_folder_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FolderCreateResponse) + end + def create( + # The folder will be created with this name. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) will be replaced by an underscore i.e. + # `_`. + folder_name:, + # The folder where the new folder should be created, for root use `/` else the + # path e.g. `containing/folder/`. + # + # Note: If any folder(s) is not present in the parentFolderPath parameter, it will + # be automatically created. For example, if you pass `/product/images/summer`, + # then `product`, `images`, and `summer` folders will be created if they don't + # already exist. + parent_folder_path:, + request_options: {} + ) + end + + # This will delete a folder and all its contents permanently. The API returns an + # empty response. + sig do + params( + folder_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FolderDeleteResponse) + end + def delete( + # Full path to the folder you want to delete. For example `/folder/to/delete/`. + folder_path:, + request_options: {} + ) + end + + # This will copy one folder into another. The selected folder, its nested folders, + # files, and their versions (in `includeVersions` is set to true) are copied in + # this operation. Note: If any file at the destination has the same name as the + # source file, then the source file and its versions will be appended to the + # destination file version history. + sig do + params( + destination_path: String, + source_folder_path: String, + include_versions: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FolderCopyResponse) + end + def copy( + # Full path to the destination folder where you want to copy the source folder + # into. + destination_path:, + # The full path to the source folder you want to copy. + source_folder_path:, + # Option to copy all versions of files that are nested inside the selected folder. + # By default, only the current version of each file will be copied. When set to + # true, all versions of each file will be copied. Default value - `false`. + include_versions: nil, + request_options: {} + ) + end + + # This will move one folder into another. The selected folder, its nested folders, + # files, and their versions are moved in this operation. Note: If any file at the + # destination has the same name as the source file, then the source file and its + # versions will be appended to the destination file version history. + sig do + params( + destination_path: String, + source_folder_path: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FolderMoveResponse) + end + def move( + # Full path to the destination folder where you want to move the source folder + # into. + destination_path:, + # The full path to the source folder you want to move. + source_folder_path:, + request_options: {} + ) + end + + # This API allows you to rename an existing folder. The folder and all its nested + # assets and sub-folders will remain unchanged, but their paths will be updated to + # reflect the new folder name. + sig do + params( + folder_path: String, + new_folder_name: String, + purge_cache: T::Boolean, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::FolderRenameResponse) + end + def rename( + # The full path to the folder you want to rename. + folder_path:, + # The new name for the folder. + # + # All characters except alphabets and numbers (inclusive of unicode letters, + # marks, and numerals in other languages) and `-` will be replaced by an + # underscore i.e. `_`. + new_folder_name:, + # Option to purge cache for the old nested files and their versions' URLs. + # + # When set to true, it will internally issue a purge cache request on CDN to + # remove the cached content of the old nested files and their versions. There will + # only be one purge request for all the nested files, which will be counted + # against your monthly purge quota. + # + # Note: A purge cache request will be issued against + # `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This + # will remove all nested files, their versions' URLs, and any transformations made + # using query parameters on these files or their versions. However, the cache for + # file transformations made using path parameters will persist. You can purge them + # using the purge API. For more details, refer to the purge API documentation. + # + # Default value - `false` + purge_cache: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/resources/folders/job.rbi b/rbi/imagekit/resources/folders/job.rbi new file mode 100644 index 00000000..f59139e4 --- /dev/null +++ b/rbi/imagekit/resources/folders/job.rbi @@ -0,0 +1,29 @@ +# typed: strong + +module Imagekit + module Resources + class Folders + class Job + # This API returns the status of a bulk job like copy and move folder operations. + sig do + params( + job_id: String, + request_options: Imagekit::RequestOptions::OrHash + ).returns(Imagekit::Models::Folders::JobGetResponse) + end + def get( + # The `jobId` is returned in the response of bulk job API e.g. copy folder or move + # folder API. + job_id, + request_options: {} + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end + end +end diff --git a/rbi/imagekit/resources/webhooks.rbi b/rbi/imagekit/resources/webhooks.rbi new file mode 100644 index 00000000..76b48078 --- /dev/null +++ b/rbi/imagekit/resources/webhooks.rbi @@ -0,0 +1,50 @@ +# typed: strong + +module Imagekit + module Resources + class Webhooks + sig do + params(payload: String).returns( + T.any( + Imagekit::VideoTransformationAcceptedEvent, + Imagekit::VideoTransformationReadyEvent, + Imagekit::VideoTransformationErrorEvent, + Imagekit::UploadPreTransformSuccessEvent, + Imagekit::UploadPreTransformErrorEvent, + Imagekit::UploadPostTransformSuccessEvent, + Imagekit::UploadPostTransformErrorEvent + ) + ) + end + def unsafe_unwrap( + # The raw webhook payload as a string + payload + ) + end + + sig do + params(payload: String).returns( + T.any( + Imagekit::VideoTransformationAcceptedEvent, + Imagekit::VideoTransformationReadyEvent, + Imagekit::VideoTransformationErrorEvent, + Imagekit::UploadPreTransformSuccessEvent, + Imagekit::UploadPreTransformErrorEvent, + Imagekit::UploadPostTransformSuccessEvent, + Imagekit::UploadPostTransformErrorEvent + ) + ) + end + def unwrap( + # The raw webhook payload as a string + payload + ) + end + + # @api private + sig { params(client: Imagekit::Client).returns(T.attached_class) } + def self.new(client:) + end + end + end +end diff --git a/rbi/imagekit/version.rbi b/rbi/imagekit/version.rbi new file mode 100644 index 00000000..dd908e9e --- /dev/null +++ b/rbi/imagekit/version.rbi @@ -0,0 +1,5 @@ +# typed: strong + +module Imagekit + VERSION = T.let(T.unsafe(nil), String) +end diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 00000000..cc31aa85 --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then + brew bundle check >/dev/null 2>&1 || { + echo "==> Installing Homebrew dependencies…" + brew bundle + } +fi + +echo "==> Installing Ruby dependencies…" + +exec -- bundle install "$@" diff --git a/scripts/format b/scripts/format new file mode 100755 index 00000000..177d1e63 --- /dev/null +++ b/scripts/format @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Running formatters" + +exec -- bundle exec rake format "$@" diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 00000000..08b0dbeb --- /dev/null +++ b/scripts/lint @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Running linters" + +exec -- bundle exec rake lint "$@" diff --git a/scripts/mock b/scripts/mock new file mode 100755 index 00000000..0b28f6ea --- /dev/null +++ b/scripts/mock @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [[ -n "$1" && "$1" != '--'* ]]; then + URL="$1" + shift +else + URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" +fi + +# Check if the URL is empty +if [ -z "$URL" ]; then + echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" + exit 1 +fi + +echo "==> Starting mock server with URL ${URL}" + +# Run prism mock on the given spec +if [ "$1" == "--daemon" ]; then + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + + # Wait for server to come online + echo -n "Waiting for server" + while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + echo -n "." + sleep 0.1 + done + + if grep -q "✖ fatal" ".prism.log"; then + cat .prism.log + exit 1 + fi + + echo +else + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" +fi diff --git a/scripts/test b/scripts/test new file mode 100755 index 00000000..e0dc1374 --- /dev/null +++ b/scripts/test @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +function prism_is_running() { + curl --silent "http://localhost:4010" >/dev/null 2>&1 +} + +kill_server_on_port() { + pids=$(lsof -t -i tcp:"$1" || echo "") + if [ "$pids" != "" ]; then + kill "$pids" + echo "Stopped $pids." + fi +} + +function is_overriding_api_base_url() { + [ -n "$TEST_API_BASE_URL" ] +} + +if ! is_overriding_api_base_url && ! prism_is_running ; then + # When we exit this script, make sure to kill the background mock server process + trap 'kill_server_on_port 4010' EXIT + + # Start the dev server + ./scripts/mock --daemon +fi + +if is_overriding_api_base_url ; then + echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" + echo +elif ! prism_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" + echo -e "running against your OpenAPI spec." + echo + echo -e "To run the server, pass in the path or url of your OpenAPI" + echo -e "spec to the prism command:" + echo + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo + + exit 1 +else + echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo +fi + +echo "==> Running tests" +bundle exec rake test "$@" diff --git a/sig/imagekit/client.rbs b/sig/imagekit/client.rbs new file mode 100644 index 00000000..5e7f6ff8 --- /dev/null +++ b/sig/imagekit/client.rbs @@ -0,0 +1,45 @@ +module Imagekit + class Client < Imagekit::Internal::Transport::BaseClient + DEFAULT_MAX_RETRIES: 2 + + DEFAULT_TIMEOUT_IN_SECONDS: Float + + DEFAULT_INITIAL_RETRY_DELAY: Float + + DEFAULT_MAX_RETRY_DELAY: Float + + attr_reader private_api_key: String + + attr_reader password: String? + + attr_reader custom_metadata_fields: Imagekit::Resources::CustomMetadataFields + + attr_reader files: Imagekit::Resources::Files + + attr_reader assets: Imagekit::Resources::Assets + + attr_reader cache: Imagekit::Resources::Cache + + attr_reader folders: Imagekit::Resources::Folders + + attr_reader accounts: Imagekit::Resources::Accounts + + attr_reader beta: Imagekit::Resources::Beta + + attr_reader webhooks: Imagekit::Resources::Webhooks + + private def auth_headers: -> ::Hash[String, String] + + def base_url_overridden?: -> bool + + def initialize: ( + ?private_api_key: String?, + ?password: String?, + ?base_url: String?, + ?max_retries: Integer, + ?timeout: Float, + ?initial_retry_delay: Float, + ?max_retry_delay: Float + ) -> void + end +end diff --git a/sig/imagekit/errors.rbs b/sig/imagekit/errors.rbs new file mode 100644 index 00000000..40508602 --- /dev/null +++ b/sig/imagekit/errors.rbs @@ -0,0 +1,110 @@ +module Imagekit + module Errors + class Error < StandardError + attr_accessor cause: StandardError? + end + + class ConversionError < Imagekit::Errors::Error + def cause: -> StandardError? + + def initialize: ( + on: Class, + method: Symbol, + target: top, + value: top, + ?cause: StandardError? + ) -> void + end + + class APIError < Imagekit::Errors::Error + attr_accessor url: URI::Generic + + attr_accessor status: Integer? + + attr_accessor body: top? + + def initialize: ( + url: URI::Generic, + ?status: Integer?, + ?body: Object?, + ?request: nil, + ?response: nil, + ?message: String? + ) -> void + end + + class APIConnectionError < Imagekit::Errors::APIError + def initialize: ( + url: URI::Generic, + ?status: nil, + ?body: nil, + ?request: nil, + ?response: nil, + ?message: String? + ) -> void + end + + class APITimeoutError < Imagekit::Errors::APIConnectionError + def initialize: ( + url: URI::Generic, + ?status: nil, + ?body: nil, + ?request: nil, + ?response: nil, + ?message: String? + ) -> void + end + + class APIStatusError < Imagekit::Errors::APIError + def self.for: ( + url: URI::Generic, + status: Integer, + body: Object?, + request: nil, + response: nil, + ?message: String? + ) -> instance + + def initialize: ( + url: URI::Generic, + status: Integer, + body: Object?, + request: nil, + response: nil, + ?message: String? + ) -> void + end + + class BadRequestError < Imagekit::Errors::APIStatusError + HTTP_STATUS: 400 + end + + class AuthenticationError < Imagekit::Errors::APIStatusError + HTTP_STATUS: 401 + end + + class PermissionDeniedError < Imagekit::Errors::APIStatusError + HTTP_STATUS: 403 + end + + class NotFoundError < Imagekit::Errors::APIStatusError + HTTP_STATUS: 404 + end + + class ConflictError < Imagekit::Errors::APIStatusError + HTTP_STATUS: 409 + end + + class UnprocessableEntityError < Imagekit::Errors::APIStatusError + HTTP_STATUS: 422 + end + + class RateLimitError < Imagekit::Errors::APIStatusError + HTTP_STATUS: 429 + end + + class InternalServerError < Imagekit::Errors::APIStatusError + HTTP_STATUS: Range[Integer] + end + end +end diff --git a/sig/imagekit/file_part.rbs b/sig/imagekit/file_part.rbs new file mode 100644 index 00000000..3a8befa0 --- /dev/null +++ b/sig/imagekit/file_part.rbs @@ -0,0 +1,21 @@ +module Imagekit + class FilePart + attr_reader content: Pathname | StringIO | IO | String + + attr_reader content_type: String? + + attr_reader filename: String? + + private def read: -> String + + def to_json: (*top a) -> String + + def to_yaml: (*top a) -> String + + def initialize: ( + Pathname | StringIO | IO | String content, + ?filename: String?, + ?content_type: String? + ) -> void + end +end diff --git a/sig/imagekit/internal.rbs b/sig/imagekit/internal.rbs new file mode 100644 index 00000000..90664cb4 --- /dev/null +++ b/sig/imagekit/internal.rbs @@ -0,0 +1,9 @@ +module Imagekit + module Internal + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + type file_input = Pathname | StringIO | IO | String | Imagekit::FilePart + + OMIT: Object + end +end diff --git a/sig/imagekit/internal/transport/base_client.rbs b/sig/imagekit/internal/transport/base_client.rbs new file mode 100644 index 00000000..420b711d --- /dev/null +++ b/sig/imagekit/internal/transport/base_client.rbs @@ -0,0 +1,131 @@ +module Imagekit + module Internal + module Transport + class BaseClient + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + type request_components = + { + method: Symbol, + path: String | ::Array[String], + query: ::Hash[String, (::Array[String] | String)?]?, + headers: ::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?]?, + body: top?, + unwrap: (Symbol + | Integer + | ::Array[(Symbol | Integer)] + | (^(top arg0) -> top))?, + page: Class?, + stream: Class?, + model: Imagekit::Internal::Type::Converter::input?, + options: Imagekit::request_opts? + } + type request_input = + { + method: Symbol, + url: URI::Generic, + headers: ::Hash[String, String], + body: top, + max_retries: Integer, + timeout: Float + } + + MAX_REDIRECTS: 20 + + PLATFORM_HEADERS: ::Hash[String, String] + + def self.validate!: ( + Imagekit::Internal::Transport::BaseClient::request_components req + ) -> void + + def self.should_retry?: ( + Integer status, + headers: ::Hash[String, String] + ) -> bool + + def self.follow_redirect: ( + Imagekit::Internal::Transport::BaseClient::request_input request, + status: Integer, + response_headers: ::Hash[String, String] + ) -> Imagekit::Internal::Transport::BaseClient::request_input + + def self.reap_connection!: ( + Integer | Imagekit::Errors::APIConnectionError status, + stream: Enumerable[String]? + ) -> void + + attr_reader base_url: URI::Generic + + attr_reader timeout: Float + + attr_reader max_retries: Integer + + attr_reader initial_retry_delay: Float + + attr_reader max_retry_delay: Float + + attr_reader headers: ::Hash[String, String] + + attr_reader idempotency_header: String? + + # @api private + attr_reader requester: Imagekit::Internal::Transport::PooledNetRequester + + def initialize: ( + base_url: String, + ?timeout: Float, + ?max_retries: Integer, + ?initial_retry_delay: Float, + ?max_retry_delay: Float, + ?headers: ::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?], + ?idempotency_header: String? + ) -> void + + private def auth_headers: -> ::Hash[String, String] + + private def generate_idempotency_key: -> String + + private def build_request: ( + Imagekit::Internal::Transport::BaseClient::request_components req, + Imagekit::request_options opts + ) -> Imagekit::Internal::Transport::BaseClient::request_input + + private def retry_delay: ( + ::Hash[String, String] headers, + retry_count: Integer + ) -> Float + + def send_request: ( + Imagekit::Internal::Transport::BaseClient::request_input request, + redirect_count: Integer, + retry_count: Integer, + send_retry_header: bool + ) -> [Integer, top, Enumerable[String]] + + def request: ( + Symbol method, + String | ::Array[String] path, + ?query: ::Hash[String, (::Array[String] | String)?]?, + ?headers: ::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?]?, + ?body: top?, + ?unwrap: (Symbol + | Integer + | ::Array[(Symbol | Integer)] + | (^(top arg0) -> top))?, + ?page: Class?, + ?stream: Class?, + ?model: Imagekit::Internal::Type::Converter::input?, + ?options: Imagekit::request_opts? + ) -> top + + def inspect: -> String + end + end + end +end diff --git a/sig/imagekit/internal/transport/pooled_net_requester.rbs b/sig/imagekit/internal/transport/pooled_net_requester.rbs new file mode 100644 index 00000000..281ecf51 --- /dev/null +++ b/sig/imagekit/internal/transport/pooled_net_requester.rbs @@ -0,0 +1,45 @@ +module Imagekit + module Internal + module Transport + class PooledNetRequester + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + type request = + { + method: Symbol, + url: URI::Generic, + headers: ::Hash[String, String], + body: top, + deadline: Float + } + + KEEP_ALIVE_TIMEOUT: 30 + + DEFAULT_MAX_CONNECTIONS: Integer + + def self.connect: (URI::Generic url) -> top + + def self.calibrate_socket_timeout: (top conn, Float deadline) -> void + + def self.build_request: ( + Imagekit::Internal::Transport::PooledNetRequester::request request + ) { + (String arg0) -> void + } -> [top, (^-> void)] + + private def with_pool: ( + URI::Generic url, + deadline: Float + ) { + (top arg0) -> void + } -> void + + def execute: ( + Imagekit::Internal::Transport::PooledNetRequester::request request + ) -> [Integer, top, Enumerable[String]] + + def initialize: (?size: Integer) -> void + end + end + end +end diff --git a/sig/imagekit/internal/type/array_of.rbs b/sig/imagekit/internal/type/array_of.rbs new file mode 100644 index 00000000..53ceaa09 --- /dev/null +++ b/sig/imagekit/internal/type/array_of.rbs @@ -0,0 +1,48 @@ +module Imagekit + module Internal + module Type + class ArrayOf[Elem] + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + def self.[]: ( + ::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> instance + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + ::Array[top] | top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> (::Array[top] | top) + + def dump: ( + ::Array[top] | top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> (::Array[top] | top) + + def to_sorbet_type: -> top + + def item_type: -> Elem + + def nilable?: -> bool + + def initialize: ( + ::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/imagekit/internal/type/base_model.rbs b/sig/imagekit/internal/type/base_model.rbs new file mode 100644 index 00000000..81e90505 --- /dev/null +++ b/sig/imagekit/internal/type/base_model.rbs @@ -0,0 +1,102 @@ +module Imagekit + module Internal + module Type + class BaseModel + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + type known_field = + { mode: (:coerce | :dump)?, required: bool, nilable: bool } + + def self.inherited: (self child) -> void + + def self.known_fields: -> ::Hash[Symbol, (Imagekit::Internal::Type::BaseModel::known_field + & { type_fn: (^-> Imagekit::Internal::Type::Converter::input) })] + + def self.fields: -> ::Hash[Symbol, (Imagekit::Internal::Type::BaseModel::known_field + & { type: Imagekit::Internal::Type::Converter::input })] + + private def self.add_field: ( + Symbol name_sym, + required: bool, + type_info: { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Imagekit::Internal::Type::Converter::input?, + union: ^-> Imagekit::Internal::Type::Converter::input?, + api_name: Symbol + } + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input, + spec: ::Hash[Symbol, top] + ) -> void + + def self.required: ( + Symbol name_sym, + ::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + def self.optional: ( + Symbol name_sym, + ::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + private def self.request_only: { -> void } -> void + + private def self.response_only: { -> void } -> void + + def self.==: (top other) -> bool + + def self.hash: -> Integer + + def ==: (top other) -> bool + + def hash: -> Integer + + def self.coerce: ( + Imagekit::Internal::Type::BaseModel | ::Hash[top, top] | top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> (instance | top) + + def self.dump: ( + instance | top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> (::Hash[top, top] | top) + + def self.to_sorbet_type: -> top + + def self.recursively_to_h: ( + Imagekit::Internal::Type::BaseModel model, + convert: bool + ) -> ::Hash[Symbol, top] + + def []: (Symbol key) -> top? + + def to_h: -> ::Hash[Symbol, top] + + alias to_hash to_h + + def deep_to_h: -> ::Hash[Symbol, top] + + def deconstruct_keys: (::Array[Symbol]? keys) -> ::Hash[Symbol, top] + + def to_json: (*top a) -> String + + def to_yaml: (*top a) -> String + + def initialize: (?::Hash[Symbol, top] | instance data) -> void + + def self.inspect: (?depth: Integer) -> String + + def to_s: -> String + + def inspect: -> String + end + end + end +end diff --git a/sig/imagekit/internal/type/base_page.rbs b/sig/imagekit/internal/type/base_page.rbs new file mode 100644 index 00000000..cec13b1b --- /dev/null +++ b/sig/imagekit/internal/type/base_page.rbs @@ -0,0 +1,24 @@ +module Imagekit + module Internal + module Type + module BasePage[Elem] + def next_page?: -> bool + + def next_page: -> instance + + def auto_paging_each: { (Elem arg0) -> void } -> void + + def to_enum: -> Enumerable[Elem] + + alias enum_for to_enum + + def initialize: ( + client: Imagekit::Internal::Transport::BaseClient, + req: Imagekit::Internal::Transport::BaseClient::request_components, + headers: ::Hash[String, String], + page_data: top + ) -> void + end + end + end +end diff --git a/sig/imagekit/internal/type/boolean.rbs b/sig/imagekit/internal/type/boolean.rbs new file mode 100644 index 00000000..8ff7e123 --- /dev/null +++ b/sig/imagekit/internal/type/boolean.rbs @@ -0,0 +1,26 @@ +module Imagekit + module Internal + module Type + class Boolean + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + def self.===: (top other) -> bool + + def self.==: (top other) -> bool + + def self.coerce: ( + bool | top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> (bool | top) + + def self.dump: ( + bool | top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> (bool | top) + + def self.to_sorbet_type: -> top + end + end + end +end diff --git a/sig/imagekit/internal/type/converter.rbs b/sig/imagekit/internal/type/converter.rbs new file mode 100644 index 00000000..30d3221f --- /dev/null +++ b/sig/imagekit/internal/type/converter.rbs @@ -0,0 +1,79 @@ +module Imagekit + module Internal + module Type + module Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + type input = Imagekit::Internal::Type::Converter | Class + + type coerce_state = + { + translate_names: bool, + strictness: bool, + exactness: { yes: Integer, no: Integer, maybe: Integer }, + error: Class, + branched: Integer + } + + type dump_state = { can_retry: bool } + + def coerce: ( + top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> top + + def dump: ( + top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> top + + def inspect: (?depth: Integer) -> String + + def self.type_info: ( + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Imagekit::Internal::Type::Converter::input?, + union: ^-> Imagekit::Internal::Type::Converter::input? + } + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input spec + ) -> (^-> top) + + def self.meta_info: ( + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Imagekit::Internal::Type::Converter::input?, + union: ^-> Imagekit::Internal::Type::Converter::input? + } + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input type_info, + { + const: (nil | bool | Integer | Float | Symbol)?, + enum: ^-> Imagekit::Internal::Type::Converter::input?, + union: ^-> Imagekit::Internal::Type::Converter::input? + } + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input spec + ) -> ::Hash[Symbol, top] + + def self.new_coerce_state: ( + ?translate_names: bool + ) -> Imagekit::Internal::Type::Converter::coerce_state + + def self.coerce: ( + Imagekit::Internal::Type::Converter::input target, + top value, + ?state: Imagekit::Internal::Type::Converter::coerce_state + ) -> top + + def self.dump: ( + Imagekit::Internal::Type::Converter::input target, + top value, + ?state: Imagekit::Internal::Type::Converter::dump_state + ) -> top + + def self.inspect: (top target, depth: Integer) -> String + end + end + end +end diff --git a/sig/imagekit/internal/type/enum.rbs b/sig/imagekit/internal/type/enum.rbs new file mode 100644 index 00000000..19825e23 --- /dev/null +++ b/sig/imagekit/internal/type/enum.rbs @@ -0,0 +1,32 @@ +module Imagekit + module Internal + module Type + module Enum + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + def self.values: -> ::Array[(nil | bool | Integer | Float | Symbol)] + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + String | Symbol | top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> (Symbol | top) + + def dump: ( + Symbol | top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> (Symbol | top) + + def to_sorbet_type: -> top + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/imagekit/internal/type/file_input.rbs b/sig/imagekit/internal/type/file_input.rbs new file mode 100644 index 00000000..2047a19e --- /dev/null +++ b/sig/imagekit/internal/type/file_input.rbs @@ -0,0 +1,25 @@ +module Imagekit + module Internal + module Type + class FileInput + extend Imagekit::Internal::Type::Converter + + def self.===: (top other) -> bool + + def self.==: (top other) -> bool + + def self.coerce: ( + StringIO | String | top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> (StringIO | top) + + def self.dump: ( + Pathname | StringIO | IO | String | top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> (Pathname | StringIO | IO | String | top) + + def self.to_sorbet_type: -> top + end + end + end +end diff --git a/sig/imagekit/internal/type/hash_of.rbs b/sig/imagekit/internal/type/hash_of.rbs new file mode 100644 index 00000000..898a3566 --- /dev/null +++ b/sig/imagekit/internal/type/hash_of.rbs @@ -0,0 +1,48 @@ +module Imagekit + module Internal + module Type + class HashOf[Elem] + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + def self.[]: ( + ::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> instance + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + ::Hash[top, top] | top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> (::Hash[Symbol, top] | top) + + def dump: ( + ::Hash[top, top] | top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> (::Hash[Symbol, top] | top) + + def to_sorbet_type: -> top + + def item_type: -> Elem + + def nilable?: -> bool + + def initialize: ( + ::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input type_info, + ?::Hash[Symbol, top] spec + ) -> void + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/imagekit/internal/type/request_parameters.rbs b/sig/imagekit/internal/type/request_parameters.rbs new file mode 100644 index 00000000..33e5d91c --- /dev/null +++ b/sig/imagekit/internal/type/request_parameters.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Internal + module Type + type request_parameters = { request_options: Imagekit::request_opts } + + module RequestParameters + attr_reader request_options: Imagekit::request_opts + + def request_options=: (Imagekit::request_opts) -> Imagekit::request_opts + + module Converter + def dump_request: (top params) -> [top, ::Hash[Symbol, top]] + end + end + end + end +end diff --git a/sig/imagekit/internal/type/union.rbs b/sig/imagekit/internal/type/union.rbs new file mode 100644 index 00000000..1dcd9350 --- /dev/null +++ b/sig/imagekit/internal/type/union.rbs @@ -0,0 +1,52 @@ +module Imagekit + module Internal + module Type + module Union + include Imagekit::Internal::Type::Converter + include Imagekit::Internal::Util::SorbetRuntimeSupport + + private def self.known_variants: -> ::Array[[Symbol?, (^-> Imagekit::Internal::Type::Converter::input), ::Hash[Symbol, top]]] + + def self.derefed_variants: -> ::Array[[Symbol?, top, ::Hash[Symbol, top]]] + + def self.variants: -> ::Array[top] + + private def self.discriminator: (Symbol property) -> void + + private def self.variant: ( + Symbol + | ::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input key, + ?::Hash[Symbol, top] + | ^-> Imagekit::Internal::Type::Converter::input + | Imagekit::Internal::Type::Converter::input spec + ) -> void + + private def self.resolve_variant: ( + top value + ) -> Imagekit::Internal::Type::Converter::input? + + def ===: (top other) -> bool + + def ==: (top other) -> bool + + def hash: -> Integer + + def coerce: ( + top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> top + + def dump: ( + top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> top + + def to_sorbet_type: -> top + + def inspect: (?depth: Integer) -> String + end + end + end +end diff --git a/sig/imagekit/internal/type/unknown.rbs b/sig/imagekit/internal/type/unknown.rbs new file mode 100644 index 00000000..79647fe7 --- /dev/null +++ b/sig/imagekit/internal/type/unknown.rbs @@ -0,0 +1,26 @@ +module Imagekit + module Internal + module Type + class Unknown + extend Imagekit::Internal::Type::Converter + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + def self.===: (top other) -> bool + + def self.==: (top other) -> bool + + def self.coerce: ( + top value, + state: Imagekit::Internal::Type::Converter::coerce_state + ) -> top + + def self.dump: ( + top value, + state: Imagekit::Internal::Type::Converter::dump_state + ) -> top + + def self.to_sorbet_type: -> top + end + end + end +end diff --git a/sig/imagekit/internal/util.rbs b/sig/imagekit/internal/util.rbs new file mode 100644 index 00000000..4440cd2b --- /dev/null +++ b/sig/imagekit/internal/util.rbs @@ -0,0 +1,185 @@ +module Imagekit + module Internal + module Util + extend Imagekit::Internal::Util::SorbetRuntimeSupport + + def self?.monotonic_secs: -> Float + + def self?.walk_namespaces: ( + Module | Class ns + ) -> Enumerable[(Module | Class)] + + def self?.arch: -> String + + def self?.os: -> String + + def self?.primitive?: (top input) -> bool + + def self?.coerce_boolean: (String | bool input) -> (bool | top) + + def self?.coerce_boolean!: (String | bool input) -> bool? + + def self?.coerce_integer: (String | Integer input) -> (Integer | top) + + def self?.coerce_float: (String | Integer | Float input) -> (Float | top) + + def self?.coerce_hash: (top input) -> (::Hash[top, top] | top) + + def self?.coerce_hash!: (top input) -> ::Hash[top, top]? + + def self?.deep_merge_lr: (top lhs, top rhs, ?concat: bool) -> top + + def self?.deep_merge: ( + *::Array[top] values, + ?sentinel: top?, + ?concat: bool + ) -> top + + def self?.dig: ( + ::Hash[Symbol, top] | ::Array[top] | top data, + (Symbol + | Integer + | ::Array[(Symbol | Integer)] + | (^(top arg0) -> top))? pick + ) { + -> top? + } -> top? + + def self?.uri_origin: (URI::Generic uri) -> String + + def self?.interpolate_path: (String | ::Array[String] path) -> String + + def self?.decode_query: (String? query) -> ::Hash[String, ::Array[String]] + + def self?.encode_query: ( + ::Hash[String, (::Array[String] | String)?]? query + ) -> String? + + type parsed_uri = + { + scheme: String?, + host: String?, + port: Integer?, + path: String?, + query: ::Hash[String, ::Array[String]] + } + + def self?.parse_uri: ( + URI::Generic | String url + ) -> Imagekit::Internal::Util::parsed_uri + + def self?.unparse_uri: ( + Imagekit::Internal::Util::parsed_uri parsed + ) -> URI::Generic + + def self?.join_parsed_uri: ( + Imagekit::Internal::Util::parsed_uri lhs, + Imagekit::Internal::Util::parsed_uri rhs + ) -> URI::Generic + + def self?.normalized_headers: ( + *::Hash[String, (String + | Integer + | ::Array[(String | Integer)?])?] headers + ) -> ::Hash[String, String] + + class ReadIOAdapter + def close?: -> bool? + + def close: -> void + + private def read_enum: (Integer? max_len) -> String + + def read: (?Integer? max_len, ?String? out_string) -> String? + + def initialize: ( + String | Pathname | StringIO | Enumerable[String] src + ) { + (String arg0) -> void + } -> void + end + + def self?.writable_enum: { + (Enumerator::Yielder y) -> void + } -> Enumerable[String] + + JSON_CONTENT: Regexp + JSONL_CONTENT: Regexp + + def self?.write_multipart_content: ( + Enumerator::Yielder y, + val: top, + closing: ::Array[^-> void], + ?content_type: String? + ) -> void + + def self?.write_multipart_chunk: ( + Enumerator::Yielder y, + boundary: String, + key: Symbol | String, + val: top, + closing: ::Array[^-> void] + ) -> void + + def self?.encode_multipart_streaming: ( + top body + ) -> [String, Enumerable[String]] + + def self?.encode_content: ( + ::Hash[String, String] headers, + top body + ) -> top + + def self?.force_charset!: (String content_type, text: String) -> void + + def self?.decode_content: ( + ::Hash[String, String] headers, + stream: Enumerable[String], + ?suppress_error: bool + ) -> top + + def self?.fused_enum: ( + Enumerable[top] enum, + ?external: bool + ) { + -> void + } -> Enumerable[top] + + def self?.close_fused!: (Enumerable[top]? enum) -> void + + def self?.chain_fused: ( + Enumerable[top]? enum + ) { + (Enumerator::Yielder arg0) -> void + } -> Enumerable[top] + + type server_sent_event = + { event: String?, data: String?, id: String?, retry: Integer? } + + def self?.decode_lines: (Enumerable[String] enum) -> Enumerable[String] + + def self?.decode_sse: ( + Enumerable[String] lines + ) -> Enumerable[Imagekit::Internal::Util::server_sent_event] + + module SorbetRuntimeSupport + class MissingSorbetRuntimeError < ::RuntimeError + end + + private def sorbet_runtime_constants: -> ::Hash[Symbol, top] + + def const_missing: (Symbol name) -> void + + def sorbet_constant_defined?: (Symbol name) -> bool + + def define_sorbet_constant!: (Symbol name) { -> top } -> void + + def to_sorbet_type: -> top + + def self.to_sorbet_type: ( + Imagekit::Internal::Util::SorbetRuntimeSupport | top `type` + ) -> top + end + end + end +end diff --git a/sig/imagekit/models.rbs b/sig/imagekit/models.rbs new file mode 100644 index 00000000..746736e2 --- /dev/null +++ b/sig/imagekit/models.rbs @@ -0,0 +1,107 @@ +module Imagekit + module Accounts = Imagekit::Models::Accounts + + class AssetListParams = Imagekit::Models::AssetListParams + + class BaseOverlay = Imagekit::Models::BaseOverlay + + module Beta = Imagekit::Models::Beta + + module Cache = Imagekit::Models::Cache + + class CustomMetadataField = Imagekit::Models::CustomMetadataField + + class CustomMetadataFieldCreateParams = Imagekit::Models::CustomMetadataFieldCreateParams + + class CustomMetadataFieldDeleteParams = Imagekit::Models::CustomMetadataFieldDeleteParams + + class CustomMetadataFieldListParams = Imagekit::Models::CustomMetadataFieldListParams + + class CustomMetadataFieldUpdateParams = Imagekit::Models::CustomMetadataFieldUpdateParams + + class File = Imagekit::Models::File + + class FileCopyParams = Imagekit::Models::FileCopyParams + + class FileDeleteParams = Imagekit::Models::FileDeleteParams + + class FileGetParams = Imagekit::Models::FileGetParams + + class FileMoveParams = Imagekit::Models::FileMoveParams + + class FileRenameParams = Imagekit::Models::FileRenameParams + + module Files = Imagekit::Models::Files + + class FileUpdateParams = Imagekit::Models::FileUpdateParams + + class FileUploadParams = Imagekit::Models::FileUploadParams + + class Folder = Imagekit::Models::Folder + + class FolderCopyParams = Imagekit::Models::FolderCopyParams + + class FolderCreateParams = Imagekit::Models::FolderCreateParams + + class FolderDeleteParams = Imagekit::Models::FolderDeleteParams + + class FolderMoveParams = Imagekit::Models::FolderMoveParams + + class FolderRenameParams = Imagekit::Models::FolderRenameParams + + module Folders = Imagekit::Models::Folders + + class ImageOverlay = Imagekit::Models::ImageOverlay + + class Metadata = Imagekit::Models::Metadata + + module Overlay = Imagekit::Models::Overlay + + class OverlayPosition = Imagekit::Models::OverlayPosition + + class OverlayTiming = Imagekit::Models::OverlayTiming + + class SolidColorOverlay = Imagekit::Models::SolidColorOverlay + + class SolidColorOverlayTransformation = Imagekit::Models::SolidColorOverlayTransformation + + class SrcOptions = Imagekit::Models::SrcOptions + + module StreamingResolution = Imagekit::Models::StreamingResolution + + class SubtitleOverlay = Imagekit::Models::SubtitleOverlay + + class SubtitleOverlayTransformation = Imagekit::Models::SubtitleOverlayTransformation + + class TextOverlay = Imagekit::Models::TextOverlay + + class TextOverlayTransformation = Imagekit::Models::TextOverlayTransformation + + class Transformation = Imagekit::Models::Transformation + + module TransformationPosition = Imagekit::Models::TransformationPosition + + module UnsafeUnwrapWebhookEvent = Imagekit::Models::UnsafeUnwrapWebhookEvent + + module UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent + + class UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent + + class UploadPostTransformSuccessEvent = Imagekit::Models::UploadPostTransformSuccessEvent + + class UploadPreTransformErrorEvent = Imagekit::Models::UploadPreTransformErrorEvent + + class UploadPreTransformSuccessEvent = Imagekit::Models::UploadPreTransformSuccessEvent + + class VideoOverlay = Imagekit::Models::VideoOverlay + + class VideoTransformationAcceptedEvent = Imagekit::Models::VideoTransformationAcceptedEvent + + class VideoTransformationErrorEvent = Imagekit::Models::VideoTransformationErrorEvent + + class VideoTransformationReadyEvent = Imagekit::Models::VideoTransformationReadyEvent + + class WebhookUnsafeUnwrapParams = Imagekit::Models::WebhookUnsafeUnwrapParams + + class WebhookUnwrapParams = Imagekit::Models::WebhookUnwrapParams +end diff --git a/sig/imagekit/models/accounts/origin_create_params.rbs b/sig/imagekit/models/accounts/origin_create_params.rbs new file mode 100644 index 00000000..60ad3272 --- /dev/null +++ b/sig/imagekit/models/accounts/origin_create_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type origin_create_params = + { } & Imagekit::Internal::Type::request_parameters + + class OriginCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/origin_delete_params.rbs b/sig/imagekit/models/accounts/origin_delete_params.rbs new file mode 100644 index 00000000..da2cff14 --- /dev/null +++ b/sig/imagekit/models/accounts/origin_delete_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type origin_delete_params = + { } & Imagekit::Internal::Type::request_parameters + + class OriginDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/origin_get_params.rbs b/sig/imagekit/models/accounts/origin_get_params.rbs new file mode 100644 index 00000000..b80c072e --- /dev/null +++ b/sig/imagekit/models/accounts/origin_get_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type origin_get_params = + { } & Imagekit::Internal::Type::request_parameters + + class OriginGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/origin_list_params.rbs b/sig/imagekit/models/accounts/origin_list_params.rbs new file mode 100644 index 00000000..ea2e0350 --- /dev/null +++ b/sig/imagekit/models/accounts/origin_list_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type origin_list_params = + { } & Imagekit::Internal::Type::request_parameters + + class OriginListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/origin_list_response.rbs b/sig/imagekit/models/accounts/origin_list_response.rbs new file mode 100644 index 00000000..e689073a --- /dev/null +++ b/sig/imagekit/models/accounts/origin_list_response.rbs @@ -0,0 +1,10 @@ +module Imagekit + module Models + module Accounts + type origin_list_response = + ::Array[Imagekit::Models::Accounts::origin_response] + + OriginListResponse: Imagekit::Internal::Type::Converter + end + end +end diff --git a/sig/imagekit/models/accounts/origin_request.rbs b/sig/imagekit/models/accounts/origin_request.rbs new file mode 100644 index 00000000..2e5e7916 --- /dev/null +++ b/sig/imagekit/models/accounts/origin_request.rbs @@ -0,0 +1,468 @@ +module Imagekit + module Models + module Accounts + type origin_request = + Imagekit::Accounts::OriginRequest::S3 + | Imagekit::Accounts::OriginRequest::S3Compatible + | Imagekit::Accounts::OriginRequest::CloudinaryBackup + | Imagekit::Accounts::OriginRequest::WebFolder + | Imagekit::Accounts::OriginRequest::WebProxy + | Imagekit::Accounts::OriginRequest::Gcs + | Imagekit::Accounts::OriginRequest::AzureBlob + | Imagekit::Accounts::OriginRequest::AkeneoPim + + module OriginRequest + extend Imagekit::Internal::Type::Union + + type s3 = + { + access_key: String, + bucket: String, + name: String, + secret_key: String, + type: :S3, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + + class S3 < Imagekit::Internal::Type::BaseModel + attr_accessor access_key: String + + attr_accessor bucket: String + + attr_accessor name: String + + attr_accessor secret_key: String + + attr_accessor type: :S3 + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + attr_reader prefix: String? + + def prefix=: (String) -> String + + def initialize: ( + access_key: String, + bucket: String, + name: String, + secret_key: String, + ?base_url_for_canonical_header: String, + ?include_canonical_header: bool, + ?prefix: String, + ?type: :S3 + ) -> void + + def to_hash: -> { + access_key: String, + bucket: String, + name: String, + secret_key: String, + type: :S3, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + end + + type s3_compatible = + { + access_key: String, + bucket: String, + endpoint: String, + name: String, + secret_key: String, + type: :S3_COMPATIBLE, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String, + :s3_force_path_style => bool + } + + class S3Compatible < Imagekit::Internal::Type::BaseModel + attr_accessor access_key: String + + attr_accessor bucket: String + + attr_accessor endpoint: String + + attr_accessor name: String + + attr_accessor secret_key: String + + attr_accessor type: :S3_COMPATIBLE + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + attr_reader prefix: String? + + def prefix=: (String) -> String + + attr_reader s3_force_path_style: bool? + + def s3_force_path_style=: (bool) -> bool + + def initialize: ( + access_key: String, + bucket: String, + endpoint: String, + name: String, + secret_key: String, + ?base_url_for_canonical_header: String, + ?include_canonical_header: bool, + ?prefix: String, + ?s3_force_path_style: bool, + ?type: :S3_COMPATIBLE + ) -> void + + def to_hash: -> { + access_key: String, + bucket: String, + endpoint: String, + name: String, + secret_key: String, + type: :S3_COMPATIBLE, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String, + :s3_force_path_style => bool + } + end + + type cloudinary_backup = + { + access_key: String, + bucket: String, + name: String, + secret_key: String, + type: :CLOUDINARY_BACKUP, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + + class CloudinaryBackup < Imagekit::Internal::Type::BaseModel + attr_accessor access_key: String + + attr_accessor bucket: String + + attr_accessor name: String + + attr_accessor secret_key: String + + attr_accessor type: :CLOUDINARY_BACKUP + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + attr_reader prefix: String? + + def prefix=: (String) -> String + + def initialize: ( + access_key: String, + bucket: String, + name: String, + secret_key: String, + ?base_url_for_canonical_header: String, + ?include_canonical_header: bool, + ?prefix: String, + ?type: :CLOUDINARY_BACKUP + ) -> void + + def to_hash: -> { + access_key: String, + bucket: String, + name: String, + secret_key: String, + type: :CLOUDINARY_BACKUP, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + end + + type web_folder = + { + base_url: String, + name: String, + type: :WEB_FOLDER, + base_url_for_canonical_header: String, + forward_host_header_to_origin: bool, + include_canonical_header: bool + } + + class WebFolder < Imagekit::Internal::Type::BaseModel + attr_accessor base_url: String + + attr_accessor name: String + + attr_accessor type: :WEB_FOLDER + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader forward_host_header_to_origin: bool? + + def forward_host_header_to_origin=: (bool) -> bool + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + def initialize: ( + base_url: String, + name: String, + ?base_url_for_canonical_header: String, + ?forward_host_header_to_origin: bool, + ?include_canonical_header: bool, + ?type: :WEB_FOLDER + ) -> void + + def to_hash: -> { + base_url: String, + name: String, + type: :WEB_FOLDER, + base_url_for_canonical_header: String, + forward_host_header_to_origin: bool, + include_canonical_header: bool + } + end + + type web_proxy = + { + name: String, + type: :WEB_PROXY, + base_url_for_canonical_header: String, + include_canonical_header: bool + } + + class WebProxy < Imagekit::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor type: :WEB_PROXY + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + def initialize: ( + name: String, + ?base_url_for_canonical_header: String, + ?include_canonical_header: bool, + ?type: :WEB_PROXY + ) -> void + + def to_hash: -> { + name: String, + type: :WEB_PROXY, + base_url_for_canonical_header: String, + include_canonical_header: bool + } + end + + type gcs = + { + bucket: String, + client_email: String, + name: String, + private_key: String, + type: :GCS, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + + class Gcs < Imagekit::Internal::Type::BaseModel + attr_accessor bucket: String + + attr_accessor client_email: String + + attr_accessor name: String + + attr_accessor private_key: String + + attr_accessor type: :GCS + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + attr_reader prefix: String? + + def prefix=: (String) -> String + + def initialize: ( + bucket: String, + client_email: String, + name: String, + private_key: String, + ?base_url_for_canonical_header: String, + ?include_canonical_header: bool, + ?prefix: String, + ?type: :GCS + ) -> void + + def to_hash: -> { + bucket: String, + client_email: String, + name: String, + private_key: String, + type: :GCS, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + end + + type azure_blob = + { + account_name: String, + container: String, + name: String, + sas_token: String, + type: :AZURE_BLOB, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + + class AzureBlob < Imagekit::Internal::Type::BaseModel + attr_accessor account_name: String + + attr_accessor container: String + + attr_accessor name: String + + attr_accessor sas_token: String + + attr_accessor type: :AZURE_BLOB + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + attr_reader prefix: String? + + def prefix=: (String) -> String + + def initialize: ( + account_name: String, + container: String, + name: String, + sas_token: String, + ?base_url_for_canonical_header: String, + ?include_canonical_header: bool, + ?prefix: String, + ?type: :AZURE_BLOB + ) -> void + + def to_hash: -> { + account_name: String, + container: String, + name: String, + sas_token: String, + type: :AZURE_BLOB, + base_url_for_canonical_header: String, + include_canonical_header: bool, + prefix: String + } + end + + type akeneo_pim = + { + base_url: String, + client_id: String, + client_secret: String, + name: String, + password: String, + type: :AKENEO_PIM, + username: String, + base_url_for_canonical_header: String, + include_canonical_header: bool + } + + class AkeneoPim < Imagekit::Internal::Type::BaseModel + attr_accessor base_url: String + + attr_accessor client_id: String + + attr_accessor client_secret: String + + attr_accessor name: String + + attr_accessor password: String + + attr_accessor type: :AKENEO_PIM + + attr_accessor username: String + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_reader include_canonical_header: bool? + + def include_canonical_header=: (bool) -> bool + + def initialize: ( + base_url: String, + client_id: String, + client_secret: String, + name: String, + password: String, + username: String, + ?base_url_for_canonical_header: String, + ?include_canonical_header: bool, + ?type: :AKENEO_PIM + ) -> void + + def to_hash: -> { + base_url: String, + client_id: String, + client_secret: String, + name: String, + password: String, + type: :AKENEO_PIM, + username: String, + base_url_for_canonical_header: String, + include_canonical_header: bool + } + end + + def self?.variants: -> ::Array[Imagekit::Models::Accounts::origin_request] + end + end + end +end diff --git a/sig/imagekit/models/accounts/origin_response.rbs b/sig/imagekit/models/accounts/origin_response.rbs new file mode 100644 index 00000000..bca52d65 --- /dev/null +++ b/sig/imagekit/models/accounts/origin_response.rbs @@ -0,0 +1,418 @@ +module Imagekit + module Models + module Accounts + type origin_response = + Imagekit::Accounts::OriginResponse::S3 + | Imagekit::Accounts::OriginResponse::S3Compatible + | Imagekit::Accounts::OriginResponse::CloudinaryBackup + | Imagekit::Accounts::OriginResponse::WebFolder + | Imagekit::Accounts::OriginResponse::WebProxy + | Imagekit::Accounts::OriginResponse::Gcs + | Imagekit::Accounts::OriginResponse::AzureBlob + | Imagekit::Accounts::OriginResponse::AkeneoPim + + module OriginResponse + extend Imagekit::Internal::Type::Union + + type s3 = + { + id: String, + bucket: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :S3, + base_url_for_canonical_header: String + } + + class S3 < Imagekit::Internal::Type::BaseModel + attr_accessor bucket: String + + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor prefix: String + + attr_accessor type: :S3 + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + bucket: String, + include_canonical_header: bool, + name: String, + prefix: String, + ?base_url_for_canonical_header: String, + ?type: :S3 + ) -> void + + def to_hash: -> { + id: String, + bucket: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :S3, + base_url_for_canonical_header: String + } + end + + type s3_compatible = + { + id: String, + bucket: String, + endpoint: String, + include_canonical_header: bool, + name: String, + prefix: String, + :s3_force_path_style => bool, + type: :S3_COMPATIBLE, + base_url_for_canonical_header: String + } + + class S3Compatible < Imagekit::Internal::Type::BaseModel + attr_accessor bucket: String + + attr_accessor endpoint: String + + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor prefix: String + + attr_accessor s3_force_path_style: bool + + attr_accessor type: :S3_COMPATIBLE + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + bucket: String, + endpoint: String, + include_canonical_header: bool, + name: String, + prefix: String, + s3_force_path_style: bool, + ?base_url_for_canonical_header: String, + ?type: :S3_COMPATIBLE + ) -> void + + def to_hash: -> { + id: String, + bucket: String, + endpoint: String, + include_canonical_header: bool, + name: String, + prefix: String, + :s3_force_path_style => bool, + type: :S3_COMPATIBLE, + base_url_for_canonical_header: String + } + end + + type cloudinary_backup = + { + id: String, + bucket: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :CLOUDINARY_BACKUP, + base_url_for_canonical_header: String + } + + class CloudinaryBackup < Imagekit::Internal::Type::BaseModel + attr_accessor bucket: String + + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor prefix: String + + attr_accessor type: :CLOUDINARY_BACKUP + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + bucket: String, + include_canonical_header: bool, + name: String, + prefix: String, + ?base_url_for_canonical_header: String, + ?type: :CLOUDINARY_BACKUP + ) -> void + + def to_hash: -> { + id: String, + bucket: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :CLOUDINARY_BACKUP, + base_url_for_canonical_header: String + } + end + + type web_folder = + { + id: String, + base_url: String, + forward_host_header_to_origin: bool, + include_canonical_header: bool, + name: String, + type: :WEB_FOLDER, + base_url_for_canonical_header: String + } + + class WebFolder < Imagekit::Internal::Type::BaseModel + attr_accessor base_url: String + + attr_accessor forward_host_header_to_origin: bool + + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor type: :WEB_FOLDER + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + base_url: String, + forward_host_header_to_origin: bool, + include_canonical_header: bool, + name: String, + ?base_url_for_canonical_header: String, + ?type: :WEB_FOLDER + ) -> void + + def to_hash: -> { + id: String, + base_url: String, + forward_host_header_to_origin: bool, + include_canonical_header: bool, + name: String, + type: :WEB_FOLDER, + base_url_for_canonical_header: String + } + end + + type web_proxy = + { + id: String, + include_canonical_header: bool, + name: String, + type: :WEB_PROXY, + base_url_for_canonical_header: String + } + + class WebProxy < Imagekit::Internal::Type::BaseModel + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor type: :WEB_PROXY + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + include_canonical_header: bool, + name: String, + ?base_url_for_canonical_header: String, + ?type: :WEB_PROXY + ) -> void + + def to_hash: -> { + id: String, + include_canonical_header: bool, + name: String, + type: :WEB_PROXY, + base_url_for_canonical_header: String + } + end + + type gcs = + { + id: String, + bucket: String, + client_email: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :GCS, + base_url_for_canonical_header: String + } + + class Gcs < Imagekit::Internal::Type::BaseModel + attr_accessor bucket: String + + attr_accessor client_email: String + + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor prefix: String + + attr_accessor type: :GCS + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + bucket: String, + client_email: String, + include_canonical_header: bool, + name: String, + prefix: String, + ?base_url_for_canonical_header: String, + ?type: :GCS + ) -> void + + def to_hash: -> { + id: String, + bucket: String, + client_email: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :GCS, + base_url_for_canonical_header: String + } + end + + type azure_blob = + { + id: String, + account_name: String, + container: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :AZURE_BLOB, + base_url_for_canonical_header: String + } + + class AzureBlob < Imagekit::Internal::Type::BaseModel + attr_accessor account_name: String + + attr_accessor container: String + + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor prefix: String + + attr_accessor type: :AZURE_BLOB + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + account_name: String, + container: String, + include_canonical_header: bool, + name: String, + prefix: String, + ?base_url_for_canonical_header: String, + ?type: :AZURE_BLOB + ) -> void + + def to_hash: -> { + id: String, + account_name: String, + container: String, + include_canonical_header: bool, + name: String, + prefix: String, + type: :AZURE_BLOB, + base_url_for_canonical_header: String + } + end + + type akeneo_pim = + { + id: String, + base_url: String, + include_canonical_header: bool, + name: String, + type: :AKENEO_PIM, + base_url_for_canonical_header: String + } + + class AkeneoPim < Imagekit::Internal::Type::BaseModel + attr_accessor base_url: String + + attr_accessor include_canonical_header: bool + + attr_accessor name: String + + attr_accessor type: :AKENEO_PIM + + attr_reader base_url_for_canonical_header: String? + + def base_url_for_canonical_header=: (String) -> String + + attr_accessor id: String + + def initialize: ( + id: String, + base_url: String, + include_canonical_header: bool, + name: String, + ?base_url_for_canonical_header: String, + ?type: :AKENEO_PIM + ) -> void + + def to_hash: -> { + id: String, + base_url: String, + include_canonical_header: bool, + name: String, + type: :AKENEO_PIM, + base_url_for_canonical_header: String + } + end + + def self?.variants: -> ::Array[Imagekit::Models::Accounts::origin_response] + end + end + end +end diff --git a/sig/imagekit/models/accounts/origin_update_params.rbs b/sig/imagekit/models/accounts/origin_update_params.rbs new file mode 100644 index 00000000..cb2744ce --- /dev/null +++ b/sig/imagekit/models/accounts/origin_update_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type origin_update_params = + { } & Imagekit::Internal::Type::request_parameters + + class OriginUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_create_params.rbs b/sig/imagekit/models/accounts/url_endpoint_create_params.rbs new file mode 100644 index 00000000..d657e79d --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_create_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_create_params = + { } & Imagekit::Internal::Type::request_parameters + + class URLEndpointCreateParams < Imagekit::Models::Accounts::URLEndpointRequest + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_delete_params.rbs b/sig/imagekit/models/accounts/url_endpoint_delete_params.rbs new file mode 100644 index 00000000..ea88292a --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_delete_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_delete_params = + { } & Imagekit::Internal::Type::request_parameters + + class URLEndpointDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_get_params.rbs b/sig/imagekit/models/accounts/url_endpoint_get_params.rbs new file mode 100644 index 00000000..f13c5bf6 --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_get_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_get_params = + { } & Imagekit::Internal::Type::request_parameters + + class URLEndpointGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_list_params.rbs b/sig/imagekit/models/accounts/url_endpoint_list_params.rbs new file mode 100644 index 00000000..f90a121a --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_list_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_list_params = + { } & Imagekit::Internal::Type::request_parameters + + class URLEndpointListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_list_response.rbs b/sig/imagekit/models/accounts/url_endpoint_list_response.rbs new file mode 100644 index 00000000..01943b07 --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_list_response.rbs @@ -0,0 +1,10 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_list_response = + ::Array[Imagekit::Accounts::URLEndpointResponse] + + URLEndpointListResponse: Imagekit::Internal::Type::Converter + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_request.rbs b/sig/imagekit/models/accounts/url_endpoint_request.rbs new file mode 100644 index 00000000..de0983f1 --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_request.rbs @@ -0,0 +1,97 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_request = + { + description: String, + origins: ::Array[String], + url_prefix: String, + url_rewriter: Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter + } + + class URLEndpointRequest < Imagekit::Internal::Type::BaseModel + attr_accessor description: String + + attr_reader origins: ::Array[String]? + + def origins=: (::Array[String]) -> ::Array[String] + + attr_reader url_prefix: String? + + def url_prefix=: (String) -> String + + attr_reader url_rewriter: Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter? + + def url_rewriter=: ( + Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter + ) -> Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter + + def initialize: ( + description: String, + ?origins: ::Array[String], + ?url_prefix: String, + ?url_rewriter: Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter + ) -> void + + def to_hash: -> { + description: String, + origins: ::Array[String], + url_prefix: String, + url_rewriter: Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter + } + + type url_rewriter = + Imagekit::Accounts::URLEndpointRequest::URLRewriter::Cloudinary + | Imagekit::Accounts::URLEndpointRequest::URLRewriter::Imgix + | Imagekit::Accounts::URLEndpointRequest::URLRewriter::Akamai + + module URLRewriter + extend Imagekit::Internal::Type::Union + + type cloudinary = + { type: :CLOUDINARY, preserve_asset_delivery_types: bool } + + class Cloudinary < Imagekit::Internal::Type::BaseModel + attr_accessor type: :CLOUDINARY + + attr_reader preserve_asset_delivery_types: bool? + + def preserve_asset_delivery_types=: (bool) -> bool + + def initialize: ( + ?preserve_asset_delivery_types: bool, + ?type: :CLOUDINARY + ) -> void + + def to_hash: -> { + type: :CLOUDINARY, + preserve_asset_delivery_types: bool + } + end + + type imgix = { type: :IMGIX } + + class Imgix < Imagekit::Internal::Type::BaseModel + attr_accessor type: :IMGIX + + def initialize: (?type: :IMGIX) -> void + + def to_hash: -> { type: :IMGIX } + end + + type akamai = { type: :AKAMAI } + + class Akamai < Imagekit::Internal::Type::BaseModel + attr_accessor type: :AKAMAI + + def initialize: (?type: :AKAMAI) -> void + + def to_hash: -> { type: :AKAMAI } + end + + def self?.variants: -> ::Array[Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter] + end + end + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_response.rbs b/sig/imagekit/models/accounts/url_endpoint_response.rbs new file mode 100644 index 00000000..8c2da016 --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_response.rbs @@ -0,0 +1,96 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_response = + { + id: String, + description: String, + origins: ::Array[String], + url_prefix: String, + url_rewriter: Imagekit::Models::Accounts::URLEndpointResponse::url_rewriter + } + + class URLEndpointResponse < Imagekit::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor origins: ::Array[String] + + attr_accessor url_prefix: String + + attr_reader url_rewriter: Imagekit::Models::Accounts::URLEndpointResponse::url_rewriter? + + def url_rewriter=: ( + Imagekit::Models::Accounts::URLEndpointResponse::url_rewriter + ) -> Imagekit::Models::Accounts::URLEndpointResponse::url_rewriter + + attr_accessor id: String + + def initialize: ( + id: String, + description: String, + origins: ::Array[String], + url_prefix: String, + ?url_rewriter: Imagekit::Models::Accounts::URLEndpointResponse::url_rewriter + ) -> void + + def to_hash: -> { + id: String, + description: String, + origins: ::Array[String], + url_prefix: String, + url_rewriter: Imagekit::Models::Accounts::URLEndpointResponse::url_rewriter + } + + type url_rewriter = + Imagekit::Accounts::URLEndpointResponse::URLRewriter::Cloudinary + | Imagekit::Accounts::URLEndpointResponse::URLRewriter::Imgix + | Imagekit::Accounts::URLEndpointResponse::URLRewriter::Akamai + + module URLRewriter + extend Imagekit::Internal::Type::Union + + type cloudinary = + { preserve_asset_delivery_types: bool, type: :CLOUDINARY } + + class Cloudinary < Imagekit::Internal::Type::BaseModel + attr_accessor preserve_asset_delivery_types: bool + + attr_accessor type: :CLOUDINARY + + def initialize: ( + preserve_asset_delivery_types: bool, + ?type: :CLOUDINARY + ) -> void + + def to_hash: -> { + preserve_asset_delivery_types: bool, + type: :CLOUDINARY + } + end + + type imgix = { type: :IMGIX } + + class Imgix < Imagekit::Internal::Type::BaseModel + attr_accessor type: :IMGIX + + def initialize: (?type: :IMGIX) -> void + + def to_hash: -> { type: :IMGIX } + end + + type akamai = { type: :AKAMAI } + + class Akamai < Imagekit::Internal::Type::BaseModel + attr_accessor type: :AKAMAI + + def initialize: (?type: :AKAMAI) -> void + + def to_hash: -> { type: :AKAMAI } + end + + def self?.variants: -> ::Array[Imagekit::Models::Accounts::URLEndpointResponse::url_rewriter] + end + end + end + end +end diff --git a/sig/imagekit/models/accounts/url_endpoint_update_params.rbs b/sig/imagekit/models/accounts/url_endpoint_update_params.rbs new file mode 100644 index 00000000..0989d858 --- /dev/null +++ b/sig/imagekit/models/accounts/url_endpoint_update_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Accounts + type url_endpoint_update_params = + { } & Imagekit::Internal::Type::request_parameters + + class URLEndpointUpdateParams < Imagekit::Models::Accounts::URLEndpointRequest + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/accounts/usage_get_params.rbs b/sig/imagekit/models/accounts/usage_get_params.rbs new file mode 100644 index 00000000..b5ea8183 --- /dev/null +++ b/sig/imagekit/models/accounts/usage_get_params.rbs @@ -0,0 +1,30 @@ +module Imagekit + module Models + module Accounts + type usage_get_params = + { end_date: Date, start_date: Date } + & Imagekit::Internal::Type::request_parameters + + class UsageGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor end_date: Date + + attr_accessor start_date: Date + + def initialize: ( + end_date: Date, + start_date: Date, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + end_date: Date, + start_date: Date, + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/accounts/usage_get_response.rbs b/sig/imagekit/models/accounts/usage_get_response.rbs new file mode 100644 index 00000000..8b11aae0 --- /dev/null +++ b/sig/imagekit/models/accounts/usage_get_response.rbs @@ -0,0 +1,52 @@ +module Imagekit + module Models + module Accounts + type usage_get_response = + { + bandwidth_bytes: Integer, + extension_units_count: Integer, + media_library_storage_bytes: Integer, + original_cache_storage_bytes: Integer, + video_processing_units_count: Integer + } + + class UsageGetResponse < Imagekit::Internal::Type::BaseModel + attr_reader bandwidth_bytes: Integer? + + def bandwidth_bytes=: (Integer) -> Integer + + attr_reader extension_units_count: Integer? + + def extension_units_count=: (Integer) -> Integer + + attr_reader media_library_storage_bytes: Integer? + + def media_library_storage_bytes=: (Integer) -> Integer + + attr_reader original_cache_storage_bytes: Integer? + + def original_cache_storage_bytes=: (Integer) -> Integer + + attr_reader video_processing_units_count: Integer? + + def video_processing_units_count=: (Integer) -> Integer + + def initialize: ( + ?bandwidth_bytes: Integer, + ?extension_units_count: Integer, + ?media_library_storage_bytes: Integer, + ?original_cache_storage_bytes: Integer, + ?video_processing_units_count: Integer + ) -> void + + def to_hash: -> { + bandwidth_bytes: Integer, + extension_units_count: Integer, + media_library_storage_bytes: Integer, + original_cache_storage_bytes: Integer, + video_processing_units_count: Integer + } + end + end + end +end diff --git a/sig/imagekit/models/asset_list_params.rbs b/sig/imagekit/models/asset_list_params.rbs new file mode 100644 index 00000000..21cd33ef --- /dev/null +++ b/sig/imagekit/models/asset_list_params.rbs @@ -0,0 +1,138 @@ +module Imagekit + module Models + type asset_list_params = + { + file_type: Imagekit::Models::AssetListParams::file_type, + limit: Integer, + path: String, + search_query: String, + skip: Integer, + sort: Imagekit::Models::AssetListParams::sort, + type: Imagekit::Models::AssetListParams::type_ + } + & Imagekit::Internal::Type::request_parameters + + class AssetListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_reader file_type: Imagekit::Models::AssetListParams::file_type? + + def file_type=: ( + Imagekit::Models::AssetListParams::file_type + ) -> Imagekit::Models::AssetListParams::file_type + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader path: String? + + def path=: (String) -> String + + attr_reader search_query: String? + + def search_query=: (String) -> String + + attr_reader skip: Integer? + + def skip=: (Integer) -> Integer + + attr_reader sort: Imagekit::Models::AssetListParams::sort? + + def sort=: ( + Imagekit::Models::AssetListParams::sort + ) -> Imagekit::Models::AssetListParams::sort + + attr_reader type: Imagekit::Models::AssetListParams::type_? + + def type=: ( + Imagekit::Models::AssetListParams::type_ + ) -> Imagekit::Models::AssetListParams::type_ + + def initialize: ( + ?file_type: Imagekit::Models::AssetListParams::file_type, + ?limit: Integer, + ?path: String, + ?search_query: String, + ?skip: Integer, + ?sort: Imagekit::Models::AssetListParams::sort, + ?type: Imagekit::Models::AssetListParams::type_, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_type: Imagekit::Models::AssetListParams::file_type, + limit: Integer, + path: String, + search_query: String, + skip: Integer, + sort: Imagekit::Models::AssetListParams::sort, + type: Imagekit::Models::AssetListParams::type_, + request_options: Imagekit::RequestOptions + } + + type file_type = :all | :image | :"non-image" + + module FileType + extend Imagekit::Internal::Type::Enum + + ALL: :all + IMAGE: :image + NON_IMAGE: :"non-image" + + def self?.values: -> ::Array[Imagekit::Models::AssetListParams::file_type] + end + + type sort = + :ASC_NAME + | :DESC_NAME + | :ASC_CREATED + | :DESC_CREATED + | :ASC_UPDATED + | :DESC_UPDATED + | :ASC_HEIGHT + | :DESC_HEIGHT + | :ASC_WIDTH + | :DESC_WIDTH + | :ASC_SIZE + | :DESC_SIZE + | :ASC_RELEVANCE + | :DESC_RELEVANCE + + module Sort + extend Imagekit::Internal::Type::Enum + + ASC_NAME: :ASC_NAME + DESC_NAME: :DESC_NAME + ASC_CREATED: :ASC_CREATED + DESC_CREATED: :DESC_CREATED + ASC_UPDATED: :ASC_UPDATED + DESC_UPDATED: :DESC_UPDATED + ASC_HEIGHT: :ASC_HEIGHT + DESC_HEIGHT: :DESC_HEIGHT + ASC_WIDTH: :ASC_WIDTH + DESC_WIDTH: :DESC_WIDTH + ASC_SIZE: :ASC_SIZE + DESC_SIZE: :DESC_SIZE + ASC_RELEVANCE: :ASC_RELEVANCE + DESC_RELEVANCE: :DESC_RELEVANCE + + def self?.values: -> ::Array[Imagekit::Models::AssetListParams::sort] + end + + type type_ = :file | :"file-version" | :folder | :all + + module Type + extend Imagekit::Internal::Type::Enum + + FILE: :file + FILE_VERSION: :"file-version" + FOLDER: :folder + ALL: :all + + def self?.values: -> ::Array[Imagekit::Models::AssetListParams::type_] + end + end + end +end diff --git a/sig/imagekit/models/asset_list_response.rbs b/sig/imagekit/models/asset_list_response.rbs new file mode 100644 index 00000000..f60e52fd --- /dev/null +++ b/sig/imagekit/models/asset_list_response.rbs @@ -0,0 +1,16 @@ +module Imagekit + module Models + type asset_list_response_item = Imagekit::Folder | Imagekit::File + + module AssetListResponseItem + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::asset_list_response_item] + end + + type asset_list_response = + ::Array[Imagekit::Models::asset_list_response_item] + + AssetListResponse: Imagekit::Internal::Type::Converter + end +end diff --git a/sig/imagekit/models/base_overlay.rbs b/sig/imagekit/models/base_overlay.rbs new file mode 100644 index 00000000..5b012352 --- /dev/null +++ b/sig/imagekit/models/base_overlay.rbs @@ -0,0 +1,26 @@ +module Imagekit + module Models + type base_overlay = + { position: Imagekit::OverlayPosition, timing: Imagekit::OverlayTiming } + + class BaseOverlay < Imagekit::Internal::Type::BaseModel + attr_reader position: Imagekit::OverlayPosition? + + def position=: (Imagekit::OverlayPosition) -> Imagekit::OverlayPosition + + attr_reader timing: Imagekit::OverlayTiming? + + def timing=: (Imagekit::OverlayTiming) -> Imagekit::OverlayTiming + + def initialize: ( + ?position: Imagekit::OverlayPosition, + ?timing: Imagekit::OverlayTiming + ) -> void + + def to_hash: -> { + position: Imagekit::OverlayPosition, + timing: Imagekit::OverlayTiming + } + end + end +end diff --git a/sig/imagekit/models/beta/v2/file_upload_params.rbs b/sig/imagekit/models/beta/v2/file_upload_params.rbs new file mode 100644 index 00000000..0546ac88 --- /dev/null +++ b/sig/imagekit/models/beta/v2/file_upload_params.rbs @@ -0,0 +1,433 @@ +module Imagekit + module Models + module Beta + module V2 + type file_upload_params = + { + file: Imagekit::Internal::file_input, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + folder: String, + is_private_file: bool, + is_published: bool, + overwrite_ai_tags: bool, + overwrite_custom_metadata: bool, + overwrite_file: bool, + overwrite_tags: bool, + response_fields: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field], + tags: ::Array[String], + transformation: Imagekit::Beta::V2::FileUploadParams::Transformation, + use_unique_file_name: bool, + webhook_url: String + } + & Imagekit::Internal::Type::request_parameters + + class FileUploadParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file: Imagekit::Internal::file_input + + attr_accessor file_name: String + + attr_reader token: String? + + def token=: (String) -> String + + attr_reader checks: String? + + def checks=: (String) -> String + + attr_reader custom_coordinates: String? + + def custom_coordinates=: (String) -> String + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension]? + + def extensions=: ( + ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension] + ) -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension] + + attr_reader folder: String? + + def folder=: (String) -> String + + attr_reader is_private_file: bool? + + def is_private_file=: (bool) -> bool + + attr_reader is_published: bool? + + def is_published=: (bool) -> bool + + attr_reader overwrite_ai_tags: bool? + + def overwrite_ai_tags=: (bool) -> bool + + attr_reader overwrite_custom_metadata: bool? + + def overwrite_custom_metadata=: (bool) -> bool + + attr_reader overwrite_file: bool? + + def overwrite_file=: (bool) -> bool + + attr_reader overwrite_tags: bool? + + def overwrite_tags=: (bool) -> bool + + attr_reader response_fields: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field]? + + def response_fields=: ( + ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field] + ) -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field] + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + attr_reader transformation: Imagekit::Beta::V2::FileUploadParams::Transformation? + + def transformation=: ( + Imagekit::Beta::V2::FileUploadParams::Transformation + ) -> Imagekit::Beta::V2::FileUploadParams::Transformation + + attr_reader use_unique_file_name: bool? + + def use_unique_file_name=: (bool) -> bool + + attr_reader webhook_url: String? + + def webhook_url=: (String) -> String + + def initialize: ( + file: Imagekit::Internal::file_input, + file_name: String, + ?token: String, + ?checks: String, + ?custom_coordinates: String, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + ?folder: String, + ?is_private_file: bool, + ?is_published: bool, + ?overwrite_ai_tags: bool, + ?overwrite_custom_metadata: bool, + ?overwrite_file: bool, + ?overwrite_tags: bool, + ?response_fields: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field], + ?tags: ::Array[String], + ?transformation: Imagekit::Beta::V2::FileUploadParams::Transformation, + ?use_unique_file_name: bool, + ?webhook_url: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file: Imagekit::Internal::file_input, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + folder: String, + is_private_file: bool, + is_published: bool, + overwrite_ai_tags: bool, + overwrite_custom_metadata: bool, + overwrite_file: bool, + overwrite_tags: bool, + response_fields: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field], + tags: ::Array[String], + transformation: Imagekit::Beta::V2::FileUploadParams::Transformation, + use_unique_file_name: bool, + webhook_url: String, + request_options: Imagekit::RequestOptions + } + + type extension = + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg + | Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription + | Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension + + module Extension + extend Imagekit::Internal::Type::Union + + type remove_bg = + { + name: :"remove-bg", + options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options + } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"remove-bg" + + attr_reader options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options? + + def options=: ( + Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options + ) -> Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options + + def initialize: ( + ?options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options, + ?name: :"remove-bg" + ) -> void + + def to_hash: -> { + name: :"remove-bg", + options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options + } + + type options = + { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + + class Options < Imagekit::Internal::Type::BaseModel + attr_reader add_shadow: bool? + + def add_shadow=: (bool) -> bool + + attr_reader bg_color: String? + + def bg_color=: (String) -> String + + attr_reader bg_image_url: String? + + def bg_image_url=: (String) -> String + + attr_reader semitransparency: bool? + + def semitransparency=: (bool) -> bool + + def initialize: ( + ?add_shadow: bool, + ?bg_color: String, + ?bg_image_url: String, + ?semitransparency: bool + ) -> void + + def to_hash: -> { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + end + end + + type auto_tagging_extension = + { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ + } + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + attr_accessor max_tags: Integer + + attr_accessor min_confidence: Integer + + attr_accessor name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ + + def initialize: ( + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ + ) -> void + + def to_hash: -> { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ + } + + type name_ = :"google-auto-tagging" | :"aws-auto-tagging" + + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING: :"google-auto-tagging" + AWS_AUTO_TAGGING: :"aws-auto-tagging" + + def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_] + end + end + + type ai_auto_description = { name: :"ai-auto-description" } + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"ai-auto-description" + + def initialize: (?name: :"ai-auto-description") -> void + + def to_hash: -> { name: :"ai-auto-description" } + end + + def self?.variants: -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension] + end + + type response_field = + :tags + | :customCoordinates + | :isPrivateFile + | :embeddedMetadata + | :isPublished + | :customMetadata + | :metadata + + module ResponseField + extend Imagekit::Internal::Type::Enum + + TAGS: :tags + CUSTOM_COORDINATES: :customCoordinates + IS_PRIVATE_FILE: :isPrivateFile + EMBEDDED_METADATA: :embeddedMetadata + IS_PUBLISHED: :isPublished + CUSTOM_METADATA: :customMetadata + METADATA: :metadata + + def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field] + end + + type transformation = + { + post: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::post], + pre: String + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_reader post: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::post]? + + def post=: ( + ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::post] + ) -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::post] + + attr_reader pre: String? + + def pre=: (String) -> String + + def initialize: ( + ?post: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::post], + ?pre: String + ) -> void + + def to_hash: -> { + post: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::post], + pre: String + } + + type post = + Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Transformation + | Imagekit::Beta::V2::FileUploadParams::Transformation::Post::GifToVideo + | Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Thumbnail + | Imagekit::Beta::V2::FileUploadParams::Transformation::Post::Abs + + module Post + extend Imagekit::Internal::Type::Union + + type transformation = { type: :transformation, value: String } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor type: :transformation + + attr_accessor value: String + + def initialize: (value: String, ?type: :transformation) -> void + + def to_hash: -> { type: :transformation, value: String } + end + + type gif_to_video = { type: :"gif-to-video", value: String } + + class GifToVideo < Imagekit::Internal::Type::BaseModel + attr_accessor type: :"gif-to-video" + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: (?value: String, ?type: :"gif-to-video") -> void + + def to_hash: -> { type: :"gif-to-video", value: String } + end + + type thumbnail = { type: :thumbnail, value: String } + + class Thumbnail < Imagekit::Internal::Type::BaseModel + attr_accessor type: :thumbnail + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: (?value: String, ?type: :thumbnail) -> void + + def to_hash: -> { type: :thumbnail, value: String } + end + + type abs = + { + protocol: Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs::protocol, + type: :abs, + value: String + } + + class Abs < Imagekit::Internal::Type::BaseModel + attr_accessor protocol: Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs::protocol + + attr_accessor type: :abs + + attr_accessor value: String + + def initialize: ( + protocol: Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs::protocol, + value: String, + ?type: :abs + ) -> void + + def to_hash: -> { + protocol: Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs::protocol, + type: :abs, + value: String + } + + type protocol = :hls | :dash + + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS: :hls + DASH: :dash + + def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::Post::Abs::protocol] + end + end + + def self?.variants: -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Transformation::post] + end + end + end + end + end + end +end diff --git a/sig/imagekit/models/beta/v2/file_upload_response.rbs b/sig/imagekit/models/beta/v2/file_upload_response.rbs new file mode 100644 index 00000000..3955ca0d --- /dev/null +++ b/sig/imagekit/models/beta/v2/file_upload_response.rbs @@ -0,0 +1,321 @@ +module Imagekit + module Models + module Beta + module V2 + type file_upload_response = + { + ai_tags: ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::AITag]?, + audio_codec: String, + bit_rate: Integer, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + duration: Integer, + embedded_metadata: ::Hash[Symbol, top], + extension_status: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: bool, + is_published: bool, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail_url: String, + url: String, + version_info: Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo, + video_codec: String, + width: Float + } + + class FileUploadResponse < Imagekit::Internal::Type::BaseModel + attr_accessor ai_tags: ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::AITag]? + + attr_reader audio_codec: String? + + def audio_codec=: (String) -> String + + attr_reader bit_rate: Integer? + + def bit_rate=: (Integer) -> Integer + + attr_accessor custom_coordinates: String? + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader duration: Integer? + + def duration=: (Integer) -> Integer + + attr_reader embedded_metadata: ::Hash[Symbol, top]? + + def embedded_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader extension_status: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus? + + def extension_status=: ( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus + ) -> Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus + + attr_reader file_id: String? + + def file_id=: (String) -> String + + attr_reader file_path: String? + + def file_path=: (String) -> String + + attr_reader file_type: String? + + def file_type=: (String) -> String + + attr_reader height: Float? + + def height=: (Float) -> Float + + attr_reader is_private_file: bool? + + def is_private_file=: (bool) -> bool + + attr_reader is_published: bool? + + def is_published=: (bool) -> bool + + attr_reader metadata: Imagekit::Metadata? + + def metadata=: (Imagekit::Metadata) -> Imagekit::Metadata + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader size: Float? + + def size=: (Float) -> Float + + attr_accessor tags: ::Array[String]? + + attr_reader thumbnail_url: String? + + def thumbnail_url=: (String) -> String + + attr_reader url: String? + + def url=: (String) -> String + + attr_reader version_info: Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo? + + def version_info=: ( + Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo + ) -> Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo + + attr_reader video_codec: String? + + def video_codec=: (String) -> String + + attr_reader width: Float? + + def width=: (Float) -> Float + + def initialize: ( + ?ai_tags: ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::AITag]?, + ?audio_codec: String, + ?bit_rate: Integer, + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?duration: Integer, + ?embedded_metadata: ::Hash[Symbol, top], + ?extension_status: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus, + ?file_id: String, + ?file_path: String, + ?file_type: String, + ?height: Float, + ?is_private_file: bool, + ?is_published: bool, + ?metadata: Imagekit::Metadata, + ?name: String, + ?size: Float, + ?tags: ::Array[String]?, + ?thumbnail_url: String, + ?url: String, + ?version_info: Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo, + ?video_codec: String, + ?width: Float + ) -> void + + def to_hash: -> { + ai_tags: ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::AITag]?, + audio_codec: String, + bit_rate: Integer, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + duration: Integer, + embedded_metadata: ::Hash[Symbol, top], + extension_status: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: bool, + is_published: bool, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail_url: String, + url: String, + version_info: Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo, + video_codec: String, + width: Float + } + + type ai_tag = { confidence: Float, name: String, source: String } + + class AITag < Imagekit::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: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg + } + + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + attr_reader ai_auto_description: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description? + + def ai_auto_description=: ( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description + ) -> Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description + + attr_reader aws_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging? + + def aws_auto_tagging=: ( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging + ) -> Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging + + attr_reader google_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging? + + def google_auto_tagging=: ( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging + ) -> Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging + + attr_reader remove_bg: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg? + + def remove_bg=: ( + Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg + ) -> Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg + + def initialize: ( + ?ai_auto_description: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description, + ?aws_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging, + ?google_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging, + ?remove_bg: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg + ) -> void + + def to_hash: -> { + ai_auto_description: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg + } + + type ai_auto_description = :success | :pending | :failed + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::ai_auto_description] + end + + type aws_auto_tagging = :success | :pending | :failed + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::aws_auto_tagging] + end + + type google_auto_tagging = :success | :pending | :failed + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::google_auto_tagging] + end + + type remove_bg = :success | :pending | :failed + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus::remove_bg] + end + end + + type version_info = { id: String, name: String } + + class VersionInfo < Imagekit::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 + end +end diff --git a/sig/imagekit/models/cache/invalidation_create_params.rbs b/sig/imagekit/models/cache/invalidation_create_params.rbs new file mode 100644 index 00000000..6bd7b3d4 --- /dev/null +++ b/sig/imagekit/models/cache/invalidation_create_params.rbs @@ -0,0 +1,25 @@ +module Imagekit + module Models + module Cache + type invalidation_create_params = + { url: String } & Imagekit::Internal::Type::request_parameters + + class InvalidationCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor url: String + + def initialize: ( + url: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + url: String, + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/cache/invalidation_create_response.rbs b/sig/imagekit/models/cache/invalidation_create_response.rbs new file mode 100644 index 00000000..9e40cc12 --- /dev/null +++ b/sig/imagekit/models/cache/invalidation_create_response.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Cache + type invalidation_create_response = { request_id: String } + + class InvalidationCreateResponse < Imagekit::Internal::Type::BaseModel + attr_reader request_id: String? + + def request_id=: (String) -> String + + def initialize: (?request_id: String) -> void + + def to_hash: -> { request_id: String } + end + end + end +end diff --git a/sig/imagekit/models/cache/invalidation_get_params.rbs b/sig/imagekit/models/cache/invalidation_get_params.rbs new file mode 100644 index 00000000..ff6bb012 --- /dev/null +++ b/sig/imagekit/models/cache/invalidation_get_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Cache + type invalidation_get_params = + { } & Imagekit::Internal::Type::request_parameters + + class InvalidationGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/cache/invalidation_get_response.rbs b/sig/imagekit/models/cache/invalidation_get_response.rbs new file mode 100644 index 00000000..0c937b59 --- /dev/null +++ b/sig/imagekit/models/cache/invalidation_get_response.rbs @@ -0,0 +1,35 @@ +module Imagekit + module Models + module Cache + type invalidation_get_response = + { status: Imagekit::Models::Cache::InvalidationGetResponse::status } + + class InvalidationGetResponse < Imagekit::Internal::Type::BaseModel + attr_reader status: Imagekit::Models::Cache::InvalidationGetResponse::status? + + def status=: ( + Imagekit::Models::Cache::InvalidationGetResponse::status + ) -> Imagekit::Models::Cache::InvalidationGetResponse::status + + def initialize: ( + ?status: Imagekit::Models::Cache::InvalidationGetResponse::status + ) -> void + + def to_hash: -> { + status: Imagekit::Models::Cache::InvalidationGetResponse::status + } + + type status = :Pending | :Completed + + module Status + extend Imagekit::Internal::Type::Enum + + PENDING: :Pending + COMPLETED: :Completed + + def self?.values: -> ::Array[Imagekit::Models::Cache::InvalidationGetResponse::status] + end + end + end + end +end diff --git a/sig/imagekit/models/custom_metadata_field.rbs b/sig/imagekit/models/custom_metadata_field.rbs new file mode 100644 index 00000000..c141a507 --- /dev/null +++ b/sig/imagekit/models/custom_metadata_field.rbs @@ -0,0 +1,178 @@ +module Imagekit + module Models + type custom_metadata_field = + { + id: String, + label: String, + name: String, + schema: Imagekit::CustomMetadataField::Schema + } + + class CustomMetadataField < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor label: String + + attr_accessor name: String + + attr_accessor schema: Imagekit::CustomMetadataField::Schema + + def initialize: ( + id: String, + label: String, + name: String, + schema: Imagekit::CustomMetadataField::Schema + ) -> void + + def to_hash: -> { + id: String, + label: String, + name: String, + schema: Imagekit::CustomMetadataField::Schema + } + + type schema = + { + type: Imagekit::Models::CustomMetadataField::Schema::type_, + default_value: Imagekit::Models::CustomMetadataField::Schema::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekit::Models::CustomMetadataField::Schema::max_value, + min_length: Float, + min_value: Imagekit::Models::CustomMetadataField::Schema::min_value, + select_options: ::Array[Imagekit::Models::CustomMetadataField::Schema::select_option] + } + + class Schema < Imagekit::Internal::Type::BaseModel + attr_accessor type: Imagekit::Models::CustomMetadataField::Schema::type_ + + attr_reader default_value: Imagekit::Models::CustomMetadataField::Schema::default_value? + + def default_value=: ( + Imagekit::Models::CustomMetadataField::Schema::default_value + ) -> Imagekit::Models::CustomMetadataField::Schema::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: Imagekit::Models::CustomMetadataField::Schema::max_value? + + def max_value=: ( + Imagekit::Models::CustomMetadataField::Schema::max_value + ) -> Imagekit::Models::CustomMetadataField::Schema::max_value + + attr_reader min_length: Float? + + def min_length=: (Float) -> Float + + attr_reader min_value: Imagekit::Models::CustomMetadataField::Schema::min_value? + + def min_value=: ( + Imagekit::Models::CustomMetadataField::Schema::min_value + ) -> Imagekit::Models::CustomMetadataField::Schema::min_value + + attr_reader select_options: ::Array[Imagekit::Models::CustomMetadataField::Schema::select_option]? + + def select_options=: ( + ::Array[Imagekit::Models::CustomMetadataField::Schema::select_option] + ) -> ::Array[Imagekit::Models::CustomMetadataField::Schema::select_option] + + def initialize: ( + type: Imagekit::Models::CustomMetadataField::Schema::type_, + ?default_value: Imagekit::Models::CustomMetadataField::Schema::default_value, + ?is_value_required: bool, + ?max_length: Float, + ?max_value: Imagekit::Models::CustomMetadataField::Schema::max_value, + ?min_length: Float, + ?min_value: Imagekit::Models::CustomMetadataField::Schema::min_value, + ?select_options: ::Array[Imagekit::Models::CustomMetadataField::Schema::select_option] + ) -> void + + def to_hash: -> { + type: Imagekit::Models::CustomMetadataField::Schema::type_, + default_value: Imagekit::Models::CustomMetadataField::Schema::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekit::Models::CustomMetadataField::Schema::max_value, + min_length: Float, + min_value: Imagekit::Models::CustomMetadataField::Schema::min_value, + select_options: ::Array[Imagekit::Models::CustomMetadataField::Schema::select_option] + } + + type type_ = + :Text + | :Textarea + | :Number + | :Date + | :Boolean + | :SingleSelect + | :MultiSelect + + module Type + extend Imagekit::Internal::Type::Enum + + TEXT: :Text + TEXTAREA: :Textarea + NUMBER: :Number + DATE: :Date + BOOLEAN: :Boolean + SINGLE_SELECT: :SingleSelect + MULTI_SELECT: :MultiSelect + + def self?.values: -> ::Array[Imagekit::Models::CustomMetadataField::Schema::type_] + end + + type default_value = + String + | Float + | bool + | ::Array[Imagekit::Models::CustomMetadataField::Schema::DefaultValue::mixed] + + module DefaultValue + extend Imagekit::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataField::Schema::DefaultValue::mixed] + end + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataField::Schema::default_value] + + MixedArray: Imagekit::Internal::Type::Converter + end + + type max_value = String | Float + + module MaxValue + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataField::Schema::max_value] + end + + type min_value = String | Float + + module MinValue + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataField::Schema::min_value] + end + + type select_option = String | Float | bool + + module SelectOption + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataField::Schema::select_option] + end + end + end + end +end diff --git a/sig/imagekit/models/custom_metadata_field_create_params.rbs b/sig/imagekit/models/custom_metadata_field_create_params.rbs new file mode 100644 index 00000000..1d4f85db --- /dev/null +++ b/sig/imagekit/models/custom_metadata_field_create_params.rbs @@ -0,0 +1,179 @@ +module Imagekit + module Models + type custom_metadata_field_create_params = + { + label: String, + name: String, + schema: Imagekit::CustomMetadataFieldCreateParams::Schema + } + & Imagekit::Internal::Type::request_parameters + + class CustomMetadataFieldCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor label: String + + attr_accessor name: String + + attr_accessor schema: Imagekit::CustomMetadataFieldCreateParams::Schema + + def initialize: ( + label: String, + name: String, + schema: Imagekit::CustomMetadataFieldCreateParams::Schema, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + label: String, + name: String, + schema: Imagekit::CustomMetadataFieldCreateParams::Schema, + request_options: Imagekit::RequestOptions + } + + type schema = + { + type: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::type_, + default_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::max_value, + min_length: Float, + min_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::min_value, + select_options: ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::select_option] + } + + class Schema < Imagekit::Internal::Type::BaseModel + attr_accessor type: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::type_ + + attr_reader default_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::default_value? + + def default_value=: ( + Imagekit::Models::CustomMetadataFieldCreateParams::Schema::default_value + ) -> Imagekit::Models::CustomMetadataFieldCreateParams::Schema::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: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::max_value? + + def max_value=: ( + Imagekit::Models::CustomMetadataFieldCreateParams::Schema::max_value + ) -> Imagekit::Models::CustomMetadataFieldCreateParams::Schema::max_value + + attr_reader min_length: Float? + + def min_length=: (Float) -> Float + + attr_reader min_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::min_value? + + def min_value=: ( + Imagekit::Models::CustomMetadataFieldCreateParams::Schema::min_value + ) -> Imagekit::Models::CustomMetadataFieldCreateParams::Schema::min_value + + attr_reader select_options: ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::select_option]? + + def select_options=: ( + ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::select_option] + ) -> ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::select_option] + + def initialize: ( + type: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::type_, + ?default_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::default_value, + ?is_value_required: bool, + ?max_length: Float, + ?max_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::max_value, + ?min_length: Float, + ?min_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::min_value, + ?select_options: ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::select_option] + ) -> void + + def to_hash: -> { + type: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::type_, + default_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::max_value, + min_length: Float, + min_value: Imagekit::Models::CustomMetadataFieldCreateParams::Schema::min_value, + select_options: ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::select_option] + } + + type type_ = + :Text + | :Textarea + | :Number + | :Date + | :Boolean + | :SingleSelect + | :MultiSelect + + module Type + extend Imagekit::Internal::Type::Enum + + TEXT: :Text + TEXTAREA: :Textarea + NUMBER: :Number + DATE: :Date + BOOLEAN: :Boolean + SINGLE_SELECT: :SingleSelect + MULTI_SELECT: :MultiSelect + + def self?.values: -> ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::type_] + end + + type default_value = + String + | Float + | bool + | ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::DefaultValue::mixed] + + module DefaultValue + extend Imagekit::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::DefaultValue::mixed] + end + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::default_value] + + MixedArray: Imagekit::Internal::Type::Converter + end + + type max_value = String | Float + + module MaxValue + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::max_value] + end + + type min_value = String | Float + + module MinValue + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::min_value] + end + + type select_option = String | Float | bool + + module SelectOption + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldCreateParams::Schema::select_option] + end + end + end + end +end diff --git a/sig/imagekit/models/custom_metadata_field_delete_params.rbs b/sig/imagekit/models/custom_metadata_field_delete_params.rbs new file mode 100644 index 00000000..567c6c64 --- /dev/null +++ b/sig/imagekit/models/custom_metadata_field_delete_params.rbs @@ -0,0 +1,15 @@ +module Imagekit + module Models + type custom_metadata_field_delete_params = + { } & Imagekit::Internal::Type::request_parameters + + class CustomMetadataFieldDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end +end diff --git a/sig/imagekit/models/custom_metadata_field_delete_response.rbs b/sig/imagekit/models/custom_metadata_field_delete_response.rbs new file mode 100644 index 00000000..51fdebeb --- /dev/null +++ b/sig/imagekit/models/custom_metadata_field_delete_response.rbs @@ -0,0 +1,11 @@ +module Imagekit + module Models + type custom_metadata_field_delete_response = { } + + class CustomMetadataFieldDeleteResponse < Imagekit::Internal::Type::BaseModel + def initialize: -> void + + def to_hash: -> { } + end + end +end diff --git a/sig/imagekit/models/custom_metadata_field_list_params.rbs b/sig/imagekit/models/custom_metadata_field_list_params.rbs new file mode 100644 index 00000000..314b835e --- /dev/null +++ b/sig/imagekit/models/custom_metadata_field_list_params.rbs @@ -0,0 +1,25 @@ +module Imagekit + module Models + type custom_metadata_field_list_params = + { include_deleted: bool } & Imagekit::Internal::Type::request_parameters + + class CustomMetadataFieldListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_reader include_deleted: bool? + + def include_deleted=: (bool) -> bool + + def initialize: ( + ?include_deleted: bool, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + include_deleted: bool, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/custom_metadata_field_list_response.rbs b/sig/imagekit/models/custom_metadata_field_list_response.rbs new file mode 100644 index 00000000..7aa86e95 --- /dev/null +++ b/sig/imagekit/models/custom_metadata_field_list_response.rbs @@ -0,0 +1,8 @@ +module Imagekit + module Models + type custom_metadata_field_list_response = + ::Array[Imagekit::CustomMetadataField] + + CustomMetadataFieldListResponse: Imagekit::Internal::Type::Converter + end +end diff --git a/sig/imagekit/models/custom_metadata_field_update_params.rbs b/sig/imagekit/models/custom_metadata_field_update_params.rbs new file mode 100644 index 00000000..9da6ca07 --- /dev/null +++ b/sig/imagekit/models/custom_metadata_field_update_params.rbs @@ -0,0 +1,152 @@ +module Imagekit + module Models + type custom_metadata_field_update_params = + { + label: String, + schema: Imagekit::CustomMetadataFieldUpdateParams::Schema + } + & Imagekit::Internal::Type::request_parameters + + class CustomMetadataFieldUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_reader label: String? + + def label=: (String) -> String + + attr_reader schema: Imagekit::CustomMetadataFieldUpdateParams::Schema? + + def schema=: ( + Imagekit::CustomMetadataFieldUpdateParams::Schema + ) -> Imagekit::CustomMetadataFieldUpdateParams::Schema + + def initialize: ( + ?label: String, + ?schema: Imagekit::CustomMetadataFieldUpdateParams::Schema, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + label: String, + schema: Imagekit::CustomMetadataFieldUpdateParams::Schema, + request_options: Imagekit::RequestOptions + } + + type schema = + { + default_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::max_value, + min_length: Float, + min_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::min_value, + select_options: ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::select_option] + } + + class Schema < Imagekit::Internal::Type::BaseModel + attr_reader default_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::default_value? + + def default_value=: ( + Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::default_value + ) -> Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::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: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::max_value? + + def max_value=: ( + Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::max_value + ) -> Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::max_value + + attr_reader min_length: Float? + + def min_length=: (Float) -> Float + + attr_reader min_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::min_value? + + def min_value=: ( + Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::min_value + ) -> Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::min_value + + attr_reader select_options: ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::select_option]? + + def select_options=: ( + ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::select_option] + ) -> ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::select_option] + + def initialize: ( + ?default_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::default_value, + ?is_value_required: bool, + ?max_length: Float, + ?max_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::max_value, + ?min_length: Float, + ?min_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::min_value, + ?select_options: ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::select_option] + ) -> void + + def to_hash: -> { + default_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::default_value, + is_value_required: bool, + max_length: Float, + max_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::max_value, + min_length: Float, + min_value: Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::min_value, + select_options: ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::select_option] + } + + type default_value = + String + | Float + | bool + | ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::DefaultValue::mixed] + + module DefaultValue + extend Imagekit::Internal::Type::Union + + type mixed = String | Float | bool + + module Mixed + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::DefaultValue::mixed] + end + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::default_value] + + MixedArray: Imagekit::Internal::Type::Converter + end + + type max_value = String | Float + + module MaxValue + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::max_value] + end + + type min_value = String | Float + + module MinValue + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::min_value] + end + + type select_option = String | Float | bool + + module SelectOption + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::CustomMetadataFieldUpdateParams::Schema::select_option] + end + end + end + end +end diff --git a/sig/imagekit/models/file.rbs b/sig/imagekit/models/file.rbs new file mode 100644 index 00000000..9331ad13 --- /dev/null +++ b/sig/imagekit/models/file.rbs @@ -0,0 +1,218 @@ +module Imagekit + module Models + type file = + { + ai_tags: ::Array[Imagekit::File::AITag]?, + created_at: Time, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + file_id: String, + file_path: String, + file_type: String, + has_alpha: bool, + height: Float, + is_private_file: bool, + is_published: bool, + mime: String, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail: String, + type: Imagekit::Models::File::type_, + updated_at: Time, + url: String, + version_info: Imagekit::File::VersionInfo, + width: Float + } + + class File < Imagekit::Internal::Type::BaseModel + attr_accessor ai_tags: ::Array[Imagekit::File::AITag]? + + attr_reader created_at: Time? + + def created_at=: (Time) -> Time + + attr_accessor custom_coordinates: String? + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader file_id: String? + + def file_id=: (String) -> String + + attr_reader file_path: String? + + def file_path=: (String) -> String + + attr_reader file_type: String? + + def file_type=: (String) -> String + + attr_reader has_alpha: bool? + + def has_alpha=: (bool) -> bool + + attr_reader height: Float? + + def height=: (Float) -> Float + + attr_reader is_private_file: bool? + + def is_private_file=: (bool) -> bool + + attr_reader is_published: bool? + + def is_published=: (bool) -> bool + + attr_reader mime: String? + + def mime=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader size: Float? + + def size=: (Float) -> Float + + attr_accessor tags: ::Array[String]? + + attr_reader thumbnail: String? + + def thumbnail=: (String) -> String + + attr_reader type: Imagekit::Models::File::type_? + + def type=: ( + Imagekit::Models::File::type_ + ) -> Imagekit::Models::File::type_ + + attr_reader updated_at: Time? + + def updated_at=: (Time) -> Time + + attr_reader url: String? + + def url=: (String) -> String + + attr_reader version_info: Imagekit::File::VersionInfo? + + def version_info=: ( + Imagekit::File::VersionInfo + ) -> Imagekit::File::VersionInfo + + attr_reader width: Float? + + def width=: (Float) -> Float + + def initialize: ( + ?ai_tags: ::Array[Imagekit::File::AITag]?, + ?created_at: Time, + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?file_id: String, + ?file_path: String, + ?file_type: String, + ?has_alpha: bool, + ?height: Float, + ?is_private_file: bool, + ?is_published: bool, + ?mime: String, + ?name: String, + ?size: Float, + ?tags: ::Array[String]?, + ?thumbnail: String, + ?type: Imagekit::Models::File::type_, + ?updated_at: Time, + ?url: String, + ?version_info: Imagekit::File::VersionInfo, + ?width: Float + ) -> void + + def to_hash: -> { + ai_tags: ::Array[Imagekit::File::AITag]?, + created_at: Time, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + file_id: String, + file_path: String, + file_type: String, + has_alpha: bool, + height: Float, + is_private_file: bool, + is_published: bool, + mime: String, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail: String, + type: Imagekit::Models::File::type_, + updated_at: Time, + url: String, + version_info: Imagekit::File::VersionInfo, + width: Float + } + + type ai_tag = { confidence: Float, name: String, source: String } + + class AITag < Imagekit::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 type_ = :file | :"file-version" + + module Type + extend Imagekit::Internal::Type::Enum + + FILE: :file + FILE_VERSION: :"file-version" + + def self?.values: -> ::Array[Imagekit::Models::File::type_] + end + + type version_info = { id: String, name: String } + + class VersionInfo < Imagekit::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/imagekit/models/file_copy_params.rbs b/sig/imagekit/models/file_copy_params.rbs new file mode 100644 index 00000000..46bc8a75 --- /dev/null +++ b/sig/imagekit/models/file_copy_params.rbs @@ -0,0 +1,38 @@ +module Imagekit + module Models + type file_copy_params = + { + destination_path: String, + source_file_path: String, + include_file_versions: bool + } + & Imagekit::Internal::Type::request_parameters + + class FileCopyParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor destination_path: String + + attr_accessor source_file_path: String + + attr_reader include_file_versions: bool? + + def include_file_versions=: (bool) -> bool + + def initialize: ( + destination_path: String, + source_file_path: String, + ?include_file_versions: bool, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + destination_path: String, + source_file_path: String, + include_file_versions: bool, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/file_copy_response.rbs b/sig/imagekit/models/file_copy_response.rbs new file mode 100644 index 00000000..037e8a88 --- /dev/null +++ b/sig/imagekit/models/file_copy_response.rbs @@ -0,0 +1,11 @@ +module Imagekit + module Models + type file_copy_response = { } + + class FileCopyResponse < Imagekit::Internal::Type::BaseModel + def initialize: -> void + + def to_hash: -> { } + end + end +end diff --git a/sig/imagekit/models/file_delete_params.rbs b/sig/imagekit/models/file_delete_params.rbs new file mode 100644 index 00000000..4cd8aaa5 --- /dev/null +++ b/sig/imagekit/models/file_delete_params.rbs @@ -0,0 +1,15 @@ +module Imagekit + module Models + type file_delete_params = + { } & Imagekit::Internal::Type::request_parameters + + class FileDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end +end diff --git a/sig/imagekit/models/file_get_params.rbs b/sig/imagekit/models/file_get_params.rbs new file mode 100644 index 00000000..1a204dfb --- /dev/null +++ b/sig/imagekit/models/file_get_params.rbs @@ -0,0 +1,14 @@ +module Imagekit + module Models + type file_get_params = { } & Imagekit::Internal::Type::request_parameters + + class FileGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end +end diff --git a/sig/imagekit/models/file_move_params.rbs b/sig/imagekit/models/file_move_params.rbs new file mode 100644 index 00000000..c0d6f7f6 --- /dev/null +++ b/sig/imagekit/models/file_move_params.rbs @@ -0,0 +1,28 @@ +module Imagekit + module Models + type file_move_params = + { destination_path: String, source_file_path: String } + & Imagekit::Internal::Type::request_parameters + + class FileMoveParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor destination_path: String + + attr_accessor source_file_path: String + + def initialize: ( + destination_path: String, + source_file_path: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + destination_path: String, + source_file_path: String, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/file_move_response.rbs b/sig/imagekit/models/file_move_response.rbs new file mode 100644 index 00000000..6e5e95ee --- /dev/null +++ b/sig/imagekit/models/file_move_response.rbs @@ -0,0 +1,11 @@ +module Imagekit + module Models + type file_move_response = { } + + class FileMoveResponse < Imagekit::Internal::Type::BaseModel + def initialize: -> void + + def to_hash: -> { } + end + end +end diff --git a/sig/imagekit/models/file_rename_params.rbs b/sig/imagekit/models/file_rename_params.rbs new file mode 100644 index 00000000..f09beefd --- /dev/null +++ b/sig/imagekit/models/file_rename_params.rbs @@ -0,0 +1,34 @@ +module Imagekit + module Models + type file_rename_params = + { file_path: String, new_file_name: String, purge_cache: bool } + & Imagekit::Internal::Type::request_parameters + + class FileRenameParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file_path: String + + attr_accessor new_file_name: String + + attr_reader purge_cache: bool? + + def purge_cache=: (bool) -> bool + + def initialize: ( + file_path: String, + new_file_name: String, + ?purge_cache: bool, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_path: String, + new_file_name: String, + purge_cache: bool, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/file_rename_response.rbs b/sig/imagekit/models/file_rename_response.rbs new file mode 100644 index 00000000..f19ba301 --- /dev/null +++ b/sig/imagekit/models/file_rename_response.rbs @@ -0,0 +1,15 @@ +module Imagekit + module Models + type file_rename_response = { purge_request_id: String } + + class FileRenameResponse < Imagekit::Internal::Type::BaseModel + attr_reader purge_request_id: String? + + def purge_request_id=: (String) -> String + + def initialize: (?purge_request_id: String) -> void + + def to_hash: -> { purge_request_id: String } + end + end +end diff --git a/sig/imagekit/models/file_update_params.rbs b/sig/imagekit/models/file_update_params.rbs new file mode 100644 index 00000000..3ffb7254 --- /dev/null +++ b/sig/imagekit/models/file_update_params.rbs @@ -0,0 +1,272 @@ +module Imagekit + module Models + type file_update_params = + { update: Imagekit::Models::FileUpdateParams::update } + & Imagekit::Internal::Type::request_parameters + + class FileUpdateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_reader update: Imagekit::Models::FileUpdateParams::update? + + def update=: ( + Imagekit::Models::FileUpdateParams::update + ) -> Imagekit::Models::FileUpdateParams::update + + def initialize: ( + ?update: Imagekit::Models::FileUpdateParams::update, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + update: Imagekit::Models::FileUpdateParams::update, + request_options: Imagekit::RequestOptions + } + + type update = + Imagekit::FileUpdateParams::Update::UpdateFileDetails + | Imagekit::FileUpdateParams::Update::ChangePublicationStatus + + module Update + extend Imagekit::Internal::Type::Union + + type update_file_details = + { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension], + remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String + } + + class UpdateFileDetails < Imagekit::Internal::Type::BaseModel + attr_accessor custom_coordinates: String? + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension]? + + def extensions=: ( + ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension] + ) -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension] + + attr_reader remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags? + + def remove_ai_tags=: ( + Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags + ) -> Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags + + attr_accessor tags: ::Array[String]? + + attr_reader webhook_url: String? + + def webhook_url=: (String) -> String + + def initialize: ( + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension], + ?remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, + ?tags: ::Array[String]?, + ?webhook_url: String + ) -> void + + def to_hash: -> { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension], + remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String + } + + type extension = + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg + | Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription + | Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension + + module Extension + extend Imagekit::Internal::Type::Union + + type remove_bg = + { + name: :"remove-bg", + options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options + } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"remove-bg" + + attr_reader options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options? + + def options=: ( + Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options + ) -> Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options + + def initialize: ( + ?options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options, + ?name: :"remove-bg" + ) -> void + + def to_hash: -> { + name: :"remove-bg", + options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options + } + + type options = + { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + + class Options < Imagekit::Internal::Type::BaseModel + attr_reader add_shadow: bool? + + def add_shadow=: (bool) -> bool + + attr_reader bg_color: String? + + def bg_color=: (String) -> String + + attr_reader bg_image_url: String? + + def bg_image_url=: (String) -> String + + attr_reader semitransparency: bool? + + def semitransparency=: (bool) -> bool + + def initialize: ( + ?add_shadow: bool, + ?bg_color: String, + ?bg_image_url: String, + ?semitransparency: bool + ) -> void + + def to_hash: -> { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + end + end + + type auto_tagging_extension = + { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ + } + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + attr_accessor max_tags: Integer + + attr_accessor min_confidence: Integer + + attr_accessor name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ + + def initialize: ( + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ + ) -> void + + def to_hash: -> { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ + } + + type name_ = :"google-auto-tagging" | :"aws-auto-tagging" + + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING: :"google-auto-tagging" + AWS_AUTO_TAGGING: :"aws-auto-tagging" + + def self?.values: -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_] + end + end + + type ai_auto_description = { name: :"ai-auto-description" } + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"ai-auto-description" + + def initialize: (?name: :"ai-auto-description") -> void + + def to_hash: -> { name: :"ai-auto-description" } + end + + def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension] + end + + type remove_ai_tags = ::Array[String] | :all + + module RemoveAITags + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags] + + StringArray: Imagekit::Internal::Type::Converter + end + end + + type change_publication_status = + { + publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + } + + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + attr_reader publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish? + + def publish=: ( + Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + ) -> Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + + def initialize: ( + ?publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + ) -> void + + def to_hash: -> { + publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + } + + type publish = { is_published: bool, include_file_versions: bool } + + class Publish < Imagekit::Internal::Type::BaseModel + attr_accessor is_published: bool + + attr_reader include_file_versions: bool? + + def include_file_versions=: (bool) -> bool + + def initialize: ( + is_published: bool, + ?include_file_versions: bool + ) -> void + + def to_hash: -> { is_published: bool, include_file_versions: bool } + end + end + + def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::update] + end + end + end +end diff --git a/sig/imagekit/models/file_update_response.rbs b/sig/imagekit/models/file_update_response.rbs new file mode 100644 index 00000000..5a223c95 --- /dev/null +++ b/sig/imagekit/models/file_update_response.rbs @@ -0,0 +1,120 @@ +module Imagekit + module Models + type file_update_response = + { + extension_status: Imagekit::Models::FileUpdateResponse::ExtensionStatus + } + + class FileUpdateResponse < Imagekit::Models::File + def extension_status: -> Imagekit::Models::FileUpdateResponse::ExtensionStatus? + + def extension_status=: ( + Imagekit::Models::FileUpdateResponse::ExtensionStatus _ + ) -> Imagekit::Models::FileUpdateResponse::ExtensionStatus + + def initialize: ( + ?extension_status: Imagekit::Models::FileUpdateResponse::ExtensionStatus + ) -> void + + def to_hash: -> { + extension_status: Imagekit::Models::FileUpdateResponse::ExtensionStatus + } + + type extension_status = + { + ai_auto_description: Imagekit::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::FileUpdateResponse::ExtensionStatus::remove_bg + } + + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + attr_reader ai_auto_description: Imagekit::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description? + + def ai_auto_description=: ( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description + ) -> Imagekit::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description + + attr_reader aws_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging? + + def aws_auto_tagging=: ( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging + ) -> Imagekit::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging + + attr_reader google_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging? + + def google_auto_tagging=: ( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging + ) -> Imagekit::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging + + attr_reader remove_bg: Imagekit::Models::FileUpdateResponse::ExtensionStatus::remove_bg? + + def remove_bg=: ( + Imagekit::Models::FileUpdateResponse::ExtensionStatus::remove_bg + ) -> Imagekit::Models::FileUpdateResponse::ExtensionStatus::remove_bg + + def initialize: ( + ?ai_auto_description: Imagekit::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description, + ?aws_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging, + ?google_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging, + ?remove_bg: Imagekit::Models::FileUpdateResponse::ExtensionStatus::remove_bg + ) -> void + + def to_hash: -> { + ai_auto_description: Imagekit::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::FileUpdateResponse::ExtensionStatus::remove_bg + } + + type ai_auto_description = :success | :pending | :failed + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUpdateResponse::ExtensionStatus::ai_auto_description] + end + + type aws_auto_tagging = :success | :pending | :failed + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUpdateResponse::ExtensionStatus::aws_auto_tagging] + end + + type google_auto_tagging = :success | :pending | :failed + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUpdateResponse::ExtensionStatus::google_auto_tagging] + end + + type remove_bg = :success | :pending | :failed + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUpdateResponse::ExtensionStatus::remove_bg] + end + end + end + end +end diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs new file mode 100644 index 00000000..4a2ea622 --- /dev/null +++ b/sig/imagekit/models/file_upload_params.rbs @@ -0,0 +1,450 @@ +module Imagekit + module Models + type file_upload_params = + { + file: Imagekit::Internal::file_input, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: ::Hash[Symbol, top], + description: String, + expire: Integer, + extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + folder: String, + is_private_file: bool, + is_published: bool, + overwrite_ai_tags: bool, + overwrite_custom_metadata: bool, + overwrite_file: bool, + overwrite_tags: bool, + public_key: String, + response_fields: ::Array[Imagekit::Models::FileUploadParams::response_field], + signature: String, + tags: ::Array[String], + transformation: Imagekit::FileUploadParams::Transformation, + use_unique_file_name: bool, + webhook_url: String + } + & Imagekit::Internal::Type::request_parameters + + class FileUploadParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file: Imagekit::Internal::file_input + + attr_accessor file_name: String + + attr_reader token: String? + + def token=: (String) -> String + + attr_reader checks: String? + + def checks=: (String) -> String + + attr_reader custom_coordinates: String? + + def custom_coordinates=: (String) -> String + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader expire: Integer? + + def expire=: (Integer) -> Integer + + attr_reader extensions: ::Array[Imagekit::Models::FileUploadParams::extension]? + + def extensions=: ( + ::Array[Imagekit::Models::FileUploadParams::extension] + ) -> ::Array[Imagekit::Models::FileUploadParams::extension] + + attr_reader folder: String? + + def folder=: (String) -> String + + attr_reader is_private_file: bool? + + def is_private_file=: (bool) -> bool + + attr_reader is_published: bool? + + def is_published=: (bool) -> bool + + attr_reader overwrite_ai_tags: bool? + + def overwrite_ai_tags=: (bool) -> bool + + attr_reader overwrite_custom_metadata: bool? + + def overwrite_custom_metadata=: (bool) -> bool + + attr_reader overwrite_file: bool? + + def overwrite_file=: (bool) -> bool + + attr_reader overwrite_tags: bool? + + def overwrite_tags=: (bool) -> bool + + attr_reader public_key: String? + + def public_key=: (String) -> String + + attr_reader response_fields: ::Array[Imagekit::Models::FileUploadParams::response_field]? + + def response_fields=: ( + ::Array[Imagekit::Models::FileUploadParams::response_field] + ) -> ::Array[Imagekit::Models::FileUploadParams::response_field] + + attr_reader signature: String? + + def signature=: (String) -> String + + attr_reader tags: ::Array[String]? + + def tags=: (::Array[String]) -> ::Array[String] + + attr_reader transformation: Imagekit::FileUploadParams::Transformation? + + def transformation=: ( + Imagekit::FileUploadParams::Transformation + ) -> Imagekit::FileUploadParams::Transformation + + attr_reader use_unique_file_name: bool? + + def use_unique_file_name=: (bool) -> bool + + attr_reader webhook_url: String? + + def webhook_url=: (String) -> String + + def initialize: ( + file: Imagekit::Internal::file_input, + file_name: String, + ?token: String, + ?checks: String, + ?custom_coordinates: String, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?expire: Integer, + ?extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + ?folder: String, + ?is_private_file: bool, + ?is_published: bool, + ?overwrite_ai_tags: bool, + ?overwrite_custom_metadata: bool, + ?overwrite_file: bool, + ?overwrite_tags: bool, + ?public_key: String, + ?response_fields: ::Array[Imagekit::Models::FileUploadParams::response_field], + ?signature: String, + ?tags: ::Array[String], + ?transformation: Imagekit::FileUploadParams::Transformation, + ?use_unique_file_name: bool, + ?webhook_url: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file: Imagekit::Internal::file_input, + file_name: String, + token: String, + checks: String, + custom_coordinates: String, + custom_metadata: ::Hash[Symbol, top], + description: String, + expire: Integer, + extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + folder: String, + is_private_file: bool, + is_published: bool, + overwrite_ai_tags: bool, + overwrite_custom_metadata: bool, + overwrite_file: bool, + overwrite_tags: bool, + public_key: String, + response_fields: ::Array[Imagekit::Models::FileUploadParams::response_field], + signature: String, + tags: ::Array[String], + transformation: Imagekit::FileUploadParams::Transformation, + use_unique_file_name: bool, + webhook_url: String, + request_options: Imagekit::RequestOptions + } + + type extension = + Imagekit::FileUploadParams::Extension::RemoveBg + | Imagekit::FileUploadParams::Extension::AIAutoDescription + | Imagekit::FileUploadParams::Extension::AutoTaggingExtension + + module Extension + extend Imagekit::Internal::Type::Union + + type remove_bg = + { + name: :"remove-bg", + options: Imagekit::FileUploadParams::Extension::RemoveBg::Options + } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"remove-bg" + + attr_reader options: Imagekit::FileUploadParams::Extension::RemoveBg::Options? + + def options=: ( + Imagekit::FileUploadParams::Extension::RemoveBg::Options + ) -> Imagekit::FileUploadParams::Extension::RemoveBg::Options + + def initialize: ( + ?options: Imagekit::FileUploadParams::Extension::RemoveBg::Options, + ?name: :"remove-bg" + ) -> void + + def to_hash: -> { + name: :"remove-bg", + options: Imagekit::FileUploadParams::Extension::RemoveBg::Options + } + + type options = + { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + + class Options < Imagekit::Internal::Type::BaseModel + attr_reader add_shadow: bool? + + def add_shadow=: (bool) -> bool + + attr_reader bg_color: String? + + def bg_color=: (String) -> String + + attr_reader bg_image_url: String? + + def bg_image_url=: (String) -> String + + attr_reader semitransparency: bool? + + def semitransparency=: (bool) -> bool + + def initialize: ( + ?add_shadow: bool, + ?bg_color: String, + ?bg_image_url: String, + ?semitransparency: bool + ) -> void + + def to_hash: -> { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + end + end + + type auto_tagging_extension = + { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ + } + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + attr_accessor max_tags: Integer + + attr_accessor min_confidence: Integer + + attr_accessor name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ + + def initialize: ( + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ + ) -> void + + def to_hash: -> { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ + } + + type name_ = :"google-auto-tagging" | :"aws-auto-tagging" + + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING: :"google-auto-tagging" + AWS_AUTO_TAGGING: :"aws-auto-tagging" + + def self?.values: -> ::Array[Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_] + end + end + + type ai_auto_description = { name: :"ai-auto-description" } + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"ai-auto-description" + + def initialize: (?name: :"ai-auto-description") -> void + + def to_hash: -> { name: :"ai-auto-description" } + end + + def self?.variants: -> ::Array[Imagekit::Models::FileUploadParams::extension] + end + + type response_field = + :tags + | :customCoordinates + | :isPrivateFile + | :embeddedMetadata + | :isPublished + | :customMetadata + | :metadata + + module ResponseField + extend Imagekit::Internal::Type::Enum + + TAGS: :tags + CUSTOM_COORDINATES: :customCoordinates + IS_PRIVATE_FILE: :isPrivateFile + EMBEDDED_METADATA: :embeddedMetadata + IS_PUBLISHED: :isPublished + CUSTOM_METADATA: :customMetadata + METADATA: :metadata + + def self?.values: -> ::Array[Imagekit::Models::FileUploadParams::response_field] + end + + type transformation = + { + post: ::Array[Imagekit::Models::FileUploadParams::Transformation::post], + pre: String + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_reader post: ::Array[Imagekit::Models::FileUploadParams::Transformation::post]? + + def post=: ( + ::Array[Imagekit::Models::FileUploadParams::Transformation::post] + ) -> ::Array[Imagekit::Models::FileUploadParams::Transformation::post] + + attr_reader pre: String? + + def pre=: (String) -> String + + def initialize: ( + ?post: ::Array[Imagekit::Models::FileUploadParams::Transformation::post], + ?pre: String + ) -> void + + def to_hash: -> { + post: ::Array[Imagekit::Models::FileUploadParams::Transformation::post], + pre: String + } + + type post = + Imagekit::FileUploadParams::Transformation::Post::Transformation + | Imagekit::FileUploadParams::Transformation::Post::GifToVideo + | Imagekit::FileUploadParams::Transformation::Post::Thumbnail + | Imagekit::FileUploadParams::Transformation::Post::Abs + + module Post + extend Imagekit::Internal::Type::Union + + type transformation = { type: :transformation, value: String } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor type: :transformation + + attr_accessor value: String + + def initialize: (value: String, ?type: :transformation) -> void + + def to_hash: -> { type: :transformation, value: String } + end + + type gif_to_video = { type: :"gif-to-video", value: String } + + class GifToVideo < Imagekit::Internal::Type::BaseModel + attr_accessor type: :"gif-to-video" + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: (?value: String, ?type: :"gif-to-video") -> void + + def to_hash: -> { type: :"gif-to-video", value: String } + end + + type thumbnail = { type: :thumbnail, value: String } + + class Thumbnail < Imagekit::Internal::Type::BaseModel + attr_accessor type: :thumbnail + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: (?value: String, ?type: :thumbnail) -> void + + def to_hash: -> { type: :thumbnail, value: String } + end + + type abs = + { + protocol: Imagekit::Models::FileUploadParams::Transformation::Post::Abs::protocol, + type: :abs, + value: String + } + + class Abs < Imagekit::Internal::Type::BaseModel + attr_accessor protocol: Imagekit::Models::FileUploadParams::Transformation::Post::Abs::protocol + + attr_accessor type: :abs + + attr_accessor value: String + + def initialize: ( + protocol: Imagekit::Models::FileUploadParams::Transformation::Post::Abs::protocol, + value: String, + ?type: :abs + ) -> void + + def to_hash: -> { + protocol: Imagekit::Models::FileUploadParams::Transformation::Post::Abs::protocol, + type: :abs, + value: String + } + + type protocol = :hls | :dash + + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS: :hls + DASH: :dash + + def self?.values: -> ::Array[Imagekit::Models::FileUploadParams::Transformation::Post::Abs::protocol] + end + end + + def self?.variants: -> ::Array[Imagekit::Models::FileUploadParams::Transformation::post] + end + end + end + end +end diff --git a/sig/imagekit/models/file_upload_response.rbs b/sig/imagekit/models/file_upload_response.rbs new file mode 100644 index 00000000..10348f34 --- /dev/null +++ b/sig/imagekit/models/file_upload_response.rbs @@ -0,0 +1,317 @@ +module Imagekit + module Models + type file_upload_response = + { + ai_tags: ::Array[Imagekit::Models::FileUploadResponse::AITag]?, + audio_codec: String, + bit_rate: Integer, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + duration: Integer, + embedded_metadata: ::Hash[Symbol, top], + extension_status: Imagekit::Models::FileUploadResponse::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: bool, + is_published: bool, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail_url: String, + url: String, + version_info: Imagekit::Models::FileUploadResponse::VersionInfo, + video_codec: String, + width: Float + } + + class FileUploadResponse < Imagekit::Internal::Type::BaseModel + attr_accessor ai_tags: ::Array[Imagekit::Models::FileUploadResponse::AITag]? + + attr_reader audio_codec: String? + + def audio_codec=: (String) -> String + + attr_reader bit_rate: Integer? + + def bit_rate=: (Integer) -> Integer + + attr_accessor custom_coordinates: String? + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader duration: Integer? + + def duration=: (Integer) -> Integer + + attr_reader embedded_metadata: ::Hash[Symbol, top]? + + def embedded_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader extension_status: Imagekit::Models::FileUploadResponse::ExtensionStatus? + + def extension_status=: ( + Imagekit::Models::FileUploadResponse::ExtensionStatus + ) -> Imagekit::Models::FileUploadResponse::ExtensionStatus + + attr_reader file_id: String? + + def file_id=: (String) -> String + + attr_reader file_path: String? + + def file_path=: (String) -> String + + attr_reader file_type: String? + + def file_type=: (String) -> String + + attr_reader height: Float? + + def height=: (Float) -> Float + + attr_reader is_private_file: bool? + + def is_private_file=: (bool) -> bool + + attr_reader is_published: bool? + + def is_published=: (bool) -> bool + + attr_reader metadata: Imagekit::Metadata? + + def metadata=: (Imagekit::Metadata) -> Imagekit::Metadata + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader size: Float? + + def size=: (Float) -> Float + + attr_accessor tags: ::Array[String]? + + attr_reader thumbnail_url: String? + + def thumbnail_url=: (String) -> String + + attr_reader url: String? + + def url=: (String) -> String + + attr_reader version_info: Imagekit::Models::FileUploadResponse::VersionInfo? + + def version_info=: ( + Imagekit::Models::FileUploadResponse::VersionInfo + ) -> Imagekit::Models::FileUploadResponse::VersionInfo + + attr_reader video_codec: String? + + def video_codec=: (String) -> String + + attr_reader width: Float? + + def width=: (Float) -> Float + + def initialize: ( + ?ai_tags: ::Array[Imagekit::Models::FileUploadResponse::AITag]?, + ?audio_codec: String, + ?bit_rate: Integer, + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?duration: Integer, + ?embedded_metadata: ::Hash[Symbol, top], + ?extension_status: Imagekit::Models::FileUploadResponse::ExtensionStatus, + ?file_id: String, + ?file_path: String, + ?file_type: String, + ?height: Float, + ?is_private_file: bool, + ?is_published: bool, + ?metadata: Imagekit::Metadata, + ?name: String, + ?size: Float, + ?tags: ::Array[String]?, + ?thumbnail_url: String, + ?url: String, + ?version_info: Imagekit::Models::FileUploadResponse::VersionInfo, + ?video_codec: String, + ?width: Float + ) -> void + + def to_hash: -> { + ai_tags: ::Array[Imagekit::Models::FileUploadResponse::AITag]?, + audio_codec: String, + bit_rate: Integer, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + duration: Integer, + embedded_metadata: ::Hash[Symbol, top], + extension_status: Imagekit::Models::FileUploadResponse::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: bool, + is_published: bool, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail_url: String, + url: String, + version_info: Imagekit::Models::FileUploadResponse::VersionInfo, + video_codec: String, + width: Float + } + + type ai_tag = { confidence: Float, name: String, source: String } + + class AITag < Imagekit::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: Imagekit::Models::FileUploadResponse::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::FileUploadResponse::ExtensionStatus::remove_bg + } + + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + attr_reader ai_auto_description: Imagekit::Models::FileUploadResponse::ExtensionStatus::ai_auto_description? + + def ai_auto_description=: ( + Imagekit::Models::FileUploadResponse::ExtensionStatus::ai_auto_description + ) -> Imagekit::Models::FileUploadResponse::ExtensionStatus::ai_auto_description + + attr_reader aws_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging? + + def aws_auto_tagging=: ( + Imagekit::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging + ) -> Imagekit::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging + + attr_reader google_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging? + + def google_auto_tagging=: ( + Imagekit::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging + ) -> Imagekit::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging + + attr_reader remove_bg: Imagekit::Models::FileUploadResponse::ExtensionStatus::remove_bg? + + def remove_bg=: ( + Imagekit::Models::FileUploadResponse::ExtensionStatus::remove_bg + ) -> Imagekit::Models::FileUploadResponse::ExtensionStatus::remove_bg + + def initialize: ( + ?ai_auto_description: Imagekit::Models::FileUploadResponse::ExtensionStatus::ai_auto_description, + ?aws_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging, + ?google_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging, + ?remove_bg: Imagekit::Models::FileUploadResponse::ExtensionStatus::remove_bg + ) -> void + + def to_hash: -> { + ai_auto_description: Imagekit::Models::FileUploadResponse::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::FileUploadResponse::ExtensionStatus::remove_bg + } + + type ai_auto_description = :success | :pending | :failed + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUploadResponse::ExtensionStatus::ai_auto_description] + end + + type aws_auto_tagging = :success | :pending | :failed + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUploadResponse::ExtensionStatus::aws_auto_tagging] + end + + type google_auto_tagging = :success | :pending | :failed + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUploadResponse::ExtensionStatus::google_auto_tagging] + end + + type remove_bg = :success | :pending | :failed + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::FileUploadResponse::ExtensionStatus::remove_bg] + end + end + + type version_info = { id: String, name: String } + + class VersionInfo < Imagekit::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/imagekit/models/files/bulk_add_tags_params.rbs b/sig/imagekit/models/files/bulk_add_tags_params.rbs new file mode 100644 index 00000000..756027fa --- /dev/null +++ b/sig/imagekit/models/files/bulk_add_tags_params.rbs @@ -0,0 +1,30 @@ +module Imagekit + module Models + module Files + type bulk_add_tags_params = + { file_ids: ::Array[String], tags: ::Array[String] } + & Imagekit::Internal::Type::request_parameters + + class BulkAddTagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file_ids: ::Array[String] + + attr_accessor tags: ::Array[String] + + def initialize: ( + file_ids: ::Array[String], + tags: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_ids: ::Array[String], + tags: ::Array[String], + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/files/bulk_add_tags_response.rbs b/sig/imagekit/models/files/bulk_add_tags_response.rbs new file mode 100644 index 00000000..7d9309bc --- /dev/null +++ b/sig/imagekit/models/files/bulk_add_tags_response.rbs @@ -0,0 +1,20 @@ +module Imagekit + module Models + module Files + type bulk_add_tags_response = + { successfully_updated_file_ids: ::Array[String] } + + class BulkAddTagsResponse < Imagekit::Internal::Type::BaseModel + attr_reader successfully_updated_file_ids: ::Array[String]? + + def successfully_updated_file_ids=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?successfully_updated_file_ids: ::Array[String] + ) -> void + + def to_hash: -> { successfully_updated_file_ids: ::Array[String] } + end + end + end +end diff --git a/sig/imagekit/models/files/bulk_delete_params.rbs b/sig/imagekit/models/files/bulk_delete_params.rbs new file mode 100644 index 00000000..353a3add --- /dev/null +++ b/sig/imagekit/models/files/bulk_delete_params.rbs @@ -0,0 +1,26 @@ +module Imagekit + module Models + module Files + type bulk_delete_params = + { file_ids: ::Array[String] } + & Imagekit::Internal::Type::request_parameters + + class BulkDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file_ids: ::Array[String] + + def initialize: ( + file_ids: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_ids: ::Array[String], + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/files/bulk_delete_response.rbs b/sig/imagekit/models/files/bulk_delete_response.rbs new file mode 100644 index 00000000..7a5933c1 --- /dev/null +++ b/sig/imagekit/models/files/bulk_delete_response.rbs @@ -0,0 +1,20 @@ +module Imagekit + module Models + module Files + type bulk_delete_response = + { successfully_deleted_file_ids: ::Array[String] } + + class BulkDeleteResponse < Imagekit::Internal::Type::BaseModel + attr_reader successfully_deleted_file_ids: ::Array[String]? + + def successfully_deleted_file_ids=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?successfully_deleted_file_ids: ::Array[String] + ) -> void + + def to_hash: -> { successfully_deleted_file_ids: ::Array[String] } + end + end + end +end diff --git a/sig/imagekit/models/files/bulk_remove_ai_tags_params.rbs b/sig/imagekit/models/files/bulk_remove_ai_tags_params.rbs new file mode 100644 index 00000000..b7d6122d --- /dev/null +++ b/sig/imagekit/models/files/bulk_remove_ai_tags_params.rbs @@ -0,0 +1,30 @@ +module Imagekit + module Models + module Files + type bulk_remove_ai_tags_params = + { ai_tags: ::Array[String], file_ids: ::Array[String] } + & Imagekit::Internal::Type::request_parameters + + class BulkRemoveAITagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor ai_tags: ::Array[String] + + attr_accessor file_ids: ::Array[String] + + def initialize: ( + ai_tags: ::Array[String], + file_ids: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + ai_tags: ::Array[String], + file_ids: ::Array[String], + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/files/bulk_remove_ai_tags_response.rbs b/sig/imagekit/models/files/bulk_remove_ai_tags_response.rbs new file mode 100644 index 00000000..ffe753ea --- /dev/null +++ b/sig/imagekit/models/files/bulk_remove_ai_tags_response.rbs @@ -0,0 +1,20 @@ +module Imagekit + module Models + module Files + type bulk_remove_ai_tags_response = + { successfully_updated_file_ids: ::Array[String] } + + class BulkRemoveAITagsResponse < Imagekit::Internal::Type::BaseModel + attr_reader successfully_updated_file_ids: ::Array[String]? + + def successfully_updated_file_ids=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?successfully_updated_file_ids: ::Array[String] + ) -> void + + def to_hash: -> { successfully_updated_file_ids: ::Array[String] } + end + end + end +end diff --git a/sig/imagekit/models/files/bulk_remove_tags_params.rbs b/sig/imagekit/models/files/bulk_remove_tags_params.rbs new file mode 100644 index 00000000..020cfb2b --- /dev/null +++ b/sig/imagekit/models/files/bulk_remove_tags_params.rbs @@ -0,0 +1,30 @@ +module Imagekit + module Models + module Files + type bulk_remove_tags_params = + { file_ids: ::Array[String], tags: ::Array[String] } + & Imagekit::Internal::Type::request_parameters + + class BulkRemoveTagsParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file_ids: ::Array[String] + + attr_accessor tags: ::Array[String] + + def initialize: ( + file_ids: ::Array[String], + tags: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_ids: ::Array[String], + tags: ::Array[String], + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/files/bulk_remove_tags_response.rbs b/sig/imagekit/models/files/bulk_remove_tags_response.rbs new file mode 100644 index 00000000..ab915fda --- /dev/null +++ b/sig/imagekit/models/files/bulk_remove_tags_response.rbs @@ -0,0 +1,20 @@ +module Imagekit + module Models + module Files + type bulk_remove_tags_response = + { successfully_updated_file_ids: ::Array[String] } + + class BulkRemoveTagsResponse < Imagekit::Internal::Type::BaseModel + attr_reader successfully_updated_file_ids: ::Array[String]? + + def successfully_updated_file_ids=: (::Array[String]) -> ::Array[String] + + def initialize: ( + ?successfully_updated_file_ids: ::Array[String] + ) -> void + + def to_hash: -> { successfully_updated_file_ids: ::Array[String] } + end + end + end +end diff --git a/sig/imagekit/models/files/metadata_get_from_url_params.rbs b/sig/imagekit/models/files/metadata_get_from_url_params.rbs new file mode 100644 index 00000000..9a87d773 --- /dev/null +++ b/sig/imagekit/models/files/metadata_get_from_url_params.rbs @@ -0,0 +1,25 @@ +module Imagekit + module Models + module Files + type metadata_get_from_url_params = + { url: String } & Imagekit::Internal::Type::request_parameters + + class MetadataGetFromURLParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor url: String + + def initialize: ( + url: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + url: String, + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/files/metadata_get_params.rbs b/sig/imagekit/models/files/metadata_get_params.rbs new file mode 100644 index 00000000..61c39d07 --- /dev/null +++ b/sig/imagekit/models/files/metadata_get_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Files + type metadata_get_params = + { } & Imagekit::Internal::Type::request_parameters + + class MetadataGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/files/version_delete_params.rbs b/sig/imagekit/models/files/version_delete_params.rbs new file mode 100644 index 00000000..9a480932 --- /dev/null +++ b/sig/imagekit/models/files/version_delete_params.rbs @@ -0,0 +1,25 @@ +module Imagekit + module Models + module Files + type version_delete_params = + { file_id: String } & Imagekit::Internal::Type::request_parameters + + class VersionDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file_id: String + + def initialize: ( + file_id: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_id: String, + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/files/version_delete_response.rbs b/sig/imagekit/models/files/version_delete_response.rbs new file mode 100644 index 00000000..6c5f6681 --- /dev/null +++ b/sig/imagekit/models/files/version_delete_response.rbs @@ -0,0 +1,13 @@ +module Imagekit + module Models + module Files + type version_delete_response = { } + + class VersionDeleteResponse < Imagekit::Internal::Type::BaseModel + def initialize: -> void + + def to_hash: -> { } + end + end + end +end diff --git a/sig/imagekit/models/files/version_get_params.rbs b/sig/imagekit/models/files/version_get_params.rbs new file mode 100644 index 00000000..9944b0e5 --- /dev/null +++ b/sig/imagekit/models/files/version_get_params.rbs @@ -0,0 +1,25 @@ +module Imagekit + module Models + module Files + type version_get_params = + { file_id: String } & Imagekit::Internal::Type::request_parameters + + class VersionGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file_id: String + + def initialize: ( + file_id: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_id: String, + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/files/version_list_params.rbs b/sig/imagekit/models/files/version_list_params.rbs new file mode 100644 index 00000000..2a67793e --- /dev/null +++ b/sig/imagekit/models/files/version_list_params.rbs @@ -0,0 +1,17 @@ +module Imagekit + module Models + module Files + type version_list_params = + { } & Imagekit::Internal::Type::request_parameters + + class VersionListParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/files/version_list_response.rbs b/sig/imagekit/models/files/version_list_response.rbs new file mode 100644 index 00000000..48c5bd45 --- /dev/null +++ b/sig/imagekit/models/files/version_list_response.rbs @@ -0,0 +1,9 @@ +module Imagekit + module Models + module Files + type version_list_response = ::Array[Imagekit::File] + + VersionListResponse: Imagekit::Internal::Type::Converter + end + end +end diff --git a/sig/imagekit/models/files/version_restore_params.rbs b/sig/imagekit/models/files/version_restore_params.rbs new file mode 100644 index 00000000..22ed3a7e --- /dev/null +++ b/sig/imagekit/models/files/version_restore_params.rbs @@ -0,0 +1,25 @@ +module Imagekit + module Models + module Files + type version_restore_params = + { file_id: String } & Imagekit::Internal::Type::request_parameters + + class VersionRestoreParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor file_id: String + + def initialize: ( + file_id: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + file_id: String, + request_options: Imagekit::RequestOptions + } + end + end + end +end diff --git a/sig/imagekit/models/folder.rbs b/sig/imagekit/models/folder.rbs new file mode 100644 index 00000000..23c781ba --- /dev/null +++ b/sig/imagekit/models/folder.rbs @@ -0,0 +1,69 @@ +module Imagekit + module Models + type folder = + { + created_at: Time, + folder_id: String, + folder_path: String, + name: String, + type: Imagekit::Models::Folder::type_, + updated_at: Time + } + + class Folder < Imagekit::Internal::Type::BaseModel + attr_reader created_at: Time? + + def created_at=: (Time) -> Time + + attr_reader folder_id: String? + + def folder_id=: (String) -> String + + attr_reader folder_path: String? + + def folder_path=: (String) -> String + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader type: Imagekit::Models::Folder::type_? + + def type=: ( + Imagekit::Models::Folder::type_ + ) -> Imagekit::Models::Folder::type_ + + attr_reader updated_at: Time? + + def updated_at=: (Time) -> Time + + def initialize: ( + ?created_at: Time, + ?folder_id: String, + ?folder_path: String, + ?name: String, + ?type: Imagekit::Models::Folder::type_, + ?updated_at: Time + ) -> void + + def to_hash: -> { + created_at: Time, + folder_id: String, + folder_path: String, + name: String, + type: Imagekit::Models::Folder::type_, + updated_at: Time + } + + type type_ = :folder + + module Type + extend Imagekit::Internal::Type::Enum + + FOLDER: :folder + + def self?.values: -> ::Array[Imagekit::Models::Folder::type_] + end + end + end +end diff --git a/sig/imagekit/models/folder_copy_params.rbs b/sig/imagekit/models/folder_copy_params.rbs new file mode 100644 index 00000000..90f19170 --- /dev/null +++ b/sig/imagekit/models/folder_copy_params.rbs @@ -0,0 +1,38 @@ +module Imagekit + module Models + type folder_copy_params = + { + destination_path: String, + source_folder_path: String, + include_versions: bool + } + & Imagekit::Internal::Type::request_parameters + + class FolderCopyParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor destination_path: String + + attr_accessor source_folder_path: String + + attr_reader include_versions: bool? + + def include_versions=: (bool) -> bool + + def initialize: ( + destination_path: String, + source_folder_path: String, + ?include_versions: bool, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + destination_path: String, + source_folder_path: String, + include_versions: bool, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/folder_copy_response.rbs b/sig/imagekit/models/folder_copy_response.rbs new file mode 100644 index 00000000..3baef44d --- /dev/null +++ b/sig/imagekit/models/folder_copy_response.rbs @@ -0,0 +1,13 @@ +module Imagekit + module Models + type folder_copy_response = { job_id: String } + + class FolderCopyResponse < Imagekit::Internal::Type::BaseModel + attr_accessor job_id: String + + def initialize: (job_id: String) -> void + + def to_hash: -> { job_id: String } + end + end +end diff --git a/sig/imagekit/models/folder_create_params.rbs b/sig/imagekit/models/folder_create_params.rbs new file mode 100644 index 00000000..3dff4c00 --- /dev/null +++ b/sig/imagekit/models/folder_create_params.rbs @@ -0,0 +1,28 @@ +module Imagekit + module Models + type folder_create_params = + { folder_name: String, parent_folder_path: String } + & Imagekit::Internal::Type::request_parameters + + class FolderCreateParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor folder_name: String + + attr_accessor parent_folder_path: String + + def initialize: ( + folder_name: String, + parent_folder_path: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + folder_name: String, + parent_folder_path: String, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/folder_create_response.rbs b/sig/imagekit/models/folder_create_response.rbs new file mode 100644 index 00000000..4cc3bed8 --- /dev/null +++ b/sig/imagekit/models/folder_create_response.rbs @@ -0,0 +1,11 @@ +module Imagekit + module Models + type folder_create_response = { } + + class FolderCreateResponse < Imagekit::Internal::Type::BaseModel + def initialize: -> void + + def to_hash: -> { } + end + end +end diff --git a/sig/imagekit/models/folder_delete_params.rbs b/sig/imagekit/models/folder_delete_params.rbs new file mode 100644 index 00000000..ffc943b5 --- /dev/null +++ b/sig/imagekit/models/folder_delete_params.rbs @@ -0,0 +1,23 @@ +module Imagekit + module Models + type folder_delete_params = + { folder_path: String } & Imagekit::Internal::Type::request_parameters + + class FolderDeleteParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor folder_path: String + + def initialize: ( + folder_path: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + folder_path: String, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/folder_delete_response.rbs b/sig/imagekit/models/folder_delete_response.rbs new file mode 100644 index 00000000..9dcdda77 --- /dev/null +++ b/sig/imagekit/models/folder_delete_response.rbs @@ -0,0 +1,11 @@ +module Imagekit + module Models + type folder_delete_response = { } + + class FolderDeleteResponse < Imagekit::Internal::Type::BaseModel + def initialize: -> void + + def to_hash: -> { } + end + end +end diff --git a/sig/imagekit/models/folder_move_params.rbs b/sig/imagekit/models/folder_move_params.rbs new file mode 100644 index 00000000..50d1d68a --- /dev/null +++ b/sig/imagekit/models/folder_move_params.rbs @@ -0,0 +1,28 @@ +module Imagekit + module Models + type folder_move_params = + { destination_path: String, source_folder_path: String } + & Imagekit::Internal::Type::request_parameters + + class FolderMoveParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor destination_path: String + + attr_accessor source_folder_path: String + + def initialize: ( + destination_path: String, + source_folder_path: String, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + destination_path: String, + source_folder_path: String, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/folder_move_response.rbs b/sig/imagekit/models/folder_move_response.rbs new file mode 100644 index 00000000..dd788a3e --- /dev/null +++ b/sig/imagekit/models/folder_move_response.rbs @@ -0,0 +1,13 @@ +module Imagekit + module Models + type folder_move_response = { job_id: String } + + class FolderMoveResponse < Imagekit::Internal::Type::BaseModel + attr_accessor job_id: String + + def initialize: (job_id: String) -> void + + def to_hash: -> { job_id: String } + end + end +end diff --git a/sig/imagekit/models/folder_rename_params.rbs b/sig/imagekit/models/folder_rename_params.rbs new file mode 100644 index 00000000..ddb509d9 --- /dev/null +++ b/sig/imagekit/models/folder_rename_params.rbs @@ -0,0 +1,34 @@ +module Imagekit + module Models + type folder_rename_params = + { folder_path: String, new_folder_name: String, purge_cache: bool } + & Imagekit::Internal::Type::request_parameters + + class FolderRenameParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + attr_accessor folder_path: String + + attr_accessor new_folder_name: String + + attr_reader purge_cache: bool? + + def purge_cache=: (bool) -> bool + + def initialize: ( + folder_path: String, + new_folder_name: String, + ?purge_cache: bool, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + folder_path: String, + new_folder_name: String, + purge_cache: bool, + request_options: Imagekit::RequestOptions + } + end + end +end diff --git a/sig/imagekit/models/folder_rename_response.rbs b/sig/imagekit/models/folder_rename_response.rbs new file mode 100644 index 00000000..8b24b6dd --- /dev/null +++ b/sig/imagekit/models/folder_rename_response.rbs @@ -0,0 +1,13 @@ +module Imagekit + module Models + type folder_rename_response = { job_id: String } + + class FolderRenameResponse < Imagekit::Internal::Type::BaseModel + attr_accessor job_id: String + + def initialize: (job_id: String) -> void + + def to_hash: -> { job_id: String } + end + end +end diff --git a/sig/imagekit/models/folders/job_get_params.rbs b/sig/imagekit/models/folders/job_get_params.rbs new file mode 100644 index 00000000..ea747749 --- /dev/null +++ b/sig/imagekit/models/folders/job_get_params.rbs @@ -0,0 +1,16 @@ +module Imagekit + module Models + module Folders + type job_get_params = { } & Imagekit::Internal::Type::request_parameters + + class JobGetParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end + end +end diff --git a/sig/imagekit/models/folders/job_get_response.rbs b/sig/imagekit/models/folders/job_get_response.rbs new file mode 100644 index 00000000..dcda6269 --- /dev/null +++ b/sig/imagekit/models/folders/job_get_response.rbs @@ -0,0 +1,72 @@ +module Imagekit + module Models + module Folders + type job_get_response = + { + job_id: String, + purge_request_id: String, + status: Imagekit::Models::Folders::JobGetResponse::status, + type: Imagekit::Models::Folders::JobGetResponse::type_ + } + + class JobGetResponse < Imagekit::Internal::Type::BaseModel + attr_reader job_id: String? + + def job_id=: (String) -> String + + attr_reader purge_request_id: String? + + def purge_request_id=: (String) -> String + + attr_reader status: Imagekit::Models::Folders::JobGetResponse::status? + + def status=: ( + Imagekit::Models::Folders::JobGetResponse::status + ) -> Imagekit::Models::Folders::JobGetResponse::status + + attr_reader type: Imagekit::Models::Folders::JobGetResponse::type_? + + def type=: ( + Imagekit::Models::Folders::JobGetResponse::type_ + ) -> Imagekit::Models::Folders::JobGetResponse::type_ + + def initialize: ( + ?job_id: String, + ?purge_request_id: String, + ?status: Imagekit::Models::Folders::JobGetResponse::status, + ?type: Imagekit::Models::Folders::JobGetResponse::type_ + ) -> void + + def to_hash: -> { + job_id: String, + purge_request_id: String, + status: Imagekit::Models::Folders::JobGetResponse::status, + type: Imagekit::Models::Folders::JobGetResponse::type_ + } + + type status = :Pending | :Completed + + module Status + extend Imagekit::Internal::Type::Enum + + PENDING: :Pending + COMPLETED: :Completed + + def self?.values: -> ::Array[Imagekit::Models::Folders::JobGetResponse::status] + end + + type type_ = :COPY_FOLDER | :MOVE_FOLDER | :RENAME_FOLDER + + module Type + extend Imagekit::Internal::Type::Enum + + COPY_FOLDER: :COPY_FOLDER + MOVE_FOLDER: :MOVE_FOLDER + RENAME_FOLDER: :RENAME_FOLDER + + def self?.values: -> ::Array[Imagekit::Models::Folders::JobGetResponse::type_] + end + end + end + end +end diff --git a/sig/imagekit/models/image_overlay.rbs b/sig/imagekit/models/image_overlay.rbs new file mode 100644 index 00000000..83313253 --- /dev/null +++ b/sig/imagekit/models/image_overlay.rbs @@ -0,0 +1,59 @@ +module Imagekit + module Models + type image_overlay = + { + input: String, + type: :image, + encoding: Imagekit::Models::ImageOverlay::encoding, + transformation: ::Array[Imagekit::Transformation] + } + + class ImageOverlay < Imagekit::Models::BaseOverlay + def input: -> String + + def input=: (String _) -> String + + def `type`: -> :image + + def type=: (:image _) -> :image + + def encoding: -> Imagekit::Models::ImageOverlay::encoding? + + def encoding=: ( + Imagekit::Models::ImageOverlay::encoding _ + ) -> Imagekit::Models::ImageOverlay::encoding + + def transformation: -> ::Array[Imagekit::Transformation]? + + def transformation=: ( + ::Array[Imagekit::Transformation] _ + ) -> ::Array[Imagekit::Transformation] + + def initialize: ( + input: String, + ?encoding: Imagekit::Models::ImageOverlay::encoding, + ?transformation: ::Array[Imagekit::Transformation], + ?type: :image + ) -> void + + def to_hash: -> { + input: String, + type: :image, + encoding: Imagekit::Models::ImageOverlay::encoding, + transformation: ::Array[Imagekit::Transformation] + } + + type encoding = :auto | :plain | :base64 + + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO: :auto + PLAIN: :plain + BASE64: :base64 + + def self?.values: -> ::Array[Imagekit::Models::ImageOverlay::encoding] + end + end + end +end diff --git a/sig/imagekit/models/metadata.rbs b/sig/imagekit/models/metadata.rbs new file mode 100644 index 00000000..789a9376 --- /dev/null +++ b/sig/imagekit/models/metadata.rbs @@ -0,0 +1,546 @@ +module Imagekit + module Models + type metadata = + { + audio_codec: String, + bit_rate: Integer, + density: Integer, + duration: Integer, + exif: Imagekit::Metadata::Exif, + format_: String, + has_color_profile: bool, + has_transparency: bool, + height: Integer, + p_hash: String, + quality: Integer, + size: Integer, + video_codec: String, + width: Integer + } + + class Metadata < Imagekit::Internal::Type::BaseModel + attr_reader audio_codec: String? + + def audio_codec=: (String) -> String + + attr_reader bit_rate: Integer? + + def bit_rate=: (Integer) -> Integer + + attr_reader density: Integer? + + def density=: (Integer) -> Integer + + attr_reader duration: Integer? + + def duration=: (Integer) -> Integer + + attr_reader exif: Imagekit::Metadata::Exif? + + def exif=: (Imagekit::Metadata::Exif) -> Imagekit::Metadata::Exif + + attr_reader format_: String? + + def format_=: (String) -> String + + attr_reader has_color_profile: bool? + + def has_color_profile=: (bool) -> bool + + attr_reader has_transparency: bool? + + def has_transparency=: (bool) -> bool + + attr_reader height: Integer? + + def height=: (Integer) -> Integer + + attr_reader p_hash: String? + + def p_hash=: (String) -> String + + attr_reader quality: Integer? + + def quality=: (Integer) -> Integer + + attr_reader size: Integer? + + def size=: (Integer) -> Integer + + attr_reader video_codec: String? + + def video_codec=: (String) -> String + + attr_reader width: Integer? + + def width=: (Integer) -> Integer + + def initialize: ( + ?audio_codec: String, + ?bit_rate: Integer, + ?density: Integer, + ?duration: Integer, + ?exif: Imagekit::Metadata::Exif, + ?format_: String, + ?has_color_profile: bool, + ?has_transparency: bool, + ?height: Integer, + ?p_hash: String, + ?quality: Integer, + ?size: Integer, + ?video_codec: String, + ?width: Integer + ) -> void + + def to_hash: -> { + audio_codec: String, + bit_rate: Integer, + density: Integer, + duration: Integer, + exif: Imagekit::Metadata::Exif, + format_: String, + has_color_profile: bool, + has_transparency: bool, + height: Integer, + p_hash: String, + quality: Integer, + size: Integer, + video_codec: String, + width: Integer + } + + type exif = + { + exif: Imagekit::Metadata::Exif::Exif, + gps: Imagekit::Metadata::Exif::Gps, + image: Imagekit::Metadata::Exif::Image, + interoperability: Imagekit::Metadata::Exif::Interoperability, + makernote: ::Hash[Symbol, top], + thumbnail: Imagekit::Metadata::Exif::Thumbnail + } + + class Exif < Imagekit::Internal::Type::BaseModel + attr_reader exif: Imagekit::Metadata::Exif::Exif? + + def exif=: ( + Imagekit::Metadata::Exif::Exif + ) -> Imagekit::Metadata::Exif::Exif + + attr_reader gps: Imagekit::Metadata::Exif::Gps? + + def gps=: ( + Imagekit::Metadata::Exif::Gps + ) -> Imagekit::Metadata::Exif::Gps + + attr_reader image: Imagekit::Metadata::Exif::Image? + + def image=: ( + Imagekit::Metadata::Exif::Image + ) -> Imagekit::Metadata::Exif::Image + + attr_reader interoperability: Imagekit::Metadata::Exif::Interoperability? + + def interoperability=: ( + Imagekit::Metadata::Exif::Interoperability + ) -> Imagekit::Metadata::Exif::Interoperability + + attr_reader makernote: ::Hash[Symbol, top]? + + def makernote=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader thumbnail: Imagekit::Metadata::Exif::Thumbnail? + + def thumbnail=: ( + Imagekit::Metadata::Exif::Thumbnail + ) -> Imagekit::Metadata::Exif::Thumbnail + + def initialize: ( + ?exif: Imagekit::Metadata::Exif::Exif, + ?gps: Imagekit::Metadata::Exif::Gps, + ?image: Imagekit::Metadata::Exif::Image, + ?interoperability: Imagekit::Metadata::Exif::Interoperability, + ?makernote: ::Hash[Symbol, top], + ?thumbnail: Imagekit::Metadata::Exif::Thumbnail + ) -> void + + def to_hash: -> { + exif: Imagekit::Metadata::Exif::Exif, + gps: Imagekit::Metadata::Exif::Gps, + image: Imagekit::Metadata::Exif::Image, + interoperability: Imagekit::Metadata::Exif::Interoperability, + makernote: ::Hash[Symbol, top], + thumbnail: Imagekit::Metadata::Exif::Thumbnail + } + + type exif = + { + aperture_value: Float, + color_space: Integer, + create_date: String, + custom_rendered: Integer, + date_time_original: String, + exif_image_height: Integer, + exif_image_width: Integer, + exif_version: String, + exposure_compensation: Float, + exposure_mode: Integer, + exposure_program: Integer, + exposure_time: Float, + flash: Integer, + flashpix_version: String, + f_number: Float, + focal_length: Integer, + focal_plane_resolution_unit: Integer, + focal_plane_x_resolution: Float, + focal_plane_y_resolution: Float, + interop_offset: Integer, + iso: Integer, + metering_mode: Integer, + scene_capture_type: Integer, + shutter_speed_value: Float, + sub_sec_time: String, + white_balance: Integer + } + + class Exif < Imagekit::Internal::Type::BaseModel + attr_reader aperture_value: Float? + + def aperture_value=: (Float) -> Float + + attr_reader color_space: Integer? + + def color_space=: (Integer) -> Integer + + attr_reader create_date: String? + + def create_date=: (String) -> String + + attr_reader custom_rendered: Integer? + + def custom_rendered=: (Integer) -> Integer + + attr_reader date_time_original: String? + + def date_time_original=: (String) -> String + + attr_reader exif_image_height: Integer? + + def exif_image_height=: (Integer) -> Integer + + attr_reader exif_image_width: Integer? + + def exif_image_width=: (Integer) -> Integer + + attr_reader exif_version: String? + + def exif_version=: (String) -> String + + attr_reader exposure_compensation: Float? + + def exposure_compensation=: (Float) -> Float + + attr_reader exposure_mode: Integer? + + def exposure_mode=: (Integer) -> Integer + + attr_reader exposure_program: Integer? + + def exposure_program=: (Integer) -> Integer + + attr_reader exposure_time: Float? + + def exposure_time=: (Float) -> Float + + attr_reader flash: Integer? + + def flash=: (Integer) -> Integer + + attr_reader flashpix_version: String? + + def flashpix_version=: (String) -> String + + attr_reader f_number: Float? + + def f_number=: (Float) -> Float + + attr_reader focal_length: Integer? + + def focal_length=: (Integer) -> Integer + + attr_reader focal_plane_resolution_unit: Integer? + + def focal_plane_resolution_unit=: (Integer) -> Integer + + attr_reader focal_plane_x_resolution: Float? + + def focal_plane_x_resolution=: (Float) -> Float + + attr_reader focal_plane_y_resolution: Float? + + def focal_plane_y_resolution=: (Float) -> Float + + attr_reader interop_offset: Integer? + + def interop_offset=: (Integer) -> Integer + + attr_reader iso: Integer? + + def iso=: (Integer) -> Integer + + attr_reader metering_mode: Integer? + + def metering_mode=: (Integer) -> Integer + + attr_reader scene_capture_type: Integer? + + def scene_capture_type=: (Integer) -> Integer + + attr_reader shutter_speed_value: Float? + + def shutter_speed_value=: (Float) -> Float + + attr_reader sub_sec_time: String? + + def sub_sec_time=: (String) -> String + + attr_reader white_balance: Integer? + + def white_balance=: (Integer) -> Integer + + def initialize: ( + ?aperture_value: Float, + ?color_space: Integer, + ?create_date: String, + ?custom_rendered: Integer, + ?date_time_original: String, + ?exif_image_height: Integer, + ?exif_image_width: Integer, + ?exif_version: String, + ?exposure_compensation: Float, + ?exposure_mode: Integer, + ?exposure_program: Integer, + ?exposure_time: Float, + ?flash: Integer, + ?flashpix_version: String, + ?f_number: Float, + ?focal_length: Integer, + ?focal_plane_resolution_unit: Integer, + ?focal_plane_x_resolution: Float, + ?focal_plane_y_resolution: Float, + ?interop_offset: Integer, + ?iso: Integer, + ?metering_mode: Integer, + ?scene_capture_type: Integer, + ?shutter_speed_value: Float, + ?sub_sec_time: String, + ?white_balance: Integer + ) -> void + + def to_hash: -> { + aperture_value: Float, + color_space: Integer, + create_date: String, + custom_rendered: Integer, + date_time_original: String, + exif_image_height: Integer, + exif_image_width: Integer, + exif_version: String, + exposure_compensation: Float, + exposure_mode: Integer, + exposure_program: Integer, + exposure_time: Float, + flash: Integer, + flashpix_version: String, + f_number: Float, + focal_length: Integer, + focal_plane_resolution_unit: Integer, + focal_plane_x_resolution: Float, + focal_plane_y_resolution: Float, + interop_offset: Integer, + iso: Integer, + metering_mode: Integer, + scene_capture_type: Integer, + shutter_speed_value: Float, + sub_sec_time: String, + white_balance: Integer + } + end + + type gps = { gps_version_id: ::Array[Integer] } + + class Gps < Imagekit::Internal::Type::BaseModel + attr_reader gps_version_id: ::Array[Integer]? + + def gps_version_id=: (::Array[Integer]) -> ::Array[Integer] + + def initialize: (?gps_version_id: ::Array[Integer]) -> void + + def to_hash: -> { gps_version_id: ::Array[Integer] } + end + + type image = + { + exif_offset: Integer, + gps_info: Integer, + make: String, + model: String, + modify_date: String, + orientation: Integer, + resolution_unit: Integer, + software: String, + x_resolution: Integer, + y_cb_cr_positioning: Integer, + y_resolution: Integer + } + + class Image < Imagekit::Internal::Type::BaseModel + attr_reader exif_offset: Integer? + + def exif_offset=: (Integer) -> Integer + + attr_reader gps_info: Integer? + + def gps_info=: (Integer) -> Integer + + attr_reader make: String? + + def make=: (String) -> String + + attr_reader model: String? + + def model=: (String) -> String + + attr_reader modify_date: String? + + def modify_date=: (String) -> String + + attr_reader orientation: Integer? + + def orientation=: (Integer) -> Integer + + attr_reader resolution_unit: Integer? + + def resolution_unit=: (Integer) -> Integer + + attr_reader software: String? + + def software=: (String) -> String + + attr_reader x_resolution: Integer? + + def x_resolution=: (Integer) -> Integer + + attr_reader y_cb_cr_positioning: Integer? + + def y_cb_cr_positioning=: (Integer) -> Integer + + attr_reader y_resolution: Integer? + + def y_resolution=: (Integer) -> Integer + + def initialize: ( + ?exif_offset: Integer, + ?gps_info: Integer, + ?make: String, + ?model: String, + ?modify_date: String, + ?orientation: Integer, + ?resolution_unit: Integer, + ?software: String, + ?x_resolution: Integer, + ?y_cb_cr_positioning: Integer, + ?y_resolution: Integer + ) -> void + + def to_hash: -> { + exif_offset: Integer, + gps_info: Integer, + make: String, + model: String, + modify_date: String, + orientation: Integer, + resolution_unit: Integer, + software: String, + x_resolution: Integer, + y_cb_cr_positioning: Integer, + y_resolution: Integer + } + end + + type interoperability = + { interop_index: String, interop_version: String } + + class Interoperability < Imagekit::Internal::Type::BaseModel + attr_reader interop_index: String? + + def interop_index=: (String) -> String + + attr_reader interop_version: String? + + def interop_version=: (String) -> String + + def initialize: ( + ?interop_index: String, + ?interop_version: String + ) -> void + + def to_hash: -> { interop_index: String, interop_version: String } + end + + type thumbnail = + { + compression: Integer, + resolution_unit: Integer, + thumbnail_length: Integer, + thumbnail_offset: Integer, + x_resolution: Integer, + y_resolution: Integer + } + + class Thumbnail < Imagekit::Internal::Type::BaseModel + attr_reader compression: Integer? + + def compression=: (Integer) -> Integer + + attr_reader resolution_unit: Integer? + + def resolution_unit=: (Integer) -> Integer + + attr_reader thumbnail_length: Integer? + + def thumbnail_length=: (Integer) -> Integer + + attr_reader thumbnail_offset: Integer? + + def thumbnail_offset=: (Integer) -> Integer + + attr_reader x_resolution: Integer? + + def x_resolution=: (Integer) -> Integer + + attr_reader y_resolution: Integer? + + def y_resolution=: (Integer) -> Integer + + def initialize: ( + ?compression: Integer, + ?resolution_unit: Integer, + ?thumbnail_length: Integer, + ?thumbnail_offset: Integer, + ?x_resolution: Integer, + ?y_resolution: Integer + ) -> void + + def to_hash: -> { + compression: Integer, + resolution_unit: Integer, + thumbnail_length: Integer, + thumbnail_offset: Integer, + x_resolution: Integer, + y_resolution: Integer + } + end + end + end + end +end diff --git a/sig/imagekit/models/overlay.rbs b/sig/imagekit/models/overlay.rbs new file mode 100644 index 00000000..2172be0b --- /dev/null +++ b/sig/imagekit/models/overlay.rbs @@ -0,0 +1,16 @@ +module Imagekit + module Models + type overlay = + Imagekit::TextOverlay + | Imagekit::ImageOverlay + | Imagekit::VideoOverlay + | Imagekit::SubtitleOverlay + | Imagekit::SolidColorOverlay + + module Overlay + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::overlay] + end + end +end diff --git a/sig/imagekit/models/overlay_position.rbs b/sig/imagekit/models/overlay_position.rbs new file mode 100644 index 00000000..8576502e --- /dev/null +++ b/sig/imagekit/models/overlay_position.rbs @@ -0,0 +1,85 @@ +module Imagekit + module Models + type overlay_position = + { + focus: Imagekit::Models::OverlayPosition::focus, + x: Imagekit::Models::OverlayPosition::x, + y_: Imagekit::Models::OverlayPosition::y_ + } + + class OverlayPosition < Imagekit::Internal::Type::BaseModel + attr_reader focus: Imagekit::Models::OverlayPosition::focus? + + def focus=: ( + Imagekit::Models::OverlayPosition::focus + ) -> Imagekit::Models::OverlayPosition::focus + + attr_reader x: Imagekit::Models::OverlayPosition::x? + + def x=: ( + Imagekit::Models::OverlayPosition::x + ) -> Imagekit::Models::OverlayPosition::x + + attr_reader y_: Imagekit::Models::OverlayPosition::y_? + + def y_=: ( + Imagekit::Models::OverlayPosition::y_ + ) -> Imagekit::Models::OverlayPosition::y_ + + def initialize: ( + ?focus: Imagekit::Models::OverlayPosition::focus, + ?x: Imagekit::Models::OverlayPosition::x, + ?y_: Imagekit::Models::OverlayPosition::y_ + ) -> void + + def to_hash: -> { + focus: Imagekit::Models::OverlayPosition::focus, + x: Imagekit::Models::OverlayPosition::x, + y_: Imagekit::Models::OverlayPosition::y_ + } + + type focus = + :center + | :top + | :left + | :bottom + | :right + | :top_left + | :top_right + | :bottom_left + | :bottom_right + + module Focus + extend Imagekit::Internal::Type::Enum + + CENTER: :center + TOP: :top + LEFT: :left + BOTTOM: :bottom + RIGHT: :right + TOP_LEFT: :top_left + TOP_RIGHT: :top_right + BOTTOM_LEFT: :bottom_left + BOTTOM_RIGHT: :bottom_right + + def self?.values: -> ::Array[Imagekit::Models::OverlayPosition::focus] + end + + type x = Float | String + + module X + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::OverlayPosition::x] + end + + type y_ = Float | String + + module Y + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::OverlayPosition::y_] + end + end + end +end diff --git a/sig/imagekit/models/overlay_timing.rbs b/sig/imagekit/models/overlay_timing.rbs new file mode 100644 index 00000000..4cafca16 --- /dev/null +++ b/sig/imagekit/models/overlay_timing.rbs @@ -0,0 +1,66 @@ +module Imagekit + module Models + type overlay_timing = + { + duration: Imagekit::Models::OverlayTiming::duration, + end_: Imagekit::Models::OverlayTiming::end_, + start: Imagekit::Models::OverlayTiming::start + } + + class OverlayTiming < Imagekit::Internal::Type::BaseModel + attr_reader duration: Imagekit::Models::OverlayTiming::duration? + + def duration=: ( + Imagekit::Models::OverlayTiming::duration + ) -> Imagekit::Models::OverlayTiming::duration + + attr_reader end_: Imagekit::Models::OverlayTiming::end_? + + def end_=: ( + Imagekit::Models::OverlayTiming::end_ + ) -> Imagekit::Models::OverlayTiming::end_ + + attr_reader start: Imagekit::Models::OverlayTiming::start? + + def start=: ( + Imagekit::Models::OverlayTiming::start + ) -> Imagekit::Models::OverlayTiming::start + + def initialize: ( + ?duration: Imagekit::Models::OverlayTiming::duration, + ?end_: Imagekit::Models::OverlayTiming::end_, + ?start: Imagekit::Models::OverlayTiming::start + ) -> void + + def to_hash: -> { + duration: Imagekit::Models::OverlayTiming::duration, + end_: Imagekit::Models::OverlayTiming::end_, + start: Imagekit::Models::OverlayTiming::start + } + + type duration = Float | String + + module Duration + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::OverlayTiming::duration] + end + + type end_ = Float | String + + module End + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::OverlayTiming::end_] + end + + type start = Float | String + + module Start + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::OverlayTiming::start] + end + end + end +end diff --git a/sig/imagekit/models/solid_color_overlay.rbs b/sig/imagekit/models/solid_color_overlay.rbs new file mode 100644 index 00000000..1b4271e4 --- /dev/null +++ b/sig/imagekit/models/solid_color_overlay.rbs @@ -0,0 +1,38 @@ +module Imagekit + module Models + type solid_color_overlay = + { + color: String, + type: :solidColor, + transformation: ::Array[Imagekit::SolidColorOverlayTransformation] + } + + class SolidColorOverlay < Imagekit::Models::BaseOverlay + def color: -> String + + def color=: (String _) -> String + + def `type`: -> :solidColor + + def type=: (:solidColor _) -> :solidColor + + def transformation: -> ::Array[Imagekit::SolidColorOverlayTransformation]? + + def transformation=: ( + ::Array[Imagekit::SolidColorOverlayTransformation] _ + ) -> ::Array[Imagekit::SolidColorOverlayTransformation] + + def initialize: ( + color: String, + ?transformation: ::Array[Imagekit::SolidColorOverlayTransformation], + ?type: :solidColor + ) -> void + + def to_hash: -> { + color: String, + type: :solidColor, + transformation: ::Array[Imagekit::SolidColorOverlayTransformation] + } + end + end +end diff --git a/sig/imagekit/models/solid_color_overlay_transformation.rbs b/sig/imagekit/models/solid_color_overlay_transformation.rbs new file mode 100644 index 00000000..3e664364 --- /dev/null +++ b/sig/imagekit/models/solid_color_overlay_transformation.rbs @@ -0,0 +1,97 @@ +module Imagekit + module Models + type solid_color_overlay_transformation = + { + alpha: Float, + background: String, + gradient: Imagekit::Models::SolidColorOverlayTransformation::gradient, + height: Imagekit::Models::SolidColorOverlayTransformation::height, + radius: Imagekit::Models::SolidColorOverlayTransformation::radius, + width: Imagekit::Models::SolidColorOverlayTransformation::width + } + + class SolidColorOverlayTransformation < Imagekit::Internal::Type::BaseModel + attr_reader alpha: Float? + + def alpha=: (Float) -> Float + + attr_reader background: String? + + def background=: (String) -> String + + attr_reader gradient: Imagekit::Models::SolidColorOverlayTransformation::gradient? + + def gradient=: ( + Imagekit::Models::SolidColorOverlayTransformation::gradient + ) -> Imagekit::Models::SolidColorOverlayTransformation::gradient + + attr_reader height: Imagekit::Models::SolidColorOverlayTransformation::height? + + def height=: ( + Imagekit::Models::SolidColorOverlayTransformation::height + ) -> Imagekit::Models::SolidColorOverlayTransformation::height + + attr_reader radius: Imagekit::Models::SolidColorOverlayTransformation::radius? + + def radius=: ( + Imagekit::Models::SolidColorOverlayTransformation::radius + ) -> Imagekit::Models::SolidColorOverlayTransformation::radius + + attr_reader width: Imagekit::Models::SolidColorOverlayTransformation::width? + + def width=: ( + Imagekit::Models::SolidColorOverlayTransformation::width + ) -> Imagekit::Models::SolidColorOverlayTransformation::width + + def initialize: ( + ?alpha: Float, + ?background: String, + ?gradient: Imagekit::Models::SolidColorOverlayTransformation::gradient, + ?height: Imagekit::Models::SolidColorOverlayTransformation::height, + ?radius: Imagekit::Models::SolidColorOverlayTransformation::radius, + ?width: Imagekit::Models::SolidColorOverlayTransformation::width + ) -> void + + def to_hash: -> { + alpha: Float, + background: String, + gradient: Imagekit::Models::SolidColorOverlayTransformation::gradient, + height: Imagekit::Models::SolidColorOverlayTransformation::height, + radius: Imagekit::Models::SolidColorOverlayTransformation::radius, + width: Imagekit::Models::SolidColorOverlayTransformation::width + } + + type gradient = true | String + + module Gradient + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::SolidColorOverlayTransformation::gradient] + end + + type height = Float | String + + module Height + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::SolidColorOverlayTransformation::height] + end + + type radius = Float | :max + + module Radius + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::SolidColorOverlayTransformation::radius] + end + + type width = Float | String + + module Width + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::SolidColorOverlayTransformation::width] + end + end + end +end diff --git a/sig/imagekit/models/src_options.rbs b/sig/imagekit/models/src_options.rbs new file mode 100644 index 00000000..185f2522 --- /dev/null +++ b/sig/imagekit/models/src_options.rbs @@ -0,0 +1,64 @@ +module Imagekit + module Models + type src_options = + { + src: String, + url_endpoint: String, + expires_in: Float, + query_parameters: ::Hash[Symbol, String], + signed: bool, + transformation: ::Array[Imagekit::Transformation], + transformation_position: Imagekit::Models::transformation_position + } + + class SrcOptions < Imagekit::Internal::Type::BaseModel + attr_accessor src: String + + attr_accessor url_endpoint: String + + attr_reader expires_in: Float? + + def expires_in=: (Float) -> Float + + attr_reader query_parameters: ::Hash[Symbol, String]? + + def query_parameters=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String] + + attr_reader signed: bool? + + def signed=: (bool) -> bool + + attr_reader transformation: ::Array[Imagekit::Transformation]? + + def transformation=: ( + ::Array[Imagekit::Transformation] + ) -> ::Array[Imagekit::Transformation] + + attr_reader transformation_position: Imagekit::Models::transformation_position? + + def transformation_position=: ( + Imagekit::Models::transformation_position + ) -> Imagekit::Models::transformation_position + + def initialize: ( + src: String, + url_endpoint: String, + ?expires_in: Float, + ?query_parameters: ::Hash[Symbol, String], + ?signed: bool, + ?transformation: ::Array[Imagekit::Transformation], + ?transformation_position: Imagekit::Models::transformation_position + ) -> void + + def to_hash: -> { + src: String, + url_endpoint: String, + expires_in: Float, + query_parameters: ::Hash[Symbol, String], + signed: bool, + transformation: ::Array[Imagekit::Transformation], + transformation_position: Imagekit::Models::transformation_position + } + end + end +end diff --git a/sig/imagekit/models/streaming_resolution.rbs b/sig/imagekit/models/streaming_resolution.rbs new file mode 100644 index 00000000..7892c2cf --- /dev/null +++ b/sig/imagekit/models/streaming_resolution.rbs @@ -0,0 +1,20 @@ +module Imagekit + module Models + type streaming_resolution = + :"240" | :"360" | :"480" | :"720" | :"1080" | :"1440" | :"2160" + + module StreamingResolution + extend Imagekit::Internal::Type::Enum + + STREAMING_RESOLUTION_240: :"240" + STREAMING_RESOLUTION_360: :"360" + STREAMING_RESOLUTION_480: :"480" + STREAMING_RESOLUTION_720: :"720" + STREAMING_RESOLUTION_1080: :"1080" + STREAMING_RESOLUTION_1440: :"1440" + STREAMING_RESOLUTION_2160: :"2160" + + def self?.values: -> ::Array[Imagekit::Models::streaming_resolution] + end + end +end diff --git a/sig/imagekit/models/subtitle_overlay.rbs b/sig/imagekit/models/subtitle_overlay.rbs new file mode 100644 index 00000000..ce4b25d9 --- /dev/null +++ b/sig/imagekit/models/subtitle_overlay.rbs @@ -0,0 +1,59 @@ +module Imagekit + module Models + type subtitle_overlay = + { + input: String, + type: :subtitle, + encoding: Imagekit::Models::SubtitleOverlay::encoding, + transformation: ::Array[Imagekit::SubtitleOverlayTransformation] + } + + class SubtitleOverlay < Imagekit::Models::BaseOverlay + def input: -> String + + def input=: (String _) -> String + + def `type`: -> :subtitle + + def type=: (:subtitle _) -> :subtitle + + def encoding: -> Imagekit::Models::SubtitleOverlay::encoding? + + def encoding=: ( + Imagekit::Models::SubtitleOverlay::encoding _ + ) -> Imagekit::Models::SubtitleOverlay::encoding + + def transformation: -> ::Array[Imagekit::SubtitleOverlayTransformation]? + + def transformation=: ( + ::Array[Imagekit::SubtitleOverlayTransformation] _ + ) -> ::Array[Imagekit::SubtitleOverlayTransformation] + + def initialize: ( + input: String, + ?encoding: Imagekit::Models::SubtitleOverlay::encoding, + ?transformation: ::Array[Imagekit::SubtitleOverlayTransformation], + ?type: :subtitle + ) -> void + + def to_hash: -> { + input: String, + type: :subtitle, + encoding: Imagekit::Models::SubtitleOverlay::encoding, + transformation: ::Array[Imagekit::SubtitleOverlayTransformation] + } + + type encoding = :auto | :plain | :base64 + + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO: :auto + PLAIN: :plain + BASE64: :base64 + + def self?.values: -> ::Array[Imagekit::Models::SubtitleOverlay::encoding] + end + end + end +end diff --git a/sig/imagekit/models/subtitle_overlay_transformation.rbs b/sig/imagekit/models/subtitle_overlay_transformation.rbs new file mode 100644 index 00000000..21d04177 --- /dev/null +++ b/sig/imagekit/models/subtitle_overlay_transformation.rbs @@ -0,0 +1,78 @@ +module Imagekit + module Models + type subtitle_overlay_transformation = + { + background: String, + color: String, + font_family: String, + font_outline: String, + font_shadow: String, + font_size: Float, + typography: Imagekit::Models::SubtitleOverlayTransformation::typography + } + + class SubtitleOverlayTransformation < Imagekit::Internal::Type::BaseModel + attr_reader background: String? + + def background=: (String) -> String + + attr_reader color: String? + + def color=: (String) -> String + + attr_reader font_family: String? + + def font_family=: (String) -> String + + attr_reader font_outline: String? + + def font_outline=: (String) -> String + + attr_reader font_shadow: String? + + def font_shadow=: (String) -> String + + attr_reader font_size: Float? + + def font_size=: (Float) -> Float + + attr_reader typography: Imagekit::Models::SubtitleOverlayTransformation::typography? + + def typography=: ( + Imagekit::Models::SubtitleOverlayTransformation::typography + ) -> Imagekit::Models::SubtitleOverlayTransformation::typography + + def initialize: ( + ?background: String, + ?color: String, + ?font_family: String, + ?font_outline: String, + ?font_shadow: String, + ?font_size: Float, + ?typography: Imagekit::Models::SubtitleOverlayTransformation::typography + ) -> void + + def to_hash: -> { + background: String, + color: String, + font_family: String, + font_outline: String, + font_shadow: String, + font_size: Float, + typography: Imagekit::Models::SubtitleOverlayTransformation::typography + } + + type typography = :b | :i | :b_i + + module Typography + extend Imagekit::Internal::Type::Enum + + B: :b + I: :i + B_I: :b_i + + def self?.values: -> ::Array[Imagekit::Models::SubtitleOverlayTransformation::typography] + end + end + end +end diff --git a/sig/imagekit/models/text_overlay.rbs b/sig/imagekit/models/text_overlay.rbs new file mode 100644 index 00000000..ae294eef --- /dev/null +++ b/sig/imagekit/models/text_overlay.rbs @@ -0,0 +1,59 @@ +module Imagekit + module Models + type text_overlay = + { + text: String, + type: :text, + encoding: Imagekit::Models::TextOverlay::encoding, + transformation: ::Array[Imagekit::TextOverlayTransformation] + } + + class TextOverlay < Imagekit::Models::BaseOverlay + def text: -> String + + def text=: (String _) -> String + + def `type`: -> :text + + def type=: (:text _) -> :text + + def encoding: -> Imagekit::Models::TextOverlay::encoding? + + def encoding=: ( + Imagekit::Models::TextOverlay::encoding _ + ) -> Imagekit::Models::TextOverlay::encoding + + def transformation: -> ::Array[Imagekit::TextOverlayTransformation]? + + def transformation=: ( + ::Array[Imagekit::TextOverlayTransformation] _ + ) -> ::Array[Imagekit::TextOverlayTransformation] + + def initialize: ( + text: String, + ?encoding: Imagekit::Models::TextOverlay::encoding, + ?transformation: ::Array[Imagekit::TextOverlayTransformation], + ?type: :text + ) -> void + + def to_hash: -> { + text: String, + type: :text, + encoding: Imagekit::Models::TextOverlay::encoding, + transformation: ::Array[Imagekit::TextOverlayTransformation] + } + + type encoding = :auto | :plain | :base64 + + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO: :auto + PLAIN: :plain + BASE64: :base64 + + def self?.values: -> ::Array[Imagekit::Models::TextOverlay::encoding] + end + end + end +end diff --git a/sig/imagekit/models/text_overlay_transformation.rbs b/sig/imagekit/models/text_overlay_transformation.rbs new file mode 100644 index 00000000..db0f4c8b --- /dev/null +++ b/sig/imagekit/models/text_overlay_transformation.rbs @@ -0,0 +1,195 @@ +module Imagekit + module Models + type text_overlay_transformation = + { + alpha: Float, + background: String, + flip: Imagekit::Models::TextOverlayTransformation::flip, + font_color: String, + font_family: String, + font_size: Imagekit::Models::TextOverlayTransformation::font_size, + inner_alignment: Imagekit::Models::TextOverlayTransformation::inner_alignment, + line_height: Imagekit::Models::TextOverlayTransformation::line_height, + padding: Imagekit::Models::TextOverlayTransformation::padding, + radius: Imagekit::Models::TextOverlayTransformation::radius, + rotation: Imagekit::Models::TextOverlayTransformation::rotation, + typography: String, + width: Imagekit::Models::TextOverlayTransformation::width + } + + class TextOverlayTransformation < Imagekit::Internal::Type::BaseModel + attr_reader alpha: Float? + + def alpha=: (Float) -> Float + + attr_reader background: String? + + def background=: (String) -> String + + attr_reader flip: Imagekit::Models::TextOverlayTransformation::flip? + + def flip=: ( + Imagekit::Models::TextOverlayTransformation::flip + ) -> Imagekit::Models::TextOverlayTransformation::flip + + attr_reader font_color: String? + + def font_color=: (String) -> String + + attr_reader font_family: String? + + def font_family=: (String) -> String + + attr_reader font_size: Imagekit::Models::TextOverlayTransformation::font_size? + + def font_size=: ( + Imagekit::Models::TextOverlayTransformation::font_size + ) -> Imagekit::Models::TextOverlayTransformation::font_size + + attr_reader inner_alignment: Imagekit::Models::TextOverlayTransformation::inner_alignment? + + def inner_alignment=: ( + Imagekit::Models::TextOverlayTransformation::inner_alignment + ) -> Imagekit::Models::TextOverlayTransformation::inner_alignment + + attr_reader line_height: Imagekit::Models::TextOverlayTransformation::line_height? + + def line_height=: ( + Imagekit::Models::TextOverlayTransformation::line_height + ) -> Imagekit::Models::TextOverlayTransformation::line_height + + attr_reader padding: Imagekit::Models::TextOverlayTransformation::padding? + + def padding=: ( + Imagekit::Models::TextOverlayTransformation::padding + ) -> Imagekit::Models::TextOverlayTransformation::padding + + attr_reader radius: Imagekit::Models::TextOverlayTransformation::radius? + + def radius=: ( + Imagekit::Models::TextOverlayTransformation::radius + ) -> Imagekit::Models::TextOverlayTransformation::radius + + attr_reader rotation: Imagekit::Models::TextOverlayTransformation::rotation? + + def rotation=: ( + Imagekit::Models::TextOverlayTransformation::rotation + ) -> Imagekit::Models::TextOverlayTransformation::rotation + + attr_reader typography: String? + + def typography=: (String) -> String + + attr_reader width: Imagekit::Models::TextOverlayTransformation::width? + + def width=: ( + Imagekit::Models::TextOverlayTransformation::width + ) -> Imagekit::Models::TextOverlayTransformation::width + + def initialize: ( + ?alpha: Float, + ?background: String, + ?flip: Imagekit::Models::TextOverlayTransformation::flip, + ?font_color: String, + ?font_family: String, + ?font_size: Imagekit::Models::TextOverlayTransformation::font_size, + ?inner_alignment: Imagekit::Models::TextOverlayTransformation::inner_alignment, + ?line_height: Imagekit::Models::TextOverlayTransformation::line_height, + ?padding: Imagekit::Models::TextOverlayTransformation::padding, + ?radius: Imagekit::Models::TextOverlayTransformation::radius, + ?rotation: Imagekit::Models::TextOverlayTransformation::rotation, + ?typography: String, + ?width: Imagekit::Models::TextOverlayTransformation::width + ) -> void + + def to_hash: -> { + alpha: Float, + background: String, + flip: Imagekit::Models::TextOverlayTransformation::flip, + font_color: String, + font_family: String, + font_size: Imagekit::Models::TextOverlayTransformation::font_size, + inner_alignment: Imagekit::Models::TextOverlayTransformation::inner_alignment, + line_height: Imagekit::Models::TextOverlayTransformation::line_height, + padding: Imagekit::Models::TextOverlayTransformation::padding, + radius: Imagekit::Models::TextOverlayTransformation::radius, + rotation: Imagekit::Models::TextOverlayTransformation::rotation, + typography: String, + width: Imagekit::Models::TextOverlayTransformation::width + } + + type flip = :h | :v | :h_v | :v_h + + module Flip + extend Imagekit::Internal::Type::Enum + + H: :h + V: :v + H_V: :h_v + V_H: :v_h + + def self?.values: -> ::Array[Imagekit::Models::TextOverlayTransformation::flip] + end + + type font_size = Float | String + + module FontSize + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::TextOverlayTransformation::font_size] + end + + type inner_alignment = :left | :right | :center + + module InnerAlignment + extend Imagekit::Internal::Type::Enum + + LEFT: :left + RIGHT: :right + CENTER: :center + + def self?.values: -> ::Array[Imagekit::Models::TextOverlayTransformation::inner_alignment] + end + + type line_height = Float | String + + module LineHeight + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::TextOverlayTransformation::line_height] + end + + type padding = Float | String + + module Padding + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::TextOverlayTransformation::padding] + end + + type radius = Float | :max + + module Radius + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::TextOverlayTransformation::radius] + end + + type rotation = Float | String + + module Rotation + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::TextOverlayTransformation::rotation] + end + + type width = Float | String + + module Width + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::TextOverlayTransformation::width] + end + end + end +end diff --git a/sig/imagekit/models/transformation.rbs b/sig/imagekit/models/transformation.rbs new file mode 100644 index 00000000..afbf4af0 --- /dev/null +++ b/sig/imagekit/models/transformation.rbs @@ -0,0 +1,763 @@ +module Imagekit + module Models + type transformation = + { + ai_change_background: String, + ai_drop_shadow: Imagekit::Models::Transformation::ai_drop_shadow, + ai_edit: String, + ai_remove_background: Imagekit::Models::Transformation::ai_remove_background, + ai_remove_background_external: Imagekit::Models::Transformation::ai_remove_background_external, + ai_retouch: Imagekit::Models::Transformation::ai_retouch, + ai_upscale: Imagekit::Models::Transformation::ai_upscale, + ai_variation: Imagekit::Models::Transformation::ai_variation, + aspect_ratio: Imagekit::Models::Transformation::aspect_ratio, + audio_codec: Imagekit::Models::Transformation::audio_codec, + background: String, + blur: Float, + border: String, + color_profile: bool, + contrast_stretch: Imagekit::Models::Transformation::contrast_stretch, + crop: Imagekit::Models::Transformation::crop, + crop_mode: Imagekit::Models::Transformation::crop_mode, + default_image: String, + dpr: Float, + duration: Imagekit::Models::Transformation::duration, + end_offset: Imagekit::Models::Transformation::end_offset, + flip: Imagekit::Models::Transformation::flip, + focus: String, + format_: Imagekit::Models::Transformation::format_, + gradient: Imagekit::Models::Transformation::gradient, + grayscale: Imagekit::Models::Transformation::grayscale, + height: Imagekit::Models::Transformation::height, + lossless: bool, + metadata: bool, + named: String, + opacity: Float, + original: bool, + overlay: Imagekit::Models::overlay, + page: Imagekit::Models::Transformation::page, + progressive: bool, + quality: Float, + radius: Imagekit::Models::Transformation::radius, + raw: String, + rotation: Imagekit::Models::Transformation::rotation, + shadow: Imagekit::Models::Transformation::shadow, + sharpen: Imagekit::Models::Transformation::sharpen, + start_offset: Imagekit::Models::Transformation::start_offset, + streaming_resolutions: ::Array[Imagekit::Models::streaming_resolution], + trim: Imagekit::Models::Transformation::trim, + unsharp_mask: Imagekit::Models::Transformation::unsharp_mask, + video_codec: Imagekit::Models::Transformation::video_codec, + width: Imagekit::Models::Transformation::width, + x: Imagekit::Models::Transformation::x, + x_center: Imagekit::Models::Transformation::x_center, + y_: Imagekit::Models::Transformation::y_, + y_center: Imagekit::Models::Transformation::y_center, + zoom: Float + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_reader ai_change_background: String? + + def ai_change_background=: (String) -> String + + attr_reader ai_drop_shadow: Imagekit::Models::Transformation::ai_drop_shadow? + + def ai_drop_shadow=: ( + Imagekit::Models::Transformation::ai_drop_shadow + ) -> Imagekit::Models::Transformation::ai_drop_shadow + + attr_reader ai_edit: String? + + def ai_edit=: (String) -> String + + attr_reader ai_remove_background: Imagekit::Models::Transformation::ai_remove_background? + + def ai_remove_background=: ( + Imagekit::Models::Transformation::ai_remove_background + ) -> Imagekit::Models::Transformation::ai_remove_background + + attr_reader ai_remove_background_external: Imagekit::Models::Transformation::ai_remove_background_external? + + def ai_remove_background_external=: ( + Imagekit::Models::Transformation::ai_remove_background_external + ) -> Imagekit::Models::Transformation::ai_remove_background_external + + attr_reader ai_retouch: Imagekit::Models::Transformation::ai_retouch? + + def ai_retouch=: ( + Imagekit::Models::Transformation::ai_retouch + ) -> Imagekit::Models::Transformation::ai_retouch + + attr_reader ai_upscale: Imagekit::Models::Transformation::ai_upscale? + + def ai_upscale=: ( + Imagekit::Models::Transformation::ai_upscale + ) -> Imagekit::Models::Transformation::ai_upscale + + attr_reader ai_variation: Imagekit::Models::Transformation::ai_variation? + + def ai_variation=: ( + Imagekit::Models::Transformation::ai_variation + ) -> Imagekit::Models::Transformation::ai_variation + + attr_reader aspect_ratio: Imagekit::Models::Transformation::aspect_ratio? + + def aspect_ratio=: ( + Imagekit::Models::Transformation::aspect_ratio + ) -> Imagekit::Models::Transformation::aspect_ratio + + attr_reader audio_codec: Imagekit::Models::Transformation::audio_codec? + + def audio_codec=: ( + Imagekit::Models::Transformation::audio_codec + ) -> Imagekit::Models::Transformation::audio_codec + + attr_reader background: String? + + def background=: (String) -> String + + attr_reader blur: Float? + + def blur=: (Float) -> Float + + attr_reader border: String? + + def border=: (String) -> String + + attr_reader color_profile: bool? + + def color_profile=: (bool) -> bool + + attr_reader contrast_stretch: Imagekit::Models::Transformation::contrast_stretch? + + def contrast_stretch=: ( + Imagekit::Models::Transformation::contrast_stretch + ) -> Imagekit::Models::Transformation::contrast_stretch + + attr_reader crop: Imagekit::Models::Transformation::crop? + + def crop=: ( + Imagekit::Models::Transformation::crop + ) -> Imagekit::Models::Transformation::crop + + attr_reader crop_mode: Imagekit::Models::Transformation::crop_mode? + + def crop_mode=: ( + Imagekit::Models::Transformation::crop_mode + ) -> Imagekit::Models::Transformation::crop_mode + + attr_reader default_image: String? + + def default_image=: (String) -> String + + attr_reader dpr: Float? + + def dpr=: (Float) -> Float + + attr_reader duration: Imagekit::Models::Transformation::duration? + + def duration=: ( + Imagekit::Models::Transformation::duration + ) -> Imagekit::Models::Transformation::duration + + attr_reader end_offset: Imagekit::Models::Transformation::end_offset? + + def end_offset=: ( + Imagekit::Models::Transformation::end_offset + ) -> Imagekit::Models::Transformation::end_offset + + attr_reader flip: Imagekit::Models::Transformation::flip? + + def flip=: ( + Imagekit::Models::Transformation::flip + ) -> Imagekit::Models::Transformation::flip + + attr_reader focus: String? + + def focus=: (String) -> String + + attr_reader format_: Imagekit::Models::Transformation::format_? + + def format_=: ( + Imagekit::Models::Transformation::format_ + ) -> Imagekit::Models::Transformation::format_ + + attr_reader gradient: Imagekit::Models::Transformation::gradient? + + def gradient=: ( + Imagekit::Models::Transformation::gradient + ) -> Imagekit::Models::Transformation::gradient + + attr_reader grayscale: Imagekit::Models::Transformation::grayscale? + + def grayscale=: ( + Imagekit::Models::Transformation::grayscale + ) -> Imagekit::Models::Transformation::grayscale + + attr_reader height: Imagekit::Models::Transformation::height? + + def height=: ( + Imagekit::Models::Transformation::height + ) -> Imagekit::Models::Transformation::height + + attr_reader lossless: bool? + + def lossless=: (bool) -> bool + + attr_reader metadata: bool? + + def metadata=: (bool) -> bool + + attr_reader named: String? + + def named=: (String) -> String + + attr_reader opacity: Float? + + def opacity=: (Float) -> Float + + attr_reader original: bool? + + def original=: (bool) -> bool + + attr_reader overlay: Imagekit::Models::overlay? + + def overlay=: (Imagekit::Models::overlay) -> Imagekit::Models::overlay + + attr_reader page: Imagekit::Models::Transformation::page? + + def page=: ( + Imagekit::Models::Transformation::page + ) -> Imagekit::Models::Transformation::page + + attr_reader progressive: bool? + + def progressive=: (bool) -> bool + + attr_reader quality: Float? + + def quality=: (Float) -> Float + + attr_reader radius: Imagekit::Models::Transformation::radius? + + def radius=: ( + Imagekit::Models::Transformation::radius + ) -> Imagekit::Models::Transformation::radius + + attr_reader raw: String? + + def raw=: (String) -> String + + attr_reader rotation: Imagekit::Models::Transformation::rotation? + + def rotation=: ( + Imagekit::Models::Transformation::rotation + ) -> Imagekit::Models::Transformation::rotation + + attr_reader shadow: Imagekit::Models::Transformation::shadow? + + def shadow=: ( + Imagekit::Models::Transformation::shadow + ) -> Imagekit::Models::Transformation::shadow + + attr_reader sharpen: Imagekit::Models::Transformation::sharpen? + + def sharpen=: ( + Imagekit::Models::Transformation::sharpen + ) -> Imagekit::Models::Transformation::sharpen + + attr_reader start_offset: Imagekit::Models::Transformation::start_offset? + + def start_offset=: ( + Imagekit::Models::Transformation::start_offset + ) -> Imagekit::Models::Transformation::start_offset + + attr_reader streaming_resolutions: ::Array[Imagekit::Models::streaming_resolution]? + + def streaming_resolutions=: ( + ::Array[Imagekit::Models::streaming_resolution] + ) -> ::Array[Imagekit::Models::streaming_resolution] + + attr_reader trim: Imagekit::Models::Transformation::trim? + + def trim=: ( + Imagekit::Models::Transformation::trim + ) -> Imagekit::Models::Transformation::trim + + attr_reader unsharp_mask: Imagekit::Models::Transformation::unsharp_mask? + + def unsharp_mask=: ( + Imagekit::Models::Transformation::unsharp_mask + ) -> Imagekit::Models::Transformation::unsharp_mask + + attr_reader video_codec: Imagekit::Models::Transformation::video_codec? + + def video_codec=: ( + Imagekit::Models::Transformation::video_codec + ) -> Imagekit::Models::Transformation::video_codec + + attr_reader width: Imagekit::Models::Transformation::width? + + def width=: ( + Imagekit::Models::Transformation::width + ) -> Imagekit::Models::Transformation::width + + attr_reader x: Imagekit::Models::Transformation::x? + + def x=: ( + Imagekit::Models::Transformation::x + ) -> Imagekit::Models::Transformation::x + + attr_reader x_center: Imagekit::Models::Transformation::x_center? + + def x_center=: ( + Imagekit::Models::Transformation::x_center + ) -> Imagekit::Models::Transformation::x_center + + attr_reader y_: Imagekit::Models::Transformation::y_? + + def y_=: ( + Imagekit::Models::Transformation::y_ + ) -> Imagekit::Models::Transformation::y_ + + attr_reader y_center: Imagekit::Models::Transformation::y_center? + + def y_center=: ( + Imagekit::Models::Transformation::y_center + ) -> Imagekit::Models::Transformation::y_center + + attr_reader zoom: Float? + + def zoom=: (Float) -> Float + + def initialize: ( + ?ai_change_background: String, + ?ai_drop_shadow: Imagekit::Models::Transformation::ai_drop_shadow, + ?ai_edit: String, + ?ai_remove_background: Imagekit::Models::Transformation::ai_remove_background, + ?ai_remove_background_external: Imagekit::Models::Transformation::ai_remove_background_external, + ?ai_retouch: Imagekit::Models::Transformation::ai_retouch, + ?ai_upscale: Imagekit::Models::Transformation::ai_upscale, + ?ai_variation: Imagekit::Models::Transformation::ai_variation, + ?aspect_ratio: Imagekit::Models::Transformation::aspect_ratio, + ?audio_codec: Imagekit::Models::Transformation::audio_codec, + ?background: String, + ?blur: Float, + ?border: String, + ?color_profile: bool, + ?contrast_stretch: Imagekit::Models::Transformation::contrast_stretch, + ?crop: Imagekit::Models::Transformation::crop, + ?crop_mode: Imagekit::Models::Transformation::crop_mode, + ?default_image: String, + ?dpr: Float, + ?duration: Imagekit::Models::Transformation::duration, + ?end_offset: Imagekit::Models::Transformation::end_offset, + ?flip: Imagekit::Models::Transformation::flip, + ?focus: String, + ?format_: Imagekit::Models::Transformation::format_, + ?gradient: Imagekit::Models::Transformation::gradient, + ?grayscale: Imagekit::Models::Transformation::grayscale, + ?height: Imagekit::Models::Transformation::height, + ?lossless: bool, + ?metadata: bool, + ?named: String, + ?opacity: Float, + ?original: bool, + ?overlay: Imagekit::Models::overlay, + ?page: Imagekit::Models::Transformation::page, + ?progressive: bool, + ?quality: Float, + ?radius: Imagekit::Models::Transformation::radius, + ?raw: String, + ?rotation: Imagekit::Models::Transformation::rotation, + ?shadow: Imagekit::Models::Transformation::shadow, + ?sharpen: Imagekit::Models::Transformation::sharpen, + ?start_offset: Imagekit::Models::Transformation::start_offset, + ?streaming_resolutions: ::Array[Imagekit::Models::streaming_resolution], + ?trim: Imagekit::Models::Transformation::trim, + ?unsharp_mask: Imagekit::Models::Transformation::unsharp_mask, + ?video_codec: Imagekit::Models::Transformation::video_codec, + ?width: Imagekit::Models::Transformation::width, + ?x: Imagekit::Models::Transformation::x, + ?x_center: Imagekit::Models::Transformation::x_center, + ?y_: Imagekit::Models::Transformation::y_, + ?y_center: Imagekit::Models::Transformation::y_center, + ?zoom: Float + ) -> void + + def to_hash: -> { + ai_change_background: String, + ai_drop_shadow: Imagekit::Models::Transformation::ai_drop_shadow, + ai_edit: String, + ai_remove_background: Imagekit::Models::Transformation::ai_remove_background, + ai_remove_background_external: Imagekit::Models::Transformation::ai_remove_background_external, + ai_retouch: Imagekit::Models::Transformation::ai_retouch, + ai_upscale: Imagekit::Models::Transformation::ai_upscale, + ai_variation: Imagekit::Models::Transformation::ai_variation, + aspect_ratio: Imagekit::Models::Transformation::aspect_ratio, + audio_codec: Imagekit::Models::Transformation::audio_codec, + background: String, + blur: Float, + border: String, + color_profile: bool, + contrast_stretch: Imagekit::Models::Transformation::contrast_stretch, + crop: Imagekit::Models::Transformation::crop, + crop_mode: Imagekit::Models::Transformation::crop_mode, + default_image: String, + dpr: Float, + duration: Imagekit::Models::Transformation::duration, + end_offset: Imagekit::Models::Transformation::end_offset, + flip: Imagekit::Models::Transformation::flip, + focus: String, + format_: Imagekit::Models::Transformation::format_, + gradient: Imagekit::Models::Transformation::gradient, + grayscale: Imagekit::Models::Transformation::grayscale, + height: Imagekit::Models::Transformation::height, + lossless: bool, + metadata: bool, + named: String, + opacity: Float, + original: bool, + overlay: Imagekit::Models::overlay, + page: Imagekit::Models::Transformation::page, + progressive: bool, + quality: Float, + radius: Imagekit::Models::Transformation::radius, + raw: String, + rotation: Imagekit::Models::Transformation::rotation, + shadow: Imagekit::Models::Transformation::shadow, + sharpen: Imagekit::Models::Transformation::sharpen, + start_offset: Imagekit::Models::Transformation::start_offset, + streaming_resolutions: ::Array[Imagekit::Models::streaming_resolution], + trim: Imagekit::Models::Transformation::trim, + unsharp_mask: Imagekit::Models::Transformation::unsharp_mask, + video_codec: Imagekit::Models::Transformation::video_codec, + width: Imagekit::Models::Transformation::width, + x: Imagekit::Models::Transformation::x, + x_center: Imagekit::Models::Transformation::x_center, + y_: Imagekit::Models::Transformation::y_, + y_center: Imagekit::Models::Transformation::y_center, + zoom: Float + } + + type ai_drop_shadow = true | String + + module AIDropShadow + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::ai_drop_shadow] + end + + type ai_remove_background = true + + module AIRemoveBackground + extend Imagekit::Internal::Type::Enum + + TRUE: true + + def self?.values: -> ::Array[Imagekit::Models::Transformation::ai_remove_background] + end + + type ai_remove_background_external = true + + module AIRemoveBackgroundExternal + extend Imagekit::Internal::Type::Enum + + TRUE: true + + def self?.values: -> ::Array[Imagekit::Models::Transformation::ai_remove_background_external] + end + + type ai_retouch = true + + module AIRetouch + extend Imagekit::Internal::Type::Enum + + TRUE: true + + def self?.values: -> ::Array[Imagekit::Models::Transformation::ai_retouch] + end + + type ai_upscale = true + + module AIUpscale + extend Imagekit::Internal::Type::Enum + + TRUE: true + + def self?.values: -> ::Array[Imagekit::Models::Transformation::ai_upscale] + end + + type ai_variation = true + + module AIVariation + extend Imagekit::Internal::Type::Enum + + TRUE: true + + def self?.values: -> ::Array[Imagekit::Models::Transformation::ai_variation] + end + + type aspect_ratio = Float | String + + module AspectRatio + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::aspect_ratio] + end + + type audio_codec = :aac | :opus | :none + + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC: :aac + OPUS: :opus + NONE: :none + + def self?.values: -> ::Array[Imagekit::Models::Transformation::audio_codec] + end + + type contrast_stretch = true + + module ContrastStretch + extend Imagekit::Internal::Type::Enum + + TRUE: true + + def self?.values: -> ::Array[Imagekit::Models::Transformation::contrast_stretch] + end + + type crop = + :force | :at_max | :at_max_enlarge | :at_least | :maintain_ratio + + module Crop + extend Imagekit::Internal::Type::Enum + + FORCE: :force + AT_MAX: :at_max + AT_MAX_ENLARGE: :at_max_enlarge + AT_LEAST: :at_least + MAINTAIN_RATIO: :maintain_ratio + + def self?.values: -> ::Array[Imagekit::Models::Transformation::crop] + end + + type crop_mode = :pad_resize | :extract | :pad_extract + + module CropMode + extend Imagekit::Internal::Type::Enum + + PAD_RESIZE: :pad_resize + EXTRACT: :extract + PAD_EXTRACT: :pad_extract + + def self?.values: -> ::Array[Imagekit::Models::Transformation::crop_mode] + end + + type duration = Float | String + + module Duration + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::duration] + end + + type end_offset = Float | String + + module EndOffset + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::end_offset] + end + + type flip = :h | :v | :h_v | :v_h + + module Flip + extend Imagekit::Internal::Type::Enum + + H: :h + V: :v + H_V: :h_v + V_H: :v_h + + def self?.values: -> ::Array[Imagekit::Models::Transformation::flip] + end + + type format_ = + :auto + | :webp + | :jpg + | :jpeg + | :png + | :gif + | :svg + | :mp4 + | :webm + | :avif + | :orig + + module Format + extend Imagekit::Internal::Type::Enum + + AUTO: :auto + WEBP: :webp + JPG: :jpg + JPEG: :jpeg + PNG: :png + GIF: :gif + SVG: :svg + MP4: :mp4 + WEBM: :webm + AVIF: :avif + ORIG: :orig + + def self?.values: -> ::Array[Imagekit::Models::Transformation::format_] + end + + type gradient = true | String + + module Gradient + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::gradient] + end + + type grayscale = true + + module Grayscale + extend Imagekit::Internal::Type::Enum + + TRUE: true + + def self?.values: -> ::Array[Imagekit::Models::Transformation::grayscale] + end + + type height = Float | String + + module Height + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::height] + end + + type page = Float | String + + module Page + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::page] + end + + type radius = Float | :max + + module Radius + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::radius] + end + + type rotation = Float | String + + module Rotation + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::rotation] + end + + type shadow = true | String + + module Shadow + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::shadow] + end + + type sharpen = true | Float + + module Sharpen + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::sharpen] + end + + type start_offset = Float | String + + module StartOffset + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::start_offset] + end + + type trim = true | Float + + module Trim + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::trim] + end + + type unsharp_mask = true | String + + module UnsharpMask + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::unsharp_mask] + end + + type video_codec = :h264 | :vp9 | :av1 | :none + + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264: :h264 + VP9: :vp9 + AV1: :av1 + NONE: :none + + def self?.values: -> ::Array[Imagekit::Models::Transformation::video_codec] + end + + type width = Float | String + + module Width + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::width] + end + + type x = Float | String + + module X + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::x] + end + + type x_center = Float | String + + module XCenter + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::x_center] + end + + type y_ = Float | String + + module Y + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::y_] + end + + type y_center = Float | String + + module YCenter + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::Transformation::y_center] + end + end + end +end diff --git a/sig/imagekit/models/transformation_position.rbs b/sig/imagekit/models/transformation_position.rbs new file mode 100644 index 00000000..60ed3513 --- /dev/null +++ b/sig/imagekit/models/transformation_position.rbs @@ -0,0 +1,14 @@ +module Imagekit + module Models + type transformation_position = :path | :query + + module TransformationPosition + extend Imagekit::Internal::Type::Enum + + PATH: :path + QUERY: :query + + def self?.values: -> ::Array[Imagekit::Models::transformation_position] + end + end +end diff --git a/sig/imagekit/models/unsafe_unwrap_webhook_event.rbs b/sig/imagekit/models/unsafe_unwrap_webhook_event.rbs new file mode 100644 index 00000000..b3cb218a --- /dev/null +++ b/sig/imagekit/models/unsafe_unwrap_webhook_event.rbs @@ -0,0 +1,18 @@ +module Imagekit + module Models + type unsafe_unwrap_webhook_event = + Imagekit::VideoTransformationAcceptedEvent + | Imagekit::VideoTransformationReadyEvent + | Imagekit::VideoTransformationErrorEvent + | Imagekit::UploadPreTransformSuccessEvent + | Imagekit::UploadPreTransformErrorEvent + | Imagekit::UploadPostTransformSuccessEvent + | Imagekit::UploadPostTransformErrorEvent + + module UnsafeUnwrapWebhookEvent + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::unsafe_unwrap_webhook_event] + end + end +end diff --git a/sig/imagekit/models/unwrap_webhook_event.rbs b/sig/imagekit/models/unwrap_webhook_event.rbs new file mode 100644 index 00000000..8c1551ec --- /dev/null +++ b/sig/imagekit/models/unwrap_webhook_event.rbs @@ -0,0 +1,18 @@ +module Imagekit + module Models + type unwrap_webhook_event = + Imagekit::VideoTransformationAcceptedEvent + | Imagekit::VideoTransformationReadyEvent + | Imagekit::VideoTransformationErrorEvent + | Imagekit::UploadPreTransformSuccessEvent + | Imagekit::UploadPreTransformErrorEvent + | Imagekit::UploadPostTransformSuccessEvent + | Imagekit::UploadPostTransformErrorEvent + + module UnwrapWebhookEvent + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::unwrap_webhook_event] + end + end +end diff --git a/sig/imagekit/models/upload_post_transform_error_event.rbs b/sig/imagekit/models/upload_post_transform_error_event.rbs new file mode 100644 index 00000000..09c5bd73 --- /dev/null +++ b/sig/imagekit/models/upload_post_transform_error_event.rbs @@ -0,0 +1,183 @@ +module Imagekit + module Models + type upload_post_transform_error_event = + { + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformErrorEvent::Data, + request: Imagekit::UploadPostTransformErrorEvent::Request, + type: :"upload.post-transform.error" + } + + class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor data: Imagekit::UploadPostTransformErrorEvent::Data + + attr_accessor request: Imagekit::UploadPostTransformErrorEvent::Request + + attr_accessor type: :"upload.post-transform.error" + + def initialize: ( + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformErrorEvent::Data, + request: Imagekit::UploadPostTransformErrorEvent::Request, + ?type: :"upload.post-transform.error" + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformErrorEvent::Data, + request: Imagekit::UploadPostTransformErrorEvent::Request, + type: :"upload.post-transform.error" + } + + type data = + { + file_id: String, + name: String, + path: String, + transformation: Imagekit::UploadPostTransformErrorEvent::Data::Transformation, + url: String + } + + class Data < Imagekit::Internal::Type::BaseModel + attr_accessor file_id: String + + attr_accessor name: String + + attr_accessor path: String + + attr_accessor transformation: Imagekit::UploadPostTransformErrorEvent::Data::Transformation + + attr_accessor url: String + + def initialize: ( + file_id: String, + name: String, + path: String, + transformation: Imagekit::UploadPostTransformErrorEvent::Data::Transformation, + url: String + ) -> void + + def to_hash: -> { + file_id: String, + name: String, + path: String, + transformation: Imagekit::UploadPostTransformErrorEvent::Data::Transformation, + url: String + } + + type transformation = + { + error: Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor error: Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error + + def initialize: ( + error: Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error + ) -> void + + def to_hash: -> { + error: Imagekit::UploadPostTransformErrorEvent::Data::Transformation::Error + } + + type error = { reason: String } + + class Error < Imagekit::Internal::Type::BaseModel + attr_accessor reason: String + + def initialize: (reason: String) -> void + + def to_hash: -> { reason: String } + end + end + end + + type request = + { + transformation: Imagekit::UploadPostTransformErrorEvent::Request::Transformation, + x_request_id: String + } + + class Request < Imagekit::Internal::Type::BaseModel + attr_accessor transformation: Imagekit::UploadPostTransformErrorEvent::Request::Transformation + + attr_accessor x_request_id: String + + def initialize: ( + transformation: Imagekit::UploadPostTransformErrorEvent::Request::Transformation, + x_request_id: String + ) -> void + + def to_hash: -> { + transformation: Imagekit::UploadPostTransformErrorEvent::Request::Transformation, + x_request_id: String + } + + type transformation = + { + type: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::type_, + protocol: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::protocol, + value: String + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor type: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::type_ + + attr_reader protocol: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::protocol? + + def protocol=: ( + Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::protocol + ) -> Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::protocol + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: ( + type: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::type_, + ?protocol: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::protocol, + ?value: String + ) -> void + + def to_hash: -> { + type: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::type_, + protocol: Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::protocol, + value: String + } + + type type_ = :transformation | :abs | :"gif-to-video" | :thumbnail + + module Type + extend Imagekit::Internal::Type::Enum + + TRANSFORMATION: :transformation + ABS: :abs + GIF_TO_VIDEO: :"gif-to-video" + THUMBNAIL: :thumbnail + + def self?.values: -> ::Array[Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::type_] + end + + type protocol = :hls | :dash + + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS: :hls + DASH: :dash + + def self?.values: -> ::Array[Imagekit::Models::UploadPostTransformErrorEvent::Request::Transformation::protocol] + end + end + end + end + end +end diff --git a/sig/imagekit/models/upload_post_transform_success_event.rbs b/sig/imagekit/models/upload_post_transform_success_event.rbs new file mode 100644 index 00000000..01bf3180 --- /dev/null +++ b/sig/imagekit/models/upload_post_transform_success_event.rbs @@ -0,0 +1,133 @@ +module Imagekit + module Models + type upload_post_transform_success_event = + { + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformSuccessEvent::Data, + request: Imagekit::UploadPostTransformSuccessEvent::Request, + type: :"upload.post-transform.success" + } + + class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor data: Imagekit::UploadPostTransformSuccessEvent::Data + + attr_accessor request: Imagekit::UploadPostTransformSuccessEvent::Request + + attr_accessor type: :"upload.post-transform.success" + + def initialize: ( + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformSuccessEvent::Data, + request: Imagekit::UploadPostTransformSuccessEvent::Request, + ?type: :"upload.post-transform.success" + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + data: Imagekit::UploadPostTransformSuccessEvent::Data, + request: Imagekit::UploadPostTransformSuccessEvent::Request, + type: :"upload.post-transform.success" + } + + type data = { file_id: String, name: String, url: String } + + class Data < Imagekit::Internal::Type::BaseModel + attr_accessor file_id: String + + attr_accessor name: String + + attr_accessor url: String + + def initialize: (file_id: String, name: String, url: String) -> void + + def to_hash: -> { file_id: String, name: String, url: String } + end + + type request = + { + transformation: Imagekit::UploadPostTransformSuccessEvent::Request::Transformation, + x_request_id: String + } + + class Request < Imagekit::Internal::Type::BaseModel + attr_accessor transformation: Imagekit::UploadPostTransformSuccessEvent::Request::Transformation + + attr_accessor x_request_id: String + + def initialize: ( + transformation: Imagekit::UploadPostTransformSuccessEvent::Request::Transformation, + x_request_id: String + ) -> void + + def to_hash: -> { + transformation: Imagekit::UploadPostTransformSuccessEvent::Request::Transformation, + x_request_id: String + } + + type transformation = + { + type: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::type_, + protocol: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::protocol, + value: String + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor type: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::type_ + + attr_reader protocol: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::protocol? + + def protocol=: ( + Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::protocol + ) -> Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::protocol + + attr_reader value: String? + + def value=: (String) -> String + + def initialize: ( + type: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::type_, + ?protocol: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::protocol, + ?value: String + ) -> void + + def to_hash: -> { + type: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::type_, + protocol: Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::protocol, + value: String + } + + type type_ = :transformation | :abs | :"gif-to-video" | :thumbnail + + module Type + extend Imagekit::Internal::Type::Enum + + TRANSFORMATION: :transformation + ABS: :abs + GIF_TO_VIDEO: :"gif-to-video" + THUMBNAIL: :thumbnail + + def self?.values: -> ::Array[Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::type_] + end + + type protocol = :hls | :dash + + module Protocol + extend Imagekit::Internal::Type::Enum + + HLS: :hls + DASH: :dash + + def self?.values: -> ::Array[Imagekit::Models::UploadPostTransformSuccessEvent::Request::Transformation::protocol] + end + end + end + end + end +end diff --git a/sig/imagekit/models/upload_pre_transform_error_event.rbs b/sig/imagekit/models/upload_pre_transform_error_event.rbs new file mode 100644 index 00000000..73935081 --- /dev/null +++ b/sig/imagekit/models/upload_pre_transform_error_event.rbs @@ -0,0 +1,106 @@ +module Imagekit + module Models + type upload_pre_transform_error_event = + { + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformErrorEvent::Data, + request: Imagekit::UploadPreTransformErrorEvent::Request, + type: :"upload.pre-transform.error" + } + + class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor data: Imagekit::UploadPreTransformErrorEvent::Data + + attr_accessor request: Imagekit::UploadPreTransformErrorEvent::Request + + attr_accessor type: :"upload.pre-transform.error" + + def initialize: ( + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformErrorEvent::Data, + request: Imagekit::UploadPreTransformErrorEvent::Request, + ?type: :"upload.pre-transform.error" + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformErrorEvent::Data, + request: Imagekit::UploadPreTransformErrorEvent::Request, + type: :"upload.pre-transform.error" + } + + type data = + { + name: String, + path: String, + transformation: Imagekit::UploadPreTransformErrorEvent::Data::Transformation + } + + class Data < Imagekit::Internal::Type::BaseModel + attr_accessor name: String + + attr_accessor path: String + + attr_accessor transformation: Imagekit::UploadPreTransformErrorEvent::Data::Transformation + + def initialize: ( + name: String, + path: String, + transformation: Imagekit::UploadPreTransformErrorEvent::Data::Transformation + ) -> void + + def to_hash: -> { + name: String, + path: String, + transformation: Imagekit::UploadPreTransformErrorEvent::Data::Transformation + } + + type transformation = + { + error: Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor error: Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error + + def initialize: ( + error: Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error + ) -> void + + def to_hash: -> { + error: Imagekit::UploadPreTransformErrorEvent::Data::Transformation::Error + } + + type error = { reason: String } + + class Error < Imagekit::Internal::Type::BaseModel + attr_accessor reason: String + + def initialize: (reason: String) -> void + + def to_hash: -> { reason: String } + end + end + end + + type request = { transformation: String, x_request_id: String } + + class Request < Imagekit::Internal::Type::BaseModel + attr_accessor transformation: String + + attr_accessor x_request_id: String + + def initialize: (transformation: String, x_request_id: String) -> void + + def to_hash: -> { transformation: String, x_request_id: String } + end + end + end +end diff --git a/sig/imagekit/models/upload_pre_transform_success_event.rbs b/sig/imagekit/models/upload_pre_transform_success_event.rbs new file mode 100644 index 00000000..d043704c --- /dev/null +++ b/sig/imagekit/models/upload_pre_transform_success_event.rbs @@ -0,0 +1,366 @@ +module Imagekit + module Models + type upload_pre_transform_success_event = + { + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformSuccessEvent::Data, + request: Imagekit::UploadPreTransformSuccessEvent::Request, + type: :"upload.pre-transform.success" + } + + class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor data: Imagekit::UploadPreTransformSuccessEvent::Data + + attr_accessor request: Imagekit::UploadPreTransformSuccessEvent::Request + + attr_accessor type: :"upload.pre-transform.success" + + def initialize: ( + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformSuccessEvent::Data, + request: Imagekit::UploadPreTransformSuccessEvent::Request, + ?type: :"upload.pre-transform.success" + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + data: Imagekit::UploadPreTransformSuccessEvent::Data, + request: Imagekit::UploadPreTransformSuccessEvent::Request, + type: :"upload.pre-transform.success" + } + + type data = + { + ai_tags: ::Array[Imagekit::UploadPreTransformSuccessEvent::Data::AITag]?, + audio_codec: String, + bit_rate: Integer, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + duration: Integer, + embedded_metadata: ::Hash[Symbol, top], + extension_status: Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: bool, + is_published: bool, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail_url: String, + url: String, + version_info: Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo, + video_codec: String, + width: Float + } + + class Data < Imagekit::Internal::Type::BaseModel + attr_accessor ai_tags: ::Array[Imagekit::UploadPreTransformSuccessEvent::Data::AITag]? + + attr_reader audio_codec: String? + + def audio_codec=: (String) -> String + + attr_reader bit_rate: Integer? + + def bit_rate=: (Integer) -> Integer + + attr_accessor custom_coordinates: String? + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader duration: Integer? + + def duration=: (Integer) -> Integer + + attr_reader embedded_metadata: ::Hash[Symbol, top]? + + def embedded_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader extension_status: Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus? + + def extension_status=: ( + Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus + ) -> Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus + + attr_reader file_id: String? + + def file_id=: (String) -> String + + attr_reader file_path: String? + + def file_path=: (String) -> String + + attr_reader file_type: String? + + def file_type=: (String) -> String + + attr_reader height: Float? + + def height=: (Float) -> Float + + attr_reader is_private_file: bool? + + def is_private_file=: (bool) -> bool + + attr_reader is_published: bool? + + def is_published=: (bool) -> bool + + attr_reader metadata: Imagekit::Metadata? + + def metadata=: (Imagekit::Metadata) -> Imagekit::Metadata + + attr_reader name: String? + + def name=: (String) -> String + + attr_reader size: Float? + + def size=: (Float) -> Float + + attr_accessor tags: ::Array[String]? + + attr_reader thumbnail_url: String? + + def thumbnail_url=: (String) -> String + + attr_reader url: String? + + def url=: (String) -> String + + attr_reader version_info: Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo? + + def version_info=: ( + Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo + ) -> Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo + + attr_reader video_codec: String? + + def video_codec=: (String) -> String + + attr_reader width: Float? + + def width=: (Float) -> Float + + def initialize: ( + ?ai_tags: ::Array[Imagekit::UploadPreTransformSuccessEvent::Data::AITag]?, + ?audio_codec: String, + ?bit_rate: Integer, + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?duration: Integer, + ?embedded_metadata: ::Hash[Symbol, top], + ?extension_status: Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus, + ?file_id: String, + ?file_path: String, + ?file_type: String, + ?height: Float, + ?is_private_file: bool, + ?is_published: bool, + ?metadata: Imagekit::Metadata, + ?name: String, + ?size: Float, + ?tags: ::Array[String]?, + ?thumbnail_url: String, + ?url: String, + ?version_info: Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo, + ?video_codec: String, + ?width: Float + ) -> void + + def to_hash: -> { + ai_tags: ::Array[Imagekit::UploadPreTransformSuccessEvent::Data::AITag]?, + audio_codec: String, + bit_rate: Integer, + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + duration: Integer, + embedded_metadata: ::Hash[Symbol, top], + extension_status: Imagekit::UploadPreTransformSuccessEvent::Data::ExtensionStatus, + file_id: String, + file_path: String, + file_type: String, + height: Float, + is_private_file: bool, + is_published: bool, + metadata: Imagekit::Metadata, + name: String, + size: Float, + tags: ::Array[String]?, + thumbnail_url: String, + url: String, + version_info: Imagekit::UploadPreTransformSuccessEvent::Data::VersionInfo, + video_codec: String, + width: Float + } + + type ai_tag = { confidence: Float, name: String, source: String } + + class AITag < Imagekit::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: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg + } + + class ExtensionStatus < Imagekit::Internal::Type::BaseModel + attr_reader ai_auto_description: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description? + + def ai_auto_description=: ( + Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description + ) -> Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description + + attr_reader aws_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging? + + def aws_auto_tagging=: ( + Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging + ) -> Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging + + attr_reader google_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging? + + def google_auto_tagging=: ( + Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging + ) -> Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging + + attr_reader remove_bg: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg? + + def remove_bg=: ( + Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg + ) -> Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg + + def initialize: ( + ?ai_auto_description: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description, + ?aws_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging, + ?google_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging, + ?remove_bg: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg + ) -> void + + def to_hash: -> { + ai_auto_description: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description, + aws_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging, + google_auto_tagging: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging, + remove_bg: Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg + } + + type ai_auto_description = :success | :pending | :failed + + module AIAutoDescription + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::ai_auto_description] + end + + type aws_auto_tagging = :success | :pending | :failed + + module AwsAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::aws_auto_tagging] + end + + type google_auto_tagging = :success | :pending | :failed + + module GoogleAutoTagging + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::google_auto_tagging] + end + + type remove_bg = :success | :pending | :failed + + module RemoveBg + extend Imagekit::Internal::Type::Enum + + SUCCESS: :success + PENDING: :pending + FAILED: :failed + + def self?.values: -> ::Array[Imagekit::Models::UploadPreTransformSuccessEvent::Data::ExtensionStatus::remove_bg] + end + end + + type version_info = { id: String, name: String } + + class VersionInfo < Imagekit::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 } + + class Request < Imagekit::Internal::Type::BaseModel + attr_accessor transformation: String + + attr_accessor x_request_id: String + + def initialize: (transformation: String, x_request_id: String) -> void + + def to_hash: -> { transformation: String, x_request_id: String } + end + end + end +end diff --git a/sig/imagekit/models/video_overlay.rbs b/sig/imagekit/models/video_overlay.rbs new file mode 100644 index 00000000..1c25b201 --- /dev/null +++ b/sig/imagekit/models/video_overlay.rbs @@ -0,0 +1,59 @@ +module Imagekit + module Models + type video_overlay = + { + input: String, + type: :video, + encoding: Imagekit::Models::VideoOverlay::encoding, + transformation: ::Array[Imagekit::Transformation] + } + + class VideoOverlay < Imagekit::Models::BaseOverlay + def input: -> String + + def input=: (String _) -> String + + def `type`: -> :video + + def type=: (:video _) -> :video + + def encoding: -> Imagekit::Models::VideoOverlay::encoding? + + def encoding=: ( + Imagekit::Models::VideoOverlay::encoding _ + ) -> Imagekit::Models::VideoOverlay::encoding + + def transformation: -> ::Array[Imagekit::Transformation]? + + def transformation=: ( + ::Array[Imagekit::Transformation] _ + ) -> ::Array[Imagekit::Transformation] + + def initialize: ( + input: String, + ?encoding: Imagekit::Models::VideoOverlay::encoding, + ?transformation: ::Array[Imagekit::Transformation], + ?type: :video + ) -> void + + def to_hash: -> { + input: String, + type: :video, + encoding: Imagekit::Models::VideoOverlay::encoding, + transformation: ::Array[Imagekit::Transformation] + } + + type encoding = :auto | :plain | :base64 + + module Encoding + extend Imagekit::Internal::Type::Enum + + AUTO: :auto + PLAIN: :plain + BASE64: :base64 + + def self?.values: -> ::Array[Imagekit::Models::VideoOverlay::encoding] + end + end + end +end diff --git a/sig/imagekit/models/video_transformation_accepted_event.rbs b/sig/imagekit/models/video_transformation_accepted_event.rbs new file mode 100644 index 00000000..110ece17 --- /dev/null +++ b/sig/imagekit/models/video_transformation_accepted_event.rbs @@ -0,0 +1,252 @@ +module Imagekit + module Models + type video_transformation_accepted_event = + { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationAcceptedEvent::Data, + request: Imagekit::VideoTransformationAcceptedEvent::Request, + type: :"video.transformation.accepted" + } + + class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor data: Imagekit::VideoTransformationAcceptedEvent::Data + + attr_accessor request: Imagekit::VideoTransformationAcceptedEvent::Request + + attr_accessor type: :"video.transformation.accepted" + + def initialize: ( + id: String, + created_at: Time, + data: Imagekit::VideoTransformationAcceptedEvent::Data, + request: Imagekit::VideoTransformationAcceptedEvent::Request, + ?type: :"video.transformation.accepted" + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationAcceptedEvent::Data, + request: Imagekit::VideoTransformationAcceptedEvent::Request, + type: :"video.transformation.accepted" + } + + type data = + { + asset: Imagekit::VideoTransformationAcceptedEvent::Data::Asset, + transformation: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation + } + + class Data < Imagekit::Internal::Type::BaseModel + attr_accessor asset: Imagekit::VideoTransformationAcceptedEvent::Data::Asset + + attr_accessor transformation: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation + + def initialize: ( + asset: Imagekit::VideoTransformationAcceptedEvent::Data::Asset, + transformation: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation + ) -> void + + def to_hash: -> { + asset: Imagekit::VideoTransformationAcceptedEvent::Data::Asset, + transformation: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation + } + + type asset = { url: String } + + class Asset < Imagekit::Internal::Type::BaseModel + attr_accessor url: String + + def initialize: (url: String) -> void + + def to_hash: -> { url: String } + end + + type transformation = + { + type: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::type_, + options: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor type: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::type_ + + attr_reader options: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options? + + def options=: ( + Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options + ) -> Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options + + def initialize: ( + type: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::type_, + ?options: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options + ) -> void + + def to_hash: -> { + type: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::type_, + options: Imagekit::VideoTransformationAcceptedEvent::Data::Transformation::Options + } + + type type_ = + :"video-transformation" | :"gif-to-video" | :"video-thumbnail" + + module Type + extend Imagekit::Internal::Type::Enum + + VIDEO_TRANSFORMATION: :"video-transformation" + GIF_TO_VIDEO: :"gif-to-video" + VIDEO_THUMBNAIL: :"video-thumbnail" + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::type_] + end + + type options = + { + audio_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::audio_codec, + auto_rotate: bool, + format_: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::format_, + quality: Integer, + stream_protocol: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::stream_protocol, + variants: ::Array[String], + video_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::video_codec + } + + class Options < Imagekit::Internal::Type::BaseModel + attr_reader audio_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::audio_codec? + + def audio_codec=: ( + Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::audio_codec + ) -> Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::audio_codec + + attr_reader auto_rotate: bool? + + def auto_rotate=: (bool) -> bool + + attr_reader format_: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::format_? + + def format_=: ( + Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::format_ + ) -> Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::format_ + + attr_reader quality: Integer? + + def quality=: (Integer) -> Integer + + attr_reader stream_protocol: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::stream_protocol? + + def stream_protocol=: ( + Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::stream_protocol + ) -> Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::stream_protocol + + attr_reader variants: ::Array[String]? + + def variants=: (::Array[String]) -> ::Array[String] + + attr_reader video_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::video_codec? + + def video_codec=: ( + Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::video_codec + ) -> Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::video_codec + + def initialize: ( + ?audio_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::audio_codec, + ?auto_rotate: bool, + ?format_: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::format_, + ?quality: Integer, + ?stream_protocol: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::stream_protocol, + ?variants: ::Array[String], + ?video_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::video_codec + ) -> void + + def to_hash: -> { + audio_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::audio_codec, + auto_rotate: bool, + format_: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::format_, + quality: Integer, + stream_protocol: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::stream_protocol, + variants: ::Array[String], + video_codec: Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::video_codec + } + + type audio_codec = :aac | :opus + + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC: :aac + OPUS: :opus + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::audio_codec] + end + + type format_ = :mp4 | :webm | :jpg | :png | :webp + + module Format + extend Imagekit::Internal::Type::Enum + + MP4: :mp4 + WEBM: :webm + JPG: :jpg + PNG: :png + WEBP: :webp + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::format_] + end + + type stream_protocol = :HLS | :DASH + + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + HLS: :HLS + DASH: :DASH + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::stream_protocol] + end + + type video_codec = :h264 | :vp9 | :av1 + + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264: :h264 + VP9: :vp9 + AV1: :av1 + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationAcceptedEvent::Data::Transformation::Options::video_codec] + end + end + end + end + + type request = { url: String, x_request_id: String, user_agent: String } + + class Request < Imagekit::Internal::Type::BaseModel + attr_accessor url: String + + attr_accessor x_request_id: String + + attr_reader user_agent: String? + + def user_agent=: (String) -> String + + def initialize: ( + url: String, + x_request_id: String, + ?user_agent: String + ) -> void + + def to_hash: -> { + url: String, + x_request_id: String, + user_agent: String + } + end + end + end +end diff --git a/sig/imagekit/models/video_transformation_error_event.rbs b/sig/imagekit/models/video_transformation_error_event.rbs new file mode 100644 index 00000000..18a7d33c --- /dev/null +++ b/sig/imagekit/models/video_transformation_error_event.rbs @@ -0,0 +1,291 @@ +module Imagekit + module Models + type video_transformation_error_event = + { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationErrorEvent::Data, + request: Imagekit::VideoTransformationErrorEvent::Request, + type: :"video.transformation.error" + } + + class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor data: Imagekit::VideoTransformationErrorEvent::Data + + attr_accessor request: Imagekit::VideoTransformationErrorEvent::Request + + attr_accessor type: :"video.transformation.error" + + def initialize: ( + id: String, + created_at: Time, + data: Imagekit::VideoTransformationErrorEvent::Data, + request: Imagekit::VideoTransformationErrorEvent::Request, + ?type: :"video.transformation.error" + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationErrorEvent::Data, + request: Imagekit::VideoTransformationErrorEvent::Request, + type: :"video.transformation.error" + } + + type data = + { + asset: Imagekit::VideoTransformationErrorEvent::Data::Asset, + transformation: Imagekit::VideoTransformationErrorEvent::Data::Transformation + } + + class Data < Imagekit::Internal::Type::BaseModel + attr_accessor asset: Imagekit::VideoTransformationErrorEvent::Data::Asset + + attr_accessor transformation: Imagekit::VideoTransformationErrorEvent::Data::Transformation + + def initialize: ( + asset: Imagekit::VideoTransformationErrorEvent::Data::Asset, + transformation: Imagekit::VideoTransformationErrorEvent::Data::Transformation + ) -> void + + def to_hash: -> { + asset: Imagekit::VideoTransformationErrorEvent::Data::Asset, + transformation: Imagekit::VideoTransformationErrorEvent::Data::Transformation + } + + type asset = { url: String } + + class Asset < Imagekit::Internal::Type::BaseModel + attr_accessor url: String + + def initialize: (url: String) -> void + + def to_hash: -> { url: String } + end + + type transformation = + { + type: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::type_, + error: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error, + options: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor type: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::type_ + + attr_reader error: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error? + + def error=: ( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error + ) -> Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error + + attr_reader options: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options? + + def options=: ( + Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options + ) -> Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options + + def initialize: ( + type: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::type_, + ?error: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error, + ?options: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options + ) -> void + + def to_hash: -> { + type: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::type_, + error: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Error, + options: Imagekit::VideoTransformationErrorEvent::Data::Transformation::Options + } + + type type_ = + :"video-transformation" | :"gif-to-video" | :"video-thumbnail" + + module Type + extend Imagekit::Internal::Type::Enum + + VIDEO_TRANSFORMATION: :"video-transformation" + GIF_TO_VIDEO: :"gif-to-video" + VIDEO_THUMBNAIL: :"video-thumbnail" + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::type_] + end + + type error = + { + reason: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error::reason + } + + class Error < Imagekit::Internal::Type::BaseModel + attr_accessor reason: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error::reason + + def initialize: ( + reason: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error::reason + ) -> void + + def to_hash: -> { + reason: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error::reason + } + + type reason = + :encoding_failed | :download_failed | :internal_server_error + + module Reason + extend Imagekit::Internal::Type::Enum + + ENCODING_FAILED: :encoding_failed + DOWNLOAD_FAILED: :download_failed + INTERNAL_SERVER_ERROR: :internal_server_error + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Error::reason] + end + end + + type options = + { + audio_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::audio_codec, + auto_rotate: bool, + format_: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::format_, + quality: Integer, + stream_protocol: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::stream_protocol, + variants: ::Array[String], + video_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::video_codec + } + + class Options < Imagekit::Internal::Type::BaseModel + attr_reader audio_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::audio_codec? + + def audio_codec=: ( + Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::audio_codec + ) -> Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::audio_codec + + attr_reader auto_rotate: bool? + + def auto_rotate=: (bool) -> bool + + attr_reader format_: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::format_? + + def format_=: ( + Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::format_ + ) -> Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::format_ + + attr_reader quality: Integer? + + def quality=: (Integer) -> Integer + + attr_reader stream_protocol: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::stream_protocol? + + def stream_protocol=: ( + Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::stream_protocol + ) -> Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::stream_protocol + + attr_reader variants: ::Array[String]? + + def variants=: (::Array[String]) -> ::Array[String] + + attr_reader video_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::video_codec? + + def video_codec=: ( + Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::video_codec + ) -> Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::video_codec + + def initialize: ( + ?audio_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::audio_codec, + ?auto_rotate: bool, + ?format_: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::format_, + ?quality: Integer, + ?stream_protocol: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::stream_protocol, + ?variants: ::Array[String], + ?video_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::video_codec + ) -> void + + def to_hash: -> { + audio_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::audio_codec, + auto_rotate: bool, + format_: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::format_, + quality: Integer, + stream_protocol: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::stream_protocol, + variants: ::Array[String], + video_codec: Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::video_codec + } + + type audio_codec = :aac | :opus + + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC: :aac + OPUS: :opus + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::audio_codec] + end + + type format_ = :mp4 | :webm | :jpg | :png | :webp + + module Format + extend Imagekit::Internal::Type::Enum + + MP4: :mp4 + WEBM: :webm + JPG: :jpg + PNG: :png + WEBP: :webp + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::format_] + end + + type stream_protocol = :HLS | :DASH + + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + HLS: :HLS + DASH: :DASH + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::stream_protocol] + end + + type video_codec = :h264 | :vp9 | :av1 + + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264: :h264 + VP9: :vp9 + AV1: :av1 + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationErrorEvent::Data::Transformation::Options::video_codec] + end + end + end + end + + type request = { url: String, x_request_id: String, user_agent: String } + + class Request < Imagekit::Internal::Type::BaseModel + attr_accessor url: String + + attr_accessor x_request_id: String + + attr_reader user_agent: String? + + def user_agent=: (String) -> String + + def initialize: ( + url: String, + x_request_id: String, + ?user_agent: String + ) -> void + + def to_hash: -> { + url: String, + x_request_id: String, + user_agent: String + } + end + end + end +end diff --git a/sig/imagekit/models/video_transformation_ready_event.rbs b/sig/imagekit/models/video_transformation_ready_event.rbs new file mode 100644 index 00000000..99c49603 --- /dev/null +++ b/sig/imagekit/models/video_transformation_ready_event.rbs @@ -0,0 +1,350 @@ +module Imagekit + module Models + type video_transformation_ready_event = + { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationReadyEvent::Data, + request: Imagekit::VideoTransformationReadyEvent::Request, + type: :"video.transformation.ready", + timings: Imagekit::VideoTransformationReadyEvent::Timings + } + + class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor data: Imagekit::VideoTransformationReadyEvent::Data + + attr_accessor request: Imagekit::VideoTransformationReadyEvent::Request + + attr_accessor type: :"video.transformation.ready" + + attr_reader timings: Imagekit::VideoTransformationReadyEvent::Timings? + + def timings=: ( + Imagekit::VideoTransformationReadyEvent::Timings + ) -> Imagekit::VideoTransformationReadyEvent::Timings + + def initialize: ( + id: String, + created_at: Time, + data: Imagekit::VideoTransformationReadyEvent::Data, + request: Imagekit::VideoTransformationReadyEvent::Request, + ?timings: Imagekit::VideoTransformationReadyEvent::Timings, + ?type: :"video.transformation.ready" + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + data: Imagekit::VideoTransformationReadyEvent::Data, + request: Imagekit::VideoTransformationReadyEvent::Request, + type: :"video.transformation.ready", + timings: Imagekit::VideoTransformationReadyEvent::Timings + } + + type data = + { + asset: Imagekit::VideoTransformationReadyEvent::Data::Asset, + transformation: Imagekit::VideoTransformationReadyEvent::Data::Transformation + } + + class Data < Imagekit::Internal::Type::BaseModel + attr_accessor asset: Imagekit::VideoTransformationReadyEvent::Data::Asset + + attr_accessor transformation: Imagekit::VideoTransformationReadyEvent::Data::Transformation + + def initialize: ( + asset: Imagekit::VideoTransformationReadyEvent::Data::Asset, + transformation: Imagekit::VideoTransformationReadyEvent::Data::Transformation + ) -> void + + def to_hash: -> { + asset: Imagekit::VideoTransformationReadyEvent::Data::Asset, + transformation: Imagekit::VideoTransformationReadyEvent::Data::Transformation + } + + type asset = { url: String } + + class Asset < Imagekit::Internal::Type::BaseModel + attr_accessor url: String + + def initialize: (url: String) -> void + + def to_hash: -> { url: String } + end + + type transformation = + { + type: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::type_, + options: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options, + output: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output + } + + class Transformation < Imagekit::Internal::Type::BaseModel + attr_accessor type: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::type_ + + attr_reader options: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options? + + def options=: ( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options + ) -> Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options + + attr_reader output: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output? + + def output=: ( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output + ) -> Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output + + def initialize: ( + type: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::type_, + ?options: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options, + ?output: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output + ) -> void + + def to_hash: -> { + type: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::type_, + options: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Options, + output: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output + } + + type type_ = + :"video-transformation" | :"gif-to-video" | :"video-thumbnail" + + module Type + extend Imagekit::Internal::Type::Enum + + VIDEO_TRANSFORMATION: :"video-transformation" + GIF_TO_VIDEO: :"gif-to-video" + VIDEO_THUMBNAIL: :"video-thumbnail" + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::type_] + end + + type options = + { + audio_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::audio_codec, + auto_rotate: bool, + format_: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::format_, + quality: Integer, + stream_protocol: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::stream_protocol, + variants: ::Array[String], + video_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::video_codec + } + + class Options < Imagekit::Internal::Type::BaseModel + attr_reader audio_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::audio_codec? + + def audio_codec=: ( + Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::audio_codec + ) -> Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::audio_codec + + attr_reader auto_rotate: bool? + + def auto_rotate=: (bool) -> bool + + attr_reader format_: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::format_? + + def format_=: ( + Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::format_ + ) -> Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::format_ + + attr_reader quality: Integer? + + def quality=: (Integer) -> Integer + + attr_reader stream_protocol: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::stream_protocol? + + def stream_protocol=: ( + Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::stream_protocol + ) -> Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::stream_protocol + + attr_reader variants: ::Array[String]? + + def variants=: (::Array[String]) -> ::Array[String] + + attr_reader video_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::video_codec? + + def video_codec=: ( + Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::video_codec + ) -> Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::video_codec + + def initialize: ( + ?audio_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::audio_codec, + ?auto_rotate: bool, + ?format_: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::format_, + ?quality: Integer, + ?stream_protocol: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::stream_protocol, + ?variants: ::Array[String], + ?video_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::video_codec + ) -> void + + def to_hash: -> { + audio_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::audio_codec, + auto_rotate: bool, + format_: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::format_, + quality: Integer, + stream_protocol: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::stream_protocol, + variants: ::Array[String], + video_codec: Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::video_codec + } + + type audio_codec = :aac | :opus + + module AudioCodec + extend Imagekit::Internal::Type::Enum + + AAC: :aac + OPUS: :opus + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::audio_codec] + end + + type format_ = :mp4 | :webm | :jpg | :png | :webp + + module Format + extend Imagekit::Internal::Type::Enum + + MP4: :mp4 + WEBM: :webm + JPG: :jpg + PNG: :png + WEBP: :webp + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::format_] + end + + type stream_protocol = :HLS | :DASH + + module StreamProtocol + extend Imagekit::Internal::Type::Enum + + HLS: :HLS + DASH: :DASH + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::stream_protocol] + end + + type video_codec = :h264 | :vp9 | :av1 + + module VideoCodec + extend Imagekit::Internal::Type::Enum + + H264: :h264 + VP9: :vp9 + AV1: :av1 + + def self?.values: -> ::Array[Imagekit::Models::VideoTransformationReadyEvent::Data::Transformation::Options::video_codec] + end + end + + type output = + { + url: String, + video_metadata: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata + } + + class Output < Imagekit::Internal::Type::BaseModel + attr_accessor url: String + + attr_reader video_metadata: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata? + + def video_metadata=: ( + Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata + ) -> Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata + + def initialize: ( + url: String, + ?video_metadata: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata + ) -> void + + def to_hash: -> { + url: String, + video_metadata: Imagekit::VideoTransformationReadyEvent::Data::Transformation::Output::VideoMetadata + } + + type video_metadata = + { + bitrate: Integer, + duration: Float, + height: Integer, + width: Integer + } + + class VideoMetadata < Imagekit::Internal::Type::BaseModel + attr_accessor bitrate: Integer + + attr_accessor duration: Float + + attr_accessor height: Integer + + attr_accessor width: Integer + + def initialize: ( + bitrate: Integer, + duration: Float, + height: Integer, + width: Integer + ) -> void + + def to_hash: -> { + bitrate: Integer, + duration: Float, + height: Integer, + width: Integer + } + end + end + end + end + + type request = { url: String, x_request_id: String, user_agent: String } + + class Request < Imagekit::Internal::Type::BaseModel + attr_accessor url: String + + attr_accessor x_request_id: String + + attr_reader user_agent: String? + + def user_agent=: (String) -> String + + def initialize: ( + url: String, + x_request_id: String, + ?user_agent: String + ) -> void + + def to_hash: -> { + url: String, + x_request_id: String, + user_agent: String + } + end + + type timings = { download_duration: Integer, encoding_duration: Integer } + + class Timings < Imagekit::Internal::Type::BaseModel + attr_reader download_duration: Integer? + + def download_duration=: (Integer) -> Integer + + attr_reader encoding_duration: Integer? + + def encoding_duration=: (Integer) -> Integer + + def initialize: ( + ?download_duration: Integer, + ?encoding_duration: Integer + ) -> void + + def to_hash: -> { + download_duration: Integer, + encoding_duration: Integer + } + end + end + end +end diff --git a/sig/imagekit/models/webhook_unsafe_unwrap_params.rbs b/sig/imagekit/models/webhook_unsafe_unwrap_params.rbs new file mode 100644 index 00000000..6b7b0859 --- /dev/null +++ b/sig/imagekit/models/webhook_unsafe_unwrap_params.rbs @@ -0,0 +1,15 @@ +module Imagekit + module Models + type webhook_unsafe_unwrap_params = + { } & Imagekit::Internal::Type::request_parameters + + class WebhookUnsafeUnwrapParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end +end diff --git a/sig/imagekit/models/webhook_unwrap_params.rbs b/sig/imagekit/models/webhook_unwrap_params.rbs new file mode 100644 index 00000000..e321d3b5 --- /dev/null +++ b/sig/imagekit/models/webhook_unwrap_params.rbs @@ -0,0 +1,15 @@ +module Imagekit + module Models + type webhook_unwrap_params = + { } & Imagekit::Internal::Type::request_parameters + + class WebhookUnwrapParams < Imagekit::Internal::Type::BaseModel + extend Imagekit::Internal::Type::RequestParameters::Converter + include Imagekit::Internal::Type::RequestParameters + + def initialize: (?request_options: Imagekit::request_opts) -> void + + def to_hash: -> { request_options: Imagekit::RequestOptions } + end + end +end diff --git a/sig/imagekit/request_options.rbs b/sig/imagekit/request_options.rbs new file mode 100644 index 00000000..44de316d --- /dev/null +++ b/sig/imagekit/request_options.rbs @@ -0,0 +1,34 @@ +module Imagekit + type request_opts = + Imagekit::RequestOptions | Imagekit::request_options | ::Hash[Symbol, top] + + type request_options = + { + idempotency_key: String?, + extra_query: ::Hash[String, (::Array[String] | String)?]?, + extra_headers: ::Hash[String, String?]?, + extra_body: top?, + max_retries: Integer?, + timeout: Float? + } + + class RequestOptions < Imagekit::Internal::Type::BaseModel + def self.validate!: (Imagekit::request_opts opts) -> void + + attr_accessor idempotency_key: String? + + attr_accessor extra_query: ::Hash[String, (::Array[String] | String)?]? + + attr_accessor extra_headers: ::Hash[String, String?]? + + attr_accessor extra_body: top? + + attr_accessor max_retries: Integer? + + attr_accessor timeout: Float? + + def initialize: ( + ?Imagekit::request_options | ::Hash[Symbol, top] values + ) -> void + end +end diff --git a/sig/imagekit/resources/accounts.rbs b/sig/imagekit/resources/accounts.rbs new file mode 100644 index 00000000..dfc6188c --- /dev/null +++ b/sig/imagekit/resources/accounts.rbs @@ -0,0 +1,13 @@ +module Imagekit + module Resources + class Accounts + attr_reader usage: Imagekit::Resources::Accounts::Usage + + attr_reader origins: Imagekit::Resources::Accounts::Origins + + attr_reader url_endpoints: Imagekit::Resources::Accounts::URLEndpoints + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/resources/accounts/origins.rbs b/sig/imagekit/resources/accounts/origins.rbs new file mode 100644 index 00000000..3cc90be7 --- /dev/null +++ b/sig/imagekit/resources/accounts/origins.rbs @@ -0,0 +1,31 @@ +module Imagekit + module Resources + class Accounts + class Origins + def create: ( + origin: Imagekit::Models::Accounts::origin_request, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Accounts::origin_response + + def update: ( + String id, + origin: Imagekit::Models::Accounts::origin_request, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Accounts::origin_response + + def list: ( + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Accounts::origin_list_response + + def delete: (String id, ?request_options: Imagekit::request_opts) -> nil + + def get: ( + String id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Accounts::origin_response + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/accounts/url_endpoints.rbs b/sig/imagekit/resources/accounts/url_endpoints.rbs new file mode 100644 index 00000000..b87de7ed --- /dev/null +++ b/sig/imagekit/resources/accounts/url_endpoints.rbs @@ -0,0 +1,37 @@ +module Imagekit + module Resources + class Accounts + class URLEndpoints + def create: ( + description: String, + ?origins: ::Array[String], + ?url_prefix: String, + ?url_rewriter: Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Accounts::URLEndpointResponse + + def update: ( + String id, + description: String, + ?origins: ::Array[String], + ?url_prefix: String, + ?url_rewriter: Imagekit::Models::Accounts::URLEndpointRequest::url_rewriter, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Accounts::URLEndpointResponse + + def list: ( + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Accounts::url_endpoint_list_response + + def delete: (String id, ?request_options: Imagekit::request_opts) -> nil + + def get: ( + String id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Accounts::URLEndpointResponse + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/accounts/usage.rbs b/sig/imagekit/resources/accounts/usage.rbs new file mode 100644 index 00000000..b4c781db --- /dev/null +++ b/sig/imagekit/resources/accounts/usage.rbs @@ -0,0 +1,15 @@ +module Imagekit + module Resources + class Accounts + class Usage + def get: ( + end_date: Date, + start_date: Date, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Accounts::UsageGetResponse + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/assets.rbs b/sig/imagekit/resources/assets.rbs new file mode 100644 index 00000000..65ba95d1 --- /dev/null +++ b/sig/imagekit/resources/assets.rbs @@ -0,0 +1,18 @@ +module Imagekit + module Resources + class Assets + def list: ( + ?file_type: Imagekit::Models::AssetListParams::file_type, + ?limit: Integer, + ?path: String, + ?search_query: String, + ?skip: Integer, + ?sort: Imagekit::Models::AssetListParams::sort, + ?type: Imagekit::Models::AssetListParams::type_, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::asset_list_response + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/resources/beta.rbs b/sig/imagekit/resources/beta.rbs new file mode 100644 index 00000000..750d302a --- /dev/null +++ b/sig/imagekit/resources/beta.rbs @@ -0,0 +1,9 @@ +module Imagekit + module Resources + class Beta + attr_reader v2: Imagekit::Resources::Beta::V2 + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/resources/beta/v2.rbs b/sig/imagekit/resources/beta/v2.rbs new file mode 100644 index 00000000..3b91ef06 --- /dev/null +++ b/sig/imagekit/resources/beta/v2.rbs @@ -0,0 +1,11 @@ +module Imagekit + module Resources + class Beta + class V2 + attr_reader files: Imagekit::Resources::Beta::V2::Files + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/beta/v2/files.rbs b/sig/imagekit/resources/beta/v2/files.rbs new file mode 100644 index 00000000..1bc818b9 --- /dev/null +++ b/sig/imagekit/resources/beta/v2/files.rbs @@ -0,0 +1,35 @@ +module Imagekit + module Resources + class Beta + class V2 + class Files + def upload: ( + file: Imagekit::Internal::file_input, + file_name: String, + ?token: String, + ?checks: String, + ?custom_coordinates: String, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + ?folder: String, + ?is_private_file: bool, + ?is_published: bool, + ?overwrite_ai_tags: bool, + ?overwrite_custom_metadata: bool, + ?overwrite_file: bool, + ?overwrite_tags: bool, + ?response_fields: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::response_field], + ?tags: ::Array[String], + ?transformation: Imagekit::Beta::V2::FileUploadParams::Transformation, + ?use_unique_file_name: bool, + ?webhook_url: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Beta::V2::FileUploadResponse + + def initialize: (client: Imagekit::Client) -> void + end + end + end + end +end diff --git a/sig/imagekit/resources/cache.rbs b/sig/imagekit/resources/cache.rbs new file mode 100644 index 00000000..e8051527 --- /dev/null +++ b/sig/imagekit/resources/cache.rbs @@ -0,0 +1,9 @@ +module Imagekit + module Resources + class Cache + attr_reader invalidation: Imagekit::Resources::Cache::Invalidation + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/resources/cache/invalidation.rbs b/sig/imagekit/resources/cache/invalidation.rbs new file mode 100644 index 00000000..66bcbae0 --- /dev/null +++ b/sig/imagekit/resources/cache/invalidation.rbs @@ -0,0 +1,19 @@ +module Imagekit + module Resources + class Cache + class Invalidation + def create: ( + url: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Cache::InvalidationCreateResponse + + def get: ( + String request_id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Cache::InvalidationGetResponse + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/custom_metadata_fields.rbs b/sig/imagekit/resources/custom_metadata_fields.rbs new file mode 100644 index 00000000..f14f6f73 --- /dev/null +++ b/sig/imagekit/resources/custom_metadata_fields.rbs @@ -0,0 +1,31 @@ +module Imagekit + module Resources + class CustomMetadataFields + def create: ( + label: String, + name: String, + schema: Imagekit::CustomMetadataFieldCreateParams::Schema, + ?request_options: Imagekit::request_opts + ) -> Imagekit::CustomMetadataField + + def update: ( + String id, + ?label: String, + ?schema: Imagekit::CustomMetadataFieldUpdateParams::Schema, + ?request_options: Imagekit::request_opts + ) -> Imagekit::CustomMetadataField + + def list: ( + ?include_deleted: bool, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::custom_metadata_field_list_response + + def delete: ( + String id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::CustomMetadataFieldDeleteResponse + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs new file mode 100644 index 00000000..991b1f14 --- /dev/null +++ b/sig/imagekit/resources/files.rbs @@ -0,0 +1,76 @@ +module Imagekit + module Resources + class Files + attr_reader bulk: Imagekit::Resources::Files::Bulk + + attr_reader versions: Imagekit::Resources::Files::Versions + + attr_reader metadata: Imagekit::Resources::Files::Metadata + + def update: ( + String file_id, + ?update: Imagekit::Models::FileUpdateParams::update, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FileUpdateResponse + + def delete: ( + String file_id, + ?request_options: Imagekit::request_opts + ) -> nil + + def copy: ( + destination_path: String, + source_file_path: String, + ?include_file_versions: bool, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FileCopyResponse + + def get: ( + String file_id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::File + + def move: ( + destination_path: String, + source_file_path: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FileMoveResponse + + def rename: ( + file_path: String, + new_file_name: String, + ?purge_cache: bool, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FileRenameResponse + + def upload: ( + file: Imagekit::Internal::file_input, + file_name: String, + ?token: String, + ?checks: String, + ?custom_coordinates: String, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?expire: Integer, + ?extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + ?folder: String, + ?is_private_file: bool, + ?is_published: bool, + ?overwrite_ai_tags: bool, + ?overwrite_custom_metadata: bool, + ?overwrite_file: bool, + ?overwrite_tags: bool, + ?public_key: String, + ?response_fields: ::Array[Imagekit::Models::FileUploadParams::response_field], + ?signature: String, + ?tags: ::Array[String], + ?transformation: Imagekit::FileUploadParams::Transformation, + ?use_unique_file_name: bool, + ?webhook_url: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FileUploadResponse + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/resources/files/bulk.rbs b/sig/imagekit/resources/files/bulk.rbs new file mode 100644 index 00000000..a8df17a8 --- /dev/null +++ b/sig/imagekit/resources/files/bulk.rbs @@ -0,0 +1,32 @@ +module Imagekit + module Resources + class Files + class Bulk + def delete: ( + file_ids: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Files::BulkDeleteResponse + + def add_tags: ( + file_ids: ::Array[String], + tags: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Files::BulkAddTagsResponse + + def remove_ai_tags: ( + ai_tags: ::Array[String], + file_ids: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Files::BulkRemoveAITagsResponse + + def remove_tags: ( + file_ids: ::Array[String], + tags: ::Array[String], + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Files::BulkRemoveTagsResponse + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/files/metadata.rbs b/sig/imagekit/resources/files/metadata.rbs new file mode 100644 index 00000000..4ddd61e6 --- /dev/null +++ b/sig/imagekit/resources/files/metadata.rbs @@ -0,0 +1,19 @@ +module Imagekit + module Resources + class Files + class Metadata + def get: ( + String file_id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Metadata + + def get_from_url: ( + url: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Metadata + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/files/versions.rbs b/sig/imagekit/resources/files/versions.rbs new file mode 100644 index 00000000..881e2c57 --- /dev/null +++ b/sig/imagekit/resources/files/versions.rbs @@ -0,0 +1,32 @@ +module Imagekit + module Resources + class Files + class Versions + def list: ( + String file_id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Files::version_list_response + + def delete: ( + String version_id, + file_id: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Files::VersionDeleteResponse + + def get: ( + String version_id, + file_id: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::File + + def restore: ( + String version_id, + file_id: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::File + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/folders.rbs b/sig/imagekit/resources/folders.rbs new file mode 100644 index 00000000..f5990d9b --- /dev/null +++ b/sig/imagekit/resources/folders.rbs @@ -0,0 +1,40 @@ +module Imagekit + module Resources + class Folders + attr_reader job: Imagekit::Resources::Folders::Job + + def create: ( + folder_name: String, + parent_folder_path: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FolderCreateResponse + + def delete: ( + folder_path: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FolderDeleteResponse + + def copy: ( + destination_path: String, + source_folder_path: String, + ?include_versions: bool, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FolderCopyResponse + + def move: ( + destination_path: String, + source_folder_path: String, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FolderMoveResponse + + def rename: ( + folder_path: String, + new_folder_name: String, + ?purge_cache: bool, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::FolderRenameResponse + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/resources/folders/job.rbs b/sig/imagekit/resources/folders/job.rbs new file mode 100644 index 00000000..81561a88 --- /dev/null +++ b/sig/imagekit/resources/folders/job.rbs @@ -0,0 +1,14 @@ +module Imagekit + module Resources + class Folders + class Job + def get: ( + String job_id, + ?request_options: Imagekit::request_opts + ) -> Imagekit::Models::Folders::JobGetResponse + + def initialize: (client: Imagekit::Client) -> void + end + end + end +end diff --git a/sig/imagekit/resources/webhooks.rbs b/sig/imagekit/resources/webhooks.rbs new file mode 100644 index 00000000..ea4242dd --- /dev/null +++ b/sig/imagekit/resources/webhooks.rbs @@ -0,0 +1,27 @@ +module Imagekit + module Resources + class Webhooks + def unsafe_unwrap: ( + String payload + ) -> (Imagekit::VideoTransformationAcceptedEvent + | Imagekit::VideoTransformationReadyEvent + | Imagekit::VideoTransformationErrorEvent + | Imagekit::UploadPreTransformSuccessEvent + | Imagekit::UploadPreTransformErrorEvent + | Imagekit::UploadPostTransformSuccessEvent + | Imagekit::UploadPostTransformErrorEvent) + + def unwrap: ( + String payload + ) -> (Imagekit::VideoTransformationAcceptedEvent + | Imagekit::VideoTransformationReadyEvent + | Imagekit::VideoTransformationErrorEvent + | Imagekit::UploadPreTransformSuccessEvent + | Imagekit::UploadPreTransformErrorEvent + | Imagekit::UploadPostTransformSuccessEvent + | Imagekit::UploadPostTransformErrorEvent) + + def initialize: (client: Imagekit::Client) -> void + end + end +end diff --git a/sig/imagekit/version.rbs b/sig/imagekit/version.rbs new file mode 100644 index 00000000..56afb0ab --- /dev/null +++ b/sig/imagekit/version.rbs @@ -0,0 +1,3 @@ +module Imagekit + VERSION: String +end diff --git a/sorbet/config b/sorbet/config new file mode 100644 index 00000000..6fe84ed8 --- /dev/null +++ b/sorbet/config @@ -0,0 +1,2 @@ +--dir=rbi/ +--ignore=test/ diff --git a/sorbet/rbi/.gitignore b/sorbet/rbi/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/sorbet/rbi/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/test/imagekit/api_service/bulk_test.rb b/test/imagekit/api_service/bulk_test.rb deleted file mode 100644 index a1a234fb..00000000 --- a/test/imagekit/api_service/bulk_test.rb +++ /dev/null @@ -1,185 +0,0 @@ -require_relative '../spec_helper' - -RSpec.describe ImageKitIo::ApiService::Bulk do - let(:bulk_api_service) { described_class } - let(:config) { ImageKitIo.config } - let(:constants) { ImageKitIo.constants } - let!(:private_key) { config.private_key } - let!(:public_key) { config.public_key } - let!(:url_endpoint) { config.url_endpoint } - - describe 'TestBatchDelete' do - it "test_remove_files_fails_on_unauthenticated_request" do - file_ids = %w[file_id_1 file_id_2] - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({code: 401, body: {}}) - - SUT = bulk_api_service.new(request_obj) - resp = SUT.remove_files(file_ids: file_ids) - - expect(@ac[:payload]).to eq({"fileIds": file_ids}.to_json) - expect(resp[:code]).to eq(401) - end - - it "test_remove_files_fails_on_item_not_found" do - file_ids = %w[file_id_1 file_id_2] - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({code: 404, body: {message: "The requested file(s) does not exist.", - help: "For support kindly contact us at support@imagekit.io .", - missingFileIds: file_ids,},},) - - SUT = bulk_api_service.new(request_obj) - resp = SUT.remove_files(file_ids: file_ids) - - expect(@ac[:payload]).to eq({"fileIds": file_ids}.to_json) - expect(resp[:code]).to eq(404) - expect(resp[:body][:missingFileIds]).to eq(file_ids) - end - - it "test_remove_files_succeeds" do - request_obj = double - file_ids = %w[file_id_1 file_id_2] - - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({code: 200, body: {successfullyDeletedFileIds: file_ids}}) - - SUT = bulk_api_service.new(request_obj) - resp = SUT.remove_files(file_ids: file_ids) - - expect(@ac[:payload]).to eq({"fileIds": file_ids}.to_json) - expect(resp[:code]).to eq(200) - expect(resp[:body][:successfullyDeletedFileIds]).to eq(file_ids) - end - end - - context 'batch tags' do - let!(:req_obj) { double } - let(:file_ids) { %[file_id_1 file_id_2] } - - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({code: 200, body: { successfullyUpdatedFileIds: file_ids }}) - @sut = bulk_api_service.new(req_obj) - end - - context 'add_tags' do - it 'raises error on empty parameters' do - expect { - @sut.add_tags - }.to raise_error(ArgumentError) - end - - it 'test_add_tags' do - resp = @sut.add_tags(file_ids: file_ids, tags: ['custom_tag']) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/addTags") - expect(@ac[:payload]).to eq("{\"fileIds\":\"file_id_1 file_id_2\",\"tags\":[\"custom_tag\"]}") - expect(resp[:code]).to eq(200) - end - end - - context 'remove_tags' do - it 'raises error on empty parameters' do - expect { - @sut.remove_tags - }.to raise_error(ArgumentError) - end - - it 'test_remove_tags' do - resp = @sut.remove_tags(file_ids: file_ids, tags: ['custom_tag_remove']) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/removeTags") - expect(@ac[:payload]).to eq("{\"fileIds\":\"file_id_1 file_id_2\",\"tags\":[\"custom_tag_remove\"]}") - expect(resp[:code]).to eq(200) - end - end - - context 'remove_ai_tags' do - it 'raises error on empty parameters' do - expect { - @sut.remove_ai_tags - }.to raise_error(ArgumentError) - end - - it 'test_remove_ai_tags' do - resp = @sut.remove_ai_tags(file_ids: file_ids, ai_tags: ['custom_ai_tag']) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/removeAITags") - expect(@ac[:payload]).to eq("{\"fileIds\":\"file_id_1 file_id_2\",\"AITags\":[\"custom_ai_tag\"]}") - expect(resp[:code]).to eq(200) - end - end - end - - context 'job status' do - let(:req_obj) { double } - let(:job_id) { '619e038e20b7ef03efc4eeb9' } - - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - response_body = {"jobId"=> job_id, "type"=>"MOVE_FOLDER", "status"=>"Completed"} - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({code: 200, body: response_body }) - @sut = bulk_api_service.new(req_obj) - end - - it 'raises error when parameter id not given' do - expect { - @sut.job_status - }.to raise_error(ArgumentError) - end - - it 'test_job_status' do - resp = @sut.job_status(job_id: job_id) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/bulkJobs/#{job_id}") - expect(@ac[:method]).to eq('get') - expect(@ac[:payload]).to eq({ :jobId => job_id}) - expect(resp[:body]['jobId']).to eq(job_id) - expect(resp[:body]['status']).to eq('Completed') - end - end -end diff --git a/test/imagekit/api_service/custom_metadata_field_test.rb b/test/imagekit/api_service/custom_metadata_field_test.rb deleted file mode 100644 index 5555bb9b..00000000 --- a/test/imagekit/api_service/custom_metadata_field_test.rb +++ /dev/null @@ -1,101 +0,0 @@ -require_relative '../spec_helper' - -RSpec.describe ImageKitIo::ApiService::CustomMetadataField do - let(:custom_metadata_service) { described_class } - let(:config) { ImageKitIo.config } - let(:constants) { ImageKitIo.constants } - let!(:private_key) { config.private_key } - let!(:public_key) { config.public_key } - let!(:url_endpoint) { config.url_endpoint } - - context 'custom metadata' do - let(:req_obj) { double } - let(:success_response) { - {"id"=>"619e667520b7ef03efc5d870", "name"=>"price1", "label"=>"price", "schema"=>{"type"=>"Number", "minValue"=>100, "maxValue"=>300}} - } - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - - end - - it 'raises error when not providing parameter for create' do - @sut = custom_metadata_service.new(req_obj) - expect { - @sut.create(name: nil, label: 'test_label', schema: '') - }.to raise_error(ArgumentError) - end - - it 'test_create_custom_metadata' do - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({code: 200, body: success_response }) - @sut = custom_metadata_service.new(req_obj) - resp = @sut.create( - name: 'price1', - label: 'price', - schema: { - type: 'Number', - minValue: 100, - maxValue: 300 - } - ) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/customMetadataFields") - expect(@ac[:method]).to eq('post') - expect(resp[:body]['id']).to eq(success_response["id"]) - end - - it 'test_get_custom_metadata' do - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({code: 200, body: [success_response] }) - @sut = custom_metadata_service.new(req_obj) - resp = @sut.list - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/customMetadataFields") - expect(@ac[:method]).to eq('get') - expect(resp[:body]).to eq([success_response]) - end - - it 'raises error when parameter not provided on update_custom_metadata' do - @sut = custom_metadata_service.new(req_obj) - expect { - @sut.update(id: nil, label: 'test_label', schema: '') - }.to raise_error(ArgumentError) - end - - it 'test_update_custom_metadata' do - metadata_id = "619e667320b7ef03efc5d850" - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({code: 200, body: {"id"=>metadata_id, "name"=>"price1", "label"=>"price1", "schema"=>{"type"=>"Number", "minValue"=>100, "maxValue"=>300}} }) - @sut = custom_metadata_service.new(req_obj) - resp = @sut.update(id: metadata_id, label: 'price1', schema: nil) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/customMetadataFields/#{metadata_id}") - expect(@ac[:method]).to eq('patch') - expect(resp[:body]).to eq({"id"=>metadata_id, "name"=>"price1", "label"=>"price1", "schema"=>{"type"=>"Number", "minValue"=>100, "maxValue"=>300}} ) - end - - it 'raises error when parameter not provided on update_custom_metadata' do - @sut = custom_metadata_service.new(req_obj) - expect { - @sut.delete - }.to raise_error(ArgumentError) - end - - it 'test_delete_custom_metadata' do - metadata_id = "619e667320b7ef03efc5d850" - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({code: 204, body: { success: true} }) - @sut = custom_metadata_service.new(req_obj) - @sut.delete(id: metadata_id) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/customMetadataFields/#{metadata_id}") - expect(@ac[:method]).to eq('delete') - end - end -end diff --git a/test/imagekit/api_service/file_test.rb b/test/imagekit/api_service/file_test.rb deleted file mode 100644 index 8707faf3..00000000 --- a/test/imagekit/api_service/file_test.rb +++ /dev/null @@ -1,1196 +0,0 @@ -require_relative '../spec_helper' - -RSpec.describe ImageKitIo::ApiService::File do - let(:file_api_service) { described_class } - let(:config) { ImageKitIo.config } - let(:constants) { ImageKitIo.constants } - let!(:private_key) { config.private_key } - let!(:public_key) { config.public_key } - let!(:url_endpoint) { config.url_endpoint } - - describe 'FileUploadTest' do - it "test_upload_with_valid_expected_success_without_tags_and_remote_url" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - - upload = SUT.upload(file: "http://remotefiles.com/fake_file.jpg", file_name: "my_file_name") - expect(@ac[:payload].to_json).to eq("{\"multipart\":true,\"file\":\"http://remotefiles.com/fake_file.jpg\",\"fileName\":\"my_file_name\"}") - - expect(upload[:status_code]).to eq(200) - - end - - it "test_upload_with_valid_expected_success_without_tags_and_base64" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - base64="f06830ca9f1e3e90" - upload = SUT.upload(file: base64, file_name: "my_file_name") - expect(@ac[:payload].to_json).to eq("{\"multipart\":true,\"file\":\"#{base64}\",\"fileName\":\"my_file_name\"}") - expect(ImageKitIo::Utils::Calculation.is_valid_hex(base64)).to eq(true) - expect(upload[:status_code]).to eq(200) - - end - - it "test_upload_with_valid_expected_success_without_tags_and_file" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - file = open("test/imagekit/dummy_data/sample.jpg", "rb") - upload = SUT.upload(file: file, file_name: "my_file_name") - expect(@ac[:payload].keys).to eq([:multipart, :file, :fileName]) - expect(@ac[:payload][:file].io).to eq(file) - expect(@ac[:payload][:fileName]).to eq('my_file_name') - expect(upload[:status_code]).to eq(200) - - end - - it "test_upload_with_valid_expected_success_with_custom_coordinates" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - - upload = SUT.upload(file: "./fake_file.jpg", file_name: "my_file_name", custom_coordinates: "10, 10, 100, 100") - - expect(@ac[:payload].to_json).to eq("{\"multipart\":true,\"file\":\"./fake_file.jpg\",\"fileName\":\"my_file_name\",\"customCoordinates\":\"10, 10, 100, 100\"}") - - expect(upload[:status_code]).to eq(200) - - end - - it "test_upload_with_valid_expected_success_with_extensions" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - SUT = file_api_service.new(request_obj) - upload = SUT.upload(file: "./fake_file.jpg", file_name: "my_file_name", extensions: [ - { - name: 'remove-bg', - options: { - add_shadow: true - } - } - ]) - expect(@ac[:payload]['extensions']).to eq("[{\"name\":\"remove-bg\",\"options\":{\"add_shadow\":true}}]") - expect(upload[:status_code]).to eq(200) - end - - it "test_upload_with_valid_expected_success_with_customMetadata" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - SUT = file_api_service.new(request_obj) - upload = SUT.upload( - file: "./fake_file.jpg", - file_name: "my_file_name", - custom_metadata: { - brand: 'Nike', - color: 'red' - } - ) - expect(@ac[:payload]['customMetadata']).to eq("{\"brand\":\"Nike\",\"color\":\"red\"}") - expect(upload[:status_code]).to eq(200) - end - - it "test_upload_with_valid_expected_success" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - - upload = SUT.upload(file: "./fake_file.jpg", file_name: "my_file_name", response_fields: %w[is_private_file tags], tags: %w[abc def], use_unique_file_name: false) - - expect(@ac[:payload].to_json).to eq("{\"multipart\":true,\"file\":\"./fake_file.jpg\",\"fileName\":\"my_file_name\",\"responseFields\":\"is_private_file,tags\",\"tags\":\"abc,def\",\"useUniqueFileName\":\"false\"}") - - expect(upload[:status_code]).to eq(200) - - end - - it "test_upload_fails_on_invalid_options" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, message: nil}) - - SUT = file_api_service.new(request_obj) - expect{ - SUT.upload(file: "fake_file.jpg", file_name: "fake_name", invalid_option: "invalid_option" ) - }.to raise_error(ArgumentError) - end - - it "test_upload_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, message: nil}) - - SUT = file_api_service.new(request_obj) - upload = SUT.upload(file: "fake_file.jpg", file_name: "fake_name") - expect(@ac[:payload][:file]).to eq("fake_file.jpg") - expect(@ac[:payload][:fileName]).to eq("fake_name") - expect(upload[:status_code]).to eq(401) - end - - it "test_upload_with_valid_expected_success_with_transformation" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - - upload = SUT.upload(file: "./fake_file.jpg", file_name: "my_file_name", transformation: { pre: 'l-text,i-Imagekit,fs-50,l-end', post: [{type: 'transformation', value: 'w-100'}]}) - - expect(@ac[:payload]['transformation']).to eq("{\"pre\":\"l-text,i-Imagekit,fs-50,l-end\",\"post\":[{\"type\":\"transformation\",\"value\":\"w-100\"}]}") - - expect(upload[:status_code]).to eq(200) - - end - - it "test_upload_with_checks" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - - upload = SUT.upload(file: "./fake_file.jpg", file_name: "my_file_name", checks: '"file.size" < "1mb"') - - expect(@ac[:payload]['checks']).to eq('"file.size" < "1mb"') - - expect(upload[:status_code]).to eq(200) - - end - - it "test_upload_with_is_published" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - - SUT = file_api_service.new(request_obj) - - upload = SUT.upload(file: "./fake_file.jpg", file_name: "my_file_name", is_published: true ) - - expect(@ac[:payload]['isPublished']).to eq("true") - - expect(upload[:status_code]).to eq(200) - - end - - end - - describe 'FileListTest' do - it "test_list_files_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401}) - - SUT = file_api_service.new(request_obj) - resp = SUT.list("skip": 0, "limit": 10) - - expect(@ac[:payload].to_json).to eq("{\"skip\":0,\"limit\":10}") - expect(resp[:status_code]).to eq(401) - end - - it "test_list_files_succeeds_with_basic_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body:[]}) - - SUT = file_api_service.new(request_obj) - resp = SUT.list("skip": 0, "limit": 10) - expect(@ac[:payload].to_json).to eq("{\"skip\":0,\"limit\":10}") - expect(resp[:status_code]).to eq(200) - end - end - - describe 'FileVersionDetailTest' do - let(:success_response) { - "{\"fileId\":\"my_file_id\",\"name\":\"cat1.jpg\",\"size\":102117,\"versionInfo\":{\"id\":\"my_file_id\",\"name\":\"Version 2\"},\"filePath\":\"/cat1.jpg\",\"url\":\"https://ik.imagekit.io/app_id/cat1.jpg\",\"fileType\":\"image\",\"height\":700,\"width\":1050,\"thumbnailUrl\":\"https://ik.imagekit.io/app_id/tr:n-ik_ml_thumbnail/cat1.jpg\",\"tags\":[\"abc\",\"def\"],\"AITags\":null,\"isPrivateFile\":true,\"customCoordinates\":null,\"metadata\":{\"height\":700,\"width\":1050,\"size\":70842,\"format\":\"jpg\",\"hasColorProfile\":false,\"quality\":0,\"density\":72,\"hasTransparency\":false,\"exif\":{},\"pHash\":\"90249d9b1fc74367\"}}" - } - it 'test_get_file_version_detail_succeeds_with_id' do - request_client = double - allow_any_instance_of(ImageKitIo::Request) - .to receive(:create_headers) - .and_return({}) - allow(RestClient::Request) - .to receive(:new) - .and_return(request_client) - allow(request_client) - .to receive(:execute) - .and_return(OpenStruct.new(code: 200, - body: success_response, - content_type: "application/json" - )) - - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - resp = SUT.get_file_version_detail(file_id: "my_file_id", version_id: 'my_file_id') - expect(resp).to_not have_key(:error) - expect(resp[:response]).to have_key('versionInfo') - expect(resp[:response]['versionInfo']['id']).to eq('my_file_id') - end - - it 'test_get_file_version_detail_failed_without_file_id' do - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - expect{SUT.get_file_version_detail(version_id: 'file_version_id')}.to raise_error(ArgumentError, 'file_id is required') - end - - it 'test_get_file_version_detail_failed_without_version_id' do - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - expect{SUT.get_file_version_detail(file_id: 'my_file_id')}.to raise_error(ArgumentError, 'version_id is required') - end - end - - describe 'FileVersionsTest' do - let(:success_response) { - "[{\"type\":\"file\",\"name\":\"cat1.jpg\",\"createdAt\":\"2022-06-02T11:50:44.402Z\",\"updatedAt\":\"2022-06-14T15:44:12.300Z\",\"fileId\":\"my_file_id\",\"tags\":[\"abc\",\"def\"],\"AITags\":null,\"versionInfo\":{\"id\":\"my_file_id\",\"name\":\"Version 2\"},\"embeddedMetadata\":{\"DateCreated\":\"2022-06-14T15:44:12.299Z\",\"DateTimeCreated\":\"2022-06-14T15:44:12.299Z\"},\"customCoordinates\":null,\"customMetadata\":{},\"isPrivateFile\":true,\"url\":\"https://ik.imagekit.io/app_id/cat1.jpg\",\"thumbnail\":\"https://ik.imagekit.io/app_id/tr:n-ik_ml_thumbnail/cat1.jpg\",\"fileType\":\"image\",\"filePath\":\"/cat1.jpg\",\"height\":700,\"width\":1050,\"size\":102117,\"hasAlpha\":false,\"mime\":\"image/jpeg\"},{\"type\":\"file-version\",\"name\":\"cat1.jpg\",\"createdAt\":\"2022-06-14T15:44:10.910Z\",\"updatedAt\":\"2022-06-14T15:44:11.372Z\",\"fileId\":\"my_file_id\",\"tags\":[\"abc\",\"def\"],\"AITags\":null,\"versionInfo\":{\"id\":\"my_file_second_version_id\",\"name\":\"Version 1\"},\"embeddedMetadata\":{\"DateCreated\":\"2022-06-02T11:50:45.537Z\",\"DateTimeCreated\":\"2022-06-02T11:50:45.540Z\"},\"customCoordinates\":null,\"customMetadata\":{},\"isPrivateFile\":true,\"url\":\"https://ik.imagekit.io/app_id/cat1.jpg?ik-obj-version=ik_version_id\",\"thumbnail\":\"https://ik.imagekit.io/app_id/tr:n-ik_ml_thumbnail/cat1.jpg?ik-obj-version=ik_version_id\",\"fileType\":\"image\",\"filePath\":\"/cat1.jpg\",\"height\":700,\"width\":1050,\"size\":102117,\"hasAlpha\":false,\"mime\":\"image/jpeg\"}]" - } - it 'test_get_file_versions_succeeds_with_id' do - request_client = double - allow_any_instance_of(ImageKitIo::Request) - .to receive(:create_headers) - .and_return({}) - allow(RestClient::Request) - .to receive(:new) - .and_return(request_client) - allow(request_client) - .to receive(:execute) - .and_return(OpenStruct.new(code: 200, - body: success_response, - content_type: "application/json" - )) - - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - resp = SUT.get_file_versions(file_id: "my_file_id") - expect(resp).to_not have_key(:error) - expect(resp[:response]).to be_an_instance_of(Array) - expect(resp[:response].length).to eq(2) - expect(resp[:response][0]['versionInfo']['id']).to eq('my_file_id') - expect(resp[:response][0]['versionInfo']['name']).to eq('Version 2') - expect(resp[:response][1]['versionInfo']['id']).to eq('my_file_second_version_id') - expect(resp[:response][1]['versionInfo']['name']).to eq('Version 1') - end - - it 'test_get_file_version_failed_without_file_id' do - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - expect{SUT.get_file_versions}.to raise_error(ArgumentError) - end - end - - describe 'RestoreFileVersionTest' do - let(:success_response) { - "{\"type\":\"file\",\"name\":\"cat1.jpg\",\"createdAt\":\"2022-06-02T11:50:44.402Z\",\"updatedAt\":\"2022-06-14T16:20:06.258Z\",\"fileId\":\"my_file_id\",\"tags\":[\"abc\",\"def\"],\"AITags\":null,\"versionInfo\":{\"id\":\"my_second_version\",\"name\":\"Version 2\"},\"embeddedMetadata\":{\"DateCreated\":\"2022-06-02T11:50:45.537Z\",\"DateTimeCreated\":\"2022-06-02T11:50:45.540Z\"},\"customCoordinates\":null,\"customMetadata\":{},\"isPrivateFile\":true,\"url\":\"https://ik.imagekit.io/app_id/cat1.jpg\",\"thumbnail\":\"https://ik.imagekit.io/app_id/tr:n-ik_ml_thumbnail/cat1.jpg\",\"fileType\":\"image\",\"filePath\":\"/cat1.jpg\",\"height\":700,\"width\":1050,\"size\":102117,\"hasAlpha\":false,\"mime\":\"image/jpeg\"}" - } - it 'test_restore_file_version_succeeds_with_id' do - request_client = double - allow_any_instance_of(ImageKitIo::Request) - .to receive(:create_headers) - .and_return({}) - allow(RestClient::Request) - .to receive(:new) - .and_return(request_client) - allow(request_client) - .to receive(:execute) - .and_return(OpenStruct.new(code: 200, - body: success_response, - content_type: "application/json" - )) - - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - resp = SUT.restore_file_version(file_id: "my_file_id", version_id: 'my_second_version') - expect(resp).to_not have_key(:error) - expect(resp[:response]['versionInfo']['id']).to eq('my_second_version') - expect(resp[:response]['versionInfo']['name']).to eq('Version 2') - end - - it 'test_restore_file_version_failed_without_file_id' do - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - expect{SUT.restore_file_version(version_id: 'my_file_version_id')}.to raise_error(ArgumentError, 'file_id is required') - end - - it 'test_restore_file_version_failed_without_version_id' do - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - expect{SUT.restore_file_version(file_id: 'my_file_id')}.to raise_error(ArgumentError, 'version_id is required') - end - end - - describe 'DeleteFileVersionTest' do - let(:success_response) { - "{\"success\":true}" - } - it 'test_restore_file_version_succeeds_with_id' do - request_client = double - allow_any_instance_of(ImageKitIo::Request) - .to receive(:create_headers) - .and_return({}) - allow(RestClient::Request) - .to receive(:new) - .and_return(request_client) - allow(request_client) - .to receive(:execute) - .and_return(OpenStruct.new(code: 200, - body: success_response, - content_type: "application/json" - )) - - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - resp = SUT.delete_file_version(file_id: "my_file_id", version_id: 'my_second_version') - expect(resp).to_not have_key(:error) - expect(resp[:response]['success']).to eq(true) - end - - it 'test_delete_file_version_without_file_id' do - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - expect{SUT.delete_file_version(version_id: 'my_file_version_id')}.to raise_error(ArgumentError, 'file_id is required') - end - - it 'test_delete_file_version_failed_without_version_id' do - imagekit_request = ImageKitIo::Request.new(private_key, public_key, url_endpoint) - SUT = file_api_service.new(imagekit_request) - expect{SUT.delete_file_version(file_id: 'my_file_id')}.to raise_error(ArgumentError, 'version_id is required') - end - end - - describe 'FileDetailTest' do - it "test_get_file_details_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body:{message: "Unauthorized request!"}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.details(file_identifier: "demo-file-id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/demo-file-id/details/") - expect(resp[:status_code]).to eq(401) - expect(resp[:body][:message]).to eq("Unauthorized request!") - end - - it "test_file_details_succeeds_with_id" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: {fileId: "demo-file-id"}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.details(file_identifier: "demo-file-id") - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/demo-file-id/details/") - expect(resp[:status_code]).to eq(200) - end - end - - describe 'TestDeleteFile' do - it "test_file_delete_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body: {fileId: "demo-file-id"}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.delete(file_id: "demo-file-id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/demo-file-id") - expect(@ac[:method]).to eq("delete") - expect(resp[:status_code]).to eq(401) - end - - it "test_file_delete_fails_on_item_not_found" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 204, body: {fileId: "demo-file-id"}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.delete(file_id: "demo-file-id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/demo-file-id") - expect(@ac[:method]).to eq("delete") - expect(resp[:status_code]).to eq(204) - end - - it "test_file_delete_succeeds" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: {fileId: "demo-file-id"}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.delete(file_id: "demo-file-id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/demo-file-id") - expect(@ac[:method]).to eq("delete") - expect(resp[:status_code]).to eq(200) - - end - end - - describe 'TestPurgeCache' do - it "test_purge_cache_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body: {}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.purge_cache(file_url: "file_url") - - expect(@ac[:payload].to_json).to eq("{\"url\":\"file_url\"}") - expect(resp[:status_code]).to eq(401) - end - - it "test_purge_cache_succeeds" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: {requestId:"requestId"}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.purge_cache(file_url: "file_url") - - expect(@ac[:payload].to_json).to eq("{\"url\":\"file_url\"}") - expect(resp[:status_code]).to eq(200) - expect(resp[:body][:requestId]).to eq("requestId") - end - end - - describe 'TestPurgeCacheStatus' do - it "test_get_purge_cache_status_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body: {}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.purge_cache_status(request_id: "request-id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/purge/request-id") - expect(resp[:status_code]).to eq(401) - - end - - it "test_purge_cache_status_succeeds" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: {status: "Complete"}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.purge_cache_status(request_id: "request-id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/purge/request-id") - expect(resp[:status_code]).to eq(200) - expect(resp[:body][:status]).to eq("Complete") - end - end - - describe 'TestGetMetaData' do - it "test_get_metadata_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body: {}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.get_metadata(file_id: "file_id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/file_id/metadata") - expect(resp[:status_code]).to eq(401) - - end - - it 'raises error when parameter not provided' do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: {}}) - - SUT = file_api_service.new(request_obj) - expect { - SUT.get_metadata - }.to raise_error(ArgumentError) - end - - it "test_get_metadata_succeeds" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: {}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.get_metadata(file_id: "file_id") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/file_id/metadata") - expect(resp[:status_code]).to eq(200) - end - end - - describe 'TestUpdateFileDetails' do - it "test_details_fails_on_unauthenticated_request" do - - options = {"tags": %w[tag1 tag2], "custom_coordinates": "10,10,100,100"} - - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body: {}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.update_details(file_id: "file_id", **options) - expect(@ac[:payload]).to eq("{\"tags\":[\"tag1\",\"tag2\"],\"customCoordinates\":\"10,10,100,100\"}") - expect(resp[:status_code]).to eq(401) - - end - - it "test_update_file_details_succeeds_with_id" do - options = {tags: %w[tag1 tag2], "custom_coordinates": "10,10,100,100"} - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: options}) - - SUT = file_api_service.new(request_obj) - resp = SUT.update_details(file_id: "file_id", **options) - - expect(JSON.parse(@ac[:payload])['tags']).to eq(options[:tags]) - expect(JSON.parse(@ac[:payload])['customCoordinates']).to eq(options[:custom_coordinates]) - expect(resp[:status_code]).to eq(200) - expect(resp[:body]).to eq(options) - end - - it "test_update_file_publication_status" do - options = { publish: { isPublished: true, includeFileVersions: true }} - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: options}) - - SUT = file_api_service.new(request_obj) - resp = SUT.update_details(file_id: "file_id", **options) - - expect(JSON.parse(@ac[:payload])['publish']['isPublished']).to eq(options[:publish][:isPublished]) - expect(JSON.parse(@ac[:payload])['publish']['isPublished']).to eq(options[:publish][:includeFileVersions]) - expect(resp[:status_code]).to eq(200) - expect(resp[:body]).to eq(options) - end - - it "test_update_file_details_fails_missing_arguments" do - options = { tags: 'custom tag' } - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: options}) - - SUT = file_api_service.new(request_obj) - expect { - SUT.update_details(file_id: "file_id", **options) - }.to raise_error(ArgumentError) - end - - it "test_update_file_details_fails_tags_not_an_array" do - options = {tags: "RANDOM_TEXT", "custom_coordinates": "10,10,100,100"} - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: options}) - - SUT = file_api_service.new(request_obj) - expect { - SUT.update_details(file_id: "file_id", **options) - }.to raise_error(ArgumentError) - end - - it "test_update_file_details_fails_custom_coordinates_not_a_string" do - options = {"custom_coordinates": %w[random]} - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: options}) - - SUT = file_api_service.new(request_obj) - expect { - SUT.update_details(file_id: "file_id", **options) - }.to raise_error(ArgumentError) - end - - it "test_update_file_details_expected_success_with_extensions" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - SUT = file_api_service.new(request_obj) - upload = SUT.update_details(file_id: "file_id_xyz", extensions: [ - { - 'name': 'google-auto-tagging', - 'maxTags': 5, - 'minConfidence': 95 - } - ]) - expect(@ac[:payload]).to eq("{\"extensions\":[{\"name\":\"google-auto-tagging\",\"maxTags\":5,\"minConfidence\":95}]}") - expect(upload[:status_code]).to eq(200) - end - - it "test_update_with_valid_expected_success_with_customMetadata" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - @ac={} - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200}) - SUT = file_api_service.new(request_obj) - upload = SUT.update_details( - file_id: "file_id_xyz", - custom_metadata: { - brand: 'Nike', - color: 'red' - } - ) - expect(@ac[:payload]).to eq("{\"customMetadata\":{\"brand\":\"Nike\",\"color\":\"red\"}}") - expect(upload[:status_code]).to eq(200) - end - end - - describe 'TestGetRemoteFileURLMetaData' do - it "test_get_metadata_from_remote_url_fails_on_unauthenticated_request" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body: {}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.get_metadata_from_remote_url(remote_file_url: "http://example.com/fakefileurl") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/metadata?url=http://example.com/fakefileurl") - expect(resp[:status_code]).to eq(401) - end - - it "test_get_metadata_from_remote_url_fails_on_blank_url" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 401, body: {}}) - - SUT = file_api_service.new(request_obj) - expect { - SUT.get_metadata_from_remote_url(remote_file_url: "") - }.to raise_error(ArgumentError) - end - - it "test_get_metadata_from_remote_url_succeeds" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({status_code: 200, body: {}}) - - SUT = file_api_service.new(request_obj) - resp = SUT.get_metadata_from_remote_url(remote_file_url: "http://example.com/fakefileurl") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/metadata?url=http://example.com/fakefileurl") - expect(resp[:status_code]).to eq(200) - end - end - - context 'copy' do - let!(:req_obj) { double } - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 200, body: { success: true }}) - @sut = file_api_service.new(req_obj) - end - - it 'raises error when parameter not provided' do - expect { - @sut.copy(source_file_path: '', destination_path: nil) - }.to raise_error(ArgumentError) - - end - - it 'test_copy' do - source_file = 'test/dummy.png' - destination_path = '/my_image' - resp = @sut.copy(source_file_path: source_file, destination_path: destination_path) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/copy") - expect(@ac[:payload]).to eq("{\"sourceFilePath\":\"test/dummy.png\",\"destinationPath\":\"/my_image\",\"includeFileVersions\":false}") - expect(resp[:status_code]).to eq(200) - resp = @sut.copy(source_file_path: source_file, destination_path: destination_path, include_file_versions: true) - expect(@ac[:payload]).to eq("{\"sourceFilePath\":\"test/dummy.png\",\"destinationPath\":\"/my_image\",\"includeFileVersions\":true}") - expect(resp[:status_code]).to eq(200) - end - end - - context 'move' do - let!(:req_obj) { double } - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 200, body: { success: true }}) - @sut = file_api_service.new(req_obj) - end - - it 'raises error when parameter not provided' do - expect { - @sut.move(source_file_path: '', destination_path: nil) - }.to raise_error(ArgumentError) - - end - - it 'test_move' do - source_file = 'test/dummy.png' - destination_path = '/my_image' - resp = @sut.move(source_file_path: source_file, destination_path: destination_path) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/move") - expect(@ac[:payload]).to eq({:sourceFilePath=>"test/dummy.png", :destinationPath=>"/my_image"}) - expect(resp[:status_code]).to eq(200) - end - end - - context 'rename' do - let!(:req_obj) { double } - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 200, body: { success: true }}) - @sut = file_api_service.new(req_obj) - end - - it 'raises error when parameter not provided' do - expect { - @sut.rename(file_path: '', new_file_name: nil) - }.to raise_error(ArgumentError) - - end - - it 'test_rename' do - source_file = 'test/dummy.png' - new_name = 'my_image.png' - resp = @sut.rename(file_path: source_file, new_file_name: new_name) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/files/rename") - expect(@ac[:payload]).to eq("{\"filePath\":\"test/dummy.png\",\"newFileName\":\"my_image.png\"}") - expect(@ac[:method]).to eq('put') - expect(resp[:status_code]).to eq(200) - end - - it 'test_rename with the option purge_cache' do - source_file = 'test/dummy.png' - new_name = 'my_image.png' - resp = @sut.rename(file_path: source_file, new_file_name: new_name, purge_cache: true) - expect(@ac[:payload]).to eq("{\"filePath\":\"test/dummy.png\",\"newFileName\":\"my_image.png\",\"purgeCache\":true}") - end - end - - context 'stream file' do - let!(:req_obj) { double } - - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - allow(req_obj) - .to receive(:request_stream){|method,url,headers, &block| @ac={method: method, url: url, headers: headers, block: block}} - .and_return({status_code: 200, body: { success: true }}) - @sut = file_api_service.new(req_obj) - end - - it 'raises error when parameter not provided' do - expect { - @sut.stream_file - }.to raise_error(ArgumentError) - end - - it 'test_stream_file' do - remote_file_url = 'https://ik.imagekit.io/kcdfvxhgfkn/testing_Hx_I_Ys_c.jpg' - block = proc { - puts 'block given' - } - @sut.stream_file(remote_file_url: remote_file_url, &block) - - expect(@ac[:block].is_a?(Proc)).to be(true) - expect(@ac[:url]).to eq(remote_file_url) - end - end -end diff --git a/test/imagekit/api_service/folder_test.rb b/test/imagekit/api_service/folder_test.rb deleted file mode 100644 index ba42c4d2..00000000 --- a/test/imagekit/api_service/folder_test.rb +++ /dev/null @@ -1,127 +0,0 @@ -require_relative '../spec_helper' - -RSpec.describe ImageKitIo::ApiService::Folder do - let(:folder_api_service) { described_class } - let(:config) { ImageKitIo.config } - let(:constants) { ImageKitIo.constants } - let!(:private_key) { config.private_key } - let!(:public_key) { config.public_key } - let!(:url_endpoint) { config.url_endpoint } - - context 'folder' do - let!(:req_obj) { double } - before do - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(req_obj) - allow(req_obj) - .to receive(:create_headers) - .and_return({}) - end - - context 'create' do - it 'raises error when parameter not provided' do - @sut = folder_api_service.new(req_obj) - expect { - @sut.create('', nil) - }.to raise_error(ArgumentError) - end - - it 'test_create_folder' do - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 201, body: { success: true }}) - @sut = folder_api_service.new(req_obj) - folder_name = 'test_folder' - parent_folder = '' - resp = @sut.create(folder_name: folder_name, parent_folder_path: parent_folder) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/folder") - expect(@ac[:payload]).to eq("{\"folderName\":\"test_folder\",\"parentFolderPath\":\"\"}") - expect(@ac[:method]).to eq('post') - expect(resp[:status_code]).to eq(201) - end - end - - context 'delete' do - it 'raises error when parameter not provided' do - @sut = folder_api_service.new(req_obj) - expect { - @sut.delete - }.to raise_error(ArgumentError) - end - - it 'test_delete_folder' do - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 204, body: { success: true }}) - @sut = folder_api_service.new(req_obj) - folder_path = 'test_folder' - resp = @sut.delete(folder_path: folder_path) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/folder") - expect(@ac[:method]).to eq('delete') - expect(resp[:body][:success]).to be(true) - end - end - - context 'copy' do - it 'raises error when parameter not provided' do - @sut = folder_api_service.new(req_obj) - expect { - @sut.copy - }.to raise_error(ArgumentError) - end - - it 'test_copy_folder' do - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 200, body: { jobId: '123456' }}) - @sut = folder_api_service.new(req_obj) - source_folder = 'my_folder' - destination_path = 'copied' - resp = @sut.copy(source_folder_path: source_folder, destination_path: destination_path) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/bulkJobs/copyFolder") - expect(@ac[:method]).to eq('post') - expect(@ac[:payload]).to eq("{\"sourceFolderPath\":\"my_folder\",\"destinationPath\":\"copied\",\"includeFileVersions\":false}") - expect(resp[:body][:jobId]).to eq('123456') - end - - it 'test_copy_folder_with_include_versions_parameter' do - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 200, body: { jobId: '123456' }}) - @sut = folder_api_service.new(req_obj) - source_folder = 'my_folder' - destination_path = 'copied' - resp = @sut.copy(source_folder_path: source_folder, destination_path: destination_path, include_file_versions: true) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/bulkJobs/copyFolder") - expect(@ac[:method]).to eq('post') - expect(@ac[:payload]).to eq("{\"sourceFolderPath\":\"my_folder\",\"destinationPath\":\"copied\",\"includeFileVersions\":true}") - expect(resp[:body][:jobId]).to eq('123456') - end - end - - context 'move' do - it 'raises error when parameter not provided' do - @sut = folder_api_service.new(req_obj) - expect { - @sut.copy - }.to raise_error(ArgumentError) - end - - it 'test_move_folder' do - allow(req_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload: payload}} - .and_return({status_code: 200, body: { jobId: '123456' }}) - @sut = folder_api_service.new(req_obj) - source_folder = 'my_folder/inside_folder' - destination_path = 'moved/inside_another_folder' - resp = @sut.move(source_folder_path: source_folder, destination_path: destination_path) - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/bulkJobs/moveFolder") - expect(@ac[:method]).to eq('post') - expect(@ac[:payload]).to eq({:sourceFolderPath=>"my_folder/inside_folder", :destinationPath=>"moved/inside_another_folder"}) - expect(resp[:body][:jobId]).to eq('123456') - end - end - end -end diff --git a/test/imagekit/client_test.rb b/test/imagekit/client_test.rb index 33c13832..22cda48d 100644 --- a/test/imagekit/client_test.rb +++ b/test/imagekit/client_test.rb @@ -1,409 +1,405 @@ -require_relative './spec_helper' -require 'rspec/autorun' - -RSpec.describe ImageKitIo::Client do - let(:subject) { described_class } - let!(:public_key) { 'public_xyz' } - let!(:private_key) { 'private_xyz' } - let!(:url_endpoint) { 'https://imagekit.io/your-imgekit-id' } - let(:constants) { ImageKitIo.constants } - - it "test_initialization_with_private_key_missing" do - request_obj = double - expect { - subject.new(" ", public_key, url_endpoint) - }.to raise_error(ArgumentError, constants.MISSING_PRIVATE_KEY) - end +# frozen_string_literal: true - it "test_initialization_with_non_string_private_key" do - request_obj = double - expect { - subject.new({ RANDOM: "RANDOM"}, public_key, url_endpoint) - }.to raise_error(ArgumentError, constants.MISSING_PRIVATE_KEY) - end +require_relative "test_helper" - it "test_initialization_with_public_key_missing" do - request_obj = double - expect { - subject.new(private_key, " ", url_endpoint) - }.to raise_error(ArgumentError, constants.MISSING_PUBLIC_KEY) - end +class ImagekitTest < Minitest::Test + extend Minitest::Serial + include WebMock::API - it "test_initialization_with_non_string_public_key" do - request_obj = double - expect { - subject.new(private_key, { RANDOM: "RANDOM"}, url_endpoint) - }.to raise_error(ArgumentError, constants.MISSING_PUBLIC_KEY) + def before_all + super + WebMock.enable! end - it "test_initialization_with_url_endpoint_missing" do - request_obj = double - expect { - subject.new(private_key, public_key, " ") - }.to raise_error(ArgumentError, constants.MISSING_URL_ENDPOINT) + def setup + super + Thread.current.thread_variable_set(:mock_sleep, []) end - it "test_initialization_with_non_string_url_endpoint" do - request_obj = double - expect { - subject.new(private_key, public_key, { RANDOM: "RANDOM"}) - }.to raise_error(ArgumentError, constants.MISSING_URL_ENDPOINT) + def teardown + Thread.current.thread_variable_set(:mock_sleep, nil) + WebMock.reset! + super end - context 'FileUploadTest' do - it "test_upload_with_valid_expected_success" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) - - upload = SUT.upload_file(file: "fakefile.jpg", file_name: "fake", content_type: 'image/jpeg') + def after_all + WebMock.disable! + super + end - expect(upload[:code]).to eq(200) + def test_raises_on_missing_non_nullable_opts + e = assert_raises(ArgumentError) do + Imagekit::Client.new end + assert_match(/is required/, e.message) + end + def test_client_default_request_default_retry_attempts + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 500, body: {}) - it "test_list_files_with_valid_expected_success" do - # test list_files method - - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) - - file_list = SUT.list_files + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) - expect(file_list[:code]).to eq(200) + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end - it "test_file_versions_with_valid_expected_success" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) + assert_requested(:any, /./, times: 3) + end - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) + def test_client_given_request_default_retry_attempts + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 500, body: {}) - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - resp = SUT.file_versions(file_id: 'my_new_file_id') + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password", + max_retries: 3 + ) - expect(resp[:code]).to eq(200) + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end - it "test_file_version_detail_with_valid_expected_success" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - resp = SUT.file_version_detail(file_id: 'my_new_file_id', version_id: 'my_file_version_id') + assert_requested(:any, /./, times: 4) + end - expect(resp[:code]).to eq(200) + def test_client_default_request_given_retry_attempts + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 500, body: {}) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) + + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {max_retries: 3} + ) end - it "test_delete_file_version_with_valid_expected_success" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - resp = SUT.delete_file_version(file_id: 'my_new_file_id', version_id: 'my_file_version_id') + assert_requested(:any, /./, times: 4) + end - expect(resp[:code]).to eq(200) + def test_client_given_request_given_retry_attempts + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 500, body: {}) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password", + max_retries: 3 + ) + + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {max_retries: 4} + ) end - it "test_restore_file_version_with_valid_expected_success" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - resp = SUT.restore_file_version(file_id: 'my_new_file_id', version_id: 'my_file_version_id') + assert_requested(:any, /./, times: 5) + end - expect(resp[:code]).to eq(200) + def test_client_retry_after_seconds + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json( + status: 500, + headers: {"retry-after" => "1.3"}, + body: {} + ) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password", + max_retries: 1 + ) + + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end - it "test_get_file_details_with_valid_expected_success" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) - - file_detail = SUT.get_file_details(file_id: "http://example.com/fake.jpg") + assert_requested(:any, /./, times: 2) + assert_equal(1.3, Thread.current.thread_variable_get(:mock_sleep).last) + end - expect(file_detail[:code]).to eq(200) + def test_client_retry_after_date + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json( + status: 500, + headers: {"retry-after" => (Time.now + 10).httpdate}, + body: {} + ) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password", + max_retries: 1 + ) + + assert_raises(Imagekit::Errors::InternalServerError) do + Thread.current.thread_variable_set(:time_now, Time.now) + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + Thread.current.thread_variable_set(:time_now, nil) end - it "test_update_file_details_with_valid_expected_success" do - - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) - - upload = SUT.update_file_details(file_id: "fake_id", tags: ["image_tag"], - custom_coordinates: "10,10,100, 100") + assert_requested(:any, /./, times: 2) + assert_in_delta(10, Thread.current.thread_variable_get(:mock_sleep).last, 1.0) + end - expect(upload[:code]).to eq(200) + def test_client_retry_after_ms + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json( + status: 500, + headers: {"retry-after-ms" => "1300"}, + body: {} + ) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password", + max_retries: 1 + ) + + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end - it "test_delete_file_with_valid_expected_success" do - # test for delete_file - - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) + assert_requested(:any, /./, times: 2) + assert_equal(1.3, Thread.current.thread_variable_get(:mock_sleep).last) + end - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) + def test_retry_count_header + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 500, body: {}) - delete_resp = SUT.delete_file(file_id: "fake_id") + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) - expect(delete_resp[:code]).to eq(200) + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end - it "test_get_file_metadata_valid_expected_success" do - # test for get_file_metadata - - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) - - resp = SUT.get_file_metadata(file_id: "fake_id") - - expect(resp[:code]).to eq(200) + 3.times do + assert_requested(:any, /./, headers: {"x-stainless-retry-count" => _1}) end + end - it "test_get_metadata_from_remote_url_succeeds" do - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request){|method,url,headers,payload| @ac={method: method, url: url, headers: headers, payload:payload}} - .and_return({code: 200, body: {}}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) - - resp = SUT.get_remote_file_url_metadata(remote_file_url: "http://example.com/fakefileurl") - - expect(@ac[:url]).to eq("https://api.imagekit.io/v1/metadata?url=http://example.com/fakefileurl") - expect(resp[:code]).to eq(200) + def test_omit_retry_count_header + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 500, body: {}) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) + + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {"x-stainless-retry-count" => nil}} + ) end - it "test_purge_file_cache_valid_expected_success" do - # test for get_purge_file_cache - - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) - - resp = SUT.purge_file_cache(file_url: "http://example.com/fake.jpg") - - expect(resp[:code]).to eq(200) + assert_requested(:any, /./, times: 3) do + refute_includes(_1.headers.keys.map(&:downcase), "x-stainless-retry-count") end + end - it "test_purge_file_cache_status_valid_expected_success" do - # test for get_purge_file_cache - - request_obj = double - allow(ImageKitIo::Request) - .to receive(:new) - .with(private_key, public_key, url_endpoint) - .and_return(request_obj) - - allow(request_obj) - .to receive(:create_headers) - .and_return({}) - - allow(request_obj) - .to receive(:request) - .and_return({code: 200}) - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) + def test_overwrite_retry_count_header + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 500, body: {}) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) + + assert_raises(Imagekit::Errors::InternalServerError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {"x-stainless-retry-count" => "42"}} + ) + end - resp = SUT.purge_file_cache_status(request_id: "fake_id") + assert_requested(:any, /./, headers: {"x-stainless-retry-count" => "42"}, times: 3) + end - expect(resp[:code]).to eq(200) + def test_client_redirect_307 + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json( + status: 307, + headers: {"location" => "/redirected"}, + body: {} + ) + stub_request(:any, "http://localhost/redirected").to_return( + status: 307, + headers: {"location" => "/redirected"} + ) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) + + assert_raises(Imagekit::Errors::APIConnectionError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {}} + ) end - it "test_phash_distance_fails_if_not_hexa" do - # test for get_purge_file_cache + recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first - request_obj = double - - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) + assert_requested(:any, "http://localhost/redirected", times: Imagekit::Client::MAX_REDIRECTS) do + assert_equal(recorded.method, _1.method) + assert_equal(recorded.body, _1.body) + assert_equal( + recorded.headers.transform_keys(&:downcase).fetch("content-type"), + _1.headers.transform_keys(&:downcase).fetch("content-type") + ) + end + end - expect { - SUT.phash_distance("f06830ca9f1e3e90", "RANDOM") - }.to raise_error(ArgumentError) + def test_client_redirect_303 + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json( + status: 303, + headers: {"location" => "/redirected"}, + body: {} + ) + stub_request(:get, "http://localhost/redirected").to_return( + status: 303, + headers: {"location" => "/redirected"} + ) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) + + assert_raises(Imagekit::Errors::APIConnectionError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {}} + ) end - it "test_phash_distance_fails_if_argument_missing" do + assert_requested(:get, "http://localhost/redirected", times: Imagekit::Client::MAX_REDIRECTS) do + headers = _1.headers.keys.map(&:downcase) + refute_includes(headers, "content-type") + assert_nil(_1.body) + end + end - request_obj = double + def test_client_redirect_auth_keep_same_origin + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json( + status: 307, + headers: {"location" => "/redirected"}, + body: {} + ) + stub_request(:any, "http://localhost/redirected").to_return( + status: 307, + headers: {"location" => "/redirected"} + ) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) + + assert_raises(Imagekit::Errors::APIConnectionError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {"authorization" => "Bearer xyz"}} + ) + end - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) - SUT.set_ik_request(request_obj) + recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first + auth_header = recorded.headers.transform_keys(&:downcase).fetch("authorization") - expect { - SUT.phash_distance("f06830ca9f1e3e90", " ") - }.to raise_error(ArgumentError) + assert_equal("Bearer xyz", auth_header) + assert_requested(:any, "http://localhost/redirected", times: Imagekit::Client::MAX_REDIRECTS) do + auth_header = _1.headers.transform_keys(&:downcase).fetch("authorization") + assert_equal("Bearer xyz", auth_header) end + end - it "test_generate_url_with_path" do - # request_obj=ImageKitIo::Request.new(@private_key,@public_key,@url_endpoint) - # url_obj = Url.new(request_obj) + def test_client_redirect_auth_strip_cross_origin + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json( + status: 307, + headers: {"location" => "https://example.com/redirected"}, + body: {} + ) + stub_request(:any, "https://example.com/redirected").to_return( + status: 307, + headers: {"location" => "https://example.com/redirected"} + ) + + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) + + assert_raises(Imagekit::Errors::APIConnectionError) do + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {"authorization" => "Bearer xyz"}} + ) + end - SUT = ImageKitIo::Client.new(private_key, public_key, url_endpoint) + assert_requested(:any, "https://example.com/redirected", times: Imagekit::Client::MAX_REDIRECTS) do + headers = _1.headers.keys.map(&:downcase) + refute_includes(headers, "authorization") + end + end - options = {path: "/default-image.jpg", - url_endpoint: url_endpoint, - transformation: [{height: 300, width: 400}], - } - url = SUT.url(options) + def test_default_headers + stub_request(:post, "http://localhost/api/v1/files/upload").to_return_json(status: 200, body: {}) - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/default-image.jpg") - end + image_kit = + Imagekit::Client.new( + base_url: "http://localhost", + private_api_key: "My Private API Key", + password: "My Password" + ) - it "get_authentication_params_test_with_hard_coded_params" do - SUT = ImageKitIo::Client.new('private_key_test', public_key, url_endpoint) - # SUT.set_ik_request(request_obj) + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") - result=SUT.get_authentication_parameters('your_token',1582269249) - expect('your_token').to eq(result[:token]) - expect(nil).not_to eq(result[:expire]) - expect('e71bcd6031016b060d349d212e23e85c791decdd').to eq(result[:signature]) + assert_requested(:any, /./) do |req| + headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type") + headers.each { refute_empty(_1) } end end end diff --git a/test/imagekit/configuration_test.rb b/test/imagekit/configuration_test.rb deleted file mode 100644 index 74db598b..00000000 --- a/test/imagekit/configuration_test.rb +++ /dev/null @@ -1,64 +0,0 @@ -require_relative './spec_helper' -require 'rspec/autorun' - -RSpec.describe ImageKitIo::Configurable do - let(:configurable_obj) { Class.new.send :include, ImageKitIo::Configurable} - - describe 'Configuration' do - it 'configure with the keys' do - configurable_obj.configure do |config| - config.public_key = 'public_key_123' - end - expect(configurable_obj.config.public_key).to eq('public_key_123') - # test the default service - expect(configurable_obj.config.service).to eq(:carrierwave) - end - - it 'configure without keys' do - expect(configurable_obj.config.service).to eq(:carrierwave) - expect(configurable_obj.config.private_key).to eq(nil) - end - - context 'constants' do - let(:constants) { configurable_obj.constants} - - it 'returns constant class' do - expect(constants).to eq(ImageKitIo::Constant) - end - - it "returns default key's value" do - expect(constants.BASE_URL).to eq("https://api.imagekit.io/v1/files") - end - - it "supports customization" do - constants.TIMESTAMP = '88888' - expect(constants.TIMESTAMP).to eq('88888') - configurable_obj.configure do |config| - config.constants.TIMESTAMP = '5555' - end - expect(configurable_obj.constants.TIMESTAMP).to eq('5555') - end - end - - context 'services' do - it 'configures carrierwave by default' do - expect(configurable_obj.config.service).to eq(:carrierwave) - expect(configurable_obj).to receive(:require_relative).with('../carrierwave/carrierwave') - expect(configurable_obj).to_not receive(:require_relative).with('../active_storage/active_storage') - configurable_obj.configure do |config| - config.private_key = 'private_key_123' - end - end - - it 'supports active_storage configuration' do - expect(configurable_obj).to_not receive(:require_relative).with('../carrierwave/carrierwave') - expect(configurable_obj).to receive(:require_relative).with('../active_storage/active_storage') - configurable_obj.configure do |config| - config.private_key = 'private_key_123' - config.service = :active_storage - end - expect(configurable_obj.config.service).to eq(:active_storage) - end - end - end -end diff --git a/test/imagekit/constant_test.rb b/test/imagekit/constant_test.rb deleted file mode 100644 index dbb0bcc4..00000000 --- a/test/imagekit/constant_test.rb +++ /dev/null @@ -1,17 +0,0 @@ -require_relative './spec_helper' -require 'rspec/autorun' - -RSpec.describe ImageKitIo::Constantable do - let(:constantable_class) { ImageKitIo::Constant } - - it 'defines the constants method in included class' do - constantable_obj = Class.new.send(:include, ImageKitIo::Constantable) - expect(constantable_obj).to receive(:constants).and_return(true) - constantable_obj.constants - end - - it "returns the defined constant's value" do - expect(constantable_class).to receive(:method_missing).and_call_original - expect(constantable_class.BASE_URL).to eq("https://api.imagekit.io/v1/files") - end -end diff --git a/test/imagekit/dummy_data/data.rb b/test/imagekit/dummy_data/data.rb deleted file mode 100644 index cf655e2c..00000000 --- a/test/imagekit/dummy_data/data.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -PRIVATE_KEY = "private_xyz" -PUBLIC_KEY = "public_xyz" -URL_ENDPOINT = "imagekit.io/your-imgekit-id/" diff --git a/test/imagekit/dummy_data/file.rb b/test/imagekit/dummy_data/file.rb deleted file mode 100644 index 67be48ed..00000000 --- a/test/imagekit/dummy_data/file.rb +++ /dev/null @@ -1,60 +0,0 @@ -FAILED_GENERIC_RESP = {"message": "Hi There is an error"} -SUCCESS_GENERIC_RESP = {"response": "Success"} -AUTHENTICATION_ERR_MSG = { - "message": "Your account cannot be authenticated.", - "help": "For support kindly contact us at support@imagekit.io .", -} -FAILED_DELETE_RESP = {"message": "Item Not Found"} - -SUCCESS_PURGE_CACHE_MSG = {"request_id": "fake_abc_xyz"} - -SUCCESS_PURGE_CACHE_STATUS_MSG = {"status": "pending"} - -SERVER_ERR_MSG = { - "message": "We have experienced an internal error while processing your request.", - "help": "For support kindly contact us at support@imagekit.io .", -} - -SUCCESS_LIST_RESP_MESSAGE = { - "response": [ - { - "type": "file", - "name": "default-image.jpg", - "fileId": "53dgd6023f28ft7fse488992c", - "tags": None, - "customCoordinates": None, - "isPrivateFile": None, - "url": "https://ik.imagekit.io/fakeid/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/fakeid/tr:n-media_library_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - }, - { - "type": "file", - "name": "default-image.jpg", - "fileId": "53dgd6023f28ft7fse488992c", - "tags": None, - "customCoordinates": None, - "isPrivateFile": None, - "url": "https://ik.imagekit.io/fakeid/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/fakeid/tr:n-media_library_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - }, - ], -} - -SUCCESS_DETAIL_MSG = { - "response": { - "type": "file", - "name": "default-image.jpg", - "fileId": "53dgd6023f28ft7fse488992c", - "tags": None, - "customCoordinates": None, - "isPrivateFile": None, - "url": "https://ik.imagekit.io/fakeid/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/fakeid/tr:n-media_library_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - } -} diff --git a/test/imagekit/dummy_data/sample.jpg b/test/imagekit/dummy_data/sample.jpg deleted file mode 100644 index 1db39e04b4ccf009cf0d4503a684ca75e8e2c3d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 102117 zcmbTd2UL^K_BQ&4q7+d;q)8Q!4oW9<5D<_qy@>%r5s)rOQxTOaB_Jgry@L=DL;VR- zLx^;c5)nfPAPAvI^}e2S*Z-V**ZRI&CakQ7nR$~vGkf;z{mjmvnLpnEMngRVJpclM z0Jp&x@aOvlTLT>(7c&b}J%c;CU;_YLxP8aV&!2)30DS#|11hJ}Do&Mtgl>I3H{3HMvm%MGp$M>K5|5u0!_AoFQ03c>y zZ&^3@AQ*__K>Q#q_~GCBUm#|=@ADT^Q2oV$pnxD||BK=O#uESP^KY#A7rXiTxq*HD z%KXsH*X=L<4C0reA?_fiyaVF+P%rl|5Kn+u@Ii>L7l?m@n8nxKH3$HxF8r+zc87U_ z_y&kC1m3mK0kJ9o&|HB37ry^rIN1FWC?^2u_&*E}^n!Z^^NGMj`EDvJEAicS4}0Jq z94u+(3iELdbmPwum7nNdtH^w1UN&L{bQSK|NQ5B`@}|0Rcng}aA)pt~RVRo0-EdHKP?<@R&) z3ik5%bZ|0iq zxK1HWp+uoYVMKA4!ifS-5kL_^5l4|i@rI(9qL$(V#U~03#U#Zyigk)TN`R7{l9iI5 zQj$`MQisx%(w@?TGLSNwGJ!ISvY4`-vX!!*a-8xTbqB^5ypyr|$r-o7+P}@?&sl%w_sk5ldshg>LsVAuk z)cfboont*Gd`|J)?Q?eLyw5#8mvjz!uHoE2=SI&hpW8cs{yfKd@$+iuP0zcY4?Z7% zKIeSx`L6S0=LzS3)6moK(#X*0(b&`Y(LANeqN%3oq#2_j(j3z=(hAW+X-#R}Xv1k! zX-jEaX>qg!+G9EFMdO(JRxN(|gg!(!Zg9M?XNn zM1OdJ`GVL5oePc^LN26SsJQUYh1m;a1_p-f44Mq~48aU33{?z042ulEFJ8VVb!N#kUNLFhkJvEl}D4un1%3(g z3K|PW3f2gI6`~bV67m$v7U~x|xGsF%=K724E!S6t*@X>+BZO;&=S3JqG(-YKibWM^PLuAJKD!}*{>s=BOpP0dxUNbQ?CpZY!Zx9ZK^qyn|sywPFzi0i(U8b8{E&o{|lxA%Z9DHX}V>)k=)hX z)7^<4Y98qxt8g`V2At%n;hE*R;ico1>$UBD+q=;Fz{k|5!spKen+FZPG`{zI(SFQ+ zK7OD5dHf&wk3JNC82|8F05kv*@GH^==;&#F#<7hF@#wC*vcn# zPkf$WpWb+y{&e@5&9l}x?zq^v<>&g(YvM1)2gXmoPIuX0|UCAcLF zCEiHPN<2w|B@HFtOn#I6C&eRWBvm1`;PtuJey^v}G}0>5nbITDmotnrK4kJ`CS>j+ zTo8jD2 zQbVeBto>4VtL|gHWPMQsYeV8Y;9bbOwZ?mmQ%y!q-6$ng{d=MJ`OTM`6Fxvbgn#(e z;@R@;qus|*v?02?Ri(ALO{%S;oxeS=<4Q+rCtYV;=bx^KuDyRA{dquzl&y}q7)t^Te7wSo3Q=pcGXX{ZIGfcY>iKirI!$2N~BjC{Z;;y!*+ z{?aZV&|#n6BZa3 zvKF}(i}9lPhHnbrI+kuN4S%=%KDP{8UjGsF~C_ov{ou>g?ul{ZM zSNZG6{Hy$*t$)4(7bqbB1tTRR=oOJ;urW1j%i|L#F@9Sb63F(GEt{vq?{`RHYC|F< zFT5ReHhGO87dTwhGylTZz2nz@keZ_?UZt_7@j-7F!%2gYs*CdT0>zfW<>)QU(kZXB zBI#kz8nGs|WGu3EmT!bE_Z;zP@b7o}^OC~RooDPFj(gj?M=q(m zr(wNE(a$g&B#&6Nb9%3MIwdEg5dkjy2=|Kz&8Tn+b)Uwf|0Yd!sw&Wg%8CqRCHLji8Wb| z%;3@C(Q(^finhvF#{$_~hsShvk`Fs7NydbCDG_z0*g|G3D!nYey$h zQSC?2?fY3`Wfr{_wa>M!z+rpQnq|fcNt}zlz{f?Sc|#xQrb?IN|3?mk>AHm3JzR`& z8`TT%3{!8Ha#EsAEr(~KUJaMSs;&y$uhPkdxIU0?Yn(14koM~FtZKx@Q(>Z9xU7rX zcnTtjq!(dTfFQ;s#^~=xEb>~Xgcjt>?kM{BrP7CMI>hWnR%+f{Erby4l`I5SyX^yPlkNM~D(5W{Lyn<0#@7-llRjb+gc zya813L4a?Zj0{}K>{JkGjTbdfejLpz?+?lk^_~0y)E+`_hB)MSxPQcc97ZATqm#wl znmChntULUMcgHa;r8{s^C+xWNevm*odda#-GEO9Q~83ob#@4}XFyT5wZmQzPDihjZV zP~}kkkG+r+p3cJ5@iyEvlC<>cNL|`4;xrZ0;C9${93H&)ZS^HME`&Co;$PKJWU>+ z6-vThA0D$XS-Cx00x`OhP;;;Hx%SLI*W{V`=?phY>@e+Dan;Oanr~x4?k65{3rM117kCPArRdT8 zQ&Q;cf61SoXX{PS){i}((Ys{d?#;jrj}4<6o}&_8wpB8A*0p{=`+f5t??!e+zdq#t z1Hco*<_^zN8-`QWY?5^f*80}^!ObV@=n^y9N^bg&c{Ps}4%~E0Z=7LZE)qkCF_%$Q z)0=Zx^w~CFNt)n{o8Wvp9YR|@#b70G^?oV}URMzHqR{W;YwN?d3WZn%C@gitTZHyq zIvT)G0D#0&#dg0u$C1SM^vS@|+jAyPhwWU(ApxY7ldo*pV^KwDhc>;R4XlP*U z$}4&S_lV2o1=)SW5O8M`r;OZrEe;uW1kT+}905U>#At||#MB4f&F zxN2r2R88NQ8;G^PZFZxGn?+OfZsVY_o-Kx>62svt&rxZt?S0t_+wF~Rv2nIn96H@8 z_$4B0QS^6S(~Bscf=BXd>^T5Pp`(Dr!{T3Qa;nBzd?%0y+xv%MHOrUnTD<2`3iD2? zWhaFBA1jVGn4iAW5}Wb{jSpx-+i>`1LX-{uaAP54^ABKp_^ki#yS}1io8(F4G_F*( z^3+Hr$8l)TPEsG%xMpNwtwI;daxo6}uEMREr^ra&BUWPOd!Ow}pSMh(w{l~ar1oEM z+3>E(3if_PN-ss3HglClCDq#}X4E18)0a|8fQFF^3X-E-%0MiIfIJR#vB-PBy;cu} zZ^=D(cz&{3V52YU7bMD+@cjN2hU8+Sa-omYrh(o|wf|n_Z#Ntkk3cnK=OHW26F$RY zo~Pks*P#Vy0%^pu)uB7TA3tJi>6h=4o}|lk!P$p9srsda7u*{d4zc(MOG7!Mu2vC0 zbgI|C$Qy5oKPwww4(^C{CgKmd^M7Yn3nc3+uunc(2%nd&j!rd_&vC@rA%?5gr3O7W zB2vv~#p%qsyp`Vd)%30QJ35}K4nKaBa}d4|_Uo*k({jDjnWumJ*N3CXso?Ivb8QHU zZq89AW;;ZC+wh4Q9k?wkwHavufbqTNIe_k4IpYNi3o4;|%r~CUSS%A)f9&iX)`k9# z(O0p)qU=Wu31|(M`Wz&aW5vK#B#}pXV?x+rdv&^Jx(kOdTbZ7U>MCeJ&7EbCLl2wi z1d{b^VP<_bBTLDayAe3s0+gDEwF-CoL_{)A`h@w#h=zhCB)F&S0`S?Gg&tfN)_?TJ z@$%4-YQFP{QfGrm|KgeS*Q2v&X@}8oK-Evy|SAtoN137vjH0 z^yUuly|9>auiOaUhpHW(96gF`7y6 zKW8+wHT(zSIBrJCcOKAWy0D&une0KH!KY(HxA-5Fbrm!Rw0@jx%pqQM`@ll*Re-;l zeU8aGiI5B2+gKva_P4b3Cw_gb?*0eR>EBS#?nz~kv#6cHaLvHY`j(~q!yd~gD!y{W zSlFjeIjL~RCn_rDec(}VknP!cR2RjoGRG6sa?!@bail$9cUk|AE@)2eanfB`1E);C zI{yIEhmrLaF|76T+-bQ!e#bTg!zbiydYmpFli)M!ZK0r?+aWB>kyl&upO~w4o z!upG9Y%B#uelQ_$_waan*=g(Ly3dEfIxfEv=;)9`5;`q?O#y9hXmpcnIOLT{cF>+D zaecO@vtBK_P~GM6`0{!bK4SqFfBVbJl`5D#mo3cPv2#l|m*@fNl>KlEr;%9&tSm1B zgU{=kC3nV@{GRT@4E-cFm|a8oT=AFNqOc0m+szPJy+2`J@E_1Dgqt08s4(EiRaiSZk+uA zh{3;zf}Zq35*{Ua7rbRw4#El={kBzd{ADIWp%THnf;i&OXSlVU&KUF#uYSX) zWIEbs%6lqkm&jna>9r{9UvRPDG22$x<;~Lu>=J2j+iSgd24VPI%*;^xZY8ydkoMhc zilTIyFC{1lZz%zYB^d9;QJQO7UNd_rM+kq*w=ps$*!>BIeUgxuUP**5nQNwdWo>~eRWUpsl=Fo9C(b< z)-G;N`LOz5o`Sazb@!WeBUN$_gL?_P0l!aqk;JW&8vOU=y>DaYCMZ3W-nMh2bs3bX zx1AUHE@bIvWQ@*kYVQ%xoQt%LGn;=dOO=@@t(h3}>$u_~Cf)nm>3l`>X#giglS2Ns z2qgfRJrpcptcj$8|1pcQo)ScI=%@uaS>UYku()=Ifp0_zlZa9t2gctQ>@*9--{AP--jo zDgT7BkY>3Y3;cd7MV$Eaeu>15j}IJ0hRcu0JEID1OTz0{>b@h1>S)V=7cETc$J@~d zUsa=>3r(*VvBh z^0(c^LN@*Nlac*MDTAhsdyHi%<|8F}e{B;Mv`zm~B-R@hxAYZK)MS3`h8Jpl{q^-I zntuAnkC5fmN1*5)$iFW#=sb1?Z*jEXF1cvD-;TO8iod#g{NPbY2ziw>Kx_5{T!&b? zIDW_8^qFFM`ZP#M5qtMPj1X`XSBm5Sir9L{do58>Dl}?51J{y68vl0Il08un5~k)w zsNo= zJIV|NlL+!W*aMfLbW^w;V^-Y9Lb?^cR{t1>Y2khGWheg(|8iF~wE{a#>R0Qv$A(&h zzAt=HCYVqdxjL=tq%2<89_in<-%toW-tk!{B8Qk0Xbj&zP1It#GLZ0@-_{YJ6^E3( zW4EQD;sbz8c8a$)fT%dNP+%HIz;XjGcVtXSOkQ;M#i*%zwa|x)i&wkShX>}bBPQg_ z4TDf1nI51V9JC&$p?h+w2xJR_U5YNLrS z_K`tHTzFQIN%xa4I*5uwL-g(-rVF{WuUdYV`gAY+BlpL9q@fxCH>sd4Wkn3Hvz`1% z^0NBjz4e}%-=}|o;xmoOqw|-fMhYGue72%BG<*w`X~re|C{3eJ|3P&gM$f4N`4Sr^ zCa4KeW|{>Sz0!S%NHM$qGHF_+&_rVWn_4z`x(z$>Qy95P2F*~b@6v-$!-%UNy@!O8 z9P)Ael6~(3w_-G`PEOh2AGS1HoO%k!qIhTymNuhXh^XJkgE_VvnaKd_19x+mFY}wu z8R)F0J#G~`SCfJ7lNc}tGgZ$YQO8T;em;uPJJD$9A6_4+c{5O3V%I;OrJlbXvJ5WF zl#G9-Uo>Gy9X}uKZ-T+rG|;|7h*TO<$5v_yxZZnd%_hppN~syjCiUbwP2AJBV60dS zaD8EpEq*PINU$f@+o-o2jjy<9N4AZpxZ$8xt)m!+_T%xP)s?K^DTN{7{Mk1@0-~W_ zgvE^rKjIonE%fjxN<6jjYuGmFNJC}JhgctxAt?mYOQKH4TJ)3bY&Q_Y%{(O)m8QrNPuE^UN~A5OPc7EI|&uwXUMjWHI_cB=)W6;tzZ?d}{d`@_xpC{f}#c=i#L zPrC|_{A2fj2W(M2x2pYtS9JvRzK`re9cX0FwH4SObYn7wtbyk= z7TP~bpNgmd!!*Ok$|e*`!2#;KD3mk-t*XNQ$~RH z8wwhJO*0BEIzR+8WK_)Px7X8f{U**44zwa*iAl8ahU`kzh@T zNad(6*7x9d<8FuQ zf`7#h^z4CLX1YGiKp^cYhmd*AMnDASOYC`FL&E4ifC5`nuug1M4k0`|_~GM=;429D#gh{kKj-n)NEOw&bmg4e{V=`s*H0PC zX7}5-%)bCMq?rv7Aog0jA83`b9rGU_Zt^;OI@mjDz<=9b#9x8-+9)3+$S3%DPl=(Q z4@-d3leYqPPsxNRm+HvV;0m?e&#(1eT?0u^*)GO~(sUCXGrzoL7b(*Q1gTOoS?MU` zS-^mmg+^BIiP4LzKa97bTfGqnR@&ZTh8|^>hW6icv3}6L{9WSBe!RMHL#BV!VvI+p zdP-N~_|G#J)3)%BKh|-pU4eHlWqKxMDb+C3`$MK#8Hj* zD~OWa`8l$*v7NDgGB?*xz#FXu9{sAYt*|Tqjx=me*z{?V=o@Oz#7(rjSb~Iy@bubm zcv1MOR<b(9|I6XT99dKSZ$x!<#OY`zw^17*1PI!ds7HT>_Du8YN5Z$j@b;WL?43UBU1JHSc!rsF zoM+lOj^|Sr2B6tvhdiD>ow4WtY|hM^-p<1(S12&U2&zjR*tcF- z`zxeSc|3&y2ABH!Xs@@;x#dWa+@At)4StD?lI6qD8#8CeiJ4vY?^3=>WiR zQiRT(BYZqEyg?1`tTFwuI!nw*v_j6%u>6(h4btGm_jOh7K%8*VGHExzEjXZ+5Eo%8 z?Oz#r`r{|24SBegcfh60zBC|M8mPpV=26?(a9sFFjXNcg-Il7F+Dsdvou%BEYkt8m zDYzutF|vb8HR=-bsAZ=sCXwi(L-3dqZ{oy;-Du(*YGR}1uhk<~VMh1yg}Y~6WM~+g zSQ6knklwg<+jCYvTl=Q%tj?${g`kAyz{|TJfd~G9k(Ig$KO^NB57C!Vi9uNfl7Lcd23Dwl*TGj!q)|vyU$DXuRDC z9LRc5mYFOp^CM6-%Ud0LN`LtNy@cl~ckDBHS_5lytX*SnQX|%4G9@#JlvfzZ)#0od zjem3eF|uYg5+_gE?j8VjsK-L_COUc8@BVN|y4oKgn-n#@a&(G+HS=cn;hH^0FqwN0 z_KuE&vA8>(hVD}uVeXjRbh-;OCoR;w_#& z654QmL=wm5*vMU=)^SPwv^IDR7KF8^U0>ssZn3!xuj%=&F1%iXDH+5l!xNR;Xa@x| zQ`~>Jl^xscny&bpzh&u;V;Q8g5*sw)njxC!CY9PCEmPhHu4flUvqp76_tpuZU3 z;$@`{Cu_Th_TKp1ba(6{*j-J7avh&$_wIJ~kf9OL>?Fs9%8m4!O^&S+B5s-z64ctP z*Kbj4^U*QcQUJvek;|F@;vb=Y{hBmUxONg{U?-u|U>`Ko-5r5?t8)Ky#jHHV0H0^>V3y4y4q-9Lc0nvCWm z6bw3YBlEi9htmv^F%2>D`@v6}2K}>dIU#j}Y-G?^`r+9Ds_Ts@9Vt-};fp6eq4KJ0 zV$yKzGzqT~IWn_Go_=u{Q*2jiXh*a*^79?NKbzU~@CRRN(;4xw^(E1mC*>b4vFBp6 z&c%pZ*Nc+1eP_kF5wJ2PQbu+O4(Bq`fj)HU>L;iAV|%9arTA;RR}@9lKeGxl*skwi z;vGE}#*)_B$!~iH0#&?>cd^Z3y{<{%@@xRDb+neN% z`m)e(J}w#u{@n*ND2Ed5If)A&$QcO7&>IFQH5K-slXujoDs+u4dKT#3e?&)WT6GbIpMYj72DFX1!I^wi;L zq5JkxXX>|(db_c7gK>A;_>??JdJb_Rn0{biN}LEizneLQp!VA|S6>6<%p$Y+(Zj zyuLxWe#FTu<<@jQsUhe1fEb3Z!+1ZxZum)BiiniWoGa*P4cRE$3?EUQU%m)j`_@d)vd99xiV8nGit6d2MRvu$+c_j%X))$W4VD z(7l&Fq5^^SW^_L&PPSI_)e4Pv_Vzk$V417;eLM_|;fgs~%*R#euh2<>}?| zC}t`@&Dz0)c|^Hl-@vHP2Tnrj?DtRWJ9e1SFNb&|7oJ&xq)vyf zk{^^&D6`V4Oq#%%!+%>BOLGI}_sx@pQ=l0oi#ap}c){exOm=i~OT#laOKH~k4*zR*F9ZO5AAEB^mugHFkNTO(b(U&!jbl@coz$hl;Pya$tqEkh$)ERoeNLZj%35m7d{ z^)JiSHn@;SI8zPDxooybA^Yq*A7*844KkzOH6q!dC4Q36(O!lj1))0`9uDt1Z_nqB z9QRLb6IO##iq~6TZ(5^Rs#j_dCjD*%6!*o)C7groQ-ME|t-nGWB7YsLa=F9|ccoS| zkfVD~RJI!ZLNFSdW_sAEgdw9v2i*HFP!d4^V!xSU}aTp0^Y_ zEnbi2_Rl9p4i3F)Fs`qi>iyW{bE{RxBEz5(%UI@3u7bN*9!Blm*_BT*eYOz_mvOT5 zaxXZIJc*zKkAjDBj#aR%wW`(btxc11x)>##l418r&QM%X#}av|7c4?F1l^6*FmtYLJ4k-?zhM9pS&hiANnc1 zKRhCk!)gi^^lY(uw#MU%g=*E_<;7awjaQ7V0_Nfu0fm)yEo~pH&cDLxNiny)$Cx>toyM!{P<&YkoVLC zzg+oCA&VnkMVI1})BCIYojkt-Nc+(Zi0QpYU?SRLJ^|J^Lz)510qvVRyFFP;n7{si z#CXbchjvrjh*z%2>0~tlNu_nY2pi-$)Ji@bR1wTr0+?Hdy#))tzcwON7yK3_ISFAVHo-*6zSz-K>R1To@NAFHO463(EO!z4 zGHER9vgMS;XbL)fAD4nA-ofPE2}umf8&_S-A?)=_x2UT0>*TL*`wX{#8L7pdj ze=Y5$pu{Wo5f5AOm&Rswa@U{Tn##LTk-XmCI!|^N&-IpLZ+7+T46~LKx3Ez#G!*lJ zE={iZ9cd_26R=Ih{6D7|C}v8kXoM@C?QH96oML5+4p(73t#?_pYcS7WsrW@3b!37K5{aov5#N?eb1jGFveBfm?j%Zp}-9ZPg_Ug#BxX=v_k0f15A}(S{;YJrNZl)YY$2k5MF{^ zqPkG{RFP%+=ciNetbJBypZ|W>!qfaLG}(^ma5I!Vd5A)+GzShkei;?dvYS{bli059 z;I-OWZkfw;e`eJ}`%(VxqSqq2j)PFvW3^P_2rkdxi|BPB(4La*Nb94py&buFzuHZXdCs`8YmL`*ucS4#iQkrZV9tD9YW~q8UXuH!V7i^)*lLGl z`e$T@5%YtgLBWl56C_3(Rmz;KtP-HYyf)0-A?uZWA8VI}x?b;8nioJRRd4*v#G_Wc z)=A2jqlEKf^p;A=wGrt2g0o^{uX2FDV||j!sC)~O6x7;SwSq>ABi`?1et-vM4Lc&? zQ>sB7q;GDk;<>n#S@NVrdPH{?$Jj{4P50huXh%>#YIQGlPaVsNQwoQ4Q)2&n5 zhy$5!kkapZFV?n}$%@%Robr0brLx`@9p*2hsEpZxjmexAoN^?TP5N@uRokFUs4D{H-~eF43PrY9d1U!#Z+I z?>%9RV6oHc3^&4p39Huse4cp53HQ$fX?cH@j=mvh4WqvGdViw^wl3o0u${bz7IIY!Fsk->K(6nlv(C$gxdv+KKsVjpsAd(%LXtp=ku7OX=m%3ch)v?RS;r#>9Xiq z(~Ar%Z9f?nxm#PgZ9aJ8xnae^VSP8>dG=SA5oR^w_lITn}*T&1l zM;1syZ9%f6VG^kGPH>d8dM2rUVA*GvH9J+)ak38u1{!kPqo+V}&Ph~ABdcV=^ zwzpU!<85z9fLupBVuHpt=_p?sp49~(L8t#fd2j|vzOqvWBRJ#N>2krF?l3KO(%Y0c zz$(v@cvcr)e=r#^yqr4Q@ltQZVcR)5Y&*}-`@;;;o*a=h++=VoYo@>#?U{Yozc;6P zu@f1kiWj#hZ?aoXL&CKN{PHql8mlci)UW98UTYa z6-kdi!680)Yc;y#kldNt-za4y*qqb*aud#6C7?I_%C;Ydel62)Oci>A?*2Qz`~^G% zY1(}Rv3F)YJb13ozAX_WhI!Crb$_J7A}jRHAzSeytcz*(xaz@}_xc)=!JQzGhpHYj zG8Ho{yC##~Xjq=vh!z$E0yIQ;^*BKHIpN&wmbOHAoXoZxYoNcrvGamOb!=80a7?muoC|J6FNp zFjodlJ7dVcL(jZm6x>=r*;GIvH2azw(Mx`)uxxypM8U#$E#Yp0z{SjP?pEIjHKPMt zP5Nt07p&;z#dBF=?;}zyytG7fKizqQas~5A+I@}0d9*ni5pMU>ew^?|TgsxJS(zj& zZ<$!v=gcV&4WXL4<9(X)#I;1LcSmzqimc|_u4A9TJo??Ik9dpjj?c$7DFlf-%Uozfi6_0?$I=IBZ0< z5CQd;LU5^u$0;s`fqUE@U|PAM;^GnO0W}t*VT%Aq<8?&0=Cr^32S|x0dSCT*H6L;x;Z9&TOk)oU#=)0jPsDsf22f zxS>8l)CY_kB{hY0y^siVpO;4(e>d>#x`EG6Q>jP#D=_EjaBP1O<4E~!rpI;HZ_IA z>M!ze`^%UuFey1?oe?kMlXF4Ht<1-b-tCT1j-T&yblY~Qd$jLpaEr(KP>}ty2WwyL zd!e}M)$vS1@Yo#G9#_8AGjsGPr0qVI?jcCI8YV0&z!eJ~Huy)ZdiS%o+mr83ykag_ zu@!%1Os8Wb9&7PZi>e&Ph`P;hM8-WiIubT&P|5#}UU=~FnR(Oa^7+S~+H=}3>2oc} z6j%0CdAO@&51&fUk<}Vp#L>aE=N&h>+b{JWhhJY4sNA4)?`hwG-ia7=AFVci>ES7F z@Zr8y!rD4gR>3hHOQTz*!YMcU%J-ANyQa^grD9>=E^Ow$id_gmeF#11+tQN@&iDe# zOmWl1!%?}tg(m_(uCQrRVZAo;k5Ebom+eY=r4N7XL>|mWqA2z!pFW^PC2Fl_=#m>9 zv!9-!Qg%dm%#@1@_MsaJZZ+|bw%e2L#Rd_h9BW<&7EbPVJ|?vz-`^FAMM&g)!Dd6}3GPWvr$NZ4D%^-69~EikE7b;Tj2oV-RgTqO z6px4Z-n?l)6?R9;hBBI`ZXMn{a!- z$eIT!DX-TmR5*VxU?n7HBM#{V+i>cHKdzv()6quiNauyCzsN;CT0mK&)&f!+kJKOY zi)9J27}#zglZ7frXLdc;z#K~zDiM9nRqh+*DX|nO_K1wH)?g|g>#attYG%T~IplIeyN)!?mLl}!Xg2X@j%99>_ z*VmA9F6<`5if-;(%aV&9y)YM6yq;W70+?-necA0^*Sr*6p6+&MV?2&ByBT}MD z4Xct3$kQqLC}p_~rtq5yFjdz`<)5LDcwy%#HuVnT!bn6pR{DcmreIT5szFL=v5G+n zG{1>Gt9^}QR-7vZ&=*iw`=tTDmWZe-mh7%hL2-M$PfnY9a0}tj4u$7TGp&!Lw6Bqp zneBwCP}JkBJ_T)AUPB-uv$EosP<>+Gm;St#gz=NsM@%Nmh|{`CxWDWdtTs@|cH4AP zk!UQnuCDXQ9_VGlR;V;Ude`bb+5@G29m*Fw8!6ii72+Ue*ADZe=~#EHn?vN z*C;y!FU=F1^SFaBaQCr>rla8xURhZXa&d~HRagfhwC(VwX6lQROS4Wv*OEQDKX+ZR zv)-oXcaOl_!dlySI1vlSmG<%-Mxs`RzmA*uMGeo5aIc7u4~Z693}tPPcNe@Nxqj)k z$L?^Byvp{-hdTP}WPKn{=8Q8}(S-ysrG8?0@M zkPMx64Z5$)m0&B%ciWSxnTb8C8B>)QBy7MSITbp;Yr8tXd)YeM!F%Y zV@~Oy4*c1YydTt;Sog^3A%i;aum6Lo?|^Hfc>?8AQ9w{a??@6lh=d|dP)I_6P!d8H zPzW7SssaKQN&*B(sG*4TE)o=^2p>vGC{mTCh!mBkpnx>-9e)4cdvEr*%N>{9+1c5h zva_2g7a#sEp?=>wMOF8=?vd2eId%EWKtYKsnRbg?-4UO2&K)zkMr(n6lbcRch)tQ% z;_@VW2PsQmuYPTpmnqpqJg;?CZD=v%XXEELHr`iG$QeN?XeKuzw(BOGTm`-@2{)BN zxQBa=)POawT9s&7R&lKY)+%%%ExHipxkNAqWt=|opu?wnuW38>XGneJmjeIhdB<$) zS2s+3tGw*u0^fvvx!4eIHT-jBD6=MyGfOQn!eV|`m4^QfSp7mW_a`%C)a|~rFCv>27 zZ4{klP=R`9By-IOdQR$cj2&A+kx?gGO--d=C9THIP9ry^a`Rqk^_xvsY#cW=Tl0i9 z%=c*;S2uHFU3&b)v?JyQui5a7@4MjlYpG}-#|&rJvA#0BD&4g(tCGo=wd&39zs1B} z6j_=3!=$o#L&1H@+UmMnUDZh-NbkFT<63COnd-d~7;P(raYLM%aB|q+^mIZ3$ zWlQ-&vt3Yj9QZMsJDy5Y=+!c?qxJn%Z~#{IlnkfuG+dFXfhMLvxH`Oj)F*$5W*9kQ zf@S>%+Ou~RUrS5TmsA+4G?5H3w}M)mw9Jr27oNNx=L z8ikpu(*DU(L(QBJfl!H^%yW*V=1}XP$5<`m-^mO5cpu{`umgclfH5+;${i>xVQiOc zFsC;wv3F1XT^Q%$grmi>%tGRUY(9;!yo=o&GVG(F9ho`EJ**gkP{C5#1wW8z;iO26GM=(FFQ zUTjb##z+!Qz~f7BDa@Q$=4>M=3KVuu*5Y1`x3?TS3#aXa6W3)lr2&~tlE*%fZIpVV zcvHPvZe*`b)#&lC3cLI$}{>*}tDM zMoMf@Ohvj?sitQbsh+|j6R>b9m#QuJoiPY=jmR65iEIm-OsL91HzFvE%g4Z+9G9=y zgXLmjUJ{k?a!D`Vl1gic)IEYcl-cL%Q(U=3BK|S6|2gnmMYngf=g4%>yOiY+vl@rf zl9V^jnsdLZgycn8rSST6p9@dj85l=0%|@1&j}@O`A}mqin1F5JtJhTMo%DsKB4do8 zsRFBH*$hR*^#HPGwI}Oo2!f)Jus)tp%eOi$NwZ58h_2wOxMB}E!Q_g3{Fsf`gt?-U zkB_LXFINa3xdO_rDIc-DcUhUzYjTdOq8zY?YvhqNe51H&Mo27s<4O7pbsz*08IhA(?E? zGHhFY#h3!uAL31+@jS@26H*DjUMByeQN61{n#)?&5>w7;OEBRAcC~kEU6P8VB6euegPBgfG`UI|09j-s3CJe4?!o{L!=K-=P z-|Rh@uJ@JFwCz%`CmvJpwjHxR1}p{BF9yp+voTJTTk%RH*_lX^&j}T%@!n^CXaSZl zhu?^PYVl*>Bi{gfbAXnYL@@(Qf}h(QyG z1U+71AjwVsH@>To7YbJ;AycaL>s~_vGzNxa6CG&H4sN+9@5{yIq^E>2Yp^W=7tM4G z%*KAA&X$a|Hika2MtOHwWD}X6On_`ZAmtm_N)&#m*mV7vfT8}Spg`}RqOkglCkrLH z>gY^dMs^x5Pf?hFO0C`sXyvN_VE)98%`tW53UYiEE>8*em1>_dk@haD({l_r{H&p?h_(PlA??Ax z)=-6D4KFa9OcF?WdRp|}7Kb|)m1c%i9%5l8iE84LWzR72vZWLwi!e|BVM~{=1KE%G zyWiM#%<;`|^Q}){HGYSYF$VAp8GA1WMd9Gb|6#diWFK8}OYXrKq6A~>-F5v2UNOE~ z!q+#cEGE1CBHX+8YqK;r6o%FMM~H=tEuRz?Lgv6Ep&580H6%?0%W-Vq z3Q$DOVxq-8R$NKS+kYkFE3W%0lJu7p*w$h$6CIx~>$k$b4m6tzHU~62{Kz$uGO}0w z2db)1ljT5|a`B^~rlwCiPZ8Pjei+lk20up5e_LM^evXSC@t{oTDNT*Ob$xtc`HN;D< z!+Bk8&Kj{Z!V{T2El}tFp%CTcn2%p(#-K(55!=B@S`@hR) z4a6~EQ?fdzQ!ALe7VKjl3S zD=|9=taB?|i9PB?w2~{-G~M}4q(!UJ6d~3sivR4UwVO3gZ=39GA#B>ir>j91iK6vsr z_7Uql>8t5i^Ix=nBWoAOA3PvBqy|W0Enyz7e<_1y_QEokG$ulRSVg*bD<}S2Y<2IodORyZmB@k#*_@m+@C7sY$K?dh)~Lm^-14x+Lt<+>YyLj! zxni%bJilJMnC;;(kmt2qWW_)9<)j~3 zRT>vG8Q)P{;qlXzc`sHp_j0hSs|RqJNj~ho4~lZ??XOYF#DH(h^4`34HNaNxqj5n4 zyt8WuhG(RL!Tz{#ze%f`Ixbn=%E_I+%=j?KkjmPt`Q*lYKi&5cFZR8*N7u@x%^S}q z9o^o&v-4@A_{Hlr->VL~6N3%)Ypa{=q_j9Muyuf&iRR~;v>sQOwTh&x$}pPrY}hPq zm}A&Dz@SFKss>zR_(;lJ$7ko^Ii-~aEBQF z{ouRxZ9)2{61%H-OizI=WC$`Oc5m}k!KHt`p1mA)d`K*MQ@Y?1=xZ`OjC<(Oz5USb z`L(b60lG60P2vF3$&F`826IC@xyc0aGsIg(pD^2&t6!#)8)ol@S|-W)-)Or?8mliT z1c>9Tj+4**aMfH2P0;6T=Uyii=9=+kG?cM&RED|=9LQtrAEk>?fs`kfC(82GP+to( zl9U!yR3OT-`E`>Hr1HP1tQgp+N#g4uGR$B^EM@cIv%fdmkYO>xrU6ZquzIS8N0EmG z9uN5)gT%S@w`tnH%%s93So9CjzHk=MZb-^XLxrO32Cmsxr!Fy)OL_hzduYeQlk5T) zt^t?QBZvjy?}xvqSi;aPRaG8lkVMpVOuAjfC0G0KcfRy!xc<*n-Ov4GiTx{lxE4Q9 z;9e2SlEFl`-sxSt?W4T@W?AtUl2-*W>C}Fkl>%}-7zBz`NbWTDEPZ+_?N^hmLGxZz zd)-bX{|3!hGpXQ3vGf6ZlpEN$7P73hQ!6=wV&R>jZfn~J2r~}7cX8Eg%jVGr{AQ=|M21$ z86gI49g`0XEVpW^z*Qyy;X)4g+h^3D-;TD;|Fv4)+rKF9g|wV9L!!xGh%W5n7u_-V z{o`@5zdXlj%TeNS;^{Q3q~(bx6gg+!P#&8_%K6<7CQ05U`XvL#v1qDX!J`f*6;VzEMZV|Ii}ok4E#QADg|D|Ny<))7ZOtoI zyU__r!MvKG{dxVLO%o#-uu6q*moE7oC(o$Ay`2bPI4TGG>@1G8>Hql&1Xj|7;Rl}+ z;Bfey*Vbe%d(`|v!aB{(c{*dV`)4qw-W75|Z84Fm^l)j$(8%8=yjy8bX@5Dfvac!f zk$dfpUj#CLz0_U&VD66oIWVQa+~7&x?Ra(7J>MvygFyJ4^Yp^vDzWF}i9}%Ex;w5y z(p*!G21q1(KYIQ?elLu{98hq&l0y6T5 zO1c3T*TGQu3Qy{oXUL~ihgl+77@!YT=CzUN4?=ck((dBG~JGY)W`REra zTDx|oef%I+x$q@yjvRHlMnp3ls4_ej=2?Upso4A_k?!V91Gz-KM*-}<_aJJ+>^}Cs zmSH~%Ct*P{2-JQ18H$*L3U00`SZLU8e|+O$va5ifPxnW^EJ}|sIpf6Ol0rp7X zQ84RJ&nd~={};R31|N6((6e;tDlqJCF1ZLvd2ExE${^R#e0^Qrk&Lvm;vKQe^WSbK z3iAK1j!(?dWIc>kF8DW%)lw3b2M#jA$YG@6Z@adET-5@w6??8qg6HUmA5BJf4EfDl zGOD+$4jPnG?QC!f%i7)J!M%{zu;OH1BMp&HkA%7Fk?9efKH_F^+aqkaC+M-V*s$m#<(rSZJPxFrNn zl~UJJaFw_u`R|WYqQR}#!LY-TB01Qzw)2b6G5f(HNBE|LgNRr;0Aoq>6CPD%S7WZ@ zWN|x1d&>@%%LRd#6nB;*^Ait!1Q^wsxP-k^(tgTyb&0OqdLoYFrcOfpaxsqctgOJs zEmrAvfeNy%eIM_4-jYP8!*IkAIjnpql@D1I9}|^rWnT7a`R1_y-XbP=_%KiqY7=X< z#+}-Derao<4uIq-dY?_l$6U8}!_fqjeJLw9q|+eiXMP9NhhiaTDGzTFl0dKQ_;;8U zCG5#1xhEJ$7Ns|3_(W+Y;>ovB3o;^kbxN^#SMki%dA~64^~Oo-t=l9`P}D?!d2eES ze&(m}r|9H0aKWwK9y63fQe2m@q@4EHp38J$m$=#M@CtJ;-~WN1ubS4?1O-i5=3!+tn$8dlJ0zE z?dk9hABQ`ZDf!#Hc2=2OJ2i@BI}40KX8RKF&Skez2Q41LsK_bQ(}r&?Cd?~;n35K& zBK7{4@&7C05F!Y*jk!V!1dUnL1`&ef{pN-ZP{Y-j>YD z9ni#fO42Vt^`u@;r<367%g?_iJI>Yipr;{&B}6}Cq; z$laD5VHgw5$Sj;hZrwZC5sf8-2bp@Mw5aA`>o;w}7(H#Fm4GY-Xo>+_eI(aP2Wj`h|bdwHcmHGAjcX9{UsWJXg7K{ zxvwG4@$^&@srC=k?4FPAn8fLIZ*Nbt6HB~a$)9Su-3=kn3N8`otCEh8_S^QKRT(p{ zOg}br7cr#LSM8R`@@ZG!S=yvcpT7>CQ>b93!f%P3sjtaH4-Jh0$MfphwVQZ{4+9yE z%-X4AkIK`hB=5+NzPqd4F_Uy)vnXE^Z^<}IhGW!@;K*_~LB{Yh`nE7sqZG)ebR$@f zZ2m5;7JPWe^0y_5AaXDQ`A3y6@?`sIxYTSTLw#NJ?eWw8C1sc4DQ zA1f-#XU(YgRBZm63out{Sl*?9V6(R3?-#BH2*^6GAit1zGbO3G=9zaQ(?o+@hIv|` z?06czI=w={aRl*R*H7Z-!&>RfHOaJU~?(dk!vXLME}{=$A1URITBe13Z?7 zht~4-l>8+TB2F5YhYdCwqZieg5zUBf_;X0GQ-H^Ghvn34$yv*R-w5Z%)a_!Zgi=Q` ze%Owezdufai!3!!(fWEbUH-1s3;CJys&7`(hLowP=Mlv#FUxMdeW|79&6iRCkQQqt zqbmKN`0#w2Nu^sC40q^?!o{FhwBFR0fAuK!C`qXbN^4mSP!1r-(dNjbs*2ntD}Lv|rIAE?G0KY22~ zJl7a??+=srYV{ivg*1C<1zunX<*L@i$LOSeC6^*kTtl!%o@aa1@MV;|*7hRemk(cLOK-e-ORmTJ#<<8I(+L&Rxq7FXWrA~_?*BDe9OOT&JCocfu|d`y z2l;zm_12#ssz$hnLBmw#;mBB)Q64m4uX<7h4i?Pc0QTx7iX8ZsY$x&Jh7YXsZ(WO0|z;eU5dpmH0#OSjP zqvY){*ZFhF&o5sMve@}b)A7D^0@0(;b_sqrOm})Og8l9SL&}t5Ckn&Cv~gj+XWr*k zVEdcu1H@0KuKMft$6E)>P#P+%kUf?odB+PiQY#-@wTgxgyc!t8rr?{^p?rmzUD7t_|LyXL*s9N5fxAs z@c1~8VVB+AtLCo>vqTGYg?q7iB08Uodj8y9>$8{V!n`0AMF!hm2X}m(`ZI>so@A8C zUR>J3ttyVOI3Nv+FP$H@rVxeLD?C5HR6}=<%MUR?&nc3w&t3}3JJGut2;@i0p;4Ho zurP%xEBLdb;_)P;{ zMBBAOZB^qg?s=MdqHBHbDKnGxThD&AX#F;a=uPDzEA8LQB2bnp`F&46#_FB!zVt#! zNT6HY%*{yMSX0D^JrJSA(6V8P@jcQSk~%|#b8>P7VR$r_r^f;icDL_4rL;nV!XA!^ zJ^rqp^vUW!kpPGmK&s#e<5mG1aNylMDyqBKTZFt#Qk zD*u|Jg5yhkm1sFYaEO!?UGLQ#Ro**LZUg7ds{wxXab)_->BLys!7bw$eogZ~Ov42> zw`3g`NVqO#wD|^pf|2jDapX#IWhhXvl7d{(L`$-kik$sG>eC$QE*$whUlBhuOoW|q z3mwN|7}p`D2-b;Yv7f~u(3lIZlVp0TG<%-(f81N7<}P?2AAG@hx_tS*+FOOO0fh_IAX-Ta%I@jH~o5EbsIsqp8VhsC+5GDXq5mZZumXnNszK36jT! z@m%$^Irf4VKG5n7(FK&d{9xy->B->HO++g%?^0@7xuTn&S#&DNZd7)L^99Jq zuyO3n?AEdBkh~s1mlTctJQu2_ss{9=QG;SFL)2HuXwfL-Zz?JgMXeaxt0EsFO-XNF zKNqEcGYp-%eWsu;zw3d&d}rD-h_lo@Rkm)-rFy7x)ks|@N7<^QIb}{&Q&p~z;!YJg z`Sj*}oMC6&@z2ubY35GDXArQ9DdcBREjIWXs|7_xhHa@cW)AODDhseABVX`mzWaUv z-}Br7pkI6KblQIHqCDeey^Kvmy@S|VAyfigrBGRFKT}-;1D^&X96slEsayy85CD_H z5WF90cp}c~3{87@CfNeuXkNdkxCNoeruw(^Etqz(Tq4$mo_b-xu1IV0-JAOA6|E%T zBx0n*RZO)XtGLn`O)@S7~Ax-56;oUEDBH|~c;z24Xd%-Kd~tOWv_r%LR~d7Txm5 zd9gFtnDB>bHR6ib*>|n8LqTyT6Q6~Mm*jcn-4K_Vj4!VOI9f?tIJ5(>*i$Cfi5sdYu;f+sBw-$k^#eK`Ox3j; zhHJ#i+s|Ty-a|{hNq{No=FJii^g%n9icaGpI#8ku<$l~}Th@;!YvUOX&mv!F%y=U| zbE_pXrn?QEr`a5k)4uJ!c?&BtxNoF0khRc4TuC*$z*50mPykQLvvDqfAR^s3I( z`4vm;s-d7={k&Bv*-|`%%;Kb*8oNB~BD?=oLrM!$e77hh>Gh|qjSOFP#E#41d3K@f zY$2f}DA|AAuO1ZN_Jm(jYgfV|@kpIcq#mF>&0oj6`KW>CV(gi95ntNz%k&xaFe4SZQg>u&KOFJPlLwT*EE@@kgk|qFQpt_yjf&=Kwfy*!s=N3dsDgS9Vw!{lS8xG zO%TGWTnk3XV4hE{8ou6Pv3X!6t06PSeV|pUWl$WPUH@g0_fx_oU};bf6zIh_=EeHC zh_}s^%fASX>8(5{*7fQvC6L|!S{X;0_7MPWA1-Z*YMqm~T6Ox7uJy09l^(13fv)b} zPu=OU-XAtp-NX;y78L{v$BaX)jguBuWsNWKH~c80cZ{umFg8(o0$-~sEz_U(G5XM- zr%A(!Sb4!pv|xFiqlGn3!W1`a?MrAWFZTNPFLly4Y=(+#ma3XDWv`r!XT;4vlyyyi znCxp!qbae$cr|GjO47ztq%-z2^$V5AAKU2mJE$}jcZ)2Ie-1U@dxo+^d~FnzGYEPEB6;Pc3-_t z3(DkX)UV!N{lnzkCQP~YE*^XP!>(8*wA;illlCMWr z?w(z)>YSd&mTXT&`_?QRelX(sI`j<>+ayXMBaOoLgk z)x1eGNmA^5q3*Qpz9YsTraKZ*37%ULzwtQPz%SVd!8SwDnoX|MqmM;W7ydBq#s`aw zZzXH?wp^sY#eJn?dZ@z_q{3IlDb#=@i*5>TKUzEC<$ty@&8(aoM;rCUT_ z`gTX#G_hUd*KE(MzX*r<(SSRcONBtd?%jWw&Kspi8BG?Pj_w@Qy_9nX2s7_&JLO*> z6z{t6;~Ey0p9^@ujVPrF@q%S;kE-tg6J4PY;{b?*h4c4}vfe;N*#UnJ z8-&d9)&R*v{W{4*_;c}HKEfX+`jGhUxy)Vg<3CIce#jpts1x@eCa^QjdExx!%-z!| zl82Yu#m5^<&Q|SePx^1)-P&+{ZB<+`T`th`i6WWx++zC2wT>T&`&+82YJmKHe8~L8 zHc3zpYst$px;{7Y0R^h|z41^}Ovem^FYHarO%pDj50&%2`0TSZ4Nx(BMdQ4hBXu!N z)}F1cd8B^b^2Ymy%a4>Z{xDgt<0GqPL5GX4;D4Ax=Y|en&ZhwQssl)#n@T=-h>BVO zM=fZAofo{n04QIj04K+@2QeWg2M& z;fI-g&7RwndfY~&x5e2e4|75`)f5cBX0yZ%zpHrtbzkMT@r1LneZrChKC1e)__eWQ z4$v)%{_N+7c#nzYl-XsT$h6$N+7VTkwViCfUe$T=o~O&)wGT>0wO2GP%BL=9WC3a* z`VW&t{r0VLH<;mXgbpdb$n>xfPB7Ur#pgcVzcBBxg?sd{T5Gx5%Sj7c!#b{^dwRs+ zLumMEly$H?E(7#dkgN1ZfkOGUJdWPntKPhk`IdU`tZhctQ`)HUxVA@0QE%5iXO6Oh zW~F)0Ku+9=$M0yEn%^Uu5aM+i#vT(Rx{Twibsm!i`84=GTzUJBxO;I#h72jTte`YZ zrogV#+DG?jj#TC=YHWolFxzQ2&OIt6uNAFvkTO3N-(k|}frIE#6sn*^Dg5!`U9#`K`MY%6sG8i4Z1nu$A@tzA-53^IY zGa^5Q-vGxL%e+&j!^4`PsiqSUfmt=ei969lc5lg3j)_is1O7ii zcA-q!3|~Vj{*Ta9@uetsFIB3>U1L4YN35;gb@@pj#N0IP{dsRz`sX@ovpFqO-szOo zy!~yQ%iCeI)Ynk3`Igb;|GdWU6Y{)n_NkK6FfEUQ(ug+l_MRa?WI2zb(lBF>lKV@K z!|sSZIt4$Im50%q^WsKj!$+jZYRK|eYDo6*4+0GpQ15m=)1j4OvmeUx0h<-+pw@(6yp2FB? z0|wSF*Y|hQE}(<$#$8_~rKAUeBtM@{9Q*)eQi^@uvWp_+w~}Zdzb2{VlTlZe+LVdPq{}1sq|qf|fe( z%2I9<&0l3$X;?vA2F)bx#8+yACIF56@6mkG&_x?Gm9%gh@?4bgLAWR=1X3qjzGfJp zoizXAo3_~)a1T87J9{YKgbo`CBD@ui#2WV6{BBNAI~vf^v1gWKh&m(?Vd z%JGJea^nVY{A##l6^pp@^Z>>9t@^k1Z&6zTmvDoYDr4yH)DJ4nhQ3KlqNCaiVMMV~ z!*cRRNSnb6>T)S^+3+s#51L4hm?5`8jSzf9`YO=Gs1;SU?fEz8-JUwY>jeRaDC1X8 zdCy5(Q_WK zVW7tJi9;hpXh!iPqXIX*_q*J^UY~<##wmrC2$aw@e~JBh+1F@9S9tDXFn>1!+g5bQ09 zaG8_^7H28slCll2WgvhP0&-oMp1W?-Y=LRT@&?J#NoX>ee-$6)Pn<<#J8~%icD}wI zucbxOWwS)?y7qj7nk5-w!Oz21o8Q!;jQJ zFuV)kqhUiHY2fr8i7{=n`4?-Vn75*qFG$w1If4fQKa&MSOiv+T*7J{ttI0w%qHs6C z8Pvi{ugdGWR_Z6qMb_j``=#~t68VEh#xKRR%7uiDRDh1%ddeFz6eq!aO+lH|QdOT- zbE#ARjGiNz8luZY)Igolrlv3r0m%F@PQsXHOn_Q|pC90r8cYPn)9#4mZqqlfpS}-1 zWw9zO&L|j@GqhL|mA*10r+>dTk+^?k|GEQVCgrnQsGvCWQ_K1_GUOJ#AN~CT$={0i zN`D&hAWKLMU3LO1TYtUXWqmjqN}^D< z5K-WQl1upzP_0{)@sG0-Bh`&^*gUQ+3)i90`hqR>kTq$!WF6_WtvFb%@#OBwssN5 z#>P;nv5tpgx32Z1f7*xn$|XkAQHjw9fH(;h7@G6+49*5TqHthXo9(z?3-~2_T7V(? zDEh@;NabPUsZe3cMeqw=+(7C&p*}D$FiLYH6|#|fS9rly@*5K7ZJafC&7X@0b->b5 zQU2Gh8tHon+rd^W$L5k%?9t60e#_evfZ#m$SUvgeSs=9L(tkd|!Il$+#?X}hc$Z4K zS5J_$Hpiaa&g=1?0vMR8vWBL2UmF`6pDv%(5Xxq~_HWF*c(R!P8u0ZK$Qz()WO*eh zt5{a>AXH^1z+<8tnCbxndTyz@0<;3^@`6%ooU$Y&uu<1E1!R8v(c>+#&EF(Jm~ySV zPSHug=~_g*&*B8cn|=Qq>vI%HB=Do;ff~y@z!PJ6QC(&C$I(0xI){Ul2wZ`27MS%= zS?yW;cUH@_Sj*tvcphos%^)MWJMoBAA`#S$e3wX@MzOzvNPwtYrB|xTy{eRZKn1K! zfPVyj{hiwK=sSw&0S171A0$H)&J@tCYddXt%!!3EblyOHy0lbb!9pUJI>-7iGoj^Q84p4yW#LE{KT-RrN zjtJ3_4CI6T-#3n2sJi_}Pk}byJ-ln1m6g9~dnm>(09bJBLRtU4J`YYQm5q1#50e+b zv-^kaRF#9P)Svkv7qTEL5JRH}P_<`6`3ulSz=y=}AHKjBvVdi6>R3L;MP^Eg-1CHu~?Cy`(2g+d6cZpOv zP}_Oxy1S#i3-k5+o4uc`;QzSe2+`hyzx+T-Le79Y5d?h~{`si9DEBOCsuaAl{}3I; zy07wy3hmDaVph)sKNki>tR6cBT#kM!3|L_I&oL0!aZc`Y7f$d<0P(6A@D=83kn6W# z{`dX{tO9T8{gdBxB3vRnIyz>kg~b56H$jBm93o4s9Y@_4rB*Z&pnCNMUX!9+TF{`8 zOL6tGG+i;Q#3%5}E`iq*FF#^I<;zN5I@c!4RsuL@tHI=zl~7M;xbn`^q;M3mcn1k4!??qACe z5COcw{ea&a0+B$`>9p;_=;Z5l?N0pzS11AmAw0|Kfa&w!#Ivhd)ma1d_E!sEdzW~` z;q8nWiT71Ef55gZCRrRg$F?LYFJbLFpEE0?`}+g=9zQ>G1-+mGT$xprm(N-R^7MD9 zs7RoE1Ee8Xr-!btF6X>bxF@r7e8RcJCpv^MGco_bE0unRuN9p3(kY&JImoTBHAC0u zY)FIyk@FT8E+~uGJ>;=NSBRCB=kR2e_D_87QBjwr#(PN66|Vp#JSxyUW8mt77c2wA z0OQzFO-jl;oJ(?B%X1XL$|}}%a6&?;RzMxRVVdyH^joxq@3TbqGb)5RjW;TZ^BVo^ z{{i~cKTElWLVxcKK|lM5%R>m>0V3sYj4!@I*@hA$9-Mm-NxqN_`9 zJOVVG?t63f+U4Ze`e5))-f+XwvD7|Hd(o3B1zO+HL8sH(>);qr80*35Ne~#)+52q! zZHAC(%JynI3Be|H5<(c?<3SaOk9+US5E?cDwv%RbZI@&cYVO+0bYgfEk{;sk%IdKV zYhWY~W4OSQGi}jOxXDeXUZcb?;Z5pb7 z2d1Qvz1~IQh+zKZOFKLU27^~_KG_4q2_z2-SK;n6@Q51+ctWQI?Y|=B^hcwOyk%0y zqlUgn4|U(UVX~r>mV2QIIgNODWjklu6oQ#$brNGX_3y>*xRmk-@|Z$ z`KF#MY;PoA3Kk!vM0*;OH0`0WaYH@z0^La47S%erVG(mMsl@nccbjvow3kpq^Yg@u4f=Z?ABCIbC0T@Ml z>&>ZPZM~X=-IfNlu7k0YkURgh#?7E%b;L^G^#xv#OK|_7Z#erI|gIGPvXF;oIBgMWC8gFujh&!E|l@ z!~EID$i(slnkS`fsOQ~F4$YbGm3!iECGMV#<07QsZL=PYhWoT0AR_NBNPyfEyS)uV zdg@n(^I)*a&9)D}nKvcw^2OSnlm(?^gT*4oZ)#8K6<`u)?Br`^`e9XbzVeWDn(ECN|T zIs)LFC2&_2z&p2weT?u{x3Oi~II`I3`zrq{-@4O@qK#z=Pl9NeONslLIU6ZnRaG3ku zKu!OG3r1g`Fo)6SjD{f#zb(<7O~PSldIDsm#fue)Y_EA9m2S8>VkQ32jY!syNk+|I z;G=f>=eph-8YT*m39}k!q$C0D#)yLhz~u&j5Ill~c4+lWu)Lq7ZdejB?()k){fb9* z`&Xxr$NFFpu!@9oSh8nf`~_q&7MjRh>Ox+rcl`>)RT_xBeSX6M;~*vF9M-4gqtN~k zV&OXsnL>PPshfPn;dW8!A=zD@ESMcAp{M`dGXo!BvFI-2b2A{8u`fs^W;m^8jQvN7 zYu8*{TxWcJ>9k+}39Gg-(v^Bd%D16res}GQPGt{B$U_CYQaTKb@a+b7GtkjbAa1Fd z8*b`Q`eq%_j$t$LlfSa|t?kGu#nMyca@4TIQ1i&@`B&RhPTld{+LNBN;UmEb9Givg z(FA&eLIlheJ#uGHg_|p~jWBPg_U(7HQSIztDRI@98b9@*qCf?tHU`4c_zwu%N!!Y08`M>dzY zd@Y)9Fy7!*cPS~!BVr?NA|;RL?r2`vH?^+{aKq6-Bf8`H%39B#ZS$jgwt_I2BTn+k@TQhw@7>CIt zs{Eq<#p4K{kdKakwF*S$+bD_f8{)2}QF!V%bK~D}Cu8Hp7I`rG3VNU7~Kbh!4&GjeF|*}NseT@r~MN&ELm7 z>mlHGGv)TA(^tdlQpRjIdrB_>ED$f_;`SXOkd?*85{94CNQ3^@EW`w5W#tP1C|`gQ z!}x%X8Sb=wl$>8hSWVZG_`h}k)(UVL<4KiO;ogO)Ck`TAE-5dGpyyp@;%E94urO$K zmO*lB;#ZPWQxTi5OH6?}?SbrC>xB1898DqjKhYd?m#>@*h7 z1&#TkR0sCCy=nEN@~^l>`j-2?Op9;7 z-mLI4JwCtPacw#5(M#Q!N9{4~uO@vP93s0=7?5XVi+-W`M<1oq7ApVqczv?9MasB) zpTf)UB}HTP;O*=~$R7W4gHz5Zmq!KqsNI@tXjJpMD7MbNnHF>R@YR%5hwzY_l`Xn4 zzQ0N4Mt8&9{B5e4nqs&-^(;h+I!Piw+AoOj0z6vzQ&zX&qEl=|lY(-2Cxz zJM`wh4(+#2Ym^yFWUf$D86UZ)*tIa~l@l?8{D{gpo*@m>B=;w|W_<>I~lZtN2 z@BhP;Qe(hjz?vJVQS6VJiz+gTayt}1{B`pSprwo4UUeBN9!}3Hn)a^6Ia_T92mfIz z7y0>Hr@L(Fvs#q7a>ZVtcVuq;Zyng9qK4mE#nphP#*2jVu>kV@o3*GVhh+lp)0l?Z zS*7yO&__-l8Pvt%Q1?)ey-?TtBFY*r{_r_sm-y=>y*QzR3(m2UA(zhT4{d=>9M%JF zz6`g1=RDNQtSq+ZJJb;VvbNNGWWdx$2{B$)MyHo|VONTH0M>ktJ$JPD6#eT=;!XKSM!Gm|vsBb`_61>#Ma#$<|Ks{cfPVNX>Ph}U3B60>I)d*@}T z;HA|Sv!?Nu!?bc7Kju$)rXtjqZx) zaLbSQ-*X2-aWm;kXT$%!;m(d^QeRdhkw*6b=S2h=tEq;$vd?Ka*F4~GH*d61+pJea z1P&ZOHue9}`SAi!rvL^h(;Xl-Z7feUP0Z;F{Ivj#!}6%b`zt$*;$Iw9mKY zV8o{Ws8*5ofYY{Z4lffx3>M(}X1&IX#2>?g>S|{Wm6d#;9&NpSJdrbDl#E z)v6>+1@r0xNxkGF8rYx-UUHaCN1;`6ab?HM)!vqj>qM6O&DDvkGIuO=J++=3tBR(b zM}V72_Uin;y5^0qPNL+?Or81=8*T+oU2e1)_t<0o?C*xWt{EaDyx!H77cm7Rrm~2H z?p&zVP~~r`VQJ1a3mgFybJ=Z-v5;7@oo6FSdJ=elSZm)f5X zXzUO=NmNzc1BUsW6P==MV+|tUfjD9u^RI6J8;jXfb?K=uvgawQjE(IGibBDfTyZ8K zBu@&@k@&#?eZ<*a>iGr*-cwSw%kBW5--WShUWwt)gBZ;G5X@gOeTP@`2?NX(0KWjh zADDeqXmlXCXnG?ME|i!>1Gkb@j>Sx8gO z5?NP1)puz~b&^|#VhLZ{c>QBLf0wGHReRHkfw z+WYDKCStEVy%^$&t0SdXM!)wA)LV(q z>8*1H%&uTbe3q?ekb1jNboAu79DRDu=I5Mff;;d-iQSt@;l@hq zN>qmoh(}%AXMFo|=zCMWE9KLWL7 zi%rDpm8P0i%wm&f$Xec1t*d-j|Moh3@M3nF_(hKb`*f^rV`kv?_5l^J8j|~*e74oC z2P!I{SLz92z+GyT`E#Frs)5tvq0_N;E*3PS=dpMAA? zBLGNu;hB+mYD8q!;Quhz{|- z_UL6BV=d;d&*Z!0Bu`yC#Bw6eXd|IXPZVQX0c!XO=DoyIjmLxdU5CVj4S&XdBF9J0{^A-$VeCH&UqOx}p6W_eU3Ad}GkEf*W<(^tUevwU^C_`Ec+iDtO*-Gq zRHxMkZyO0q4CHSwi8HxeijJ~K8~0RID_Pbh$kPC;+w9;^t$K8=m``GXxhg7j9y@_7 zWw_{IYxJFn;Ae79%@BmPWozKIQEZKg=bnrwM?(mXNX1OoK|oxb@%FMX%^@4Ra$M3l z_e~1}43$JMy(;qsu)vR2G0}UhVI7dhGTZGBW-|~K>W7JKwyr&K?B%oKYOFuQLlYdt zbd~l2-hry@qJ|C&i%V5ispaD;_I1f^RXFG5_pF%4AjaoT1pMCm}VpGhtX6sZcYaNb`aWNf%6B_UWI<&O@pRm5o~>8x|XJ0 z-+)>(8#KY=!*4LpI>3cG$tEUfXO#Xvm8xbQvAs+8yr0u{Sy$rpsD?5v6vbcIoPNr= zE~ewnJ*yqm(gB2Q|L)DR3xm^JJ&K98EUD^OB7p#EELxb{#Zt!@J|iEOc>&ao{0sE1 zf<1OIF);x9W%vvpt$6?APgHoU&cvnA1?HJsZV-0`@Z{b`@hZ9A3#9W%s5uX z6I*0kN?`370gOJLqk#?f%Ghvk^CIju0xj za$?MxJb86_&2Q)rRYH*BT6s6{LuuZ&G}u-H%a(SPuC^3HstTG^j_G^sfUBN?@?hB5 zfcUCv5GO9K$qt0c$dIen;~szWAC#h5f>9K4rK3xEB3BFmhF83n?s6Q#Vr{yHv}!ts!<8S$V<*i+*B?{%R zgG2(8D-D=rK$hW|!e}M@JD$Y^6t#BA|re7J^&*;N3&cnOV-xQ`vZxcMZfSCP?Kmc4+ z6lB07yBLy@1;F{$D?~4fZzVrwK~mbFCADp))rSm)XLRNOx8fw5%sIae0|TrPK>wvP z+28GPrzcOfwbfOb0!uAygS&CIx^x z2KwHmtLEv-ueUqE9&+gC3PK&35aZ0~D?)IbNfRhF1g7pM*vCddHs14!WwbF?fg=+P zrjM)a+0~@_rIMR#A{Q1d^~1ikuG{@WIg1Y$FqQJClBqgt9#lyq;=(*cKS zw&9^RH|R`Lt-iB%UV}s4C%`HIIn$Q+SL22i9Te{UPdVv?8^es@Hp3r1>9YFo4ydvZ0={&F>MzA%i{OR8am_@Mm$0kFM}UGl!hc{Viq7X1$)ED5iK`rr_!D;4M3Pp)uMT+g5ft_B5@< zpW}b8m40P8&2hhAc_|#W!xh+dsq1*2oqQsjgP!Y9qaUYs?mgo_<8g;kjTso*lLc?- zQfZF=&~*~7KcbX4l#ylE2>>91&MT|<2L3OWy?T=e(Bzn!z}|za`%ug6?S+f4U()+J z)R^KW-GMd#EO__)IC_;HF8;*=HO+6?R?|Eiz2DyEoa^Te%=dH`Jw++2JAz|v40yp! z;x_OnKd_dYD9EO;t9FkSAydm8UM5j#(~e7BmaQcMn0o?XY@ZX;e8coYn*+NM>kX7FEyF37fisyt>Mc% zjsZ+n$1+^@C3a<&rI#D=*vQiEGPg}8ko^NkA6#l)2KoQPvoU^zVl3w|W+*ki6r0saHQPzeza%@T`QztA(QJGNDO+FUOmG zXEks&p)r_yUIBff-JoI$=)TSWKIf~b3t7<4V zd;rQ{G`MeEr^IioKWWX+Q+B}Q9J;H7I{ZB`(N3L}{OOas+?HAFPnoNfeflr-ut#?6 zD!QLNQ+dL96`h>{JOh&Zcl!oZ4TRKQ*3a$00apL<0g4yvC@EY_H;!@Sut`G=ML{>= z1Kj>_B;X~j3M{^^mS?iECFrzc z2$GeyY^`9az%dWuR(UYe%6C7GRV5bRLsf~|>Dh0c4vMO(+Oz(ACXa$mRJiCL#A~$=6gQ3&4X?BK4|Dzp{D8-QuHRU;Lw&>~C4z5}=yH3MlzWW#_QvIQR zx~qK3HUO)SYOE6vrbD79b#^y?VHIv%W!z({&WRk{naDJcYOZoHou{1rnw3st~g#=tJ-S7 zVgApj)dA-ACF8>29>&K|xTs;b3^-Ru%@^80)BIEZ+iCjX3hv_vMFCp}WN$>7VuS~u zRFKeF9Q>%pU=oHhfI&uFL}btczai-UK9^PKpzw_47jl|2lD&Vf{W4BrM1L6$c#o@D zAY6nxGOj)2UvC8|!vL{>)T5)ViuOQHz}2743bc;=SYOXWU0eVf1Lz1)bAJ;60~MFI z0F-6*^Jw+z$sf`^tI)bU6tMX+uyyiPuPy$v)=mI5@E^ti59cK3hqYkijpxACn=1$b zs!@v)s0$;wMoe^@kbsErY9IEiy$z`#Py$M7HqnRra5Srkn4-0N2nHmsWB}}F%x)7p zx`dNR&T9uN8@hRfVaHTn=2uoN@BPoNhqo1OOpy-g8W7`dtv;I=_Lj^_1``EVGtBp6 zCsVQuK(6Lr_?mwISV9`lDSF-CPt?^U{v@Pd_Gi0rPbH?=UM?)?m5e&qOudp*Ln!O_ z9mTO${Ry3tP#6C+p2rQzAh2}MpZ9anrtTOUtW9?et$+#EX6nO}d;k46_a%mQEjP=` ztL$h;Tm9YgOUbMEyJHal+xLGy^8fw_#&_3MNzfS^yPCsoytW$ulek?wS^e0Fa&}6_ zn{{CqmEwor92x%vGToJ-Lb#2JAW)woWbc7r3ig$;RxDhmfw_;&2TEuatDNZGCW;bnjzAb&KeEA6?Ups01R*l%Ar2w}5&0pPd7Fm9j z9nN*URddzvt7W_KD;vgW(a=y$B^8|&q34$b`Bd(8<4@lxpPma(Lv_#>_orLi1N2{CNs|02 z$$wrqX^aGQQa6@X>HU;_TJnClPcyplnOUP$!{ znW6U0LO;}`fqe#B_i4PhVBnnlZ$OJ(3yQAO=|^X!&|$NBM>!NAplFF;=KXtRd$Z4p z-?@?(;*G}CuDNx{`Tnclaz|z1wp-aJiqxRG zm(@=y-zpqT>s9Km_xh>d%6I(Hygo3zp+*wF97cGiHu$A8Vs`XSGcCTCADrT{!hpyZ)L{`Sk8MddeV#Kh_AdmLkjs)};#rJFUWWoE7)zrV58wm;SEm656^x%{ z?yjYGoQCcm8Q2>8>pB;=9*Wio!8I|?kGo&!7=qVIG)OQAm1LKC4H?JJpSadY|7mY` zJ*{Bv2NUdzz_^8i@W@O!Qygo%?!L)dUoA0jfMIq_lDo%&V2Q~mp`6=*<#J1{G6Qx1!ms?!y0WbK@ zIV~-GC4~D+J-fAir+#V>rx-Xr8s=r|CL1fUrxPBsrZ+a6D+|ZZ*ZP4Rx%G?gr^u3g zNNIU6RwvBaix4kI^7V}gqx5&|Nyhn0QU;S?VyWtUI`CUo>Q%~qL~yu_JeZwU0lHw{omWj|fT(cm$qc3POyEUy1GiH|u^<9j+NtJz;T$Thj$ZMUUtEcv0RgQ~nSDCJ=N0pJ- zg5pet>1VSMqn}BhTmab=l&mCQ! zn~u!4efHMx7bCsyQfaS`8h7C*yVk!2Xg(cZHoS3plQUhkwh>*$mBjL82bSZt_v1A zBBK|NAMtp~SFD@!E>K^pNWxAfg~%ok>%Z@d8)+)Rht!RgV*Ag!%=x$ijI>j~IBWEq zd-B(;Ra)HPgL{*|bUX4Ru#7k6k9hF7MO8bANvIvjUYY@75L42&DTFdlNZIx3)Y`xIv z@3pr;lKx%Hx@xBrP_0_A$kuCn+e^~PUMu;nrOuV-opt5CA8uhb;Q3^pX%b7m_86I z9foT!$H;q3rSx0b88tOP2j`-c{$5L2H}|x3FfBboHAg?@_o0b9=d_V-oa`F4PU zM}~X6H;FD;x{65Yy7h~QcC!x^PIJ)O#0vf=;C9GyQxQej$t5=|w0Pe8EaBMeNbJvj zAIBrg!y@iE$KR#x#oH9;+Ue5fChzeCCh4{gfLU@O)Mqx+M+4o{d;@@(=8 zT=}e$&3Iu#8k*loK5A(2T0VE%%Ek-B599m;xa{Q~nA!6O!Q^u0!TaHcV*!z|M!5U* zgPnW4Vcp9SB1U_@+BB_A=cuQ+OOM3dlS~m%doVQ)wDVRRd{$iEsn-y-O`yB#x@f$? zxg51kcZoYZZf!E0WUE+k|4n7wts_-xFC3yO8=@+`KCym2oG>(^%N3&~zPae=%MhfR ziQ}i5BbQ2xHse)=8Rj9|)@|JG6H>ppvj!I(tz?{GuY6+;nXjX&%&kREMS$!dr>}oL zqITCzDU!XHzN_To&M)iE=EQf_Z1>oK!yNK<aF3R@jNYL<0)A(}b&akuXYrfJSXhkNh7Nsj1S0lf^}B<`VN4LVdN+^5v1 z>Cq_ir>8qz+dA8MnJ1Mra|LKk&WwA&uko1q<0YX|u~I=QxJm!r6HwQN=}&uAJ%anb z7h~A@eHtWajSma1F{pgE3;H(SRYa};`o<_s?b2?t(~&M9zH9sSam3=dV%)B63`b*p zq3(*VY7QDO;FZ~{Iww8PsYtlxR17OWb`+k_^a|y9bx#Rx86+*65kGmGH~ee*xALZ0 z*)KSQq!86x#?oe;wQq*J&Y{hNDP;m9U$|fHNd<>*TCrbr!&`t_$Z2n#J1CZUPM(+B zk@oFTKaxD1VOvV5Y?3@-4;J(*@i;ckvO=E}OHM;hZ_F+@lSU&+;7K>xw`HS9q{`|m zS{@Uuvu~-;O0cg%cl~T83}ma9CSZ~NbIgM)eCP9MrNJ_Pnvn35wA2bW?7g6modtug zjy(NI%>`3MsLTiNJwBKe^K~28QE37$5o^5jhe9 zTJbiTaSLn`{H^I{#1nAJ(La10Ow$?PIseCd{s*N2Cn^9qxtVVR&1BQ1nlyg&yT=viBM1QZ#3N3|PL?!M)wn+}!e0+NIe5)pf*_e>|(! z=Mm+5gOtCMK5dX?+Hc8yIA&xdP$ZmNW#zP+T^I#@`5qhr5Ko+;%ZgB?AYAHb0UwPD z;b@z-tBE`;lr+TprIZ|#1*MKiQ7GFZf$1;V4=6|o#^~%3Ss(`1({?wh5!{0CslQ16 z96oN@6`h-&J`km?zVU3t*ZhJ4?JpV~l6n-s z?v18vB3146sQf?%kHl3!f)q);Ok8nw%kn~d^ct>mnsL?sy%wa(8j9kgou zh~Sx7`}in){A#)qvzFpM_B5vdN_yD|+L4UMaX2K0G_3B2rJ>(27Bb#rf~MeW5-~)}krS&V}t85#g*+ZPnSqllz+dsZZoDTG1Q7m6?fH!-r6O zn$%#TL}5j#_*@LIl#f-MoXnb@LsW;7-0G4ra?zwPt#zL_tF>g*ko51h8{txfwe1xl ztd7xsAX-M@)A^f@*(Mvxh_m!Pk@>sOs<^mpaK4*0^m(@q&Z%!e#Ygqq@yNW(34K>P z0c-1x0Ma&LN+gfvb)Seuy4Q!y`4fH#`sZpN4k)_AM*NW6AS(hN_O=T>T=7Hls}HLXm&3eKSK*i!Ia49Yg0?>g-Er*lhO?Yug1#l}4Illdl;FtlpwF_t* zxSnc7^$2R0;Yy$HzQ!}Xc%9*4kdnWWOLYg59jDmnLzVYy8=#2^ooXYYt4dG9Aw*WD zHX!l>MRjqJPBPI>fTbZ5-OH_N-EbZ8iHqX3Ux1B2re9`5rsQ{bk~cxL$z#Hul^bPF zvaPCRgJ?}~&vTV1tFZT%h_oL$J!of4>Fi|DVt^27bB_jZvY3WLw|h&bpR-8j*)a;M zS2{^b^l2DO)x+Y?>wYj@=70A^FffA%Af!ZAN+2#1ALI^rU;K^|ogTF}nGb?R8Q7^k z?R;J6Edg3eDws54I321fH6pa9+WWv;*y1avIQWkS-{6g`pbIj@I%T*3=GB~u_3}R1 z&RTmwooM7h5R%ub-bIV!lopyGe9_olxSV674Au@psxZ>)5x^t!z`0@deqFgs)GS-U zh+hY?EXG>&y-AcUapAX_h2SyuvbhmJ8poh`G3e+-;aRApgjNa%FXMoG)X4tdYtuNH zxM%B&{@2It+2)L6$VK$XBZP=koL?+PG4baxF3#3$U()?PWx4Z~3_*`mqSO3c<6$36 z-Pr#8(c{0@d{Ai{w31fr01hRkNUWib+D%Bg&)Z-irV*5U`t?FgwOUGw4^|hup69_`jYfqu4> zM!c_SjK0phaGxxY4&1tE^~ZI@g`rPO${rhucXCNZE)Fu@>*6v@B@<*O&kyezVoPwh zx@i+gL5Ap{)mqO^AAai+_sFIze_~DodkL*CN9w1@Bs=`#9Q`2q^T0CZvKL!2(I1s9 zczZ8zIELVN`<8jMD`{9JVzo-Sw|`015ORQKPJ5Lpn5-zJY<$(;;! zw(tS2=;`PUzVWT8+NV(X^vP&YwO@Nd1ujcUqGVmq2iHzvv%WO?k#STfLaJToUcp9} z-aXYOz+6`z-s$LGM=;Y8DV-8=-Mje$E6LeP4{5Us^#=I_kO$DJmVajIs?sCRxBJp9 zJo>r5b=4s4-6` zB9yWPNkS0zQb{$wD1a1|fq6Y$$5eJNvRrWHBqiSl9+u9Z(7??~Z zDSRmSHuRjQLUm%!-l*aaq>#qG$yGDCgaHT2Urmx=n+0I$54e1nIeTu- z5@i6)ef94Ht~cjfZ!TD{#p?gMkzl>3t@}35Z3+R$mceqK{=Ftj4GE;TYQ_0SJPj90 zLva9hK~couWJu*eE@}zv;Go$I?)tFkmnuX4TJ3`oNjqzj|_HtWd# zJadBfc$miLcPL47Rv+L>QH^wj*FRJ72{r5x`K8&{Ee98G1{k#4(P7qrYfYSz6LIl# zIgG3deq4udg_$@AW8CNOjp_tIx%i*^+K+0XEZ-l#5I)h%&;G?c;g9(4r&`<|)IQCJ zA}09Yh$Y_22kXgq$GXIt@dh+eet%-$mfHGqYRJSwk4K4a6rn_l`o-hW(mnO=B5rqN zJ@nnZ@XytXB~=PxiHV>V27$4|A2?o3g9|^)_t653MQO-QInEtnqEZh1BjU$=>2KTX zPriruiQ7cwx0-IqA!H-2nu|}|`G>p7tFuxa;e%PHGh^=RcJ7Zj6h;uuf zQtwlGsvG;c^|!0?bEw67-O;2~3+9qgGQa^BUH5QediX&p9wgXIW+=D#(7Pre_z+pb zPfAKx3h}JS9SMCJ@lM+G5ybWl(|FMEkUU$Q+G}CABPqBS!CaSasCNv zVon};>CkE&tuB1CiRmS;IY%#HrSH0F?Z)40f!G}-gI4d0#nK}J0q%$~99q7L2;#QN zo9llB%>VC*F=s{}6YGzH^sBOy&T>3$C3eDR_f#WcqPhgEquQ1&VP$@I++%=LVPv`6 zbLN#H7OEO8?HVVM2jX>r(Qg)RA6%HKtoAc?YpDhi2+(PNAMuv}$u>MpcXoE|F=ky8 zjZS&fXFg|jIP;E21{bnMB>sTU=Fl#XyP(49ZC}FbWPg+LMQDvh9J7+yS=OoAoMX_3 zgUZ(3Ng@lP!tPVh22{l0S-cL|4CEG->DOHzFEX<)GIf@63}1hx{`Ibgk8^|YiPZX! zl7+b29UInB=}KgVdBUb&^ZZ$zvI>6OrzC|*vGJKPlY(5G4qD5ZtpJn0`&B8B2(VF9 z(Ojh6sS&ghp)1ALYy8Q#5Qr7R4_j74g1TFtGJmgeUHBhZ3NT`&uyKnGz+Smjgvb#M zs0`EWsQ+AT)fxCWFm5c?vx(yJq_b%w*y-q;#RjcukWvUt*tB!PB$TNVGR2IUjHW*F zK%^6r+tWkeBgeOq9bWR;p{jLKG9Hn5-jN`5PXrN3#LQq?MOwql#zb*rYF>4!ocQwV z-)n9uvVhak8!7Rau<)MLk+)iWkOt;uIFN4pslp6$z1<^eu==g_b_=eSadnaJC-knjr#hLL$%63RUePv-pUnPV)Bi%qOUKh2c^L*~ zr_1s2rn_Dd3bP2ybx?Flj>rrC2>FWpLaH$O_gdyD%VqG2S8pWOE3wDnndH7gGV~`5 zu>k;5xLd{f06n}|zesyhKfx^UIByfzwat^V;7P!!_6W zp-M?y{$D8Ug$69%MY^wts<=bvY;*jr%|$+_9lZK`ZPG`k55>b8>XT;&e2hFUCBGfk z={bp6B6r&ASqJu}8;lz15zxCgP&pm^;aR?^Pk!@0P>|cryzFhyH5`~g;ic-3LCN9d zB^#?exX8&uatHod0H0H=V4Wsu5KM8Yz}}}w&_l0n;hk%cQqSuKNZc2s)TSYE6L-+5 zdZO$yPX@&<9~9H$6Q0vR?yNj&iN3WC24<(Z70yvB^}A(4hk%HQu5>{NXupN>j{!S0)xLIeBe-MBqKrhC4)R!749y~lYvghkMV&1 z>rI3|%cv7wsOnOAFi;X0d36MXv=VT=vkx3_@6ToWKmNfqv3@S)PMGrmGv_mgsmL<8 zwH5N9dq0O8jEChYI~bjF<0K7`aU=Q>V^f`E((-{q7YT`2z8$^}UxGXVd8myUvCY9t z#Xl3L0-Rzq5+#aLIc&yrkNA6alT*}FG==l}>>@AN|FHM#9@C_eC($oFp;oPX$bCT0 zBg5rS5oDoQ%aC9yki@GQuDXM@VcC^C-aa-vBX_F$w6>(l#U(NYA(axosVE;^*Wql^ z{FMj69r~5S()wPvyH6T{hYi#E?~xy5FGT0URJb2L)JB**NZbki;f_#LX?!;h#F2SB z0o@i~t(EflZ?tPgMxxr0%<9X$zi2uQme8N)^oyz-lMu@$&)k#=KOZrVZb`)7;7T&R zBVyg0qH!eY^-Ll8q&GEfb99~Db(6l3GICwrL{Hp=-kAwX1RkVpuLsKn#2u5WJFf0< z3!FtaojHvuQH6dPbcIw~qoQS)yhL0gW*LpJ$VVovH*snu4z!IlD|ymXi3O`KYwnfN z(RLxpjXiW#PNQla<6KTKs+ zXQ#jlSDq{HF=MF8iO}UARD30wHHy(k$=14y{-H6SXK14AXv4nPkb-;So>_aEAe2km zi9<=nw7O;^a_6${%3a12vsnxq&b(Zd8@@-m<#(S^lkPUJreQ~JhJca&x$z}8o*MAk zrI%Xa9Gr>T#Ke^05Rq^OaR&F)I~4W=FX+dy&l79s+-Mc|W&7dNb1%L($p>Rwg#eXo$UA7)*@1bCU`2cZnBK+M#K$iu}rDI7gh_+7`j-KpWX#8(Aee^$P;n?KY^Fm;DLFz~VrK&Wm~a z#G$kU8ZO5UK3L_UBdH+W%>&4kK{w-SzjZ$n4~}nB7X)MYD+{NzDiagA+wb%ilYG^s zTC{`^By!?7aC#x9Hq{`|I+2fxdI^jmJV`wT-Tk?sJ5L+_HXQn~_o*!8`JIYNgoBUr zw(b(eh~0~bHs?IV7`fp9Ww=H`O^hVh>YjvtN+E(3wnwG4RQjxvgPsonhW{~0*eMvf|9!B0bdxIg5ca`z3COm&j z5--czYyGa%fxmK#7BXBpZnEfGoRDbva^^?>-)o)B)sE^d1fnSp`#c&E9iv*`J5{HK zyd*`!*_i0ZSRZ1j2#_j1vf0eD)7Po*L6qMyFw)F%a2%2LaZn=(-jd%=mPp=F`<%9F zK@`{}zj{J_LhVa^B5&VU86(V~yf)@s+38>_6&3cp{|20wU5_Klh@xu9GuD-}BUVJS zONdcM>CT-2S)#N>-_b8&7FEpRgs5J0mZpQ+;DeiRUuq4>Zl={Y%V~LsQA%W(XCs~D zDcT`-T^)s%1CZ3=M?@Cg-b92wBylmc-M-AYU+7dq@{aWMPU3iSWdlUh7_Ao;$%%Zb z&1Y_$JoO+`crJkrFBgiJM;x(Kc07n>IH647*-vn1R{6MWxcX!VI;XY6{yCD*A%2tw zE3J8U@N8roNp54;y|I?Kk}BcCe;}1p8TRb0F`AKug3Qb*^;~|A+|HLi`~jx9r{(9{zN4G5we=QDOvTp^(b(vK@%Og*fQfl!k+re}a48 zOxsuT#3gVD9v^djuj|P!l1w9FJ+hLIfg41(dcp!dOPJH_ChuWDQmtHP1}G&Tdh)Ol zIROq~_&QzmflUaJLu9xwd;gYP)aL{aU&xWb{dUo%XAF?r)g6(a2(OptP>m~VtA(Tq z`1$y7D&6Z5*&!)cm4ha5XRgd}MSbkNwLd)%YKp`&E+ckI>KkZW-nOMB$K0L1qv!B5 zUh(aa){ekh=#omeiMDdkX7CL#kfe)RxXt-&v_#!?fcbVQPGsC(T&jge{#T8non({` zC&{QCq;kqx#ADS$K#wZYjPhaUl!C~4RFh3~G*0Js80G#$0ox@J-5s$x&l3?U$it8u z?$W4E93_g?F-FsZOx=Owxw7#9f7{`dkDEzMWnFEo!;?WgXlteCBSTj(u3JtH#YCc` z7_v=*_t;?KhdFy{lru{(Z|mfXKUAizq1;0GGCAFIO7KK5bVM(9Cq=YFiBvCKiq|eE zwDa!uh&woq{${YQ;D84x?hz3yeITF>sr7{u6-H3w>J)hHn!!ks6;dY@bJu9}!!Q zSWE}d`b~H7K#A~3)%LvYS{k?P{m?Nt7|EP1?rnOX7+Y0ye-gVfecP++ z!D^SXc?S!Rb0*%_!9gHv^nb3dPfN z2~;(u{UQNiWFeKP?HyR7(%aj25|v$I@(nO0@;qxAU!D1KY`JR#?)CK0g|)PF>^Sqq zHIZ4pl6j-nlsKL?<<6TsZ#CnUIp(S)rb*s0l)S)UX3{H0p6k`W`)b1yE6BaVB5(VR zyV8SgHB^VcN}P}TmLV=ZG1)$!p&`{4g)`7D7k-0r?|>#v8CnLpDeYz`l1`wNRC>hg&hW~`;w-8O4h@s{{p$M=c^(!=4GFP5>qFap)VZ+2y3X`2SYFq>0MYz7 z?^K^yqX=a<7_A#;rp)2PoXWK|dCzda{G)*LvR{(qxum#w_xR3s5FJjabCusPI8C8u z{8T%rJrS9Up)xS@R@OY<+6D3=PZGVZ@8^7XhVh+I#z#ze3!S})4*%GZJBu~Y3IEuh zUpch}=h))gia2ndHphxM^yE`a#B%L$fV4C0gdUNn^!y~!$#(d_#E+HJ%#?c%d`U_yKn`cUxY_b>`9Ng9V%)TsjY~xBNsW9 z`+IuzHofw3Q3)a|;-7*;`OS8!DZAyVdiChD$ftLtQXuywC4?VQSMz(Qk?f z5KAQA!)z{e-XDj?->EC3Q{d3VP@u&BXY3t%PT_@3H&c(fz zV-2RGuX^h{X@hS=FHM$$E|~5fD^e^{sm}4>$4>0mE%OfxF8B5ocJVKRT}+2BBBy^S zL|$2lW10~HCI3_s<6j41lyfpw3z`u;OvhCdq4;VcTA#L|HbmvgM;7Bz&aW@sCF8D;->KAl3O?MU~_#xm80cQ>wcT&%TjjFI~}Ar zwGdT8OD0~ykT%Df=isuNK*$IV4R#kZT$7k9d9@31K3kl=9|&!56U0lNSSA>OKK{t2 z^8r*Jq5NX+d|h|;?DhjO3uXBJdN_`OHn2UY)%cW-x;yxGSlqGJ1ro>KXvMjp7ZH4; zQ8;O7a!_HhLholQx-Sg-_gdKWxk2mHudU#MwU+BFy?hr@^}(GK9(xFye)QUTW>N=vXn@A$q((IWWnCjt%nNvc-H7Y$^ETt%hmhOTd1I7e3wd> z=AB`1OPFz5$cI1kzt166C$m;v=DgDmT9hqW<^;C|xJ_s-ZrF9@8^Q&K(;woRUY_M= zr$@vy2CbPKE@j>xr=Q$6CugvFx7;v^8OD1nYnA1A4r;dEm{~g$kT{R*d?jr6cKiU! z>DXAHI`VwcOdRhes=abDvSxHRPc&YhqUtd{n@~?-{lkr-ZNPVwO{CC^^Dm-Oa;EF>{ha6I46jbC zMzGr-kS`5g1e=>_*RK6h-Jd1O$hXGFBMpD8nupYOJfF%c)A0p$+8yy7OXTD4a=5HI;2pM)i5@vMp;WVj$UEde zD`^aj-uL+4JuPAvFVwE+=!+NTtecRba)l0$E4&Y5Au9J0{CIYlW=LOJC$r^>0AoaU@h zbIiHl-S7Lk{pGR8?#F#!_wMU@UC-C^kk^^bPl(P}YdQUBziGovZp{;F8zY^tw0UT< z7Y*BeFQ(;DbXZMC9B#%C*iuJ4I*De?v~BVBMdD>ky!A!7o<22)vWT&=Xy#;Pv}uhs z=>VSjqX{G@`B4oPW^%P8ECU9}tl*=H}l>wEBY1>eOoa z&UMIy45eNjrK^>37Gs^IAASEL=+;cjj^%UYZ}``4si8x8 zVY10G4iZUE?lTq<@3Oa&@xn0fLM}YehTde_J#r_<{uz;2l%JzEsQl-e`>eJ;5tBpJ z_?lI(*?0?aJopxUuxbOq9ee_r7AyM_O-#$>eQxpmxUc&>P|G7Kf~>r^-*OC&;JKcL zo0Ulr&453X83=+3UPhUDDs3noGyAXMbmeKOJ@PYQSCNrA+;OXdSFfd8t>1>qeqq1c zYRgxYrA-O3aMeN-Y7}vYWG|le713!gcpzx#ul_EH&m!wdX;eYR(wasBvvl~V%*u`$ z{4xx=Db=r2w)kL0Ddkdq{8PZ8@g*qo4G|D+C=5RhgN^z9()x3raQ?!SUTHq+61qbuq&$mGS(Y#8*3~&Dm4G)Rk5Y z7OMW_4FVWy*owl~pQ%5|UmTn4F02^?B!Eqf!@v>I0^fwD1cV{|KBGEuyZbb48>+9MYb_v;g^BJFDKNmlzd4Z`jI{ll@1GSr>2c zt-`EEl271PAaitI`cZ7ts%KdY^4T0qZ*^N_h9!Ifoz@vtGExx55^v!Q^C{h`KGuW$DFY-s2qOb1`9rB^UI-jKQWYa&?;$^p09e)yAzh#7oIpH_PR4V z;iv$SZgOHsWm66j)y-2Up7C^Zv1eq-##rWJq!P3APzq4exxeSwZbgBNriN>ae*7?Hcy)?pSzZDgQG6z)7mfqrC458Fs z*}h4e@S7JIQO89U*$A0Rm#;#SmmiP%%L2gicJ%bkKO!W;#S0^pw z6Y;*kIuKzK+T$FC)A_e0cnXu{Nzvt(yB1RJo>3)GpV4Dic)Boxgm74>ylAKcV40RD zyQRwCXQ7{L_@&1QBEEPo4pS2seCd?t%u%~Lo`t0eoy>=yKvCT!tf>vLt`P3p?=kF|u#Y*1|uvRq8mEcWGcDDGn@fAf5v>q5NYG~?x$?r{?0*xeLb15ty3EmzF*L>i1skZIC1G1|F8sc z*lO03xLDjrYXm2pz#ebdupc8jJ~fy->fE9EN;$qmzW_R?x6=dPHd! z0!a!*CDH)$6}CB9K%4@*k8w)s6>t_P1QB5$ADSkRtmLKZsf*1V68r`I)dJso?>#j) zX;BMs=ktVcN(hOGsqwr}P5>H>r+ZAEY4f@DhW!ShmMtBer-YT8 zIYYa+Y5oc0lF>Qb>^UXIf`WSIgke%-qCDj6Q?1S+)q!VIMc1h%U1rp_Zr5y8%9JS; ztH~0LQ^%AAz4@kc$+x*u6^imwfP|fz^~o^Gh>(PnH-cl+a32dU_nngmo4bkwETE9) z1PB59iGcM6HZSCrPd_n!32?>b2x}L`9c=#aW_ll$`l-dAtK9xlp`w4*NKTD;n0F9ummtl-k}8oQ8F1?w@ggJ=$~#( zA)JhJ7WE~Hb|kq{ablvL*#wZANC5`no|yD63rv%WlW;3h?G8gC5WrZdz&xLT6cX&L z$Vk9k@O&S!tsBE`huVavghM4wI*wt~GOI*PT;PQXqQ1U2Uu2)c+Q&QPc)r z926=Fbln(D7Y5JiK@_(Pgd!GE?Tc2%Qmu=#(j?XC5LZCH)-%wFEKEp1-4Xp@(@;Vb zLAwC|p7KtB>HCEj%2Vwf;B>QAS5{|52>4RGx#Hm@Mq9g*#O>JqH01g?VLg z_rXBYWKs@X|CkDm`#y-+rXPJ@x%p($^fi`7tIC@p#nqtqxF{tuwLwJaUm!V7l+o>8 z!XDcFBdj*8sJrC{(D*>L2>Td!3j|kRjO&Urw~33jwO1r4s$8ng0Z3(1eSJepfi5{j z7{?>~e>r#lft=7*q0}>8r4M^8cD0JIVW>rXjtwzAep4}rra@fvukRwZiOGZA{MeA! z?bE=%$OPa>{94kcVBG4hWJ;&&=x8t)tv~&;j$%cg&4G|bQ&XB$)DMDjm&QZXuCG-C zm?+O*!hg&d#+{^Ih!i;az%oHggQbP?%2l*7?r9YT+JV3s7`y1&b+I>Jt=zmUkcF=w z#1kM8Fi{qDtqle@Zfk$I;Rj&3+;L#Qu+Nt$HKbIK^nT59$A9De%{tRI4{d@Kr zEYAedu$oR=9H*Gkv75)PbjW+`2-{JB`OC%z zmdjpwcRQu3-Z5U$B#qcvH1A{*m3o$?bQLU1HCjLHhpIMCtm9HE~jHg=}xfhIV9ZVLZyW@N!U6|H+LM}Dy3vFB9%bbnwW%7mDeH8|GMf!!L$=X-qm?KSYUG5s0a z-cEw8*l0=GhDDu@+|SF&HlWMTo94`|<%@QcRgVN}MFyWR)v9L4nSWaGvD|%lYyeb! z_?y*eJvkHzEy=PcJ({Q9uKpZ7OsRHjRIF;ezo;B>McO96*+MRMS8gM<=IJXn7o%sX zzNZtu=DaKr6MiWkZh^eHZFTFzdmRrm?%zn+yz|W;_vS^@Px^Fb=;?84nI8RW-{K-@ zvgPS+@zfKM&}y)+3J@;?9yuFS{`r%XJdk8_1+jKXNpOJ5;G4J+$XQe7${8{IiWn4j z1ExUEg}zy2*f=Q0)QpbTOg7c++&o(@722PVrQGL1Hq|y#gmWv73k-!k=Krckx;Nn4 zSo5B?Ra>%|r?B_?FI!Jk(^AdqU>qj6=7rRmYXhWx?{tp{t>X9SAKdAl{o@bscR7~( ze*t8wtwTCHRoY%UWAT@o4$(GrmtpAQLB-4)2I2a~_p2|yYNyzWGhSaQ5`Rp$OJ7N^ zpO7Dq@H}egr;~h9=l*ESJ0l)h{L+u8i*8)IHeWP8-w{cBV}F9PtD%NH}L5a1Jn0-DVA>_{=Im4m==df(?l9_-sa|`RwZwo%j-j1pG+=|!| z8U<p#IS;dMog>Tot@&fkS9eAE8$PL1G%pzCHq;O< zsuX;@=pn;qyg(u_NLV0lx#+p3UJO6rmz=nr6mNm9se~A_ZXU0gWRH z8`~bC{AX&>|Hb_$UG}Oaq^>jQM|#cBM}{*+6%y1qHsd)$|_H^ZmS$ zcGvG$9Do)5tjqL8t>`w}-)9!w*xAfNLu0h}p88iGHG0F1u@E@BIA^WX9MGkH)yX3N zL?*~@ft&`*SZXg{seTz!&C1|%p7O~MUwM%c)F=M-!nQ%DQfVqjgQUvvnI1FJ*&@2! zS(=J4B_)~)m3JRIvkC(bJ} z$p2+q%DyekZuQ7%sMc3Yutn_mJ^3~^OhTo-{?KUjMbVV(sxbDgyxYRxzrN{SdEenb zh&SAMhB?X?OQ&~P=Z$1MTKfJ7;Eg=5%B)WR`2LG>O5+uUe*Ax2_ZgK|54cveI&Mvu zmj!4jI*!!+CMnsqe2-orKL|cT*s7k~&x{nQ$q(LI`H3kPfBe`S@&w`Bg!r>4n_|)X zX0KpZ6l3ZWuxt_2YNfO<&F%1``rww__x`|b#Xs1+byCL%Bi#4*DdSk_KIWlux#(Xu z5&m!Igg0Eq`1{UXWm~c1thl@6cWCSJmo3?4vFDpzMAcWr?CrU4KElm~^k$gs@fp(r z`Q6GRm9cNdQK9c2$bXEB$yfNxwzn5?`%v6~L+z8mbzretS%BBve_j??cKnsqg;G}O zHe=JHvh1iYqG#e!T?_h)_4w$mzifZm4yzkq?&dpdJ@S|^&Z0@Tb7cQ^d8_znoX7ht zFEVZ6p7pxY{lvy|Xngz)ou4u578*^PO7`+vDTxwlxF9dd-TDD`eya9viR#X8tdU0g zoXf-D;}4hn#@n*faYW;rl)0w;2(W6%cJ7S)9zLoym>Z7Bi^m*G{gETR= z$=qcIX8qWrhK3!iuTS=ESvQh`!hZB|K6}Hw5cvZeyK`36V1G7SBP#dO-3IU_k%?1} z8x<>;dwb?s9cNBSe&!L*0sv_Fnu}iNY*ugBr)J>ssna*gVf&EvAZ`~CIM^8T5 zm$&blOSpZ+;6hm%JZtiv(0g63^~dg34)ZYM;wy&tBMcZif7$8=FXz`E^KiL--~KG` z>15pn&z9XPw9xw*gK{A$%LkBQoykOSNR}t zp2y$L{AlgbXU^r< ztM1t@yj^k-y}nAe+J&bJhy&GEMb*5?Nn(z4n|IkVa-)_CW9ki#R87ui2B{H4?l6C7 z>HqlD@Zq=k^hrN!--dd~)~(WhTMuhd-GQ1BYLv>8lQ#Tkvu%E@XdD0RA9@~8cry1v zV-MSa>{?tHf5b&INhAm2bkmH7j^ifreQ$-(Zvn$AMW3xQcuu`&IofDr>f13>UVC@T z)&Xw+I?l$yKQHVLEY&>KK{wf|MDORi$KuGmvwqo2us+3l<*H#O`Y@3`>J;GFN`|Uw z3MD?8e-hAS->H1)IA$XpK4*$HBx;RV2z}@G9aMfKA(Z724WjxKm;ghQO5xQ9zhurH6QrB?%$RAkr1(s{`(IKO^ zx)BPi^|1L;1ZUIeY@r|0C%Gw@r;e9D#5m|B?x-bKtvNJ3rH!L~W_`$f@L^QWS{*1J zcZvBY-?5ed!m|r621m4x1)AKjaU|GFYljT_|2Ir%A1?a!efCA8#gF%}XZiO}p|f|q zDbLIJ&fz8qPu|*hzS838JbLrWFb_0!XIZv%wl1}+J#uQ#7Sx#uD;(UzYn)^I55zP{m%QD_S2Y6^HVb~of);fzOb#_y%1dta1a zCv_~mEO3fSHBvpMD|#@Q+VFd6TXXu%ZI-pbyUE6dsU-99`l%CL+BwDIb&7XGq+21c z4(dy<$W*xBGLOn4R9voz-&|{s-I7(~-u8>!N4)R~@iD}IGMvvc>S>58*XCkql#b(g zU5n41<5Lb(OIlJ#Ox)tZhJUa+lYF7&pe-(YEI)HFR5Xo>FqbzpVu=hFh(Jaq< z)wsj1Z!<~q?UVN8Y4)?+4@B#FV&Q9rC685c9&#!`9OM}p$zW3VPZg!Y&&jtZUfAis z^5Pr!G!F=TrN6yfc#G@#psv&H6hrkl=ULu`RcQ7H$1WA7JF1d*?jpnH7(z0igv_uKZ@J&*AA0avf(ks!zmtghMByFgyMe`x!U5uGRS~1)h>B<4|q9c)WFTi&f@a zds6RDjfnGW(=dL?=Cj9IocmB$3%e)(vTY4MeL4Ppid^O5j;*4A1}~2R-04A%(ovNg z|HW>*Q{G1ci-^sOsI1J}@c(YUYWmBze~eqP-30TbuFmp~i1^OZ3)Hhi8r^?e=-DSs9YHR=m&Z8 zh^@F~yqxO~^h<>6IpXf)B1OmSXwnY`mswcgqwTF52KJ+V>vYn8FF$RzV;-m5G#(aK z=G9$)Jp3#wQDe)7I)V<(v6)%FQ)Ju%5x#Y2jD2GM_1E|ONUE^M?-w;pq(y``s%62Y zUb;M<$uu{VT{!rYg}(F|2;55~SM|JZuvE~X$k@G;4G;Alu0TmTJKLVX8TW$5R4-dT zt9vGC)?rv*-K%r3ZO2G89NRhneQf?etvrT6@eM$}$GZ~K-+X?Ns!Q;%%uwzP@7I{j8W;v!6(QV7rFy>IShL7< z$XQ*ks86GnlyZE}buIPY17`&M`0ec%E3R7N&x!S0GX3q;FN1r;nsqK+M1v=TTa7I^OaX#9VBIu*^l-zcNS z0t%BcPuFiZFf>sRuR$+Cs*9Gu1NWttFQgYE{rX+PR7r*Tv4UtJ#OTE3;OV9b_6_!{ zP?ay&dT!Y)vtQ0lIW;81e!w(uQ#tmofAuuhp`mO&ubkceSK63=)|#sM&Gc_E`vHTp z{U=;1s8-#o9FhD-PXbi!D{djqLgy^qu`{=Beach$L2$2(HCS>gRG5MFe|IKza#4C; zlWcYQt-vmq(wr=MRMewM6<4z^jL)Bvl1_fpR*yh`-~aH(MDXSG#@w>*wEVSn&L3ob zb9op$da=mTvy}FhU2AN)4l;SlAN{>pZ}!&R@nVY8GGpy9X(v~K`{0?+%hmKjl8jae zvtJfWd2{hSP$o&(8Ww8$Q(ckJQ)wr(ib5>p2d;OWpA@um8=buM1ox>!kr?fYy}TaL z!KG5jEe(D#8hm1t%K^Xex@}p6TcQ5su`}!F4DY6d@pb;jI;BvTK2b%R3;h-GHV@ff z?#r%UD6`>Iqb&#L$Ev@yqw28F!*_cZ64eP&ftup}jkgNe%U@STB0W5$X>G6P$CY_J z{6`_D5Jk5g&I=}F{Wun&2fbX)oSr--?-c&B&z`t)7x z;5yB=`9T~Yl2#I6`-hkO%Le?Pv;04iv=j^uh@>@wGgud53u*mR&Hty7{uc=dUKS4u z_>$;T2zHM^5ET}SqgKmi9u#4Ho@_qNGF|p;+iOLBK)^pBlKUENUzf%jx0kw9u0{qj zBN=o=wN{kRP#ET2zYv`$nUp3Kdi)GY7l&&(FDNfn!eTbP6o1=5OAxif&SJtxULrK^ z6C}~x)G&6W=S;rl7K{%U%zxeP=7;roFv}pVzdxH@$d}kv#v?C{71>z9F}K{>+rz}w z()Yx~L`Vrc;&tlx;5(ut!TV%;pUPWE+rR_9?BQxz@IN%`o_T_j^g^gKsANZsr`k?M zkf#cUGZ{30g!OgV2M6%#nq|FWBm%4EL~rpMn|3k5uD4gzEOXUG+E<@^SLp`1y{$O% zC!^(|#QuMfPVPe8cy-iPhDTO-ejZ<<7p^B@(sLfVm+pP2ZCwLP>Q*7EI zgh^|Xn9(&|PAC*Xp^RT;Ai4XITkWNo$QUDL4sbv1r{n!VblO{-BQ{uX?B>TRG1D7) zHtd|%{L3NGS?8;G++Mo!1AYC~*9K27Bc!|M%$|NY|Ar8%C2M8*=vy+&Xi-wD3<^c{|kOK@K+0JwWfbi%R|P=+8`g7MQ_`cu6A!kfh8 z<7N&UsU6-F2|BH{NAv?3J6(D&eJnzP(Z6&pZaqDx+Kbu5H^1Y~FL_cJIc08GA`u4XwZ~m(o_UudaS3eOB`F(8jyB(sa+Xw( zJQHC!kk?zk$FlODyVbh5NCw?p7*Uf+ zQc_m(>a(_M(Qh|-mep$;r}w-S$wxQ2C%PlVG&x=;&2EHO20t`<9l=eI2)aSC^0!rk zDuq&gVyVSb;pYj4JqIDO0(YnO|FSWOFi&E)jt+gq`QKr2#r^^7Wb!^j$nIbEqKyKC zOq`VVH0sQs_0UKj&~^Xhd~W-&jLga*g4ZFhDpPEP0s&^STi{hhWiC&@<8(qpn)Sim zSA`(dqE)d|$LB-KTr$EOP=>&-5t^?N6bs^bYv@5w7L)#`f?EAt!pzM@86zADN;a#C zao$Q6m>D6YG5AemxMZxPQD2^iKA`6Dqom;J+ioS_-3kpA&mI+xZw8?tYWCSl)3p^p ze=I0~6e6z18zy0digDq#|6t|zg)@pD&NtO#N~4kmU5GHh6x?vd1BP_c$G>dsdMxeN zeQ_U$(}bU?I_0ULVzN89TT)8)g-XU?TD`7mH*8GJIwYF7 zXfcJ@1P1MS0}33U;_pp22w#J1Bq_^G2rMNuDI>C%pwEp(ZOgMWcmjsqr{Yl|=e>|9djGS>;x;F&Pme<+`U?ZL0qMMQv~zg)*gy(KoXHlXP*J zK(hLG)siBB*dkpd;mxC6vvi+pUjq#&DKflh*)PLLZm+g?5MkR6i*5Tk_1O~UV~>=F z?wmhhdh+rZJ_?2E0$~5Hr3489^G3l_#xeQbw&-sp6dj%tITTS9B7bF2O`X$;)3_^<* z^Zkfu5f_M=Z7X%$J&gHG1SAVMQ91&@smX5nLb}wHgyN?q&gR6R0EC^WQddG{uLeJc z`!ASH*v~=ZmDLxT?mb4G46`0( zadJZ0C&V|-yt5lEsyZ`tgB%G1ANBK$~K_FEZK*pNDGm-CzF?OfSznk$o@^g z$fb>@iF0zxc9u+>>lGECi)0vd+xl#awyeA02@0n0fWmu|w%Jt0I-|D%m_58DPESSz z=yGnY{A)S^KLu*Z%pJI)Ql2xeGzo?%fkGhd-PuJy*hl*>sEtWW7^NNJ#KdN4v>E1h z@v}1m(ut+!VbGM^W(XMYG&^74!|bw@M`2;-bPW6hR*SvA|Nl2XxgBx2Ce~Y+-1=e7 z#O|Tlv5z@%%@!{5iiGR1V=-L+l?3)3z8YTNq9_1NKoQcwve!Qp?4~ zEB9>C;~ec%I>2+~e)Wlk@DEh0MwHB0ZgZ0-gltyY7Qj!SNvVz9efvY!X^U1i*+Qdf zFnu8uNOwZ0b4`LVq@|sCr6whOyPsDcF0aa7x(NSpcG35yljO%d`X`u4-IN^>riTdN zo1xQJSN-1y*Lo0u(XepW75*7i?*ML>EY;EqjgRMU!4~0gct%}!kU0ys5nX9mi>9N3 zTvlmIvqZY+i@YNi;N`H{IFxlGdQF;e_hMxp^=p`(q3X=gPPOiL$$k5CcQ3r26s159(ajM>&rs3AzwGFqAy;o1f=cqE~WYSc0uxkG~OFU zJBEg~3wyYZS3v}0sH8|51p|6fEP;HmvNB8AvZi__bGEb)LXdjbCFJ$8X!8e6`OEli8y;x48-8`Jt&J|4 zobwfR3EF76=pV?K;nl%ZE=iv~?+It&NAA?>;t{yW$Li1;mi*-!2ZA@G7A5=?S?)_b z13z08vgB+lA*PGwT0F3M{>zjX-#7HddQPoAGE)@W(!k^Btb?JY#^J)db#W{sg&=7O z3C(P1T%_a^{3>m3$WWIxuv#)&HU>j{c)~z|Lo`{2i7ST5Pm%nz7iobzhwTG#=#FhE zIzVBXCAM{(QBcqDWzc`~Mw`NEDI;3u59dO(pHH~nDGyA+uToZV!v`G9oP5onfneId zpIq5jUj?zbK$DyY-7ju5unWqv{hR)SJaiWufP(dx{8I1 zx^mNt#i8PoHo#($=yWNHgowh?*Jkiz(0X84%kY>=YKfY4>J9Z`{#dW z#Kikucfrp{Hk@Z?s}7^vLN*dq0Poh5Z8rnwoDxKDHy>q9r^voU`Xi@%6o=TQoAXF=Vyb#vDtmwXIAN_2r1of5u2VA5m zeZD?`zdn3(HKtGA^?ALO?NCiQuqfD`=}*)vF%F_>UfVVMX_K1F%0B$d_GHm5oqC@$ zZi;nbZE3a^CCFa-~TqmbW2)!JshN(;Qh;+x$8u^oh-jqOd zY+myaux+X^EwyeKTnl5`!+D-#REQ|AU>qi54!_A7k9odE7Kw)-W&p<*72K2&dm9M_ zLi5EtVkeTvpU+cL0us87%EP{%G=WOgN9#5CmkjBCu61z_vASwmg~IBqI3>a0h~l`N zYiT{Q1Q9HDa2s0dzTvUH@4rYY@-6{aVbbE{)BjmO15P!vvVbjxIUVZ#Az5OIM%nCR zj6_i=Gi?jreXWqV;D|8YC6?|EM&*)1*(}IaG09b9_8J{c1EIo#a?{>SdLJ7-h}kou zSpa5mp!(|{o787MkYr`0S{=yF$1mZOO!uIo^s`?Ky7PiMD44P|F$qm^Do`12Qdogt z`>%JJYfUmAk6XDat10kj1bvp&i-m!la&jIr-OF}EY@3qz{*bdsHrU8W5I#MfKm$6G zDuIc|x*ze;?U2_F`1-0oi1`N6QhaaDCZ=*z(Y)b|?RtDiniEilHB>xMGdN+qeumzr z)*atIGNWW^+O6ZD-Iuz`{SzyK+!j8$j6&h#lZ6#paA0(;gFx(wc;h(C!({l80Vs?;tOe%I?m&m;4~KYOib*FQj(zroURjc2~%YnnOqXCWUn^xyWTaD zYjIhO_CbX3rwZ-86=ulrw;{;_4+T%0Fa8ujtBd#8IE+a_fr)a#H`>dc(RR&qaU7<- z$oMEqF3Fv9K&-JXnemukW#f)uleEd8P?$x?msS*e_`JDPMj6Q5-03R|Q~xJ-#*4nI zMAOSD@ecmenpqORY^!dfuf)XP_qp~B#A=iKu9!RJIhheEMZh9{Qi~LGQX8l!osHC$ z-(aH5N7{|67WUJvwToh8ELB^BfSVQi08Y$|=xdu?R?8H|0ui)woG{N;2o{AvdA=0` zCUcOMHb^^Ff-6}}Dg&gi1MHSZek2J&ii}0nkAx!X>$KSoX|p9~2g%3@OI8 zt#S{R1{NMf(fm-pR_4Tu9BbU59huo!sXhWof%r-CxC1;*R!kCIe*#Wf#M#Oif6#X% znG=cpd}3H`vxrSe^ryH&&NqES_AE|1YsA9nDE}NulaKENXF@`*gk3KW9VrbaVmIK$ z^^cc-0`4=chsN|WJ3H8oRdPNS(vw}8hx&n>HVQT_H8$Q;Vn%zK-@c^ao&Md4=W~zI($0}=^DY*}S|N*IPqh<_j^T^y z-HLq!(jOV{8qV-mwjK`xDk<*UC$>M{BSaIwbt|l0rCOChtjrVZZOET&rlZsPY;qZs zxS{lhp5uk(SP!4{97dgZ6rT+ATLZb6|1(N4;d^QS?rDQ6f$yQRcZ?wro3LYO6z5YC;QNr1?vglydt)xg z@w8X(ou1knxo98TE4`*rmL;ikdG;#yE_kqD+oVsb*dXF*$G0`Pe09hvTMa4X*yzFOI|)$UPhXIC1(ntd8a8M}aI zT^@V4BIIjZTRWL*Wy4KQmX}p6ZnmL1&;*74@O#?JSc8e3fXCIAq9`WE%L>W8KGojVvc8)7=<&=ShMv6$O?bh!D%S;JGqTP3$S}= z+HGV)XwR=Wu5g=NZz9~b@2N%Y`6_r+By&Qo#g?}8j+Am$n(x0HZ57z1;87?pT zW%`T&Ob;ou&3|oFT>L4Je}hAx&s1`@(6z{z`;A7*U<&$t&A<9;<1kr@-_J;SzGdoi zYMG@1Byr}Vg&fNQU{{hyM!kxgfgP5@B1Xv7E+-z~w6(SUFrnJiYX6kAEc{dqjTKJQ zl0IG6@-EEj9UrNyr62PGtR)7Hj*T+L1Q2lrIe^fdo8ImP;}rGBxENTYC@GlgD~>5e z{stk4Wm+F2y5yv-0p;!6O$AAVn}I_@=hwRWJ+G=`y-%8DoTb~wW-8_`TNQC91A%)+ z_RR+J^3pW;rM#&RkV20P4a+I=Y_GeqcyUK^G*`;$UD4}F!eH53n)0%8WaA=a;jIv> zW#LO0n`D&=LUPx8Zz^U~oGzIDtr*w3h)HnOSHf(ydY?YQWA-j9?`?-Nzj!jZM1RBB zDE51ITBV0HidnkeuaI#?;W!Nm*Gz_hb8_3-ey7;@T7-iiyR#P;tmQo372}xa_P8Hs z3d?6>)$wr)>l*vMu_6i^JB|y1E#$x|O1|db_&DRX`M@`B2CaTiyR67y;5)jWb(&@O zZE6~LL+O1JqWQ%|8^-j4U5J{oR(JQ8j^eJ(Y~~Jp-<+De`Jr2ZywBY%l|$?ylPPU? zY-!KUGOLJfy?Vekq){z;=ArfCk#ISPy0jmenB}B^J;g~vV!b<2Ae5v}O5luBpa*W9 z!fiLHw~>v#6o^po{A9z(#s9QVTk564jAGauLLzLJ161M~)Sdi)qBgnECfWz|O z5=-46H(bPxvVk8$oD>v>!Hw=0a?`Xha6Nf^zAQzZaHJx(9L20twz5j7(38am6-)Q< z@Dy>4faFLhFBr&1wfLD~LiJ1!6$J*=dISTWtJ|ZA?GLE+hDloZ7QZb+nnPhF_41F5 z9R-xJ`C9&cd)QF_>=V@U}1{K32lG{UV%8 ztqne4AmTluwFM!lhiO*Ha>xHMvdaeej8<57VkgPU7Aq}LUknAfdo^)#=0K&Em?o#l z7$4HTy%2kVlNhT%HS@8-Y1i(_;g3S?~TamwP*cr=f;^GGm8dTGRx z-}yR3@rjbN(_>}jlRNW|QSdd(GhS#uL%^UyDx+EbJ~*8k5#^?Z@=TNCV!TMjL4__w!u<6&LG3a$(DGHcDn&dI$E`-45&U$nYr7>oj!{_O!4Kyp*fL+par7E;$eJ&Mnk(=kkgs z&yDXNFRz?9$$i=UqRpPn8(?2gQ7waCa*yktYokn7MALT5bKKfxqCgSyv`+ zPs{{1{nBWXjCKaue5udty|B}Lwtj;c$-C{JyuO$D`_LBfJW=TD3HLV8JWSp(>vMG$ z*@|3tK07H{2I(_YpXo+Ixm9`Gw} z9_(%_B%HoQK*OO1l>GcI3p~5a8eDRs= z`>oA*FIN%pyt$@OD=M=sya)Vk=(!K>79V-nusFJBxoRAun46&z@3$GVD-Gxy*D@i+VFCW($)#D zNPx^!Vs&$ca?BRJA<=iM2`FJlMTiOe$zeWEiE8OfFzzoj&AD%bB2n3dVB&B`cZz8} zUkA=Cmb}83UCd~t$M?-Dac}4;S6N>bi{iifZ8R|>R2Pqnc{_olRdy=_$NWR-rVew%_-%x==vsso%lzO(`wXpM zk>afmvboq4srVQbvdVmqhZ(UenJOe`VYalwBtPyVj_dWa_ym_NkEPPLQqb7Iev^}N zp~W4|X^D~b)LOa1oC0{h;|B%gh_E-)6W^1#i4^dZ8H1|X(qf@QFBnA@a?)cMVd*9|AM=LG?^kz zQfKFSCAX#~{P~hHD7)NdLw*;spRX(!S!ozQ4LidkNek*rpRy#CC=H6iUkYlB@ELn6 z1tS0$rdi=6@pU?}D+!*)O^)ORdJ(2@#lAEZJ`m3J0}Y$3l*V1%p45=GEVm=JpEfTT znZ6a3I0i&+drVw}HX%27M;rLLRzwZid|k+a75B_HWOwz$+p{poPB)~jVk2fEhG%m&xfpx$$TUfI z)?*EO>WAH#b5=J&7iU=RM^E){wrTcV(}H`Ev@&rn5j zCxOKZQAF4NxH|*~Slf|UF?V{feG(H? zqC^<~(W|y5BJ}5(_wWss7bR+a>#tGeb;5>p>^l(5G`%LVb6N>WFT9~hd_B;e^~{NWufE%~o$$?lqb;GA6}%+g2}4?Ca) zc0Tutib6qh+qQv+qaXx>fr(D#IiAsM9hE+WygN&6hg{8D@Ri}N8N^LA8vVmdOkN|q zi<^Tyr!@1#*cis0hewexW{ig*?XO}mW7ye`nQqBXV0yCnZhPP(2sgMGzX$y-0f0db z-snh4=7HH}SK}%xQVpJ`34w8vySx>1=i{kv>6tK)nlIMpJ{AlZmT85}u-5?#sDt7| z0rs3q5z$E=eg&ts=DKWUbp^@{LL3l`BodYY=v6^DflOafXLl$^b)vxL#Cf7ZPmy%A z_ORA76_>Y#p~xi7Y{k`j{{a3t#oF;08H2QX+v4)#j;erl(rQcaYUTrdC5t~J77E#t zI1%ph9Gd0>3A~yzvHp5Vv$x=q-G{brgFuNf{}1#-?RA{17+u$CB5Ziu+kj$CoZ~Fm zMp28@CEE5NO1BSh*i&77IQnXLdXk0Z@Y2*GZ`IKX#c_#-2#%Jlbo{=Lt6Gy0c}p|s z$#)pnTgAMA+@Pj&7H&=VsaAg)Z{PY>n#+1W*PUHnJ92wvcE>f$N8YF$#~fK;on7{C z>O*-+*v~BkB5DUEizr}2h&i`?9Ch2u=J2?Rt#G;99KG9quBY|mYCR6$kGs{r|3`cr(?ZJap=N3zZTzCj~p&?PLn@jp^zYLYT!R`z&&{l3(aj#FEom zc3~6ccic?yA#_ai=H$lP$c6F}h}r=4{q1Q1j+PY>rmgQoCakKqWd4O?WiTZh-vtO+1fAavF*Ewu^Re4Ew&u#Kt ze2LO*BfTg4YW&Yz`yzgUTor0MSD7)7Vvw78i0QB0@h#+O#fNtgE|+>17g_pvrBGIF zJn20!=l0~$d%Cg{%WLUI$0VU?U*Ies+V&Kukxwizl?*Rz8rv@Va4Z|P4sacFp62>$1G&uX6PxBEXL z$I*X8j*t`+#yHmZ$HQcfKDubwTjVIXPaE9UI*MKPzfq-%UAhPWh!kN%lgeSN@tX73 z-)X`8ajjTMu|T4NFgd=rXup&y$BRpNOS@h&p<`&O^Rn#@Om!K>`vS8ILI?9TH-4UE zxPb>ws&9+^WlQ@5_Qg4o3PW_H7G>wvC?J3MI#!>2_KR}yGroiy)?lh%Gyk>6B2Ho4 z67l2U`w*;e|05Kfi3Fc#{v{2IIXNYnn^MO z%m=XAU)GCb(l_K2YG2cge~iz-lxBrtp+@y0==S#3*04xVy?5p|e0)Jq6i&52bFS_p z>9QAo7S5eN;5*KTVJFGTEr{TkO_EN&rhn-Tg}Ev386CoNbu-vSJK_s52Yd|zZv0E+ z>?TyWdKpK*dt&%0edYcQz6FzA=%T-P2`CX6*MJ>?Qwj@3e=&Cvm4)LcP<=>=zV?fu zNcm6*s`Gv2{-2ajQ=GLnd_n$D2p?(Lzzb62lneGO;szsC;L}>Bc?tF69OsIcnqhet z7xs3n7+@)g&B)wm5U={Dk2zjB=-pG$y4E(CW%#VC&&8F1}JP*|LE zoWo;Jlzm2H!svBH3|~S$Nva=&;s(cY2eK#Vt(>=IR4k)%=L*62;R7bv7yr5~wEEWl z3<^T{B;uEar&RhwXA8v&&c113;x~dxk-pH|RugoE%oPkpUdrSm33o+aIc|QZGKko& zWYhIU+`A%>3E3*W)AZh6&$`$3`JS48UM`r+B^TVuOH3~nc6e}r! z&s15ggB?2v+V)tcz4sQPEN`{e!MX^}#5+N7jM`^2Mi8ExX3`7sDM%Yy!Q91`UqR-&~9PJiAictPtVUL67MJ^t(d{pxkF;Y&C; z9MENc>oOu^VxkE#M&+t8ivc*dwR(S{Q5%A&1BSNL1$rrQu9~2~-D&MI$fd3oH8<(h5R& zsDraK3kL%dHsZ4SsD9Dv@@ET+W+(y@-v-1l4sx*uw|-4H;(O+XPMT+o?eSm97(EQN zfDFRHbs@y|EE!{C6D|6ppAu^zWBmyNkcOWdFcdvY4-6#aT^pbHEps*0q+eYVhzR01 zRQ}x{Rq>|zPl7vI;(t$a;QRl6p9OB0(I3dq>ZHDy5~0KzdnIq`s|%)mXSp-JN5W?? zFj-c)j6ns1Q|RD)HZO;nwi{jvmm&u)x6~ znQUfm1pal=4nLhOVxnIB{C=AkR3S4bv#OUDBy$0_QYjaBi8I?nE~BASR7NYCmj?$9 z0v=Nv3RO_jGTySGLcaXD)ZFU76Vx}nyJ}t2Kw{MP9Ql0Q1bSG@xLFCEgv8QO_P~MjKj! zu-D>#fBI{vasNk60q_t;qJdVB6$mG%g0VsAiY4=J;AWv9_vyey-iLQ0{FU#MGq<1a z(7B6I20B?USiN)Tfs8ZS*l>dZW4w%v#nw=kN@fWg{AmY4aJqMR&*k^g(vT)*pNIxt z_)<6ITOv0~jZDa+`uR1y({|FSm{hv$u-z-e_)I zrM95{hL;VNW3PZo4av`AD`@`#po0gckJ6oQrX!bD!b7dCgBYX0-1AWLwazeM(Y}R< z>!&ASH$P_q%{yy#SmwpC0oU|?kc@>TZwOaE8FnKbZ@Ii&&sQ7QMy7@ctplm|^{3!P zOaY&48YJTpx1#(#F|9kC!Wn6o)==E6LB>-tq#aC{=;SWmQ%K&n3Z@nUD{2FS z!F0-QK&sZBqTK)LuuQpKo)(tIGw=z^yZhj?wbB(eVx#&|e}Z zq@SA_6#3vx==6{g-qYdl7;y!BaK4;GYJDTeM|d3rg^7ODC&{+^LDG#GI1|j$%RCNl zpRhfY^K2d<22}JY1x*-S8YTiE=7#sb6k+2g=W0FW!)ak{{p>9`hw3{tFNxJVKWjKd z2bTD0kTou%JRLFMhOYzE3QSKS8T}}EEh?_c*_9po5JZESQBD4s;rd%?a)Xo zzy+D=&eh4G|K-kJR&N7Y(;=1Avj&cQY)$AH5#rsag%tukX(m%cnig7VCVDWZCJ{yb zP)i=G)q6oL7Nw4#hsjjnVp?g)G>9JkHDk}Ve`y^T@4`(Gext4>fF=H1as_XxrV(H; zjok48V+1U4xdv++SWuWQbw(70srJV~LUgCq>KV<)Y>iJ2J{=txd`ME|_`=o-JYO9A ze=Q_?Fc|Iup9Zr@zm}pCRO=;ZLdBy(Y+d(M={QJmV8C}iZv4%*`Kd+NAF0qb*o=#^ ziF&-IjJAKj#63r$r_aeQ!T$t&e$LZ86%rss;ByJ#5G)_Eb4!na@ta>){@jU?HjhEj zMVX$in#32Ew{fr>I=I8AJc3Oemm)_rAlAmV>7X<)+FI<^o- zEK14`gs((Eu-qu=Y1V#nxVg#G%v?E0HnqLKVTq=4Im%Or{iQ0aok^Me$lxGpI7pk0 zrVPZviFQMna(ydFjXql_JQ-i-Y-OT!d85|g^8S; z9qkv1s3|lF(yy3IWos==bF%`))b`}a2+5Mm=>Y+t>h#Kb;gJ||2ywvktI1%FOje%9 zYXSKVlVBNnTguTt%B4I)3GZ5okU-sOfN=?_l#noKz}A;{rkm(9L2fuYzm{T-fq;sJ zLbwkpabRg`NP1#$xrUF&7*beRIA=OEXY5L-ocifo${5%xzWdQzNLKZv@M9U1ab&3w zXC_G&$IGQ49pMZ@qiX`d_A3`Z$Ze~ax(amRBC5qC`{sl)7El6RkCjAKIxF5l%4AtbPd@@#Y%WJT8*>3g_r2gM;ye@c84c*r0NxbRJK)c$=r|Vb{J3Ckf{C^@QaU+dvnryh}a%7gnlJJ!INIbb3@&5;FgN(w~^mAx=JFO4MuWJM4VD1fTM&JF>jtZ`n)0_6v|^xy`a70Ux%pgk^uuChZ(s0Q60 zwqXVKBlrdUl&rL1s3>JHyHqq_pb+`;V!Rk1+HyOF&O?M)v1L%(+H(D!$^z23LEAnc zpl)Prf?yyJ0N4eTVg~heSBPG|gJ>8`cnG;ok$j0Hc6>aIkYZV;+Mf1&1fe;sEr(lW zuQA%AbJVt;G4<#`K>Pa(50kKWK$&ZoEIG*O#(3b~0S2hHhNuMh8cRPdLyV_6I#l9i zj~kumLe9+I`$*zg56hWI6xWn<5>y1g zU;(H{X15@xVU{rPe1(+Kxg?g>=0YNhUoD?rXPT~(Sb-o;f5;6(1#MF|Nfq98mA^N_iW3f06B$Gc4ZesN!%Ni_g$vn=H?#do{vO{4xD zLYjpau=5#gCyJ+t0cm2s)gYb+|69TDX$}oyYW=zp3VB7Qyy~QZKo>=18sdy^P(T_;Ia_h#38OaX zYq2xNv~|&-M>1&m)+pi!?-Asnm<&cqmWAY^j$1=EQv85F^w>?`5PHU*BcM=HEXM$* z4IRi?0M}iwM|c}B8N`or-ZpgdkK9+2}81xWabZSucNNY#_Yu=RK$ky@|Dq)x;KFl+(*I z)88=d%`oqlZIjpNyF+f1?UZYHkG!p^d8c))n{}nwo}4 z9x+r#YTy(YH7>jme&qu=gdh!M510;PyIE}|E;;Bj8M zAxAElC6H>S%F0GG0Q6*SUCka{SPo{?_?Ca}jIZHn6Dqrn$!U|fZmkO#DYNe7yh^?~ zb+>MQJq(=Bqdi=lW#?k|g!9ok=y@rA)DXm`2!s}}j()~?2N3s1<@rtFqM;vQ@GXEG zX6dlT6wqknnVkc(B`C}fTpa?EM~+fHwcuM?WPMB=u}avfe$s%^WNcqyVJ$C1hhjZy}^KNkhg#!4^4l+<^|{dqzc4_AFJlz89CKg2U2lY60K}Ni()4UL;r( z8OT;-;VnX-z3H-P1^zBDq*eh`ljx@UH-`#X`BmBc`GRUu`MGX95w_-CpEk<5iUbQQ;wkvCiZy!*Xs}kox@LT{F+f{*&OYKdS zlsIZ0L9gp+i7eM3)5`Ao@8D&S#kcHDjy5w@%cOQ@^V#wg-$gj^4A7v4&?@Pb=s>#Y&R}Qj}#WE2QGU`5At*P zv@S%{ngW9zesh`aL_+rM*z@vf7E+pRHQ{AAem^zhGBo{ANpmm}e0TkF2F}b~cRiH2 zRD2;%c!;hzp%Kx&?i`nT&N$xc(%q{PeiDoqjMKCFEXKS9zdWA!cr=%Hw?S@u*pP@O)b)=0jMkYs1cML)4O6_EP`vVH^>FFX`gFctnJb3viFj(PVt zzZSJVKf`1s#rixS770A)daZRWL8@BOZGYFPH%rZOUSv@vu%s!s`4O}@$xqykH0md#$K>mo1;pnK+RCmUzYKfA-Id>zB0Dx?u-USqF3&W6w) zFfr>lazR8S~-yp5Bwu#eYdrZ={KD5G9XDm;B2bLZ=HsgDe^;V-N*%qtu2+C2$5SS zR&5u4wR8t#S}eTHG6l+B*P~_vG=-+}maMZbl=F=+z4G+$9y?efUJF(F+fkZ?4e}C2 zjY)sO^qjO_vn)&db0P^+$^3k6?6lyv+93~wUGR`cjfN>uD5tZm~f%7zHmuRz1BHx7u5VqwZk$0gnlVM_TMP-B0!G% z4g*)c%%Q^sY!ND9aPmP3WHvGTn*BjxVg)~0<<04iKdQ^sc6Zjj_fA6%))GBXD}PWc zM^cD$R=))(k;h!!{@A1B{0c+IQ7Bb>#jy=(+2=oGcsFGI%A!GI62r#rP72wTgbAMv;8_T706 zuKg-BqkX79VqU$Zs&r|Qaarm*+up6;QhTSDn*AjL^(w{|LA4K|zHlT**rcG*9N7PLwC6)nj`rKDf&<>HsoeO4#pL zC;XQ5+Xt6bDJH|#Qyg~$*S%}#RiKYR<4dydzK?O9a$B4jPAK%e$_s&-Cy)!|4zco6?anf?k?ojz_8z?Flro-;_38-T z1c4G^BR==dY+Y`h8oJ*wHlKN30{Rbp&^I?tYc9U9er@`C(N)Tp>+qKO{t@`&t5-rr z)p0wnuXa>}dUB7Zuj7t#Mhss6Fjzj#mIUJc(0^}JP#?Ne&?P}i?(G-%Sqho|t5twA zkIl4ragH?A=~tg~b2~l(P$euY3sFwpppI{l^H;$<=>zFav)NqHx46T+!@xx0 z@~P?Ps-J^2w+cp;yY)^~Tl{3HnEy)Ay=^q6!j=K_lt~?to;{vDZ5WQ{yw;C7;;M+R zp~BTYSS4zGRbHp7aV+uO!rKB%Ws-w`esga%+0=QeBZA>-o=m7q108^SAA`joOsmkTY02 zXpkx-$7X{eJ*@o&$vJWP-kklGL7F&wOvltz3A9iKUu)q@zD`6= z6+wu5vG)MF+{?_*np<+$xxKmLB~v9B$)9$vWeoxYVkAFR9>gH*VFTRu|%dgNREeI)9 zJ}fm|pKnyC?2~!WWrVN{!JHJrh6>XWJ37}`Y6 z*PEf|pTIicaA(MCv*b&!DHbu@0=C@w!~aDrfYYk=U>myjf|cb z5FmQkPiNXtH?>p=5X;d#LQg~UI-S~S0*s+xcp(XOsx0SF`DWDl5))Y&SsBP3M$t{e z`}uYAlQLis(gMo{!LmWmv*17@R(a<0wu&t0PZyqKyO~TR@p_w4k4P=j=0!)D8;HE} zecmc1bg03~rs@JNa#U5QSYYGsvynSISC*M|^UY}ho0nY@uIEsoTyp9hKR&4N0(cRN z4w5;ora;!`)CK?JsOI_04+vHl&x@Mup)Q#dZ-t5=l>E`k;|A?qcIdFcH zo~lm0-@oT~Xg-m99s~y`x!9aq_#C=(=8y8{m_Kqr60QNH$ILWyyhYx1(|NOFOntW! zu5z|c!Su^bu57?O)9$UuWGm_Bd|B%o#BQ2X8lDJ+x2htGP7UP=bP|mFCdSPA!`C6o|iFSQo|;gVb-HLWE|T&FiG z-KaX{ylsA)=OhJzgg7UE+vFqL7?(mgwJqTmXn+ld8t*b29=~uKQH$$u%_t?_trCE= z@9bE|WB`80a=0EmE)UoqXZX|oNQknq&#Al+8Kbv6bpe9K_NEFEmfk|S5*-$JZ%wLB z#W~lsXyiRpg8D#!7P%kHwC`&m!BIL-Q(LRN&lh(&6sHX;gb%4Oq;5+gxFFUa!{kZO z^Q}{UObVY+#xkI4eugJRpiTvtPFx1Yiuu)fMU@l~5o2kLbCLwW{o5XxYFTnuFz<&z zG3v}*LKH7aMZttIoRfVzf(`Ak^y&h9*n|oEn>vLQ-l(3(Kz~g|hy{eqEp*b;1msY? z{9q>M=&%8AFnhM#>B%La3-(ri!Da;NL0jsdgJD}gmr|t184^MZR@n}J z07Qp^n-X_FI>ATv3q9rUjL`%7F}~A4b5tHMyoS(d4l@8pVc`5{H{xo9*{Bb>xc-I6 z;9Bw2E_mySy;?R_y%?`xx`hG=$=ncA1@mlxdV-oCD(AQWsS1DVox}D&5m3MsFfBlp zBOTqoqE^lRWq)`4RelnrytPG#df5_3uy2-f0O7mRJY#V%1#*@`mR4p-9upFLOS5j( zQqFP|NeDO`l9RuCiWZFqs2d4H#Fw|e z(-@QOC=5)q(MrESz!k3`L;V&_@Q2EPaW=fHXC6 zgrvp|+Pd*ii09j&Y7PUXTfaLjw;EclX>|dB-fEpfg#3UpmBPl5^W!Y`{HUMQTxr(| zOu7IaBIKKaarqarWD>50!izVPDIA zvSJu@Pi>g81Lmvzx`RXUuA={)h|O`1R~svB{^F`g9=c9F33g5ETw9VuJNmO(yUBNQ zAQQ*gernK~m_A$Px%eFZAMlzXxVG%@GMqV!Z}Xp>bz!Uz67`IE6ptqUrSC!Oa6HIG z)N2dl2xoI`fsD?gMoiY?!}ATBALzm6e!5c)MZ5gIZj-|Xpu(u~N`F6n9-XqH!6|fi zj=(kU2oh$|BS-j~s_C~oyc478r|tt$^&ET5%5hbkxBqL}ygAQgUf~-#xW|nd=M(Dv z>O)Qvmo~9tf;+*NLX%P9t_;(&2l@KDY971r-NAm{U2Ro|8~4BQ$VSMUUVLL_t=R`N ze!>a0{~7kTEYC7ux;lNw+@GUbnBuuT>ROxR+&ddnZC4?(F%gmVaNxZ#r{3bcefK^H zo)O2;U_HfbzUrTtP#d9WqcdOrf`IjcT8c`2p*TBaa6^33>0 zt|SIQLXDnRb~bBtJIOi}DY4lG;`qC%7>A#|=X|NmRl(o|?(I=~Mu^5f1^l)FgCvx`rc>NlZ!{a?eMxLUK)g~x1TGYb1_hI%s z%yZcHWV@Dj-w)TaX;<<%4IMVDHbhZg+wzHJC&s?Hi!yLm$3LR7t}Yn`3G`q>j2nYP z1^=e-xOIbkM|E3!TR9oDr=cItjDgcGC7P=QETh)IW6#u|y{vb1^qzheLp#Wo{cg8~KLs z2-Wi`SuKrXd3h->{1o>VulXp6B(i5F(^*9gYFLSlZE1Ds&j&;WLl?W04A!g*1Q%Xq ztq2}r`>P$w#GJ1O2q*(ntK_nj@Rzu%*IB?h!QdYV7bsAld@Fl@w!P&Z{+>s+p~X|U zDsC`ms*Nz1FP-&Vr!dSTK^vrq{T?^map$H<{igUewKUdz8g~OP+}k<(!<)Z zU3HOb+QxHhGJ?e!8R(4u6b~)^VEw(uNHg?7hMSUsh)uDPK-ed>mHiZ&NPUZaI(*n5 zV6o3*V4MqYV>2Pdc(hQ1eD`@Wpwlg;+$NUyc9u(lfj{n7f9$uYO>`;8zjEiMwXUejyCn{#0Q2`u5{I%e=pq zm#xAyPFJhliUFPRFZ&j}B2WMP1Fb&5d|2cu?4R3;IIFHY|9A8*m(#(2C*~v95w9#~ zLh~aj(o95Y0b~%<>}D4btX{vr3$HHrhSSK$XLi->KQD09E~Bq(t~iW(lOD5Le0uJ* z_V{pCP_RHJH&6AJ!x8GC8V{!-MDyt0(<+Zo4QkC#n~lGJvitFIf(fb%d2G%#*IcL@ zP9psDcd<$|kz;M3-j!$6oPrh#B3fV^pofJIhMHoOG&lbsjpVef!HRQ%ehrC%974dJ zx^T;Z30Ed<>aIDf^}LXMACp|)#@V@3oz)PH&dAPH9?ZqJGY50vs!og;;loPf`;5ij z^0=vVpPJ=AnfB{}yvBQu)7kUeQP!`}9Ub#$Gw9x~m?y-2HnKH?q+O2-@~biYXYhe{Shw1%cg>1U6qS(=3WX;Pgpuwn!VOgY31Hr`9sRy z7Ryj{pgqGJ8Ud1`TK4NUs}ovF5<9yr&Ub#F|HYrSm=`i5u5v_Dw)dx z)G?LKKJlj<r`%2FYmBG7tt(GD<8NVl_sj83(1(S`6Jt@g&Ls{Q@|Bfzdy8CB@$U{1uetjZ zqZ*_8zSuRs>Bq@o8LOsXX1TI{9ZYmr``7qG@hfN0mz5W<@qED|MuV#Y0_u3iI*eZ! z{hRwHHQ?}F9jg7~kgstqV}KT4>M1fi7&Eh%{Yd{qASC;2yOB5WJ(bIv9P)wllAix^1L&#L0zIGt+u--&I>-{ySZxz8Mo zxgIcf59qdERWBx+Y#o;F9a65Ad`nn+W-D`;YuJpeesXd^LN?cOTmFWwMY2rURuxE~xHHvDVG4Ur7@F$R-tw z9vMrfeH;rw2j0ucvE!UYvN)Z-jQ62^<3^5RIgk|?!K6MVNRyWxG8W~8W0B=g<#NV&~-q3JrK)j3)J+P-~Dh9FNf~Ywh>;EieBn zRH~3JFshQi4Ic74RbB#|8yE(rOo)Ay$YK|5=0t$~x{G>lEX~<@Dof>lnn$nzI}eI1lD;?MOvbQ;uW^X`L#PeT-Jo_#f7CPh8WfiU5qVBb5i!$!#s=2 zS#wSuWzd!jT=!L|!OJS~RU@t2YLC)y@l;tnplu5w7Q?cXVj>i!8gG1fs}<#}=lMKg zTvMy4p_z5ZOOmpEDgyns%_H2PSH^{-L0TNkBQD+LjSL2Ec31G6Q4M{-gH&XWbqwncpH$Tdz7Y;l|OxZ)Dq^Uf_5iNN(-6Q8u9~Mmg^#O zS@Axi@?Xvh73$Pz4Zr)V5&uu_?qXMau#e^9&{IXh$y2=X|DAxAcwg9lJ9zNwsO%bN zg8h5)6|rGI_?r z_tn;;yV~W>xgcjnQ_Ogt>Vs~sa(P=R@0Sem^cJkyDM`v)xiiWBW(|GPo0aSvdpmY~ zr6=|@^uH63N#3cYEKeHAZHXDM`Xl@~ZBeurX7eF}{R`$SvK>vR@nUlOLu4*x@H;4k ztPU?p-$dWOD;0R{d4*4DbveU-`W^%e(8)H;f7avjoJJILY6;<$0PFO#_492QZq!7UmA6Q@Gb+lu7 zp#i%4=AX3pFX$U<)^SI@G4X->m3@m=5oFTC++VE!oe1DK9k8kXwTio8wC_)`$N)Qg z?xUTe8`OD4A*pZ9@9h58%eE@~+v4}mjbl?A5Fd@copv`Nl?9T@i<9FlR^Ocl#AO2u zrEDI6ruib+PJHy+EKRucq z@Nks;U}deyIDSZdbrC;UfFbNX?IAFI7SAQ*F3LvFIe6`LQ<7CYWv%>F8~Gkl#4hHp zbKBXD$HmV59?f`H*A-&_T+gWUPt|ZaeZrWxKd9^JzNX1D#$aPrNBC<7=Y?&OLkXqi z`c?OzQ3Ypsc#_PjN3SG(bFJ%c$^G{^OxIW5?!io%ZLF`~*XrTzH-=cqn$%j9kA}`w zHty6cq$kp}#zoIkbIhf7oQdD;U%c+f;ypipgE`glKa<0R+c&1_wJz^N@}4}{zX~K5 zy0lZ>S|W(1k*g{)kUj{^M~$3#D((bpSL|ykWz!s?9$H(JifUB`05yf%7QJ)eHG|oz zR$q6geoh5PsCY$xvW`-%|I!#=v990kc6RaSO#Rc@+vBu5*csOvm)YR!uYQWb{pdfL ziQC+$tq}v zDuWQ6EJ?LOs=^X>ayNVWP~vY?{ISz>oV$wWnVB#hTfg*vDsPk~I2C+VhJXC!PI1GA;z0V}YR8jdu}6$>Sma(p zUcG9kK=o{!Ie}{2#ulveN6!+-7Fm1MPB5O1Wi|CQatc+X(uWi<-&jaHJyt)v7caVX zMYbR2o{n}&9O#JEearg$`YNk(0x5Xfn~*g9hf>oqhGAHsu;(SYPD!Fj{+?r$229DD$dcAz$MtH&_`P@H8gBm{IK5fc z5QORe?eFgycX+jV&iqN)`p}Az;C0m2N$tkI*}jGV&wbSAJ3sPw+RI-IR)lQ}a(*Ou zK1Phw=9pTsH=m8$xZc10YRxCK%P8D+)aYI}YRX@d#MACA=ihbTTp_{d8!0F{3jd>AmlpphkA3s^-^}Cg z{qPfWE#V)QBx?CH9kgHvb454QW9*bdSX{zy>$PQ_-9g= z;YNs8?ZfG7^{N(uYOYD%{-Gii1F)-Zl9hTAAX&M1FZb*XGiG8!o>j!AC*=hT=d^-r zHBIsQRnfsOdYvgztisuMPheig{dYn)XMXm-6VICm1w`)kPAPXtLSON?PnZ7nl65IOlH& zHXSTJ?pb+JvksD6Dmcc#x36%kpz$j?>(7Dgvwd3?dKgA6b$+hs z)aV0X7<1~J&wVn3>G>=@JpGV^KZ@zl0Z7SWH=qZ-fB5CqHf1HEL%ZxaBML=ldV!NHyhG#})(L;2VZo z{mWc`_ntg%nZ|(GoBK-x!Vd zDyLmSe)->r*+r=EDE=Lz%zX2K{=SA)c4dflwi$jb%Tr!^BwihMw9U(V$e4AlwxjT^ z*hN&DtN02CdRtVREOo6ZEq76}@o8O~qhl*sH(PjkFQ!*bK|JR!dr~|t$D$N&9$g3v zY6ufxONjipHyw@I`*i5q+I#z}=)b_0Mi7oicaQ0b|7Nf{bXCJk z7sKK6?FB_;by9~yHUp+W{jOiSlyyX8K6FuEySSR3!{qYflNpa0a*IVzB5RR<$g(!+ zm=~N8qPB??JJqBy*~wJ~;-R(3-|;h%4C_F-7AB(O({-tdFP#QIHqV9X{B#x)Rvq(s zsdzHigYbSKi5ud44he`7+GEorT-7>(QPLc8{)dwd8ndV_FI=zbdv#~y@Gu6=@M5hG zt<$!!@q*DVP^t^QxZCtBORv~RLp1J3vK329%)^5W%gH!#pw0Kl=$XSt`4y z{9S#OiB2(BKfL*km%#h4X=jUB*J+DhKgxj(0yjJOObbNl@AK!J!D0v9+9H(VE zOrY)>ANaxDlR!FW=j*g{S%+)Q=;P=RE1W;*%kJdL8^-=y@=J?BbK z+_%9!`4E3l?h~r~>k%W$QO=I_&YT(?FKgjr_VsWU)< zg~GvuEC?D961ra=l^o}#;$yp(h*K5UQV|zYj^Y<_|CDg0P`P)%-0Q>LOT?~BCbNvk zwA((85zHN*-J~7Cvi^DDgw=hBiJJ-C%X2L>1v=>cL2dQF6GcLmPVJXYXPqpdt!sI$ zy8jSk-wd`%=dxMHeDqAYb^EVV>-5tb%6~2M>qOt#((oWEs~|QVgl{Xwvi5)!A*5xc zI-607)%g!!SyF$VMBt{xt=5~n5-l-KqHQrYhCh!KISPmq(GQJA$_;7nujIX?yd>Yn z$3~q9=(|XoIvWFeYGOX+PE_$5k8`UnFH^D0fqR*skLvdHrwz^$hTMze1#ICrvfBV;I?YnRl5s&?;Bo6O{CuCpdBaisfCLhP%6M3c-QsNOQ$iehg z{Ev_5k;ET@3aO-F zl@;Z`6ZF6TDkw9D+i#LpoK}BW!Q;xDSzjplPNRFQVy!1-2j!#!8r_fOqHZPT3M4b8 zo<%4O(Kl!C>Q4@ktJll3K6Re-*I#<@4&yG7Xz3oj!dkUA{Gt}Y=sbJjnE8ohwXE^i z+*z1CHG%6@e^Q?{#5!(nTf9H}?t%d79#Fd3+rqN2ox8&OFS|s;QPOy|q796VQ`3oI z)BL`DWSS7LysPd>GW^sN>?71(7u^#_+Y9?*S2C11vHE(`&+8xxG$_5PF!2Ri%YBfO z7cblOu)JV$X`J@s&Z?&O>N7JzX+*RqZCQ1EBCKxDZz{ktC$!Pl@>p#0SnE&)Rt{9d zbODI0QDU>ebmi4a8h9c)Ksy(R_{JT-I6AaebLNlLTTngU<>DoxU*xIU;lENv^hhHI z=XXyf<&}rkK+h&t?7U5xAirl(idWkZGx-K94`%c%F9_(dEGpp?UCJ&hPVKx)I!(V{ zE6GUaG`jQ@OKD72S%qXbI&`xehaVA}{}J2mr+UtNHj%#a#pS=dLC+5-_#Y6Yesji@ z?RzaDn=rzr`+hAI|JH(^p1zzDtwSnP?FqQ=RogxuUw*Rrs%(+k_0})`uot1>583>rTUw%Yzo4a*4(o@ls@G1*ae?L znepy*rC^*oLFb$r1Xi18>@EO8%ymAj%wc^bH8HBn=GI%Vzhi$9AO9&9Z(c4-9+{o0VdTpk{% zE&Eu7KcZ8T7E4iawV@~Bl&05L9<4IwgO5+7Uk-nKW}%mXyzIeP)Bd8Wrpfh7m?w4OcNu$n ze{`QhX@j4mjz-+R%6`>w^{+v}AZfLb#xnzk4hWgGgyZy*)Ns3g@0t%|2F8U9v(KX9*3M2lR_&b6t)k+upSMK1 z-DZX*$%@%KYJEG$eyP(dF6pR*W6v~%k)(_4GFcO&^G*bMmS>o_g$EXnBS_5g{&ib% zH~V9QbE?LB99OSuM6J0;d-g;#J-aDyR}}LUO3M9uSOpiGg!pXMBr!(``Cil&l~j(c zS(ym$`}y3L1(bdp@v4u0clNj;jk#Aq*@$4%iJv>NBdd9feXw$lh_^BAf>g0R{r0ac z&EUky?~3b|zagD_y{gB)v#2TIGg<;tYqDdEUNsCWgba0&HKGZ=E&Juy<@Di z@H8Y4;{ z4ww7fbX+8E&GQAN{f(|w%Gut)2fC_ghsG!0lIs?pRRkFQ)XjauDs>`)yYr-AnU>nM zk}Lp}#I;q8dk0)2jqK#sX@6yGtjNBPSa9IIlX|4u*o-yd|KpST7YA9oE_(cygSCeT z%wn{k`cvU#BB1ZF8jyJ1*QkVL2}*Y8o^7Z&<~WtX=yj;ZH?}=D7xYB5Q~8VDYdtzB zp^ZQ3(aJUDTfqpH8h$6UWY_0fJ=$+fKWKQ|U9g`kOsOT z%Z-(79JRX2m!9stAOpS+&hI|(Q? zUkM9)bR+(lqrO{TJBNJ?B&Q?D9q`NDWz=t6_T-f{wUS|`UBGrqCHrrzU*EIj(q;ICoa> zoJz05!40uvy1DH*Td`#1i;66xlUn9Kb#qxT`~ZFGLXhw&gP!0Y(6};MIbh&G6ppMSdw;%WXH+tU5-d`t=^k z8;+mox245DYiCI}(bQ0iul}C?j@LN+FOCm_Ql^jqbaZ;G zyZFvNOOIR~kH(*o$R;_EKgO4YFcn)cUoda)6Zpc$8+*R7_Z7edn;FoX!Ju@zoR=yc zsr>yz+vDtRS3Bg@pik|xH|PST267EiIi!%(D?s5DWo*P}25M?rb^bYM<)3 z$fFEac8PYW>nGn?@2y(S%Kd`kq?HSodQggNAc(A!#VzX>1=bQ7q`hbuV$R)mqCsI+?>i>I_K ztfy6UX!T7wmdA?ZOJCz181~3C-g6=_Rjmq40bsJL1@~O@jDX)Adlc;BvF7fMV^9IJdV64-Z=4Q!gBooDmn|drrtJ= zj~>nF?vVpF8tFztx};;I;08)a_h>{I8z9mxNGK^edLkkQIEf)sQ9wilBz`aNKX9&d zp6fdIbJzFtg|+pP`>`;}`?c@O)+a6 zC?H~s{sUMWm+4}3ekJUjPo1EXaqQAS>ah0?4n_kmm9P!Vs!VzBft=gw71g!vO{jaZ z&ut^1@6DQ|`g>A8yU%&}?FQ96v3d9IE^8&*%@~5m;y>KFhw-oh=!TOLt%k5gs5Z>o zfJJ1N(SYUh#`krJKy8IKjc>+>^4B41dFOTZk@CVEmmrwvK7jBUh7?v&x16tWD640pXdGh?h9_|tdKs8^jcxWZJ^$F8-ie=QMRD3?=JLjDh&IG zV!7A5xWh$Q6JOuq2gi2@i2kr9-19jvZ745jgOznhtsa3kNZQZUtSrlFEH%W2@@Ns{ z=pS6b+R0)UzCz{pi7=q`bw!b#@c&#B7vFGJ=vKxh@b&tGA}*{J@OanQ+z)m~oIAVB z0vZDm{WhEGm-7@>GxI(#gm}UNl;wZVGI>8PN}YFlCPJ&3WFqI(I=paxmz$D;trzNN z1CZHNb1CgnrsF)6uO0dF<`mfd_TwhKPql?g#E0e(CI&VpAI_cy*uM6@#}fYp^lr`F zY8=?vEz_;cUU7SQS2b5Eb=p>4Kigoznk_Jho?%7PJe=2Vl;v&76fwF~2@@VEf4?{~ z3G}8+t0$<@caNJy>Y=0ML6cWT(s0+TyYrM*{!s#|AIdWfL>$R`Rh4l?5D9~2@*WE> zEy|E(@{sE}>(TPg%pVVne#JvI4u+@Z4$p5u4YB(#tWRD?^zDIFOu&X<`Jwbby%xhb7gs-AYoDeg4I{9G~{^ zc>b;fv4rkA4^!4t&Xp-($7M*hX5s34O9Srj9@(p<@B3WVYNU3Ffs)+-cXw$Qu+F*& zX<*3wjmQnV+`In%(s-6PbZyos08Undy@sf{@3uXpBNY-Mq3-;Td&{OxOK!Ca;#F&V zx-doKB?B)&EHpgAxfT*^U)5#6$`ooxw)5<<8%~9u#og{xA+b1JYkpvTT zj;M(&tiLaePjYukVd-;Z)qy+eicMeNQC?)=fx_x6F3xfMdypaR4iSGLieU zrQ8mzL5CEma>OmX^L1D$K;AWtRFlSA>Qpr5U+FUIUZUTE=_9V zX=kOsEc*PWem4Ah=5$LpXzg-F>ZXvpWKFC3#UCly1BDfOLdd`!eHb56Csg6<5&t)M zcW-_uQmG|P6aAb$r`I3DgK8}pCb7Ptd#`{&GZX3qz-o-qOszYyEAzTiH~CkQ=9nze zFY>ov8p!3{7AE(s^=vpo_2uN`oR#H>a$%k~e}JaM#iAQJb2B+ANZcCcd}546{C~*2 zl_&3k5JjQCGh4|DlvqL6s<(flsgWFOVr$@#8~3P?sd7h37=UdGw<~xHYtMX3x)d{{ z_!FCrVK0#$ws^TO?+Ml2KvwGZl0}j~r@x+gN^^Jrkr-RRJ>BtKdPj1tmsv$LJBXy( zGN5_4d!?mwFKSFH%?pKfp`T~-PuG8Gm=KTEy%p!X) z_76JnjrY;>jXhek=8r;uXA`I|Cd>u*wM+>wrpaF5e7p}i*((ji#D=?`6#zO!(Z`gI z9qP-92kK6aralg_BJodPLqb9z#TJAUMua&e)dCb9EwGvNkn-yh`J>>2en*uPg82R0(24RM~9MJI;501 zXhTYw#2R=HE4O5xHgDNe#brE6_8txMHlAP*^up@np;09t4V&)T(shVJo+l?6wFA;= zVtcJ@w1usIH2xwvaeY2EAZXp*oyB; z>@1aG zgx4XZHdz4LSH=v>9CC@?fFx;Kleb)o-G!*FDAVS1k~=&e6ooZrm&G_%eRM7N{JqFc zm06SOuEyW8hbhJCCr7u~dc38uXJM#=rm(}_bN_vNjkdTnCdZ8V)dwJ4JHfrw1nOLbIb}LqP^h7R;<~whi``S^Hq}UI5r{~UJ zfqLhTsDOic=!^a#R`< zcNnMFk)#k5z1Iun(h-%_ZC;|^6-FEj4DD)bM3tWC+6^!mYU?)`M+)%YEV#X$Z56^}=8*MEUu@Xwz>y{*#Pf}MDgV6I z!*V$6hm#A{r?rrKnT%kS03Qw;Lz_(aTkiY@Sh z#kw$!?t>!@7U^bELSK#ux5-W!6nNGS4Q!@zDjVf;ykbpF!jPaOms6gCH%&1+=ALiD z+<#SI_~JnV*^Ejgte>k#<+V>tnwFM6v2^#gZo1+9f4ObCb|{SpIhsQ&b(ar7by+KJ zUg_IU>|L0%n}uw&bsBVkXz={YOS*}996#v$U{)pDPOKMbJg?CEbVcg3wV6n^au0`y z%$T!1D)RtayzAUB|HuTaVu?v36h?~Y~S zz#$XTDq%j{x;F7THQvMCcJ&hs3}nzQs*?9z(gow7aSbVNcL9o}TYs4SZ{h@(3q)Mt zOmC%zPz2}Pvf}rWz52`4Z^)Bxq)xK=lgHL_D|2qqmG$IhmPv8p;7q^sczT3y7!o+r z)JZ`b%|`~8`s*8%qqc_vYR9Y#rD2H;#>%HD;}O{;={3mM%B@@HR*$!>Ecgb38~E|) zyfdHw0G7Ds|b+6TtWoLt)=ZOCR>ghEd%u*_V6Yh%dB%Or=SJWM577z5}ElH~G z#vl#9h&;|f)`N%eF>@}cnQJT~Ot!WBdK71f2>vaa(zBM$?uHR(!Ve^s(rCzZ|I?PK5zo!YjhmBu$hb{FE~K(xs1^zPn20btiSs7Hw4+lTfW zm_+VEIUgvXZeOxG8!6qIic}BK)=R>*uT0kM3QDd3-K$>$5v5y`h>UCC%DiZlA9Be7|XeD?v=Z*{%W zaWUUNnEJhZ{axoPi@+IJ-S75iR)(eCG|$EbWDV1LU$65WC;*oo>bW`9==R83Gorwp zU^uvV+6g?P%_$rS!XHQ?Q5OpW^UpC1ts)Ofk0Ajyo((jtb%0&^J0)5MeSqq|VeL2k zPyc4cTL}1uvGGqt%sWa5*I&y^m6Qap-@wr9^losJ(+52o$LmxvdLVQJ`v&3LL+-W1 zL#yNa-Fm=QI4Q_6Y0$HCgQMBsFB%HaKdr{j_ z&oG|VV>6EOuUZ|u+By|N+S8C^Kf-s**Z^Up_Be@m5}1Vf;V}ckLOjtWp9`7#51buM zr@eW^>A}XtVx|*~YtoU*cFa*h1t0teFtR5v$l3l&>%B=gLuD~K*giPW2cm6U`DJ`( z6J#)#H>G~Ov9B-uJ%LUo-*^w#Rcj&12Hq9Feh^849M(FR0&cteVlxJ=^$gV4z z#^!AS9p7+=%=tJ&UdU31%v#FyURrEEZZsR*fDK=Mm_!dQ)($GgQ|`Uf87C%|;$eFw=@!o9a`k zP!Ta6;|l#!z!)o`@+4BD-et}9>UZ5lm_Ri5d$A*Ww?voPxBITjK1LfPmb!Q&@qW{o z6Q;yT+MN-6z?6<}$|bg|=>_ZPqPnWcY`v?$&eR%I^)$Ozm#w60DVT3|pnjfq*eJL1 zcjF-MnEj~dd8S>ToPnIpH}1r@FV!`rL&ioe_?@E!=YcB7avRN3)6j?(cNvXpGi#O` z!UpSRK#t)tJQo4lJU&!0JBeUu@A^?BZ;Nwm{y8P|H<~5L!+(Z<914+k=1$={OS_%5 zU6+XSw+4=|^?9}U&<7uLxIei@e$pui|JMI?Oty6_tDL;zlh$i~3hq$RR2D3z{4Ra} zycAjT_hPL2gJU>DE`qlp!yzHFWPQ@WO*Brdz- zvRe8+BF7I;ncM!xjMDozCNlRh8JI)8zs-dlM5W9t?qol1%TXiHGcR>?o2ZFbV<6wH zFHUYht-QHha~$Bg>``LElljJ0*J!Pm&)#vIWvBK9)%0QcL>nV9FcCsY{{fVoc_5Dp z?S_A){~dzXw%}A`f@$J#H2C(qL>HvRkzAIx!B)&SR=5&wcmp+Lnl`MilJ__C3k!%R ziPi33Nh$=NT-d7k{12wP_^*XXNORO92&!R+>1X8+u7$`^u2roV?-SVpeZ2oqQ3h23 zUyAJe#K8A)Maf8;NTt3dzV#d1DsP4`8~rESz^-}8Qj>`DY}I4li7wgF!V>K|9}YgW z@oPg_5f}a3_LGcu)^V3S!q3eg9DopDG9m?`$G|pbxExzJU@hK>Ir*CMFLTq+LrkrA z%M1?2IRv7f?c14jVmPS&VqO?+HQs2ovEjnsDN@f@)&8iQ>lqH?WAnZJ^bm8-QF=Rl z-uce6Z^f=9%t2O0Wj`b{#YApF=IbP(XewgEL&2gM-5}*qmk{y2>4vU{gZ=K0BmDSTcf|pWP2LG_ZNKN@7^Lv&Z7>DM~qs4=L7YG5<;utk&5y zuES5}$7NN{@qJ(S)iMqnzkQlK0Tz}?KatV_e)5yV+u(ik7+=w6hD*;XW#W~`Bc>>i z<$VIhGgCBSe6AQgZc% z;gKud4@{OctzE5IKd|Z0Mp;hqDJh7^1Ws#G91v<=ui+T{T55TF4X2J3z8=!-Xw9mH zYH$55`Pve(DV8buyzn81J!6-QFd;l+L5X4Ifp=6XdB_u3Nay|y-dn5LQiT!fdel{K zs%x~0yOrOXy_XTWO&MFV(^+0xh!-j0%T29>5zw!ue})5c!@pRT#fPh!-Q^TL{3PRH z!X)SKxTs7Kv(Vs?+_@(gEQn{BpQgL=d-`hjv~cb7?R~hAx(Z@RM%@xO!M@%=^`05F zR@^LKIp2vX(W!MB$Q`E_ef+Y4EDGmzl4AP3@L9YApXe7EB!Fd8vBOJaP7|u{w`fRYo)9H~>!k-|MrKL%|nw*d+6fY}XHk?d3Ns|Kv3a@&PfkTSm-mAu<)kt0~$ua<-r zfoaabm8TAsCOdSt{U*^q$Rq@1GJW+Lp&lc=?-NS{dl2Y zT^q0=ZksA&PR;l6U*?3pI9a$ml08oN;}tmEzW)+MRMjjyWc^kP_zT~wONpgliEjn? z5GzUhVb^6ANEXG*l=xA+gQFj* z6lb2X(A9Fs2^w$tEOE9m5!sbJu3(#`O%H-abBirtA5m#M{xe6*3A53UrGNHQ`leHvneebtT@AvIoHYS(EW*iWe{`; zS^a`}3%{)%ZmZ9Dy|QOTSwby)BJ^tTKftohi}k=?llbdq_s!B+jBhPfM4RCe_lgCf z$IMfs{M#@0pw_@=FDuT4E7-b|AXYAW-ONPDhpGPnv?)``JPGI|NCftC-(UUP>H4Py zc8Z;7JnZX}dC?TLO5LD%M^1msU3o*Vo2WW>WkjbkS*e}^=+>OBx9u4=KdN>_;SjLF z5Pj}vfX-mcaPSiEd7>HgMBKZEiJU_-cPpP9leoMq@r+ZRBYFsjaAZE6D!iR_#2(RF z{IeNj)K_w$@49=Vq&H}@(?YhNswlIMD4HDiC^Rio!Apy^b3KgnL1w5J-rSd_Wu(#+ z8A!RmP-fH_6fmf#24Pqp^L=5k+r>zDx*}1qN%fH7aGmymJyO9HOts4#K+*j9yN^d* z=Gt#7Jcle^bdoER?sxncPwwQok#qKp4|NJkn%h4)XiNPmA%q}SIVMBqh3mBYUa*?V z1eU+cxph)$Q9vY04}WEqVN`}Aue*unDyve2cyxVIX%EAy=vk}%GY zPkw^QkLVK3)#EH!;+K)2*Ainqv3KhRn}0vg<{jqZRvg{J{OUQonmxAh>AEa&?5!A2 z1d9Dcy-wYfJYu>OquBg+oJg+WJM-vb;xXGRu6^9+3)#e@@RZGKVU1v0Sa_jGsB36; zM~n6dIgq=$UGtsup<-`{{pQAs4exc?IX`)brV4Q^RVaB8oLB85%*UP}@`TN-Z)GMm zBvtT^M)M#=47_UbO${xr1pipjzgnryn0!1-JnMM!zk=6?*MGmSBq|oCDbLsvO7)=7 zHt%CxQ4}Ye+2R9Z515Q9>|UJ7@<*eG51&4|a;YSy`40s{Dn*}~m$lr<(+AeHWr(q3 zLR1OsejQ>-h*Br_)}Tf5dsKEAGnxZF{Zv46jhsCi#e2f-ro2lD?m=}^mYLw<@=|tN zptJu#Etx%FJ+zkz{0MxwRIa6;26!X|P3PA;0EWb2LzS>q+sb`gqo}F)iOadCOi3dt zG?PhWKHN8k8%I#+HCgq@$921tJy%<5P1{#yH+b?|&DtGb&KyhMxegkR60=Ed5M*1z zrxTGGHPb&96w?n?IkWm_`xLJou8sTD{}#O1$R#RgDBuyp{KUfW;(`V3PDb*Mu$>6=&~XU>m;$r5xq+RJ0Iz5Fi-<&}8$+16dp+S|5B)%wl(a#^t$iM1`|=CBhx`<4G#U^2%!2f#5=hhQ=GI z0>sdM>RGKrlC=M?F**CpnkD7{UA29RO4H#&1fOTZxC1wvy06N4O}Qktr2j*);>2T& z=YhB!M~$*-bB2ifK9}{Fjxf``5E>Dp?dU2rqKEvD!`3olAb zp192UF={k7-}H@B9=)~ZNi*F)UmfZH0G}~Ye&wb_jijqnKlPKsBmR*eSF=5SLsxl? zG5XB7p+|y^wu9OHO$3eF-{QREAO2ceovzvt^XXS6e(YMnBjs^kcR}a_^Eu|VwcuFD_baLKx{dy{`3p!!wqmE&=o#gp#{019d6doeT_w7am zZS}>(PZ$GQKNQAfPto6JFeV89Yv7!xq)2z&6Jku8V}vweO?U~F3v|u_4jK88loNM2 zKu+A2&t`9N<(cNVW6HPII4!u{&^)BwU8%Mz9TiCcf4^qpAqEZiUW&L!id7*_J3das2ojhgJAAxugeDNvvD{mbo-(=2%H zhEVr}6cvT5a{XN)%TUqOV8h*Wx%-=3Ih$Z{N!kllIoC%sRB_U4TMFS|)$)g*ju;aF zNwMqJ$%((}G^V^(y-WDA{?4!k`g{EqpLgoIwDZaM;x$$w8GSX|TcBfQk@p`UWi8D= z>+X5;(L--u;jaGxdEkt!lw-@$#lK#wsJh>iCpj8V%dUQ2{AK=}<2>JW(IYzZ`=3#yClI6X9A?c_g(~#$z65BrJU<-%AG`?En{!s zKXSU7Lbzz!cSWhxA2At?=ts$Yhmmh)r}&kDWnCOz$UQKX7s*kfs0A}oF$`sx9!aB#k zT_wdf??jZ4ECU2tg_oD=FMkr?S{X}leqFxYyI`v1&yI&z1pS7#fw*sKlOX-H$N+Q2 z2nXlXU;go_HOthcYU4c@ah7(2!@4*wjKIth&FIlt$?@+bfAG`jyXUWZ&0x z@H_LH8`@22MWfU--{Z<>olH``yh>zERp>wTIkkg*DIJfy^Tg&ahrOI2Kz4{Q~v z-zP*&0IE=4D#*R$bD!({3xRR8|02%acnvDsx>wVX1jpDn@-OiNj78aIx6H0={y4q~ zI`1|2d1@VI7L<}&bEFS&{z;cqOs)NUrfueY=TrN;&oi%jFPs|YfJ1rZPEaHu`g_z%isOjcL*I)hb5J>RxA^yT=OyFKh(v?eL}&U88X;u|bKdyE49S(}wUea> zHg94>g*wj}40#5tek4JEY)$Kbb0qo|qJEaCwCh)SaLL<{!Zt6UG~@zCafjrhZq8T) zyI$2H|E+0w!mL+`H8%WLGIUg5U@l8r;}1``%TH8$xIMMA&9}$))dD;FBwocc3&D?f z??vflj6Bxs|BM*LOwbf@*eq24DH^{h~dq|R*57xckr$&&uiJiDLK zbu5mzhh$8(5EEH~n?BBiieFzpwHgof=h6EQ;6Vh;#Zi0PK63&#eSAxP3Fg!q-GW$- zElyvT7-V-j$#h{u%|q?(Qf*B7WaG)axgIM2Y$Abpx~&tCaIDY0c=UK|zPf>xy%ze! zTRq{HjW*k9sioF~oHJ7fjRLGZ4dt5Dk)pYleoMM=TCJYm#QLE8Ke|67&m*$xT0H&c zB-Ny4K{MiA_Ld?8UXlGNb>w=|9JAkZGEe`OK7XpO92AB~E}NK2fotbAV^S() z#rj=HVI_L{cZY-Vy|JY!9pl1I z^o>kkca9ft2Px*@Ya4>`Gi*a6AAGL%DMEg*ZrmtmZ25F`mK+UsO{ux{YBnS}xaIS$ z^Zx)n4jahV=cIs=Xx$AQPJG{&p9YO}(2L?y4}7sS{bXps$vA#~Q)l!0?dSrGf{J1l zr(4G5DPVUP|%iS-t{t3`=wr+hl z9skw2&tgcAg+l+VAu|7m-Yl<-%iwQOcArnNc|x!hTOto@Csgz*xSq}CRp|A)ShS3X zMHx%vS;a$&WiJ;UZ>uCellr)CDQF|AAXKCaC=P*@} z7L2Dw6i@fCoEG}fv9@7a))>|xjuv^s-KYBEUiG=)sX}M!1t%XzV*t&tb5%Ugt6J zP%nb_>oOZobN>Svh*Ttqa#;|y4kkix7$pbj4JPRIUmEHqSaa>NQmg>q+fG*pJQHM7 zeRzEnla1>h-O%^cX?DG^(cMk?v73VUR}!UDbF(Ac=srofc0+)+fkpXRqn-goFW;RZ zFnjgW<&vmBM$KhWX<~F?hkKk;E&OGsL^$cPyZoOL*_&3E^dqxomf!Q~pm$2Q#Z0!t zl)hvkEHwubH&yUJPICA2F)ed-Bo&wkHCA9d*}J|kfP$_VCr|QWCO#&^$6p(l$-6>2 zq8?_6t**jME~mAdnjRDA7_{ciw}+=Cw8u0PCUX^_odJK1Ug}_+USgYc#HhC`lGD2g z$mqBuZt6|%96+8d>}Z|$mkp&$F7?hCdch97X5L`dE`ZWZwZ$b1Q-BQs(0j{dB{>#9 z5CKh!6Rw=AUaWXG{LtjC%hy9Xz6;BN>yyM?XZ%o-GqxoryaP z2`NyJI|X8qz5&0DDDxxM||EuF2_boSS=X+SSa4S&Y^PS$>Cf0^buZ-A`p zx}IKlJFhKCg-tcTzi@*01TZ!~?Z{ZWH(e;C!>;&YS3W_6-;9QaTMv9eU1t=LXC)B{ua()bH=|h!Gb4?JBngt_G+6`? z?(E6OqOV^~7&~1JkI3(6>eqAaWS16FSAX*4vI%QAOIA+M|0&AMoc)l7WwSVPLc2AEfdUHF&{qOd%-;wEn9cW0JFPHl)$|k+l5;NfIXj zpNw4Y^cuVyfyIK>pMe738N+nwgI0mq#y-+)U`gFb2%U~krc#1etyLMe(sYOt_$rLYD31XS{A4E zX>|Qgd6mu8FN$A3F@FyRKnbM%BoNuPI}*{(iLrXhMd#<0_e?e%0>F!SZC>q2_q{z& z^ZTaT-#s$=FCQR~SK;gY^}`wdWnr#ve@5Gunpx~McWcV?!!d2XLfJ9*H?1d!0%Tg( zkE8R>OTM0J0jjofI$znDF;%7nHs_Y`nQQCTCK1pSiT+}RNV0t?U=r{(*W@o@N`C!RAnAJhA^c7dyP1sd^u%$U)BO`Y1I5y zqokE2Tf#_~d0-jW$VY#-H7_7nL zvWKTIX$|vEc1x~U{2Cn6E$-ev$x+(eL><%OJPYSEqd|xP)%mCEInKP)DnwK2EYeN0qWc(_VP>2N)g#uN{vUJz|<$hR#GMcj{t-qTs@WXt;_G z$x-S&J=w+SA-9Y@c|}=N@_`Jk>jXo}9QWOPxMfdO$Ja z#rhv0H4gOCJb&TyY-)M3dcVNYI{0hkjX<2iXJ77y8I#sWN#|rw2?83T5{K+LlS2iV z=enV(WlZYo8C?u&O35juJYRArc;5nL!kykpLJd?kr^wm$R*;k)o+34=n`{tgyeDd} z<1Gv6_N06Sh>$3zAxnS`H}3%UNg0*tb+hxG;-k%{fmaZ|X)q>QD*5B$7qb4*m<(aa zlwof(xN>D9a+Dg+{i!^E02kjy-U>__u+3~0@j>;IAf%*S^E2Oe?uM0yNhEv6HvcGQ zSWV+oR!KaVU>44zR*JeM8j}%&2H7*H%BF7scS_=|P9NNCHpM7&;lI=rSpsvd*5X^<%oAK#dU!Qks@P&GCI>dfw)@;nV;DjhJ!?MViCD_nf>%@f@MR0k3?+Bk zlFX^{XHGu@SMlP)B8_u&UUr8cMef%=rz&C$)>=^`O?+ohf4SVX1l`1 zdD2UJfwQ_$jIz1M;x=UXb&QV}MwO$QsG3*@xQ`posjbNm_evkdq)OjKbSoWR8&1XH zxbB3nC(Jx3+iLzc6lYmM@(n6!^4yu0@tAAQrv?Y%jBbC3VK5f>D*u|L(Qu`@cJUX7 zAIfI~PouA#7n5fk~rdUH|cqBB_P22T98xD96lyD##j2nZ?7kB*GGR3lqCGT#% zA#=1VYq9qSC8H>BW|~FU3NcK~c}FS|opHC(Xpu!C|5$8^OInN&<{^!-oic&;{tWug zH{s3fK~qRi1B;vr8KVw-@=T9hbExv${%FkCK!TM?0c~a&W&^WIpknR*vF{;^HRm@! zTj3X0JR|6Tepn?iu3bBoKcQLj)X1DK!8q(1r<5+2{<>2C-2#)Cv=}|@M*8JPlDx_j zTWhGI$T36NeVJ`>kMf_>7m32;?(V)p-7L(9^o|(%IgGm)Il!{VZXIk2`jaWal$zGi z--uTG%_9zYk)Za!FH2$?97`Z>>rZ!H8Kf-Cj6AnF;r5s~spzz_b7pGIh;Q*$YT4Z5K7RF;;Iie0lNhSwyHN%NqtYO$MPD-vFOo$-W>O z^<(MJ?ycR{JT18rw$ewhjNOuDpD2D1$`07)ac{~?^@4dHFm4fe3Y&`#>E$fu&vOIX zk2(6gosf}1Qs@>Kec?dG02xf3!rx-0g`0-wf&QA!eAk4_be+d8y&AukNkw6q;Uls7 z%*HpTGg5DF6y#ZurBQND9MF=;!`T2v=JE~pD!gcr7MRUwP%=4H46r9Hqql`?m9k@w zH|L+X`lHXAFor!OqaDn)WyU(=!bnJcKaX%}Ehsan_A8Oi1Y;G48^$*lDt7E#%tL$4 zEvD^){$*RnjT2H<;R&Nyyjao9r7?+Wl6vxb1wUz*aokscVFNbc&;2P=EAO<~OB5G; zH)yL+$*zYle;QBz0WUI?9$^^2XrO$S&;KYiQ^z|O2{Slj##LYKOug4MS7cuK;4FA9 z+G>qMn40Q?>JFew$dXq;ww3RgwUHl91^npp&KXZ?T zU}+F4tXcS#L1TCqlKl3Wl2B%X>(@#vz6tYR($WdW1U;e>Qd) zUBk*FMSC$C!C&O={wpjuyy1F_$oj`ew?=!p4z3sI&WBDEK1={t0q( zBuJKwyVflhUEt@2_Z$=@iT7d4)Y!l0amJwN6F6-n<1LGPZWbHqzhKX=#dp!9OJ!qsk~<6clJV1j07+kRo~GNPjnB#y zQw_E7`0+BEGZso)HFgh%hv6d0y|y(K$*IyPVqNu+Zp4hLd0tfh(+hL{g@lEE*F!d* zxEVO9E<>Y~)W8M$Zo97@aGC~&g>Ws?Q}+;sPrXMEA%s^0We~0|>>*?9;}Uzf6c~nE zjLq!I_u11wGz6mqDt>n+d5}XRrRG*p=kO}YUPj#P5s+{nie+%uC+heKs+UvOviIj{ z1jIkPjaTiFBi-J23Fjoa(wQ;%2*~)E?NHyRGAiCK(^o0+PE(v^a#7Rb$x$D;$tt34 z1*6Axd#nUsQ{ybYYth2^Zl;ponNet;wt&fnWN&x)Yu+EpO}qBfrsq zSFsPlp_I}Lq!d(J+P^1VqHq%|-iH|vQ7&M`Weac@aaX-zNiNDULf`~U2dOgLrR}n+ zJ*mERyRv)!GBh>zpvvy4(T9l68xwUDkas0<@|zu3jWI8{cCZ?mETi=cyYPHA>Tq_L zPen;@n`lfX5^C1LkaWl?PUpv3@cXPFzDL*YY_qvG36rY^jYJyK5#=ii9%(l&DP+6U z(qC`BSA;iY8@E44Pf+g|WmjdDnq1tAG8WG75z6y@m`1+1Bx`SY%-uevkq2(?SHdRf zMW8KWlQniJs5EI z9<_)Mf%b?;R&D39shVcWbl&}HCAjGfgH!`&5 zorCN+wqYGLmQ&3>B;ON7tcezz;0?t>%f}5$?=_}B;sSZ<=atdrzAdIo@`q9+0lTS4 z8v4wbZ>#iHCy)?0NO3xG)tYtgV<}Q9=g|QO8DV*AX@7-+&MyfR_JpSYN=!Piw)LZtCUC1UzEcM&3n55D9WkVe2DC z>y;i#pD;X^?K&a9tq!My%b_NPVzwZK>0!8ErbG6u>XDJLg(y2moQcvyUVc*S*YfBm z{me?9KF={8UyC_2VV{P(@~fJd!!y-*N)G9w#5~3P2L@a?J@>hdV8Dk)hd|95QBiLa zlR{0F^qt`+;vNjJ+?sXYvcW2gszd1geOD&}$l2}%yse+s8V5b%H*d?BH>0(ERd~np zJKo|00lqRR6Gqp)j@rH&N8Oux!g7F!sm#*ZlpSu{hK;gL2gIf9MRfLyb}b1|Fq-3N zZ8XjQ0~9yo*K7KHQU{EjtnhW*_2H%$WiZErkGw|VEA|1dZjX`90C7-CyFuvK=h zcz44CM(CAK>^xUSrYI4#&H_oZ%WS*fmcj!5VV(A5N-rLA!v1NY;rKe3$WCs>;;+f0uyEHCxI z6!4VFxol>NI2iTw=0Lm{duO&wDFqK$Z$#Kq)Iko&TDSD) zd$3%-3h#8+gewm5?Iks@`9HKMh{^Ay@y(!QMd>~Nk`aK7r4OKz#(|v^6M%i zX(6v8M${pAQF!aQOtjtby4J$>^>sL5RTOIoyv>6rx%zO@7fM}hs}e$ac?;9IvTv`r zP8srL#E)T+v{puvpb&@oNU3kD0;Y1WCz-c#0}tSMSwah3Q#4I?Hv=g1VSvQFw%D4C3e-%GqEwLsjHw=69)cgE+0j3 zy#FdXp(G||*rbgut4$dtCD~2q#9a|)CM8 zWwsMV7aXUIBe`>S<$2abt}CO{+zt7-g+Q{vj8{g$l= YTje32U?tACE0QPnjkMh1(toS}12^vyF8}}l diff --git a/test/imagekit/file_part_test.rb b/test/imagekit/file_part_test.rb new file mode 100644 index 00000000..15b7078c --- /dev/null +++ b/test/imagekit/file_part_test.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require_relative "test_helper" + +class Imagekit::Test::FilePartTest < Minitest::Test + def test_to_json + text = "gray" + filepart = Imagekit::FilePart.new(StringIO.new(text)) + + assert_equal(text.to_json, filepart.to_json) + assert_equal(text.to_yaml, filepart.to_yaml) + end +end diff --git a/test/imagekit/internal/sorbet_runtime_support_test.rb b/test/imagekit/internal/sorbet_runtime_support_test.rb new file mode 100644 index 00000000..4075f247 --- /dev/null +++ b/test/imagekit/internal/sorbet_runtime_support_test.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::SorbetRuntimeSupportTest < Minitest::Test + extend Minitest::Serial + + i_suck_and_my_tests_are_order_dependent! + + module E + extend Imagekit::Internal::Type::Enum + + define_sorbet_constant!(:TaggedSymbol) { 1 } + end + + module U + extend Imagekit::Internal::Type::Union + + define_sorbet_constant!(:Variants) { 2 } + end + + class M < Imagekit::Internal::Type::BaseModel + define_sorbet_constant!(:OrHash) { 3 } + end + + def test_nil_aliases + err = Imagekit::Internal::Util::SorbetRuntimeSupport::MissingSorbetRuntimeError + + assert_raises(err) { Imagekit::Internal::AnyHash } + assert_raises(err) { Imagekit::Internal::FileInput } + assert_raises(err) { Imagekit::Internal::Type::Converter::Input } + assert_raises(err) { Imagekit::Internal::Type::Converter::CoerceState } + assert_raises(err) { Imagekit::Internal::Type::Converter::DumpState } + assert_raises(err) { Imagekit::Internal::Type::BaseModel::KnownField } + assert_raises(err) { Imagekit::Internal::Util::ParsedUri } + assert_raises(err) { Imagekit::Internal::Util::ServerSentEvent } + assert_raises(err) { Imagekit::Internal::Transport::BaseClient::RequestComponents } + assert_raises(err) { Imagekit::Internal::Transport::BaseClient::RequestInput } + assert_raises(err) { Imagekit::Internal::Transport::PooledNetRequester::Request } + assert_raises(err) { E::TaggedSymbol } + assert_raises(err) { U::Variants } + assert_raises(err) { M::OrHash } + end + + def test_stubbed_aliases + Kernel.instance_eval { const_set(:T, nil) } + + assert_equal(1, E::TaggedSymbol) + assert_equal(2, U::Variants) + assert_equal(3, M::OrHash) + end +end diff --git a/test/imagekit/internal/type/base_model_test.rb b/test/imagekit/internal/type/base_model_test.rb new file mode 100644 index 00000000..4373043c --- /dev/null +++ b/test/imagekit/internal/type/base_model_test.rb @@ -0,0 +1,727 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::PrimitiveModelTest < Minitest::Test + A = Imagekit::Internal::Type::ArrayOf[-> { Integer }] + H = Imagekit::Internal::Type::HashOf[-> { Integer }, nil?: true] + + module E + extend Imagekit::Internal::Type::Enum + end + + module U + extend Imagekit::Internal::Type::Union + end + + class B < Imagekit::Internal::Type::BaseModel + optional :a, Integer + optional :b, B + end + + def test_typing + converters = [ + Imagekit::Internal::Type::Unknown, + Imagekit::Internal::Type::Boolean, + A, + H, + E, + U, + B + ] + + converters.each do |conv| + assert_pattern do + conv => Imagekit::Internal::Type::Converter + end + end + end + + def test_coerce + cases = { + [Imagekit::Internal::Type::Unknown, :a] => [{yes: 1}, :a], + [NilClass, :a] => [{maybe: 1}, nil], + [NilClass, nil] => [{yes: 1}, nil], + [Imagekit::Internal::Type::Boolean, true] => [{yes: 1}, true], + [Imagekit::Internal::Type::Boolean, "true"] => [{no: 1}, "true"], + [Integer, 1] => [{yes: 1}, 1], + [Integer, 1.0] => [{maybe: 1}, 1], + [Integer, "1"] => [{maybe: 1}, 1], + [Integer, "one"] => [{no: 1}, "one"], + [Float, 1] => [{yes: 1}, 1.0], + [Float, "1"] => [{maybe: 1}, 1.0], + [Float, :one] => [{no: 1}, :one], + [String, :str] => [{yes: 1}, "str"], + [String, "str"] => [{yes: 1}, "str"], + [String, 1] => [{maybe: 1}, "1"], + [:a, "a"] => [{yes: 1}, :a], + [Date, "1990-09-19"] => [{yes: 1}, Date.new(1990, 9, 19)], + [Date, Date.new(1990, 9, 19)] => [{yes: 1}, Date.new(1990, 9, 19)], + [Date, "one"] => [{no: 1}, "one"], + [Time, "1990-09-19"] => [{yes: 1}, Time.new(1990, 9, 19)], + [Time, Time.new(1990, 9, 19)] => [{yes: 1}, Time.new(1990, 9, 19)], + [Time, "one"] => [{no: 1}, "one"] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Imagekit::Internal::Type::Converter.new_coerce_state + assert_pattern do + Imagekit::Internal::Type::Converter.coerce(target, input, state: state) => ^expect + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end + + def test_dump + cases = { + [Imagekit::Internal::Type::Unknown, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [A, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [H, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [E, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [U, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [B, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [String, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [:b, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [nil, B.new(a: "one", b: B.new(a: 1.0))] => {a: "one", b: {a: 1}}, + [Imagekit::Internal::Type::Boolean, true] => true, + [Imagekit::Internal::Type::Boolean, "true"] => "true", + [Integer, "1"] => "1", + [Float, 1] => 1, + [String, "one"] => "one", + [String, :one] => :one, + [:a, :b] => :b, + [:a, "a"] => "a", + [String, StringIO.new("one")] => "one", + [String, Pathname(__FILE__)] => Imagekit::FilePart + } + + cases.each do + target, input = _1 + expect = _2 + assert_pattern do + Imagekit::Internal::Type::Converter.dump(target, input) => ^expect + end + end + end + + def test_coerce_errors + cases = { + [Integer, "one"] => ArgumentError, + [Float, "one"] => ArgumentError, + [String, Time] => TypeError, + [Date, "one"] => ArgumentError, + [Time, "one"] => ArgumentError + } + + cases.each do |testcase, expect| + target, input = testcase + state = Imagekit::Internal::Type::Converter.new_coerce_state + Imagekit::Internal::Type::Converter.coerce(target, input, state: state) + assert_pattern do + state => {error: ^expect} + end + end + end + + def test_dump_retry + types = [ + Imagekit::Internal::Type::Unknown, + Imagekit::Internal::Type::Boolean, + A, + H, + E, + U, + B + ] + Pathname(__FILE__).open do |fd| + cases = [ + fd, + [fd], + {a: fd}, + {a: {b: fd}} + ] + types.product(cases).each do |target, input| + state = {can_retry: true} + Imagekit::Internal::Type::Converter.dump(target, input, state: state) + + assert_pattern do + state => {can_retry: false} + end + end + end + end +end + +class Imagekit::Test::EnumModelTest < Minitest::Test + class E0 + include Imagekit::Internal::Type::Enum + + attr_reader :values + + def initialize(*values) = (@values = values) + end + + module E1 + extend Imagekit::Internal::Type::Enum + + TRUE = true + end + + module E2 + extend Imagekit::Internal::Type::Enum + + ONE = 1 + TWO = 2 + end + + module E3 + extend Imagekit::Internal::Type::Enum + + ONE = 1.0 + TWO = 2.0 + end + + module E4 + extend Imagekit::Internal::Type::Enum + + ONE = :one + TWO = :two + end + + def test_coerce + cases = { + [E0.new, "one"] => [{no: 1}, "one"], + [E0.new(:one), "one"] => [{yes: 1}, :one], + [E0.new(:two), "one"] => [{maybe: 1}, "one"], + + [E1, true] => [{yes: 1}, true], + [E1, false] => [{no: 1}, false], + [E1, :true] => [{no: 1}, :true], + + [E2, 1] => [{yes: 1}, 1], + [E2, 1.0] => [{yes: 1}, 1], + [E2, 1.2] => [{no: 1}, 1.2], + [E2, "1"] => [{no: 1}, "1"], + + [E3, 1.0] => [{yes: 1}, 1.0], + [E3, 1] => [{yes: 1}, 1.0], + [E3, "one"] => [{no: 1}, "one"], + + [E4, :one] => [{yes: 1}, :one], + [E4, "one"] => [{yes: 1}, :one], + [E4, "1"] => [{maybe: 1}, "1"], + [E4, :"1"] => [{maybe: 1}, :"1"], + [E4, 1] => [{no: 1}, 1] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Imagekit::Internal::Type::Converter.new_coerce_state + assert_pattern do + Imagekit::Internal::Type::Converter.coerce(target, input, state: state) => ^expect + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end + + def test_dump + cases = { + [E1, true] => true, + [E1, "true"] => "true", + + [E2, 1.0] => 1.0, + [E2, 3] => 3, + [E2, "1.0"] => "1.0", + + [E3, 1.0] => 1.0, + [E3, 3] => 3, + [E3, "1.0"] => "1.0", + + [E4, :one] => :one, + [E4, "one"] => "one", + [E4, "1.0"] => "1.0" + } + + cases.each do + target, input = _1 + expect = _2 + assert_pattern do + Imagekit::Internal::Type::Converter.dump(target, input) => ^expect + end + end + end +end + +class Imagekit::Test::CollectionModelTest < Minitest::Test + A1 = Imagekit::Internal::Type::ArrayOf[-> { Integer }] + H1 = Imagekit::Internal::Type::HashOf[Integer] + + A2 = Imagekit::Internal::Type::ArrayOf[H1] + H2 = Imagekit::Internal::Type::HashOf[-> { A1 }] + + A3 = Imagekit::Internal::Type::ArrayOf[Integer, nil?: true] + H3 = Imagekit::Internal::Type::HashOf[Integer, nil?: true] + + def test_coerce + cases = { + [A1, []] => [{yes: 1}, []], + [A1, {}] => [{no: 1}, {}], + [A1, [1, 2.0]] => [{yes: 2, maybe: 1}, [1, 2]], + [A1, ["1", 2.0]] => [{yes: 1, maybe: 2}, [1, 2]], + [H1, {}] => [{yes: 1}, {}], + [H1, []] => [{no: 1}, []], + [H1, {a: 1, b: 2}] => [{yes: 3}, {a: 1, b: 2}], + [H1, {"a" => 1, "b" => 2}] => [{yes: 3}, {a: 1, b: 2}], + [H1, {[] => 1}] => [{yes: 2, no: 1}, {[] => 1}], + [H1, {a: 1.5}] => [{yes: 1, maybe: 1}, {a: 1}], + + [A2, [{}, {"a" => 1}]] => [{yes: 4}, [{}, {a: 1}]], + [A2, [{"a" => "1"}]] => [{yes: 2, maybe: 1}, [{a: 1}]], + [H2, {a: [1, 2]}] => [{yes: 4}, {a: [1, 2]}], + [H2, {"a" => ["1", 2]}] => [{yes: 3, maybe: 1}, {a: [1, 2]}], + [H2, {"a" => ["one", 2]}] => [{yes: 3, no: 1}, {a: ["one", 2]}], + + [A3, [nil, 1]] => [{yes: 3}, [nil, 1]], + [A3, [nil, "1"]] => [{yes: 2, maybe: 1}, [nil, 1]], + [H3, {a: nil, b: "1"}] => [{yes: 2, maybe: 1}, {a: nil, b: 1}], + [H3, {a: nil}] => [{yes: 2}, {a: nil}] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Imagekit::Internal::Type::Converter.new_coerce_state + assert_pattern do + Imagekit::Internal::Type::Converter.coerce(target, input, state: state) => ^expect + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end +end + +class Imagekit::Test::BaseModelTest < Minitest::Test + class M1 < Imagekit::Internal::Type::BaseModel + required :a, Integer + end + + class M2 < M1 + required :a, Time + required :b, Integer, nil?: true + optional :c, String + end + + class M3 < Imagekit::Internal::Type::BaseModel + optional :c, const: :c + required :d, const: :d + end + + class M4 < M1 + request_only do + required :a, Integer + optional :b, String + end + + response_only do + required :c, Integer + optional :d, String + end + end + + class M5 < Imagekit::Internal::Type::BaseModel + request_only do + required :c, const: :c + end + + response_only do + required :d, const: :d + end + end + + class M6 < M1 + required :a, Imagekit::Internal::Type::ArrayOf[M6] + optional :b, M6 + end + + def test_coerce + cases = { + [M1, {}] => [{yes: 1, no: 1}, {}], + [M1, :m1] => [{no: 1}, :m1], + + [M2, {}] => [{yes: 2, no: 1, maybe: 1}, {}], + [M2, {a: "1990-09-19", b: nil}] => [{yes: 4}, {a: "1990-09-19", b: nil}], + [M2, {a: "1990-09-19", b: "1"}] => [{yes: 3, maybe: 1}, {a: "1990-09-19", b: "1"}], + [M2, {a: "1990-09-19"}] => [{yes: 3, maybe: 1}, {a: "1990-09-19"}], + [M2, {a: "1990-09-19", c: nil}] => [{yes: 2, maybe: 2}, {a: "1990-09-19", c: nil}], + + [M3, {c: "c", d: "d"}] => [{yes: 3}, {c: :c, d: :d}], + [M3, {c: "d", d: "c"}] => [{yes: 1, maybe: 2}, {c: "d", d: "c"}], + + [M4, {c: 2}] => [{yes: 5}, {c: 2}], + [M4, {a: "1", c: 2}] => [{yes: 4, maybe: 1}, {a: "1", c: 2}], + [M4, {b: nil, c: 2}] => [{yes: 4, maybe: 1}, {b: nil, c: 2}], + + [M5, {}] => [{yes: 3}, {}], + [M5, {c: "c"}] => [{yes: 3}, {c: :c}], + [M5, {d: "d"}] => [{yes: 3}, {d: :d}], + [M5, {d: nil}] => [{yes: 2, no: 1}, {d: nil}], + + [M6, {a: [{a: []}]}] => [{yes: 6}, -> { _1 in {a: [M6]} }], + [M6, {b: {a: []}}] => [{yes: 4, no: 1}, -> { _1 in {b: M6} }] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, expect = rhs + state = Imagekit::Internal::Type::Converter.new_coerce_state + assert_pattern do + coerced = Imagekit::Internal::Type::Converter.coerce(target, input, state: state) + assert_equal(coerced, coerced) + if coerced.is_a?(Imagekit::Internal::Type::BaseModel) + coerced.to_h => ^expect + else + coerced => ^expect + end + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + end + end + end + + def test_dump + cases = { + [M3, M3.new] => {d: :d}, + [M3, {}] => {d: :d}, + [M3, {d: 1}] => {d: 1}, + + [M4, M4.new(a: 1, b: "b", c: 2, d: "d")] => {a: 1, b: "b"}, + [M4, {a: 1, b: "b", c: 2, d: "d"}] => {a: 1, b: "b"}, + + [M5, M5.new] => {c: :c}, + [M5, {}] => {c: :c}, + [M5, {c: 1}] => {c: 1} + } + + cases.each do + target, input = _1 + expect = _2 + assert_pattern do + Imagekit::Internal::Type::Converter.dump(target, input) => ^expect + end + end + end + + def test_accessors + cases = { + M2.new({a: "1990-09-19", b: "1"}) => [{a: "1990-09-19", b: "1"}, {a: Time.new(1990, 9, 19), b: 1}], + M2.new(a: "one", b: "one") => [{a: "one", b: "one"}, {a: ArgumentError, b: ArgumentError}], + M2.new(a: nil, b: 2.0) => [{a: nil, b: 2.0}, {a: TypeError}], + M2.new(a: nil, b: 2.2) => [{a: nil, b: 2.2}, {a: TypeError, b: 2}], + + M3.new => [{}, {d: :d}], + M3.new(d: 1) => [{d: 1}, {d: ArgumentError}], + + M5.new => [{}, {c: :c, d: :d}] + } + + cases.each do + target = _1 + data, attributes = _2 + + assert_pattern do + target.to_h => ^data + end + + attributes.each do |accessor, expect| + case expect + in Class if expect <= StandardError + tap do + target.public_send(accessor) + flunk + rescue Imagekit::Errors::ConversionError => e + assert_kind_of(expect, e.cause) + end + else + assert_pattern { target.public_send(accessor) => ^expect } + end + end + end + end + + def test_inplace_modification + m1 = M6.new(a: []) + m1.a << M6.new(a: []) + + m2 = M6.new(b: M6.new(a: [])) + m2.b.a << M6.new(a: []) + + m3 = M6.new(a: []) + m4 = M6.new(b: m3) + m3.a << M6.new(a: []) + + assert_pattern do + m1 => {a: [{a: []}]} + m2 => {b: {a: [{a: []}]}} + m4 => {b: {a: [{a: []}]}} + end + end +end + +class Imagekit::Test::UnionTest < Minitest::Test + class U0 + include Imagekit::Internal::Type::Union + + def initialize(*variants) = variants.each { variant(_1) } + end + + module U1 + extend Imagekit::Internal::Type::Union + + variant const: :a + variant const: 2 + end + + class M1 < Imagekit::Internal::Type::BaseModel + required :t, const: :a, api_name: :type + optional :c, String + end + + class M2 < Imagekit::Internal::Type::BaseModel + required :type, const: :b + optional :c, String + end + + module U2 + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :a, M1 + variant :b, M2 + end + + module U3 + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant :a, M1 + variant String + end + + module U4 + extend Imagekit::Internal::Type::Union + + discriminator :type + + variant String + variant :a, M1 + end + + class M3 < Imagekit::Internal::Type::BaseModel + optional :recur, -> { U5 } + required :a, Integer + end + + class M4 < Imagekit::Internal::Type::BaseModel + optional :recur, -> { U5 } + required :a, Imagekit::Internal::Type::ArrayOf[-> { U5 }] + end + + class M5 < Imagekit::Internal::Type::BaseModel + optional :recur, -> { U5 } + required :b, Imagekit::Internal::Type::ArrayOf[-> { U5 }] + end + + module U5 + extend Imagekit::Internal::Type::Union + + variant -> { M3 } + variant -> { M4 } + end + + module U6 + extend Imagekit::Internal::Type::Union + + variant -> { M3 } + variant -> { M5 } + end + + def test_accessors + model = M3.new(recur: []) + tap do + model.recur + flunk + rescue Imagekit::Errors::ConversionError => e + assert_kind_of(ArgumentError, e.cause) + end + end + + def test_coerce + cases = { + [U0, :""] => [{no: 1}, 0, :""], + + [U0.new(Integer, Float), "one"] => [{no: 1}, 2, "one"], + [U0.new(Integer, Float), 1.0] => [{yes: 1}, 2, 1.0], + [U0.new({const: :a}), "a"] => [{yes: 1}, 1, :a], + [U0.new({const: :a}), "2"] => [{maybe: 1}, 1, "2"], + + [U1, "a"] => [{yes: 1}, 1, :a], + [U1, "2"] => [{maybe: 1}, 2, "2"], + [U1, :b] => [{maybe: 1}, 2, :b], + + [U2, {type: :a}] => [{yes: 3}, 0, {t: :a}], + [U2, {type: "b"}] => [{yes: 3}, 0, {type: :b}], + + [U3, "one"] => [{yes: 1}, 2, "one"], + [U4, "one"] => [{yes: 1}, 1, "one"], + + [U5, {a: []}] => [{yes: 3}, 2, {a: []}], + [U6, {b: []}] => [{yes: 3}, 2, {b: []}], + + [U5, {a: [{a: []}]}] => [{yes: 6}, 4, {a: [M4.new(a: [])]}], + [U5, {a: [{a: [{a: []}]}]}] => [{yes: 9}, 6, {a: [M4.new(a: [M4.new(a: [])])]}] + } + + cases.each do |lhs, rhs| + target, input = lhs + exactness, branched, expect = rhs + state = Imagekit::Internal::Type::Converter.new_coerce_state + assert_pattern do + coerced = Imagekit::Internal::Type::Converter.coerce(target, input, state: state) + assert_equal(coerced, coerced) + if coerced.is_a?(Imagekit::Internal::Type::BaseModel) + coerced.to_h => ^expect + else + coerced => ^expect + end + state.fetch(:exactness).filter { _2.nonzero? }.to_h => ^exactness + state => {branched: ^branched} + end + end + end +end + +class Imagekit::Test::BaseModelQoLTest < Minitest::Test + class E0 + include Imagekit::Internal::Type::Enum + + attr_reader :values + + def initialize(*values) = (@values = values) + end + + module E1 + extend Imagekit::Internal::Type::Enum + + A = 1 + end + + module E2 + extend Imagekit::Internal::Type::Enum + + A = 1 + end + + module E3 + extend Imagekit::Internal::Type::Enum + + A = 2 + B = 3 + end + + class U0 + include Imagekit::Internal::Type::Union + + def initialize(*variants) = variants.each { variant(_1) } + end + + module U1 + extend Imagekit::Internal::Type::Union + + variant String + variant Integer + end + + module U2 + extend Imagekit::Internal::Type::Union + + variant String + variant Integer + end + + class M1 < Imagekit::Internal::Type::BaseModel + required :a, Integer + end + + class M2 < Imagekit::Internal::Type::BaseModel + required :a, Integer, nil?: true + end + + class M3 < M2 + required :a, Integer + end + + def test_equality + cases = { + [Imagekit::Internal::Type::Unknown, Imagekit::Internal::Type::Unknown] => true, + [Imagekit::Internal::Type::Boolean, Imagekit::Internal::Type::Boolean] => true, + [Imagekit::Internal::Type::Unknown, Imagekit::Internal::Type::Boolean] => false, + [E0.new(:a, :b), E0.new(:a, :b)] => true, + [E0.new(:a, :b), E0.new(:b, :a)] => true, + [E0.new(:a, :b), E0.new(:b, :c)] => false, + [E1, E2] => true, + [E1, E3] => false, + [U0.new(String, Integer), U0.new(String, Integer)] => true, + [U0.new(String, Integer), U0.new(Integer, String)] => false, + [U0.new(String, Float), U0.new(String, Integer)] => false, + [U1, U2] => true, + [M1, M2] => false, + [M1, M3] => true, + [M1.new(a: 1), M1.new(a: 1)] => true + } + + cases.each do + if _2 + assert_equal(*_1) + assert_equal(*_1.map(&:hash)) + else + refute_equal(*_1) + refute_equal(*_1.map(&:hash)) + end + end + end +end + +class Imagekit::Test::MetaInfoTest < Minitest::Test + A1 = Imagekit::Internal::Type::ArrayOf[Integer, nil?: true, doc: "dog"] + H1 = Imagekit::Internal::Type::HashOf[-> { String }, nil?: true, doc: "dawg"] + + class M1 < Imagekit::Internal::Type::BaseModel + required :a, Integer, doc: "dog" + optional :b, -> { String }, nil?: true, doc: "dawg" + end + + module U1 + extend Imagekit::Internal::Type::Union + + variant -> { Integer }, const: 2, doc: "dog" + variant -> { String }, doc: "dawg" + end + + def test_meta_retrieval + m1 = A1.instance_variable_get(:@meta) + m2 = H1.instance_variable_get(:@meta) + assert_equal({doc: "dog"}, m1) + assert_equal({doc: "dawg"}, m2) + + ma, mb = M1.fields.fetch_values(:a, :b) + assert_equal({doc: "dog"}, ma.fetch(:meta)) + assert_equal({doc: "dawg"}, mb.fetch(:meta)) + + ua, ub = U1.send(:known_variants).map(&:last) + assert_equal({doc: "dog"}, ua) + assert_equal({doc: "dawg"}, ub) + end +end diff --git a/test/imagekit/internal/util_test.rb b/test/imagekit/internal/util_test.rb new file mode 100644 index 00000000..48616831 --- /dev/null +++ b/test/imagekit/internal/util_test.rb @@ -0,0 +1,594 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::UtilDataHandlingTest < Minitest::Test + def test_left_map + assert_pattern do + Imagekit::Internal::Util.deep_merge({a: 1}, nil) => nil + end + end + + def test_right_map + assert_pattern do + Imagekit::Internal::Util.deep_merge(nil, {a: 1}) => {a: 1} + end + end + + def test_disjoint_maps + assert_pattern do + Imagekit::Internal::Util.deep_merge({b: 2}, {a: 1}) => {a: 1, b: 2} + end + end + + def test_overlapping_maps + assert_pattern do + Imagekit::Internal::Util.deep_merge({b: 2, c: 3}, {a: 1, c: 4}) => {a: 1, b: 2, c: 4} + end + end + + def test_nested + assert_pattern do + Imagekit::Internal::Util.deep_merge({b: {b2: 1}}, {b: {b2: 2}}) => {b: {b2: 2}} + end + end + + def test_nested_left_map + assert_pattern do + Imagekit::Internal::Util.deep_merge({b: {b2: 1}}, {b: 6}) => {b: 6} + end + end + + def test_omission + merged = Imagekit::Internal::Util.deep_merge( + {b: {b2: 1, b3: {c: 4, d: 5}}}, + {b: {b2: 1, b3: {c: Imagekit::Internal::OMIT, d: 5}}} + ) + + assert_pattern do + merged => {b: {b2: 1, b3: {d: 5}}} + end + end + + def test_concat + merged = Imagekit::Internal::Util.deep_merge( + {a: {b: [1, 2]}}, + {a: {b: [3, 4]}}, + concat: true + ) + + assert_pattern do + merged => {a: {b: [1, 2, 3, 4]}} + end + end + + def test_concat_false + merged = Imagekit::Internal::Util.deep_merge( + {a: {b: [1, 2]}}, + {a: {b: [3, 4]}}, + concat: false + ) + + assert_pattern do + merged => {a: {b: [3, 4]}} + end + end + + def test_dig + assert_pattern do + Imagekit::Internal::Util.dig(1, nil) => 1 + Imagekit::Internal::Util.dig({a: 1}, :b) => nil + Imagekit::Internal::Util.dig({a: 1}, :a) => 1 + Imagekit::Internal::Util.dig({a: {b: 1}}, [:a, :b]) => 1 + + Imagekit::Internal::Util.dig([], 1) => nil + Imagekit::Internal::Util.dig([nil, [nil, 1]], [1, 1]) => 1 + Imagekit::Internal::Util.dig({a: [nil, 1]}, [:a, 1]) => 1 + Imagekit::Internal::Util.dig([], 1.0) => nil + + Imagekit::Internal::Util.dig(Object, 1) => nil + Imagekit::Internal::Util.dig([], 1.0) { 2 } => 2 + Imagekit::Internal::Util.dig([], ->(_) { 2 }) => 2 + Imagekit::Internal::Util.dig([1], -> { _1 in [1] }) => true + end + end +end + +class Imagekit::Test::UtilUriHandlingTest < Minitest::Test + def test_parsing + %w[ + http://example.com + https://example.com/ + https://example.com:443/example?e1=e1&e2=e2&e= + ].each do |url| + parsed = Imagekit::Internal::Util.parse_uri(url) + unparsed = Imagekit::Internal::Util.unparse_uri(parsed).to_s + + assert_equal(url, unparsed) + assert_equal(parsed, Imagekit::Internal::Util.parse_uri(unparsed)) + end + end + + def test_joining + cases = [ + [ + "h://a.b/c?d=e", + "h://nope/ignored", + Imagekit::Internal::Util.parse_uri("h://a.b/c?d=e") + ], + [ + "h://a.b/c?d=e", + "h://nope", + { + host: "a.b", + path: "/c", + query: {"d" => ["e"]} + } + ] + ] + + cases.each do |expect, lhs, rhs| + assert_equal( + URI.parse(expect), + Imagekit::Internal::Util.join_parsed_uri( + Imagekit::Internal::Util.parse_uri(lhs), + rhs + ) + ) + end + end + + def test_joining_queries + base_url = "h://a.b/c?d=e" + cases = { + "c2" => "h://a.b/c/c2", + "/c2?f=g" => "h://a.b/c2?f=g", + "/c?f=g" => "h://a.b/c?d=e&f=g" + } + + cases.each do |path, expected| + assert_equal( + URI.parse(expected), + Imagekit::Internal::Util.join_parsed_uri( + Imagekit::Internal::Util.parse_uri(base_url), + {path: path} + ) + ) + end + end +end + +class Imagekit::Test::RegexMatchTest < Minitest::Test + def test_json_content + cases = { + "application/json" => true, + "application/jsonl" => false, + "application/vnd.github.v3+json" => true, + "application/vnd.api+json" => true + } + cases.each do |header, verdict| + assert_pattern do + Imagekit::Internal::Util::JSON_CONTENT.match?(header) => ^verdict + end + end + end + + def test_jsonl_content + cases = { + "application/x-ndjson" => true, + "application/x-ldjson" => true, + "application/jsonl" => true, + "application/x-jsonl" => true, + "application/json" => false, + "application/vnd.api+json" => false + } + cases.each do |header, verdict| + assert_pattern do + Imagekit::Internal::Util::JSONL_CONTENT.match?(header) => ^verdict + end + end + end +end + +class Imagekit::Test::UtilFormDataEncodingTest < Minitest::Test + class FakeCGI < CGI + def initialize(headers, io) + encoded = io.to_a + @ctype = headers["content-type"] + # rubocop:disable Lint/EmptyBlock + @io = Imagekit::Internal::Util::ReadIOAdapter.new(encoded.to_enum) {} + # rubocop:enable Lint/EmptyBlock + @c_len = encoded.join.bytesize.to_s + super() + end + + def stdinput = @io + + def env_table + { + "REQUEST_METHOD" => "POST", + "CONTENT_TYPE" => @ctype, + "CONTENT_LENGTH" => @c_len + } + end + end + + def test_file_encode + file = Pathname(__FILE__) + headers = {"content-type" => "multipart/form-data"} + cases = { + "abc" => "abc", + StringIO.new("abc") => "abc", + Imagekit::FilePart.new("abc") => "abc", + Imagekit::FilePart.new(StringIO.new("abc")) => "abc", + file => /^class Imagekit/, + Imagekit::FilePart.new(file) => /^class Imagekit/ + } + cases.each do |body, val| + encoded = Imagekit::Internal::Util.encode_content(headers, body) + cgi = FakeCGI.new(*encoded) + assert_pattern do + cgi[""].read => ^val + end + end + end + + def test_hash_encode + headers = {"content-type" => "multipart/form-data"} + cases = { + {a: 2, b: 3} => {"a" => "2", "b" => "3"}, + {a: 2, b: nil} => {"a" => "2", "b" => "null"}, + {a: 2, b: [1, 2, 3]} => {"a" => "2", "b" => "1"}, + {strio: StringIO.new("a")} => {"strio" => "a"}, + {strio: Imagekit::FilePart.new("a")} => {"strio" => "a"}, + {pathname: Pathname(__FILE__)} => {"pathname" => -> { _1.read in /^class Imagekit/ }}, + {pathname: Imagekit::FilePart.new(Pathname(__FILE__))} => {"pathname" => -> { _1.read in /^class Imagekit/ }} + } + cases.each do |body, testcase| + encoded = Imagekit::Internal::Util.encode_content(headers, body) + cgi = FakeCGI.new(*encoded) + testcase.each do |key, val| + assert_pattern do + cgi[key] => ^val + end + end + end + end +end + +class Imagekit::Test::UtilIOAdapterTest < Minitest::Test + def test_copy_read + cases = { + StringIO.new("abc") => "abc", + Enumerator.new { _1 << "abc" } => "abc" + } + cases.each do |input, expected| + io = StringIO.new + # rubocop:disable Lint/EmptyBlock + adapter = Imagekit::Internal::Util::ReadIOAdapter.new(input) {} + # rubocop:enable Lint/EmptyBlock + IO.copy_stream(adapter, io) + assert_equal(expected, io.string) + end + end + + def test_copy_write + cases = { + StringIO.new => "", + StringIO.new("abc") => "abc" + } + cases.each do |input, expected| + enum = Imagekit::Internal::Util.writable_enum do |y| + IO.copy_stream(input, y) + end + assert_equal(expected, enum.to_a.join) + end + end +end + +class Imagekit::Test::UtilFusedEnumTest < Minitest::Test + def test_closing + arr = [1, 2, 3] + once = 0 + fused = Imagekit::Internal::Util.fused_enum(arr.to_enum) do + once = once.succ + end + + enumerated_1 = fused.to_a + assert_equal(arr, enumerated_1) + assert_equal(1, once) + + enumerated_2 = fused.to_a + assert_equal([], enumerated_2) + assert_equal(1, once) + end + + def test_rewind_chain + once = 0 + fused = Imagekit::Internal::Util.fused_enum([1, 2, 3].to_enum) do + once = once.succ + end + .lazy + .map(&:succ) + .filter(&:odd?) + first = fused.next + + assert_equal(3, first) + assert_equal(0, once) + assert_raises(StopIteration) { fused.rewind.next } + assert_equal(1, once) + end + + def test_external_iteration + iter = [1, 2, 3].to_enum + first = iter.next + fused = Imagekit::Internal::Util.fused_enum(iter, external: true) + + assert_equal(1, first) + assert_equal([2, 3], fused.to_a) + end + + def test_close_fused + once = 0 + fused = Imagekit::Internal::Util.fused_enum([1, 2, 3].to_enum) do + once = once.succ + end + + Imagekit::Internal::Util.close_fused!(fused) + + assert_equal(1, once) + assert_equal([], fused.to_a) + assert_equal(1, once) + end + + def test_closed_fused_extern_iteration + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + fused = Imagekit::Internal::Util.fused_enum(enum) + first = fused.next + + assert_equal(1, first) + Imagekit::Internal::Util.close_fused!(fused) + assert_equal(1, taken) + end + + def test_closed_fused_taken_count + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + .map(&:succ) + .filter(&:odd?) + fused = Imagekit::Internal::Util.fused_enum(enum) + + assert_equal(0, taken) + Imagekit::Internal::Util.close_fused!(fused) + assert_equal(0, taken) + end + + def test_closed_fused_extern_iter_taken_count + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + .map(&:succ) + .filter(&:itself) + first = enum.next + assert_equal(2, first) + assert_equal(1, taken) + + fused = Imagekit::Internal::Util.fused_enum(enum) + Imagekit::Internal::Util.close_fused!(fused) + assert_equal(1, taken) + end + + def test_close_fused_sse_chain + taken = 0 + enum = [1, 2, 3].to_enum.lazy.map do + taken = taken.succ + _1 + end + .map(&:succ) + .filter(&:odd?) + .map(&:to_s) + + fused_1 = Imagekit::Internal::Util.fused_enum(enum) + fused_2 = Imagekit::Internal::Util.decode_lines(fused_1) + fused_3 = Imagekit::Internal::Util.decode_sse(fused_2) + + assert_equal(0, taken) + Imagekit::Internal::Util.close_fused!(fused_3) + assert_equal(0, taken) + end +end + +class Imagekit::Test::UtilContentDecodingTest < Minitest::Test + def test_charset + cases = { + "application/json" => Encoding::BINARY, + "application/json; charset=utf-8" => Encoding::UTF_8, + "charset=uTf-8 application/json; " => Encoding::UTF_8, + "charset=UTF-8; application/json; " => Encoding::UTF_8, + "charset=ISO-8859-1 ;application/json; " => Encoding::ISO_8859_1, + "charset=EUC-KR ;application/json; " => Encoding::EUC_KR + } + text = String.new.force_encoding(Encoding::BINARY) + cases.each do |content_type, encoding| + Imagekit::Internal::Util.force_charset!(content_type, text: text) + assert_equal(encoding, text.encoding) + end + end +end + +class Imagekit::Test::UtilSseTest < Minitest::Test + def test_decode_lines + cases = { + %w[] => %w[], + %W[\n\n] => %W[\n \n], + %W[\n \n] => %W[\n \n], + %w[a] => %w[a], + %W[a\nb] => %W[a\n b], + %W[a\nb\n] => %W[a\n b\n], + %W[\na b\n] => %W[\n ab\n], + %W[\na b\n\n] => %W[\n ab\n \n], + %W[\na b] => %W[\n ab], + %W[\u1F62E\u200D\u1F4A8] => %W[\u1F62E\u200D\u1F4A8], + %W[\u1F62E \u200D \u1F4A8] => %W[\u1F62E\u200D\u1F4A8], + ["\xf0\x9f".b, "\xa5\xba".b] => ["\xf0\x9f\xa5\xba".b], + ["\xf0".b, "\x9f".b, "\xa5".b, "\xba".b] => ["\xf0\x9f\xa5\xba".b] + } + eols = %W[\n \r \r\n] + cases.each do |enum, expected| + eols.each do |eol| + lines = Imagekit::Internal::Util.decode_lines(enum.map { _1.gsub("\n", eol) }) + assert_equal(expected.map { _1.gsub("\n", eol) }, lines.to_a, "eol=#{JSON.generate(eol)}") + end + end + end + + def test_mixed_decode_lines + cases = { + %w[] => %w[], + %W[\r\r] => %W[\r \r], + %W[\r \r] => %W[\r \r], + %W[\r\r\r] => %W[\r \r \r], + %W[\r\r \r] => %W[\r \r \r], + %W[\r \n] => %W[\r\n], + %W[\r\r\n] => %W[\r \r\n], + %W[\n\r] => %W[\n \r] + } + cases.each do |enum, expected| + lines = Imagekit::Internal::Util.decode_lines(enum) + assert_equal(expected, lines.to_a) + end + end + + def test_decode_sse + cases = { + "empty input" => { + [] => [] + }, + "single data event" => { + [ + "data: hello world\n", + "\n" + ] => [ + {data: "hello world\n"} + ] + }, + "multiple data lines" => { + [ + "data: line 1\n", + "data: line 2\n", + "\n" + ] => [ + {data: "line 1\nline 2\n"} + ] + }, + "complete event" => { + [ + "id: 123\n", + "event: update\n", + "data: hello world\n", + "retry: 5000\n", + "\n" + ] => [ + { + event: "update", + id: "123", + data: "hello world\n", + retry: 5000 + } + ] + }, + "multiple events" => { + [ + "event: update\n", + "data: first\n", + "\n", + "event: message\n", + "data: second\n", + "\n" + ] => [ + {event: "update", data: "first\n"}, + {event: "message", data: "second\n"} + ] + }, + "comments" => { + [ + ": this is a comment\n", + "data: actual data\n", + "\n" + ] => [ + {data: "actual data\n"} + ] + }, + "invalid retry" => { + [ + "retry: not a number\n", + "data: hello\n", + "\n" + ] => [ + {data: "hello\n"} + ] + }, + "invalid id with null" => { + [ + "id: bad\0id\n", + "data: hello\n", + "\n" + ] => [ + {data: "hello\n"} + ] + }, + "leading space in value" => { + [ + "data: hello world\n", + "data: leading space\n", + "\n" + ] => [ + {data: "hello world\n leading space\n"} + ] + }, + "no final newline" => { + [ + "data: hello\n", + "id: 1" + ] => [ + {data: "hello\n", id: "1"} + ] + }, + "multiple empty lines" => { + [ + "data: first\n", + "\n", + "\n", + "data: second\n", + "\n" + ] => [ + {data: "first\n"}, + {data: "second\n"} + ] + }, + "multibyte unicode" => { + [ + "data: \u1F62E\u200D\u1F4A8\n" + ] => [ + {data: "\u1F62E\u200D\u1F4A8\n"} + ] + } + } + + cases.each do |name, test_cases| + test_cases.each do |input, expected| + actual = Imagekit::Internal::Util.decode_sse(input).map(&:compact) + assert_equal(expected, actual, name) + end + end + end +end diff --git a/test/imagekit/request_test.rb b/test/imagekit/request_test.rb deleted file mode 100644 index 1fe06a04..00000000 --- a/test/imagekit/request_test.rb +++ /dev/null @@ -1,110 +0,0 @@ -require_relative "./spec_helper" -require "rspec/autorun" - -RSpec.describe ImageKitIo::Request do - let(:subject) { described_class } - - before(:each) do - @private_key = 'private_key_xyz' - @public_key = 'public_key_xyz' - @url_endpoint = 'https://imagekit.io/your-imgekit-id' - @request_obj = subject.new(@private_key, @public_key, @url_endpoint) - stub_request(:get, "https://www.examplenonjson.com").to_return(status: 200, body: "", headers: {content_type: "text/html"}) - stub_request(:get, "https://www.examplejson.com").to_return(body: '{"example_key": "example_value"}', headers: {content_type: "application/json"}) - stub_request(:get, "https://www.examplenotfound.com").to_return(status: 404) - stub_request(:get, "https://www.example204.com").to_return(status: 204) - end - describe 'TestRequest' do - it "test_request_init" do - request_obj = ImageKitIo::Request.new(@private_key, @public_key, @url_endpoint) - - expect(request_obj.private_key).to eq(@private_key) - end - - it "test_create_headers" do - headers = @request_obj.create_headers - expect(headers[:'Accept-Encoding']).to include("application/json") - end - - it "test_auth_headers" do - # test Auth headers working properly - auth_headers = @request_obj.auth_headers - expect(auth_headers[:Authorization]).to include("Basic") - end - - it "test_request_method_non_JSON_fail" do - response = @request_obj.request(:get, "https://www.examplenonjson.com") - expect(response).to have_key(:error) - end - - it "test_request_method_JSON_success" do - response = @request_obj.request(:get, "https://www.examplejson.com") - expect(response).to have_key(:response) - end - - it "test_request_method_404" do - response = @request_obj.request(:get, "https://www.examplenotfound.com") - expect(response).to have_key(:error) - end - - it "test_request_method_204" do - response = @request_obj.request(:get, "https://www.example204.com") - expect(response[:response]).to have_key(:success) - expect(response).to_not have_key(:error) - end - - it 'test_request_method_non_JSON_fail_with_post' do - stub_request(:post, 'https://www.exampleservererror/upload').to_return(status: 400, body: '{"message": "Server failed"}', headers: {content_type: 'application/json'}) - response = @request_obj.request(:post, 'https://www.exampleservererror/upload', nil, []) - expect(response).to have_key(:error) - end - - it 'test_request_method_JSON_success_with_post' do - stub_request(:post, 'https://www.exampleservererror/upload').to_return(status: 200, body: '{"id": "1"}', headers: {content_type: 'application/json'}) - response = @request_obj.request(:post, 'https://www.exampleservererror/upload', nil, []) - expect(response).to_not have_key(:error) - expect(response).to have_key(:response) - end - - it 'test_request_method_JSON_success_with_multipart_post' do - stub_request(:post, 'https://www.exampleservererror/upload').to_return(status: 200, body: '{"id": "1"}', headers: {content_type: 'application/json'}) - response = @request_obj.request(:post, 'https://www.exampleservererror/upload', nil, { multipart: true }) - expect(response).to_not have_key(:error) - expect(response).to have_key(:response) - end - - it 'test_request_method_non_JSON_fail_with_multipart_post' do - stub_request(:post, 'https://www.exampleservererror/upload').to_return(status: 400, body: '{"message": "Server failed"}', headers: {content_type: 'application/json'}) - response = @request_obj.request(:post, 'https://www.exampleservererror/upload', nil, { multipart: true }) - expect(response).to have_key(:error) - end - - it 'test_request_method_403' do - stub_request(:post, 'https://www.exampleservererror/upload').to_return(status: 403, body: "{\"message\":\"Your account cannot be authenticated.\",\"help\":\"For support kindly contact us at support@imagekit.io .\"}", headers: {content_type: 'application/json'}) - response = @request_obj.request(:post, 'https://www.exampleservererror/upload', nil, { multipart: true }) - expect(response).to have_key(:error) - expect(response[:error]).to eq({"message"=>"Your account cannot be authenticated.", "help"=>"For support kindly contact us at support@imagekit.io ."}) - expect(response[:headers]).to eq({"content-type"=>["application/json"]}) - expect(response[:raw_body]).to eq("{\"message\":\"Your account cannot be authenticated.\",\"help\":\"For support kindly contact us at support@imagekit.io .\"}") - expect(response[:status_code]).to eq("403") - end - - it 'test_response_headers' do - stub_request(:post, 'https://www.exampleservererror/upload').to_return(status: 200, body: "{\"message\":\"Success.\"}", headers: {"strict-transport-security"=>["max-age=15552000"], - "x-ik-requestid"=>["39e19bd4-c9c3-4025-453e-a13e6a412aa0"], - "content-type"=>["application/json; charset=utf-8"], - "x-request-id"=>["39e19bd4-c9c3-4025-a043-a13e6a412aa0"]}) - response = @request_obj.request(:post, 'https://www.exampleservererror/upload', nil, { multipart: true }) - expect(response[:headers]).to eq({"strict-transport-security"=>["max-age=15552000"], - "x-ik-requestid"=>["39e19bd4-c9c3-4025-453e-a13e6a412aa0"], - "content-type"=>["application/json; charset=utf-8"], - "x-request-id"=>["39e19bd4-c9c3-4025-a043-a13e6a412aa0"]}) - end - - it 'test_response_raw_body' do - stub_request(:post, 'https://www.exampleservererror/upload').to_return(status: 200, body: "{\"message\":\"Success.\"}", headers: {"strict-transport-security"=>["max-age=15552000"], "content-type"=>["application/json; charset=utf-8"]}) - response = @request_obj.request(:post, 'https://www.exampleservererror/upload', nil, { multipart: false }) - expect(response[:raw_body]).to eq("{\"message\":\"Success.\"}") - end - end -end diff --git a/test/imagekit/resource_namespaces.rb b/test/imagekit/resource_namespaces.rb new file mode 100644 index 00000000..52347d84 --- /dev/null +++ b/test/imagekit/resource_namespaces.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Imagekit + module Test + module Resources + module Accounts + end + + module Beta + module V2 + end + end + + module Cache + end + + module Files + end + + module Folders + end + + module V2 + end + end + end +end diff --git a/test/imagekit/resources/accounts/origins_test.rb b/test/imagekit/resources/accounts/origins_test.rb new file mode 100644 index 00000000..55df4efe --- /dev/null +++ b/test/imagekit/resources/accounts/origins_test.rb @@ -0,0 +1,347 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Accounts::OriginsTest < Imagekit::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = + @image_kit.accounts.origins.create( + origin: { + accessKey: "AKIATEST123", + bucket: "test-bucket", + name: "My S3 Origin", + secretKey: "secrettest123", + type: :S3 + } + ) + + assert_pattern do + response => Imagekit::Accounts::OriginResponse + end + + assert_pattern do + case response + in Imagekit::Accounts::OriginResponse::S3 + in Imagekit::Accounts::OriginResponse::S3Compatible + in Imagekit::Accounts::OriginResponse::CloudinaryBackup + in Imagekit::Accounts::OriginResponse::WebFolder + in Imagekit::Accounts::OriginResponse::WebProxy + in Imagekit::Accounts::OriginResponse::Gcs + in Imagekit::Accounts::OriginResponse::AzureBlob + in Imagekit::Accounts::OriginResponse::AkeneoPim + end + end + + assert_pattern do + case response + in { + type: :S3, + id: String, + bucket: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :S3_COMPATIBLE, + id: String, + bucket: String, + endpoint: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + s3_force_path_style: Imagekit::Internal::Type::Boolean, + base_url_for_canonical_header: String | nil + } + in { + type: :CLOUDINARY_BACKUP, + id: String, + bucket: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :WEB_FOLDER, + id: String, + base_url: String, + forward_host_header_to_origin: Imagekit::Internal::Type::Boolean, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + in { + type: :WEB_PROXY, + id: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + in { + type: :GCS, + id: String, + bucket: String, + client_email: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :AZURE_BLOB, + id: String, + account_name: String, + container: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :AKENEO_PIM, + id: String, + base_url: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + end + end + end + + def test_update_required_params + skip("Prism tests are disabled") + + response = + @image_kit.accounts.origins.update( + "id", + origin: { + accessKey: "AKIATEST123", + bucket: "test-bucket", + name: "My S3 Origin", + secretKey: "secrettest123", + type: :S3 + } + ) + + assert_pattern do + response => Imagekit::Accounts::OriginResponse + end + + assert_pattern do + case response + in Imagekit::Accounts::OriginResponse::S3 + in Imagekit::Accounts::OriginResponse::S3Compatible + in Imagekit::Accounts::OriginResponse::CloudinaryBackup + in Imagekit::Accounts::OriginResponse::WebFolder + in Imagekit::Accounts::OriginResponse::WebProxy + in Imagekit::Accounts::OriginResponse::Gcs + in Imagekit::Accounts::OriginResponse::AzureBlob + in Imagekit::Accounts::OriginResponse::AkeneoPim + end + end + + assert_pattern do + case response + in { + type: :S3, + id: String, + bucket: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :S3_COMPATIBLE, + id: String, + bucket: String, + endpoint: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + s3_force_path_style: Imagekit::Internal::Type::Boolean, + base_url_for_canonical_header: String | nil + } + in { + type: :CLOUDINARY_BACKUP, + id: String, + bucket: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :WEB_FOLDER, + id: String, + base_url: String, + forward_host_header_to_origin: Imagekit::Internal::Type::Boolean, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + in { + type: :WEB_PROXY, + id: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + in { + type: :GCS, + id: String, + bucket: String, + client_email: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :AZURE_BLOB, + id: String, + account_name: String, + container: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :AKENEO_PIM, + id: String, + base_url: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + end + end + end + + def test_list + skip("Prism tests are disabled") + + response = @image_kit.accounts.origins.list + + assert_pattern do + response => ^(Imagekit::Internal::Type::ArrayOf[union: Imagekit::Accounts::OriginResponse]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @image_kit.accounts.origins.delete("id") + + assert_pattern do + response => nil + end + end + + def test_get + skip("Prism tests are disabled") + + response = @image_kit.accounts.origins.get("id") + + assert_pattern do + response => Imagekit::Accounts::OriginResponse + end + + assert_pattern do + case response + in Imagekit::Accounts::OriginResponse::S3 + in Imagekit::Accounts::OriginResponse::S3Compatible + in Imagekit::Accounts::OriginResponse::CloudinaryBackup + in Imagekit::Accounts::OriginResponse::WebFolder + in Imagekit::Accounts::OriginResponse::WebProxy + in Imagekit::Accounts::OriginResponse::Gcs + in Imagekit::Accounts::OriginResponse::AzureBlob + in Imagekit::Accounts::OriginResponse::AkeneoPim + end + end + + assert_pattern do + case response + in { + type: :S3, + id: String, + bucket: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :S3_COMPATIBLE, + id: String, + bucket: String, + endpoint: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + s3_force_path_style: Imagekit::Internal::Type::Boolean, + base_url_for_canonical_header: String | nil + } + in { + type: :CLOUDINARY_BACKUP, + id: String, + bucket: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :WEB_FOLDER, + id: String, + base_url: String, + forward_host_header_to_origin: Imagekit::Internal::Type::Boolean, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + in { + type: :WEB_PROXY, + id: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + in { + type: :GCS, + id: String, + bucket: String, + client_email: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :AZURE_BLOB, + id: String, + account_name: String, + container: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + prefix: String, + base_url_for_canonical_header: String | nil + } + in { + type: :AKENEO_PIM, + id: String, + base_url: String, + include_canonical_header: Imagekit::Internal::Type::Boolean, + name: String, + base_url_for_canonical_header: String | nil + } + end + end + end +end diff --git a/test/imagekit/resources/accounts/url_endpoints_test.rb b/test/imagekit/resources/accounts/url_endpoints_test.rb new file mode 100644 index 00000000..88895a66 --- /dev/null +++ b/test/imagekit/resources/accounts/url_endpoints_test.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Accounts::URLEndpointsTest < Imagekit::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = @image_kit.accounts.url_endpoints.create(description: "My custom URL endpoint") + + assert_pattern do + response => Imagekit::Accounts::URLEndpointResponse + end + + assert_pattern do + response => { + id: String, + description: String, + origins: ^(Imagekit::Internal::Type::ArrayOf[String]), + url_prefix: String, + url_rewriter: Imagekit::Accounts::URLEndpointResponse::URLRewriter | nil + } + end + end + + def test_update_required_params + skip("Prism tests are disabled") + + response = @image_kit.accounts.url_endpoints.update("id", description: "My custom URL endpoint") + + assert_pattern do + response => Imagekit::Accounts::URLEndpointResponse + end + + assert_pattern do + response => { + id: String, + description: String, + origins: ^(Imagekit::Internal::Type::ArrayOf[String]), + url_prefix: String, + url_rewriter: Imagekit::Accounts::URLEndpointResponse::URLRewriter | nil + } + end + end + + def test_list + skip("Prism tests are disabled") + + response = @image_kit.accounts.url_endpoints.list + + assert_pattern do + response => ^(Imagekit::Internal::Type::ArrayOf[Imagekit::Accounts::URLEndpointResponse]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @image_kit.accounts.url_endpoints.delete("id") + + assert_pattern do + response => nil + end + end + + def test_get + skip("Prism tests are disabled") + + response = @image_kit.accounts.url_endpoints.get("id") + + assert_pattern do + response => Imagekit::Accounts::URLEndpointResponse + end + + assert_pattern do + response => { + id: String, + description: String, + origins: ^(Imagekit::Internal::Type::ArrayOf[String]), + url_prefix: String, + url_rewriter: Imagekit::Accounts::URLEndpointResponse::URLRewriter | nil + } + end + end +end diff --git a/test/imagekit/resources/accounts/usage_test.rb b/test/imagekit/resources/accounts/usage_test.rb new file mode 100644 index 00000000..30337d45 --- /dev/null +++ b/test/imagekit/resources/accounts/usage_test.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Accounts::UsageTest < Imagekit::Test::ResourceTest + def test_get_required_params + skip("Prism tests are disabled") + + response = @image_kit.accounts.usage.get(end_date: "2019-12-27", start_date: "2019-12-27") + + assert_pattern do + response => Imagekit::Models::Accounts::UsageGetResponse + end + + assert_pattern do + response => { + bandwidth_bytes: Integer | nil, + extension_units_count: Integer | nil, + media_library_storage_bytes: Integer | nil, + original_cache_storage_bytes: Integer | nil, + video_processing_units_count: Integer | nil + } + end + end +end diff --git a/test/imagekit/resources/accounts_test.rb b/test/imagekit/resources/accounts_test.rb new file mode 100644 index 00000000..73ea1f30 --- /dev/null +++ b/test/imagekit/resources/accounts_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::AccountsTest < Imagekit::Test::ResourceTest +end diff --git a/test/imagekit/resources/assets_test.rb b/test/imagekit/resources/assets_test.rb new file mode 100644 index 00000000..31121c1c --- /dev/null +++ b/test/imagekit/resources/assets_test.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::AssetsTest < Imagekit::Test::ResourceTest + def test_list + skip("Prism tests are disabled") + + response = @image_kit.assets.list + + assert_pattern do + response => ^(Imagekit::Internal::Type::ArrayOf[union: Imagekit::Models::AssetListResponseItem]) + end + end +end diff --git a/test/imagekit/resources/beta/v2/files_test.rb b/test/imagekit/resources/beta/v2/files_test.rb new file mode 100644 index 00000000..c664cb10 --- /dev/null +++ b/test/imagekit/resources/beta/v2/files_test.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require_relative "../../../test_helper" + +class Imagekit::Test::Resources::Beta::V2::FilesTest < Imagekit::Test::ResourceTest + def test_upload_required_params + skip("Prism tests are disabled") + + response = @image_kit.beta.v2.files.upload(file: Pathname(__FILE__), file_name: "fileName") + + assert_pattern do + response => Imagekit::Models::Beta::V2::FileUploadResponse + end + + assert_pattern do + response => { + ai_tags: ^(Imagekit::Internal::Type::ArrayOf[Imagekit::Models::Beta::V2::FileUploadResponse::AITag]) | nil, + audio_codec: String | nil, + bit_rate: Integer | nil, + custom_coordinates: String | nil, + custom_metadata: ^(Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown]) | nil, + description: String | nil, + duration: Integer | nil, + embedded_metadata: ^(Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown]) | nil, + extension_status: Imagekit::Models::Beta::V2::FileUploadResponse::ExtensionStatus | nil, + file_id: String | nil, + file_path: String | nil, + file_type: String | nil, + height: Float | nil, + is_private_file: Imagekit::Internal::Type::Boolean | nil, + is_published: Imagekit::Internal::Type::Boolean | nil, + metadata: Imagekit::Metadata | nil, + name: String | nil, + size: Float | nil, + tags: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil, + thumbnail_url: String | nil, + url: String | nil, + version_info: Imagekit::Models::Beta::V2::FileUploadResponse::VersionInfo | nil, + video_codec: String | nil, + width: Float | nil + } + end + end +end diff --git a/test/imagekit/resources/beta/v2_test.rb b/test/imagekit/resources/beta/v2_test.rb new file mode 100644 index 00000000..e35e2d0d --- /dev/null +++ b/test/imagekit/resources/beta/v2_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Beta::V2Test < Imagekit::Test::ResourceTest +end diff --git a/test/imagekit/resources/beta_test.rb b/test/imagekit/resources/beta_test.rb new file mode 100644 index 00000000..9118a6f1 --- /dev/null +++ b/test/imagekit/resources/beta_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::BetaTest < Imagekit::Test::ResourceTest +end diff --git a/test/imagekit/resources/cache/invalidation_test.rb b/test/imagekit/resources/cache/invalidation_test.rb new file mode 100644 index 00000000..e732093a --- /dev/null +++ b/test/imagekit/resources/cache/invalidation_test.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Cache::InvalidationTest < Imagekit::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = + @image_kit.cache.invalidation.create(url: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg") + + assert_pattern do + response => Imagekit::Models::Cache::InvalidationCreateResponse + end + + assert_pattern do + response => { + request_id: String | nil + } + end + end + + def test_get + skip("Prism tests are disabled") + + response = @image_kit.cache.invalidation.get("requestId") + + assert_pattern do + response => Imagekit::Models::Cache::InvalidationGetResponse + end + + assert_pattern do + response => { + status: Imagekit::Models::Cache::InvalidationGetResponse::Status | nil + } + end + end +end diff --git a/test/imagekit/resources/cache_test.rb b/test/imagekit/resources/cache_test.rb new file mode 100644 index 00000000..5844ad3c --- /dev/null +++ b/test/imagekit/resources/cache_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::CacheTest < Imagekit::Test::ResourceTest +end diff --git a/test/imagekit/resources/custom_metadata_fields_test.rb b/test/imagekit/resources/custom_metadata_fields_test.rb new file mode 100644 index 00000000..c87be2e5 --- /dev/null +++ b/test/imagekit/resources/custom_metadata_fields_test.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::CustomMetadataFieldsTest < Imagekit::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = + @image_kit.custom_metadata_fields.create(label: "price", name: "price", schema: {type: :Number}) + + assert_pattern do + response => Imagekit::CustomMetadataField + end + + assert_pattern do + response => { + id: String, + label: String, + name: String, + schema: Imagekit::CustomMetadataField::Schema + } + end + end + + def test_update + skip("Prism tests are disabled") + + response = @image_kit.custom_metadata_fields.update("id") + + assert_pattern do + response => Imagekit::CustomMetadataField + end + + assert_pattern do + response => { + id: String, + label: String, + name: String, + schema: Imagekit::CustomMetadataField::Schema + } + end + end + + def test_list + skip("Prism tests are disabled") + + response = @image_kit.custom_metadata_fields.list + + assert_pattern do + response => ^(Imagekit::Internal::Type::ArrayOf[Imagekit::CustomMetadataField]) + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @image_kit.custom_metadata_fields.delete("id") + + assert_pattern do + response => Imagekit::Models::CustomMetadataFieldDeleteResponse + end + + assert_pattern do + response => { + **_ + } + end + end +end diff --git a/test/imagekit/resources/files/bulk_test.rb b/test/imagekit/resources/files/bulk_test.rb new file mode 100644 index 00000000..dc86a12b --- /dev/null +++ b/test/imagekit/resources/files/bulk_test.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Files::BulkTest < Imagekit::Test::ResourceTest + def test_delete_required_params + skip("Prism tests are disabled") + + response = + @image_kit.files.bulk.delete(file_ids: %w[598821f949c0a938d57563bd 598821f949c0a938d57563be]) + + assert_pattern do + response => Imagekit::Models::Files::BulkDeleteResponse + end + + assert_pattern do + response => { + successfully_deleted_file_ids: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil + } + end + end + + def test_add_tags_required_params + skip("Prism tests are disabled") + + response = + @image_kit.files.bulk.add_tags( + file_ids: %w[598821f949c0a938d57563bd 598821f949c0a938d57563be], + tags: %w[t-shirt round-neck sale2019] + ) + + assert_pattern do + response => Imagekit::Models::Files::BulkAddTagsResponse + end + + assert_pattern do + response => { + successfully_updated_file_ids: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil + } + end + end + + def test_remove_ai_tags_required_params + skip("Prism tests are disabled") + + response = + @image_kit.files.bulk.remove_ai_tags( + ai_tags: %w[t-shirt round-neck sale2019], + file_ids: %w[598821f949c0a938d57563bd 598821f949c0a938d57563be] + ) + + assert_pattern do + response => Imagekit::Models::Files::BulkRemoveAITagsResponse + end + + assert_pattern do + response => { + successfully_updated_file_ids: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil + } + end + end + + def test_remove_tags_required_params + skip("Prism tests are disabled") + + response = + @image_kit.files.bulk.remove_tags( + file_ids: %w[598821f949c0a938d57563bd 598821f949c0a938d57563be], + tags: %w[t-shirt round-neck sale2019] + ) + + assert_pattern do + response => Imagekit::Models::Files::BulkRemoveTagsResponse + end + + assert_pattern do + response => { + successfully_updated_file_ids: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil + } + end + end +end diff --git a/test/imagekit/resources/files/metadata_test.rb b/test/imagekit/resources/files/metadata_test.rb new file mode 100644 index 00000000..9a60e643 --- /dev/null +++ b/test/imagekit/resources/files/metadata_test.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Files::MetadataTest < Imagekit::Test::ResourceTest + def test_get + skip("Prism tests are disabled") + + response = @image_kit.files.metadata.get("fileId") + + assert_pattern do + response => Imagekit::Metadata + end + + assert_pattern do + response => { + audio_codec: String | nil, + bit_rate: Integer | nil, + density: Integer | nil, + duration: Integer | nil, + exif: Imagekit::Metadata::Exif | nil, + format_: String | nil, + has_color_profile: Imagekit::Internal::Type::Boolean | nil, + has_transparency: Imagekit::Internal::Type::Boolean | nil, + height: Integer | nil, + p_hash: String | nil, + quality: Integer | nil, + size: Integer | nil, + video_codec: String | nil, + width: Integer | nil + } + end + end + + def test_get_from_url_required_params + skip("Prism tests are disabled") + + response = @image_kit.files.metadata.get_from_url(url: "https://example.com") + + assert_pattern do + response => Imagekit::Metadata + end + + assert_pattern do + response => { + audio_codec: String | nil, + bit_rate: Integer | nil, + density: Integer | nil, + duration: Integer | nil, + exif: Imagekit::Metadata::Exif | nil, + format_: String | nil, + has_color_profile: Imagekit::Internal::Type::Boolean | nil, + has_transparency: Imagekit::Internal::Type::Boolean | nil, + height: Integer | nil, + p_hash: String | nil, + quality: Integer | nil, + size: Integer | nil, + video_codec: String | nil, + width: Integer | nil + } + end + end +end diff --git a/test/imagekit/resources/files/versions_test.rb b/test/imagekit/resources/files/versions_test.rb new file mode 100644 index 00000000..cb25fb21 --- /dev/null +++ b/test/imagekit/resources/files/versions_test.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Files::VersionsTest < Imagekit::Test::ResourceTest + def test_list + skip("Prism tests are disabled") + + response = @image_kit.files.versions.list("fileId") + + assert_pattern do + response => ^(Imagekit::Internal::Type::ArrayOf[Imagekit::File]) + end + end + + def test_delete_required_params + skip("Prism tests are disabled") + + response = @image_kit.files.versions.delete("versionId", file_id: "fileId") + + assert_pattern do + response => Imagekit::Models::Files::VersionDeleteResponse + end + + assert_pattern do + response => { + **_ + } + end + end + + def test_get_required_params + skip("Prism tests are disabled") + + response = @image_kit.files.versions.get("versionId", file_id: "fileId") + + assert_pattern do + response => Imagekit::File + end + + assert_pattern do + response => { + ai_tags: ^(Imagekit::Internal::Type::ArrayOf[Imagekit::File::AITag]) | nil, + created_at: Time | nil, + custom_coordinates: String | nil, + custom_metadata: ^(Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown]) | nil, + description: String | nil, + file_id: String | nil, + file_path: String | nil, + file_type: String | nil, + has_alpha: Imagekit::Internal::Type::Boolean | nil, + height: Float | nil, + is_private_file: Imagekit::Internal::Type::Boolean | nil, + is_published: Imagekit::Internal::Type::Boolean | nil, + mime: String | nil, + name: String | nil, + size: Float | nil, + tags: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil, + thumbnail: String | nil, + type: Imagekit::File::Type | nil, + updated_at: Time | nil, + url: String | nil, + version_info: Imagekit::File::VersionInfo | nil, + width: Float | nil + } + end + end + + def test_restore_required_params + skip("Prism tests are disabled") + + response = @image_kit.files.versions.restore("versionId", file_id: "fileId") + + assert_pattern do + response => Imagekit::File + end + + assert_pattern do + response => { + ai_tags: ^(Imagekit::Internal::Type::ArrayOf[Imagekit::File::AITag]) | nil, + created_at: Time | nil, + custom_coordinates: String | nil, + custom_metadata: ^(Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown]) | nil, + description: String | nil, + file_id: String | nil, + file_path: String | nil, + file_type: String | nil, + has_alpha: Imagekit::Internal::Type::Boolean | nil, + height: Float | nil, + is_private_file: Imagekit::Internal::Type::Boolean | nil, + is_published: Imagekit::Internal::Type::Boolean | nil, + mime: String | nil, + name: String | nil, + size: Float | nil, + tags: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil, + thumbnail: String | nil, + type: Imagekit::File::Type | nil, + updated_at: Time | nil, + url: String | nil, + version_info: Imagekit::File::VersionInfo | nil, + width: Float | nil + } + end + end +end diff --git a/test/imagekit/resources/files_test.rb b/test/imagekit/resources/files_test.rb new file mode 100644 index 00000000..c09eb4bb --- /dev/null +++ b/test/imagekit/resources/files_test.rb @@ -0,0 +1,151 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::FilesTest < Imagekit::Test::ResourceTest + def test_update + skip("Prism tests are disabled") + + response = @image_kit.files.update("fileId") + + assert_pattern do + response => Imagekit::Models::FileUpdateResponse + end + end + + def test_delete + skip("Prism tests are disabled") + + response = @image_kit.files.delete("fileId") + + assert_pattern do + response => nil + end + end + + def test_copy_required_params + skip("Prism tests are disabled") + + response = + @image_kit.files.copy(destination_path: "/folder/to/copy/into/", source_file_path: "/path/to/file.jpg") + + assert_pattern do + response => Imagekit::Models::FileCopyResponse + end + + assert_pattern do + response => { + **_ + } + end + end + + def test_get + skip("Prism tests are disabled") + + response = @image_kit.files.get("fileId") + + assert_pattern do + response => Imagekit::File + end + + assert_pattern do + response => { + ai_tags: ^(Imagekit::Internal::Type::ArrayOf[Imagekit::File::AITag]) | nil, + created_at: Time | nil, + custom_coordinates: String | nil, + custom_metadata: ^(Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown]) | nil, + description: String | nil, + file_id: String | nil, + file_path: String | nil, + file_type: String | nil, + has_alpha: Imagekit::Internal::Type::Boolean | nil, + height: Float | nil, + is_private_file: Imagekit::Internal::Type::Boolean | nil, + is_published: Imagekit::Internal::Type::Boolean | nil, + mime: String | nil, + name: String | nil, + size: Float | nil, + tags: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil, + thumbnail: String | nil, + type: Imagekit::File::Type | nil, + updated_at: Time | nil, + url: String | nil, + version_info: Imagekit::File::VersionInfo | nil, + width: Float | nil + } + end + end + + def test_move_required_params + skip("Prism tests are disabled") + + response = + @image_kit.files.move(destination_path: "/folder/to/move/into/", source_file_path: "/path/to/file.jpg") + + assert_pattern do + response => Imagekit::Models::FileMoveResponse + end + + assert_pattern do + response => { + **_ + } + end + end + + def test_rename_required_params + skip("Prism tests are disabled") + + response = @image_kit.files.rename(file_path: "/path/to/file.jpg", new_file_name: "newFileName.jpg") + + assert_pattern do + response => Imagekit::Models::FileRenameResponse + end + + assert_pattern do + response => { + purge_request_id: String | nil + } + end + end + + def test_upload_required_params + skip("Prism tests are disabled") + + response = @image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + + assert_pattern do + response => Imagekit::Models::FileUploadResponse + end + + assert_pattern do + response => { + ai_tags: ^(Imagekit::Internal::Type::ArrayOf[Imagekit::Models::FileUploadResponse::AITag]) | nil, + audio_codec: String | nil, + bit_rate: Integer | nil, + custom_coordinates: String | nil, + custom_metadata: ^(Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown]) | nil, + description: String | nil, + duration: Integer | nil, + embedded_metadata: ^(Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown]) | nil, + extension_status: Imagekit::Models::FileUploadResponse::ExtensionStatus | nil, + file_id: String | nil, + file_path: String | nil, + file_type: String | nil, + height: Float | nil, + is_private_file: Imagekit::Internal::Type::Boolean | nil, + is_published: Imagekit::Internal::Type::Boolean | nil, + metadata: Imagekit::Metadata | nil, + name: String | nil, + size: Float | nil, + tags: ^(Imagekit::Internal::Type::ArrayOf[String]) | nil, + thumbnail_url: String | nil, + url: String | nil, + version_info: Imagekit::Models::FileUploadResponse::VersionInfo | nil, + video_codec: String | nil, + width: Float | nil + } + end + end +end diff --git a/test/imagekit/resources/folders/job_test.rb b/test/imagekit/resources/folders/job_test.rb new file mode 100644 index 00000000..6521e30e --- /dev/null +++ b/test/imagekit/resources/folders/job_test.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class Imagekit::Test::Resources::Folders::JobTest < Imagekit::Test::ResourceTest + def test_get + skip("Prism tests are disabled") + + response = @image_kit.folders.job.get("jobId") + + assert_pattern do + response => Imagekit::Models::Folders::JobGetResponse + end + + assert_pattern do + response => { + job_id: String | nil, + purge_request_id: String | nil, + status: Imagekit::Models::Folders::JobGetResponse::Status | nil, + type: Imagekit::Models::Folders::JobGetResponse::Type | nil + } + end + end +end diff --git a/test/imagekit/resources/folders_test.rb b/test/imagekit/resources/folders_test.rb new file mode 100644 index 00000000..4e5e4e43 --- /dev/null +++ b/test/imagekit/resources/folders_test.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::FoldersTest < Imagekit::Test::ResourceTest + def test_create_required_params + skip("Prism tests are disabled") + + response = @image_kit.folders.create(folder_name: "summer", parent_folder_path: "/product/images/") + + assert_pattern do + response => Imagekit::Models::FolderCreateResponse + end + + assert_pattern do + response => { + **_ + } + end + end + + def test_delete_required_params + skip("Prism tests are disabled") + + response = @image_kit.folders.delete(folder_path: "/folder/to/delete/") + + assert_pattern do + response => Imagekit::Models::FolderDeleteResponse + end + + assert_pattern do + response => { + **_ + } + end + end + + def test_copy_required_params + skip("Prism tests are disabled") + + response = + @image_kit.folders.copy( + destination_path: "/path/of/destination/folder", + source_folder_path: "/path/of/source/folder" + ) + + assert_pattern do + response => Imagekit::Models::FolderCopyResponse + end + + assert_pattern do + response => { + job_id: String + } + end + end + + def test_move_required_params + skip("Prism tests are disabled") + + response = + @image_kit.folders.move( + destination_path: "/path/of/destination/folder", + source_folder_path: "/path/of/source/folder" + ) + + assert_pattern do + response => Imagekit::Models::FolderMoveResponse + end + + assert_pattern do + response => { + job_id: String + } + end + end + + def test_rename_required_params + skip("Prism tests are disabled") + + response = @image_kit.folders.rename(folder_path: "/path/of/folder", new_folder_name: "new-folder-name") + + assert_pattern do + response => Imagekit::Models::FolderRenameResponse + end + + assert_pattern do + response => { + job_id: String + } + end + end +end diff --git a/test/imagekit/resources/shared_test.rb b/test/imagekit/resources/shared_test.rb new file mode 100644 index 00000000..be22f0e4 --- /dev/null +++ b/test/imagekit/resources/shared_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::SharedTest < Imagekit::Test::ResourceTest +end diff --git a/test/imagekit/resources/webhooks_test.rb b/test/imagekit/resources/webhooks_test.rb new file mode 100644 index 00000000..2b78db80 --- /dev/null +++ b/test/imagekit/resources/webhooks_test.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class Imagekit::Test::Resources::WebhooksTest < Imagekit::Test::ResourceTest +end diff --git a/test/imagekit/spec_helper.rb b/test/imagekit/spec_helper.rb deleted file mode 100644 index 433b4162..00000000 --- a/test/imagekit/spec_helper.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'simplecov' -SimpleCov.start 'rails' - -# require 'codecov' -# SimpleCov.formatter = SimpleCov::Formatter::Codecov - -require 'base64' -require 'rspec' -require 'webmock/rspec' -require 'carrierwave' -require 'byebug' -require 'active_storage' -require "rspec/autorun" - -require_relative '../../lib/imagekitio' diff --git a/test/imagekit/test_helper.rb b/test/imagekit/test_helper.rb new file mode 100644 index 00000000..92dbd107 --- /dev/null +++ b/test/imagekit/test_helper.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +# Requiring this file from each test file ensures we always do the following, even +# when running a single-file test: +# - Load the whole gem (as one would in production) +# - Define shared testing namespace so that we don't need to indent test files as much +# - Setting up testing dependencies + +require "digest" +require "singleton" + +require "async" +require "minitest/autorun" +require "minitest/focus" +require "minitest/hooks/test" +require "minitest/proveit" +require "minitest/rg" +require "webmock" + +require_relative "../../lib/imagekit" +require_relative "resource_namespaces" + +module Kernel + alias_method :_sleep, :sleep + + def sleep(secs) + case Thread.current.thread_variable_get(:mock_sleep) + in Array => counter + counter << secs + secs + else + _sleep(secs) + end + end +end + +class Time + class << self + alias_method :_now, :now + end + + def self.now = Thread.current.thread_variable_get(:time_now) || _now +end + +class Imagekit::Test::SingletonClient < Imagekit::Client + include Singleton + + TEST_API_BASE_URL = ENV.fetch("TEST_API_BASE_URL", "http://localhost:4010") + + def initialize + super( + base_url: Imagekit::Test::SingletonClient::TEST_API_BASE_URL, + private_api_key: "My Private API Key", + password: "My Password" + ) + end +end + +module Minitest::Serial + def test_order = :random + + def run_one_method(...) = Minitest::Runnable.run_one_method(...) +end + +class Minitest::Test + include Minitest::Hooks + + make_my_diffs_pretty! + parallelize_me! + prove_it! +end + +class Imagekit::Test::ResourceTest < Minitest::Test + def async? + return @async unless @async.nil? + @async = Digest::SHA256.hexdigest(self.class.name).to_i(16).odd? + end + + def before_all + super + @image_kit = Imagekit::Test::SingletonClient.instance + end + + def around_all = async? ? Sync { super } : super + + def around = async? ? Async { super }.wait : super +end + +module WebMock + AssertionFailure.error_class = Minitest::Assertion +end diff --git a/test/imagekit/url_test.rb b/test/imagekit/url_test.rb deleted file mode 100644 index 88b6051c..00000000 --- a/test/imagekit/url_test.rb +++ /dev/null @@ -1,444 +0,0 @@ -require_relative "./spec_helper" -require "rspec/autorun" - -RSpec.describe ImageKitIo::Url do - let(:request_obj) { ImageKitIo::Request.new(@private_key, @public_key, @url_endpoint) } - let(:url_obj) { ImageKitIo::Url.new(request_obj) } - - before(:each) do - @private_key = 'private_key_xyz' - @public_key = 'public_key_xyz' - @url_endpoint = 'https://imagekit.io/your-imgekit-id' - end - describe "TestGenerateUrl" do - it "test_request_init" do - expect(request_obj.private_key).to eq(@private_key) - end - - it "test_generate_url_without_transformations" do - - options = { path: "/default-image.jpg", - url_endpoint: @url_endpoint, - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/default-image.jpg") - end - - it "test_generate_url_with_path" do - - options = { path: "/default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/default-image.jpg") - end - - it "test_generate_url_with_path_with_special_characters" do - - options = { path: "/γειασας/Fjällräven_KnSJwp87u6q.png", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/γειασας/Fjällräven_KnSJwp87u6q.png") - end - - it "test_generate_url_without_slash" do - options = { path: "default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/default-image.jpg") - end - - it "test_generate_url_with_path_without_slash_with_special_characters" do - - options = { path: "γειασας/Fjällräven_KnSJwp87u6q.png", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/γειασας/Fjällräven_KnSJwp87u6q.png") - end - - it "test_generate_url_with_override_url_endpoint_without_slash" do - options = { path: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_override_imagekit_id", - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://ik.imagekit.io/your_override_imagekit_id/tr:h-300,w-400/default-image.jpg") - end - - it "test_generate_url_with_override_url_endpoint_without_slash_with_special_characters" do - options = { path: "/γειασας/Fjällräven_KnSJwp87u6q.png", - url_endpoint: "https://ik.imagekit.io/your_override_imagekit_id", - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://ik.imagekit.io/your_override_imagekit_id/tr:h-300,w-400/γειασας/Fjällräven_KnSJwp87u6q.png") - end - - it "test_generate_url_with_override_url_endpoint_with_slash" do - - options = { path: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_override_imagekit_id/", - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://ik.imagekit.io/your_override_imagekit_id/tr:h-300,w-400/default-image.jpg") - end - - it "test_generate_url_with_override_url_endpoint_with_slash_with_special_characters" do - options = { path: "/γειασας/Fjällräven_KnSJwp87u6q.png", - url_endpoint: "https://ik.imagekit.io/your_override_imagekit_id/", - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://ik.imagekit.io/your_override_imagekit_id/tr:h-300,w-400/γειασας/Fjällräven_KnSJwp87u6q.png") - end - - it "test_generate_url_with_override_url_endpoint_with_special_characters" do - options = { path: "/γειασας/Fjällräven_KnSJwp87u6q.png", - url_endpoint: "https://www.Fjällräven.com/your_override_imagekit_id/", - transformation: [{ height: 300, width: 400 }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://www.Fjällräven.com/your_override_imagekit_id/tr:h-300,w-400/γειασας/Fjällräven_KnSJwp87u6q.png") - end - - it "test_generate_url_with_new_transformation_parameters" do - - options = { path: "default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }, { new_params: 100 }], - } - url = url_obj.generate_url(options) - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400:new_params-100/default-image.jpg") - end - - it "test_generate_url_should_have_ik_sdk_version" do - - options = { path: "default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 },] - } - url = url_obj.generate_url(options) - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/default-image.jpg") - end - - it "test_generate_url_should_have_transformation_parameters" do - - options = { path: "default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ - height: 300, - width: 400, - aspect_ratio: '4-3', - quality: 40, - crop: 'force', - crop_mode: 'extract', - focus: 'left', - format: 'jpeg', - radius: 50, - bg: "A94D34", - border: "5-A94D34", - rotation: 90, - blur: 10, - named: "some_name", - progressive: true, - lossless: true, - trim: 5, - metadata: true, - color_profile: true, - default_image: "/folder/file.jpg", - dpr: 3, - effect_sharpen: 10, - effect_usm: "2-2-0.8-0.024", - effect_contrast: true, - effect_gray: true, - effect_shadow: 'bl-15_st-40_x-10_y-N5', - effect_gradient: 'from-red_to-white', - original: true, - raw: 'w-200,h-200' - },] - } - url = url_obj.generate_url(options) - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,e-sharpen-10,e-usm-2-2-0.8-0.024,e-contrast-true,e-grayscale-true,e-shadow-bl-15_st-40_x-10_y-N5,e-gradient-from-red_to-white,orig-true,w-200,h-200/default-image.jpg") - end - - it "test_generate_url_with_chained_transformation" do - - options = { path: "default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }, { rotation: 90 }], - } - url = url_obj.generate_url(options) - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400:rt-90/default-image.jpg") - end - - it "test_generate_url_transformation_parameters_setted_to_query" do - - options = { path: "default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }], - transformation_position: "query", - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/default-image.jpg?tr=h-300,w-400") - end - - it "test_generate_url_with_special_characters_transformation_parameters_setted_to_query" do - - options = { path: "/γειασας/Fjällräven_KnSJwp87u6q.png", - url_endpoint: @url_endpoint, - transformation: [{ height: 300, width: 400 }], - transformation_position: "query", - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/γειασας/Fjällräven_KnSJwp87u6q.png?tr=h-300,w-400") - end - - it "test_generate_url_with_query_parameters" do - - options = { path: "/default-image.jpg", - query_parameters: { "v": "123", "blank_parameter": "" }, - transformation: [{ height: 300, width: 400 }] - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/default-image.jpg?v=123&blank_parameter") - end - - it "test_generate_url_with_query_parameters_with_special_characters" do - - options = { path: "/default-image.jpg", - query_parameters: { "γειασας": "γειασας" }, - transformation: [{ height: 300, width: 400 }] - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/default-image.jpg?γειασας=γειασας") - end - - it 'test_generate_url_with_absolute_path' do - options = { path: "https://example.com/external-image.jpg", - query_parameters: { "γειασας": "γειασας" }, - transformation: [{ height: 300, width: 400 }] - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/https%3A%2F%2Fexample.com%2Fexternal-image.jpg?γειασας=γειασας") - end - - it "test_generate_url_with_src_checking_query_param_added" do - - options = { src: "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?another=abc&xyz=888", - transformation: [{ height: "300", width: "400", }], - query_parameters: { "v": "123" }, - } - - url = url_obj.generate_url(options) - expect(url).to eq("https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?another=abc&xyz=888&v=123&tr=h-300,w-400") - end - - it "test_generate_url_with_path_checking_query_param_added" do - - options = { path: "/test_YhNhoRxWt.jpg?another=abc&xyz=888", - transformation: [{ height: "300", width: "400", }], - query_parameters: { "v": "123" }, - } - - url = url_obj.generate_url(options) - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/test_YhNhoRxWt.jpg?another=abc&xyz=888&v=123") - end - - it "test_generate_url_with_src" do - # Test url generation with src param - - options = { src: "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg", - transformation: [{ height: "300", - width: "400", - format: "jpg", - progressive: "true", - effect_sharpen: "-", - effect_contrast: "1", }, - { rotation: 90 },], - transformation_position: "query" } - - url = url_obj.generate_url(options) - - expect(url).to eq("https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?tr=h-300,w-400,f-jpg,pr-true,e-sharpen,e-contrast-1:rt-90") - - end - - it "test_generate_url_with_src_with_special_characters" do - # Test url generation with src param - - options = { src: "https://www.Fjällräve.com/γειασας/Fjällräven_KnSJwp87u6q.png", - transformation: [{ height: "300", - width: "400", - format: "jpg", - progressive: "true", - effect_sharpen: "-", - effect_contrast: "1", }, - { rotation: 90 },], - transformation_position: "query" } - - url = url_obj.generate_url(options) - - expect(url).to eq("https://www.Fjällräve.com/γειασας/Fjällräven_KnSJwp87u6q.png?tr=h-300,w-400,f-jpg,pr-true,e-sharpen,e-contrast-1:rt-90") - - end - - it "test_generate_url_with_src_and_query_parameters_is_path" do - - options = { src: "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg", - transformation: [{ height: "300", - width: "400", - format: "jpg", - progressive: "true", - effect_sharpen: "-", - effect_contrast: "1", }, - { rotation: 90 },], - transformation_position: "path" } - - url = url_obj.generate_url(options) - - expect(url).to eq("https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?tr=h-300,w-400,f-jpg,pr-true,e-sharpen,e-contrast-1:rt-90") - end - - it "test_generate_url_with_path_and_signed" do - - options = { path: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{ height: "300", width: "400" }], - signed: true, } - - url = url_obj.generate_url(options) - - expect(url).to include("https://ik.imagekit.io/your_imagekit_id/endpoint/tr:h-300,w-400/default-image.jpg?ik-s=") - end - - it "test_generate_url_with_path_and_signed_with_special_characters" do - - options = { path: "/Fjällräven_KnSJwp87u6q.png", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id/endpoint/", - transformation: [{ height: "300", width: "400" }], - signed: true, } - - url = url_obj.generate_url(options) - - expect(url).to include("https://ik.imagekit.io/your_imagekit_id/endpoint/tr:h-300,w-400/Fjällräven_KnSJwp87u6q.png?ik-s=") - end - - it 'test_generate_url_with_absolute_path_and_signed' do - allow(url_obj).to receive(:get_signature_timestamp).with(5) { 100 } - options = { path: "https://example.com/external-image.jpg", - query_parameters: { "γειασας": "γειασας" }, - transformation: [{ height: 300, width: 400 }], - signed: true, - expire_seconds: 5 - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,w-400/https%3A%2F%2Fexample.com%2Fexternal-image.jpg?γειασας=γειασας&ik-s=44c1295edb1dbc1d59216fba8994b4d3a36c61e2&ik-t=100") - end - - it "test_url_with_invalid_args_returns_as_it_is" do - - options = { path: "/default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: "300", fake_field: "400" }], - } - url = url_obj.generate_url(options) - - expect(url).to eq("https://imagekit.io/your-imgekit-id/tr:h-300,fake_field-400/default-image.jpg") - end - - it "test_url_without_path_and_src_should_return_empty" do - - options = { url_endpoint: @url_endpoint, - transformation: { height: "300", width: 400 }, - signed: true, - } - url = url_obj.generate_url(options) - expect(url.to_s).to eq("") - end - - it "test_url_with_invalid_trans_pos" do - - options = { path: "/default-image.jpg", - url_endpoint: @url_endpoint, - transformation: [{ height: "300", fake: "400" }], - transformation_position: "fake", - signed: true, } - - expect { url_obj.generate_url(options) }.to raise_error(ArgumentError) - - end - - it "test_url_with_signed_without_seconds" do - request_obj = ImageKitIo::Request.new('private_key_test', 'public_key_test', 'https://test-domain.com/test-endpoint') - url_obj = ImageKitIo::Url.new(request_obj) - - options = { path: "/test-signed-url.png", - transformation: [{ width: 100 }], - signed: true, } - url = url_obj.generate_url(options) - - expect(url).to include("https://test-domain.com/test-endpoint/tr:w-100/test-signed-url.png?ik-s=") - end - - it "test_url_with_signed_with_seconds" do - request_obj = ImageKitIo::Request.new('private_key_test', 'public_key_test', 'https://test-domain.com/test-endpoint') - url_obj = ImageKitIo::Url.new(request_obj) - - options = { path: "/test-signed-url.png", - transformation: [{ width: 100 }], - expire_seconds: 100, - signed: true } - url = url_obj.generate_url(options) - - expect(url).to include("ik-t") - end - - it "test_get_signature_with_100_expire_seconds" do - - url = "https://test-domain.com/test-endpoint/tr:w-100/test-signed-url.png" - signature = url_obj.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint/", 100) - expect(signature).to eq("5e5037a31a7121cbe2964e220b4338cc6e1ba66d") - end - - it "test_get_signature_expect_without_expire_seconds" do - - url = "https://test-domain.com/test-endpoint/tr:w-100/test-signed-url.png" - signature = url_obj.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint/", 0) - - expect(signature).to eq("41b3075c40bc84147eb71b8b49ae7fbf349d0f00") - end - - it "test_get_signature_expect_without_expire_seconds_without_slash" do - - url = "https://test-domain.com/test-endpoint/tr:w-100/test-signed-url.png" - signature = url_obj.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 0) - - expect(signature).to eq("41b3075c40bc84147eb71b8b49ae7fbf349d0f00") - end - - end -end diff --git a/test/imagekit/utils/calculation_test.rb b/test/imagekit/utils/calculation_test.rb deleted file mode 100644 index 239a53a9..00000000 --- a/test/imagekit/utils/calculation_test.rb +++ /dev/null @@ -1,68 +0,0 @@ -require_relative '../spec_helper' -require "rspec/autorun" - -RSpec.describe ImageKitIo::Utils::Calculation do - let(:subject) { described_class } - - it "is_valid_hex_with_valid_hex" do - result = subject.is_valid_hex('f06830ca9f1e3e90') - expect(true).to eq(result) - end - - it "is_valid_hex_with_invalid_hex" do - result = subject.is_valid_hex('f06830ca9f1e3e90$') - expect(false).to eq(result) - end - - it "hamming_distance_test_expect_0" do - result = subject.hamming_distance('f06830ca9f1e3e90', 'f06830ca9f1e3e90') - expect(0).to eq(result) - end - - it "hamming_distance_test_expect_17" do - result = subject.hamming_distance('2d5ad3936d2e015b', '2d6ed293db36a4fb') - expect(17).to eq(result) - end - - it "hamming_distance_test_expect_37" do - result = subject.hamming_distance('a4a65595ac94518b', '7838873e791f8400') - expect(37).to eq(result) - end - - it "get_authenticated_params_test_with_nil_expire_nill_token" do - allow(OpenSSL::HMAC).to receive(:hexdigest).and_return('my_signature') - result = subject.get_authenticated_params(nil, nil, 'private_key') - expect(nil).not_to eq(result[:token]) - expect(nil).not_to eq(result[:expire]) - expect('my_signature').to eq(result[:signature]) - end - - it "get_authenticated_params_test_with_nil_expire" do - allow(OpenSSL::HMAC).to receive(:hexdigest).and_return('my_signature') - result = subject.get_authenticated_params('my_token', nil, 'private_key') - expect('my_token').to eq(result[:token]) - expect(nil).not_to eq(result[:expire]) - expect('my_signature').to eq(result[:signature]) - end - - it "get_authenticated_params_test_with_hard_coded_params" do - result = subject.get_authenticated_params('your_token', 1582269249, 'private_key_test') - expect('your_token').to eq(result[:token]) - expect(nil).not_to eq(result[:expire]) - expect('e71bcd6031016b060d349d212e23e85c791decdd').to eq(result[:signature]) - end - - it "get_authenticated_params_test_with_nil_token" do - allow(OpenSSL::HMAC).to receive(:hexdigest).and_return('my_signature') - result = subject.get_authenticated_params(nil, nil, 'private_key') - expect(nil).not_to eq(result[:token]) - expect(nil).not_to eq(result[:expire]) - expect('my_signature').to eq(result[:signature]) - end - - it "get_authenticated_params_test_with_nil_private_key" do - allow(OpenSSL::HMAC).to receive(:hexdigest).and_return('my_signature') - result = subject.get_authenticated_params('your_token', 1582269249, nil) - expect(result).to eq(nil) - end -end diff --git a/test/imagekit/utils/formatter_test.rb b/test/imagekit/utils/formatter_test.rb deleted file mode 100644 index 13a470c5..00000000 --- a/test/imagekit/utils/formatter_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require_relative '../spec_helper' -require "rspec/autorun" - -RSpec.describe ImageKitIo::Utils::Formatter do - let(:subject) { described_class } - - it "snake_to_camel_test" do - result=subject.snake_to_camel('my_snake_to_camel') - expect('mySnakeToCamel').to eq(result) - end - - it "camel_to_snake_test" do - result=subject.camel_to_snake('mySnakeToCamel') - expect('my_snake_to_camel').to eq(result) - end - - it "request_formatter_test" do - result =subject.request_formatter({'my_snake' => 'test'}) - expect('mySnake').to eq(result.keys.first) - end -end diff --git a/test/test_helper.rb b/test/test_helper.rb deleted file mode 100644 index 0ea9cca7..00000000 --- a/test/test_helper.rb +++ /dev/null @@ -1,20 +0,0 @@ -# Configure Rails Environment -ENV["RAILS_ENV"] = "test" - -require_relative "../test/dummy/config/environment" -ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)] -require "rails/test_help" - -# Filter out the backtrace from minitest while preserving the one from other libraries. -Minitest.backtrace_filter = Minitest::BacktraceFilter.new - -require "rails/test_unit/reporter" -Rails::TestUnitReporter.executable = 'bin/test' - -# Load fixtures from the engine -if ActiveSupport::TestCase.respond_to?(:fixture_path=) - ActiveSupport::TestCase.fixture_path = File.expand_path("fixtures", __dir__) - ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path - ActiveSupport::TestCase.file_fixture_path = ActiveSupport::TestCase.fixture_path + "/files" - ActiveSupport::TestCase.fixtures :all -end From 5ce5d1f2370b6b31c1d2927856bfeac5eb592a23 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:51:02 +0000 Subject: [PATCH 02/32] chore: update SDK settings --- .github/workflows/publish-gem.yml | 31 ++++++++++++ .github/workflows/release-doctor.yml | 22 +++++++++ .release-please-manifest.json | 3 ++ .stats.yml | 2 +- CONTRIBUTING.md | 4 +- README.md | 8 +++- bin/check-release-environment | 21 +++++++++ imagekit.gemspec | 2 +- release-please-config.json | 70 ++++++++++++++++++++++++++++ 9 files changed, 157 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/publish-gem.yml create mode 100644 .github/workflows/release-doctor.yml create mode 100644 .release-please-manifest.json create mode 100644 bin/check-release-environment create mode 100644 release-please-config.json diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml new file mode 100644 index 00000000..a3de9dee --- /dev/null +++ b/.github/workflows/publish-gem.yml @@ -0,0 +1,31 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to rubygems.org in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/imagekit-developer/imagekit-ruby/actions/workflows/publish-gem.yml +name: Publish Gem +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Publish to RubyGems.org + run: | + bash ./bin/publish-gem + env: + # `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org + RUBYGEMS_HOST: ${{ secrets.IMAGE_KIT_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }} + GEM_HOST_API_KEY: ${{ secrets.IMAGE_KIT_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 00000000..9d9c1e66 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,22 @@ +name: Release Doctor +on: + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'imagekit-developer/imagekit-ruby' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + RUBYGEMS_HOST: ${{ secrets.IMAGE_KIT_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }} + GEM_HOST_API_KEY: ${{ secrets.IMAGE_KIT_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..1332969b --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ad85869b..5d25590d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-3d7da4b8ef2ed30aa32c4fb3e98e498e67402e91aaa5fd4c628fc080bfe82ea1.yml openapi_spec_hash: aaa50fcbccec6f2cf1165f34bc6ac886 -config_hash: cf9d50fe62973f4e91ef65c147aabcc1 +config_hash: 9f8a678d9d4d06daec522e8deb49e3ad diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff57412c..15b2dbaa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,13 +43,13 @@ If you’d like to use the repository from source, you can either install from g To install via git in your `Gemfile`: ```ruby -gem "imagekit", git: "https://www.github.com/stainless-sdks/imagekit-ruby" +gem "imagekit", git: "https://www.github.com/imagekit-developer/imagekit-ruby" ``` Alternatively, reference local copy of the repo: ```bash -$ git clone -- 'https://www.github.com/stainless-sdks/imagekit-ruby' '' +$ git clone -- 'https://www.github.com/imagekit-developer/imagekit-ruby' '' ``` ```ruby diff --git a/README.md b/README.md index 8d9c1b92..32341ee0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Image Kit Ruby API library -The Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/stainless-sdks/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem. +The Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/imagekit-developer/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem. It is generated with [Stainless](https://www.stainless.com/). @@ -14,10 +14,14 @@ The REST API documentation can be found on [imagekit.io](https://imagekit.io/doc To use this gem, install via Bundler by adding the following to your application's `Gemfile`: + + ```ruby gem "imagekit", "~> 0.0.1" ``` + + ## Usage ```ruby @@ -275,4 +279,4 @@ Ruby 3.2.0 or higher. ## Contributing -See [the contributing documentation](https://github.com/stainless-sdks/imagekit-ruby/tree/main/CONTRIBUTING.md). +See [the contributing documentation](https://github.com/imagekit-developer/imagekit-ruby/tree/master/CONTRIBUTING.md). diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 00000000..c05436e8 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${GEM_HOST_API_KEY}" ]; then + errors+=("The GEM_HOST_API_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/imagekit.gemspec b/imagekit.gemspec index a29c6731..f094efa0 100644 --- a/imagekit.gemspec +++ b/imagekit.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = "developer@imagekit.io" s.homepage = "https://gemdocs.org/gems/imagekit" s.metadata["homepage_uri"] = s.homepage - s.metadata["source_code_uri"] = "https://github.com/stainless-sdks/imagekit-ruby" + s.metadata["source_code_uri"] = "https://github.com/imagekit-developer/imagekit-ruby" s.metadata["rubygems_mfa_required"] = false.to_s s.required_ruby_version = ">= 3.2.0" diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..32536019 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,70 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "ruby", + "version-file": "lib/imagekit/version.rb", + "extra-files": [ + { + "type": "ruby-readme", + "path": "README.md" + } + ] +} \ No newline at end of file From b4c2a8398c1b8bfa1df7da222ede418b047fe0b1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 07:19:37 +0000 Subject: [PATCH 03/32] feat(api): add BaseWebhookEvent --- .stats.yml | 6 +++--- lib/imagekit/models/unsafe_unwrap_webhook_event.rb | 10 ---------- lib/imagekit/models/unwrap_webhook_event.rb | 10 ---------- .../models/upload_post_transform_error_event.rb | 3 --- .../models/upload_post_transform_success_event.rb | 4 ---- .../models/upload_pre_transform_error_event.rb | 3 --- .../models/upload_pre_transform_success_event.rb | 4 ---- .../models/video_transformation_accepted_event.rb | 4 ---- .../models/video_transformation_error_event.rb | 5 ----- .../models/video_transformation_ready_event.rb | 5 ----- rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi | 3 --- rbi/imagekit/models/unwrap_webhook_event.rbi | 3 --- .../models/upload_post_transform_error_event.rbi | 2 -- .../models/upload_post_transform_success_event.rbi | 3 --- .../models/upload_pre_transform_error_event.rbi | 2 -- .../models/upload_pre_transform_success_event.rbi | 3 --- .../models/video_transformation_accepted_event.rbi | 3 --- .../models/video_transformation_error_event.rbi | 4 ---- .../models/video_transformation_ready_event.rbi | 4 ---- 19 files changed, 3 insertions(+), 78 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5d25590d..08185446 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-3d7da4b8ef2ed30aa32c4fb3e98e498e67402e91aaa5fd4c628fc080bfe82ea1.yml -openapi_spec_hash: aaa50fcbccec6f2cf1165f34bc6ac886 -config_hash: 9f8a678d9d4d06daec522e8deb49e3ad +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml +openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a +config_hash: 4e73c7e12a531edcd1366dab7eccc360 diff --git a/lib/imagekit/models/unsafe_unwrap_webhook_event.rb b/lib/imagekit/models/unsafe_unwrap_webhook_event.rb index 28e1b855..8c7385c2 100644 --- a/lib/imagekit/models/unsafe_unwrap_webhook_event.rb +++ b/lib/imagekit/models/unsafe_unwrap_webhook_event.rb @@ -2,31 +2,21 @@ module Imagekit module Models - # Triggered when a new video transformation request is accepted for processing. - # This event confirms that ImageKit has received and queued your transformation - # request. Use this for debugging and tracking transformation lifecycle. module UnsafeUnwrapWebhookEvent extend Imagekit::Internal::Type::Union - # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. variant -> { Imagekit::VideoTransformationAcceptedEvent } - # Triggered when video encoding is finished and the transformed resource is ready to be served. This is the key event to listen for - update your database or CMS flags when you receive this so your application can start showing the transformed video to users. variant -> { Imagekit::VideoTransformationReadyEvent } - # Triggered when an error occurs during video encoding. Listen to this webhook to log error reasons and debug issues. Check your origin and URL endpoint settings if the reason is related to download failure. For other errors, contact ImageKit support. variant -> { Imagekit::VideoTransformationErrorEvent } - # Triggered when a pre-transformation completes successfully. The file has been processed with the requested transformation and is now available in the Media Library. variant -> { Imagekit::UploadPreTransformSuccessEvent } - # Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied. variant -> { Imagekit::UploadPreTransformErrorEvent } - # Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event. variant -> { Imagekit::UploadPostTransformSuccessEvent } - # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. variant -> { Imagekit::UploadPostTransformErrorEvent } # @!method self.variants diff --git a/lib/imagekit/models/unwrap_webhook_event.rb b/lib/imagekit/models/unwrap_webhook_event.rb index c200c085..f01a6770 100644 --- a/lib/imagekit/models/unwrap_webhook_event.rb +++ b/lib/imagekit/models/unwrap_webhook_event.rb @@ -2,31 +2,21 @@ module Imagekit module Models - # Triggered when a new video transformation request is accepted for processing. - # This event confirms that ImageKit has received and queued your transformation - # request. Use this for debugging and tracking transformation lifecycle. module UnwrapWebhookEvent extend Imagekit::Internal::Type::Union - # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. variant -> { Imagekit::VideoTransformationAcceptedEvent } - # Triggered when video encoding is finished and the transformed resource is ready to be served. This is the key event to listen for - update your database or CMS flags when you receive this so your application can start showing the transformed video to users. variant -> { Imagekit::VideoTransformationReadyEvent } - # Triggered when an error occurs during video encoding. Listen to this webhook to log error reasons and debug issues. Check your origin and URL endpoint settings if the reason is related to download failure. For other errors, contact ImageKit support. variant -> { Imagekit::VideoTransformationErrorEvent } - # Triggered when a pre-transformation completes successfully. The file has been processed with the requested transformation and is now available in the Media Library. variant -> { Imagekit::UploadPreTransformSuccessEvent } - # Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied. variant -> { Imagekit::UploadPreTransformErrorEvent } - # Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event. variant -> { Imagekit::UploadPostTransformSuccessEvent } - # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. variant -> { Imagekit::UploadPostTransformErrorEvent } # @!method self.variants diff --git a/lib/imagekit/models/upload_post_transform_error_event.rb b/lib/imagekit/models/upload_post_transform_error_event.rb index 3569da50..bf8ddb2b 100644 --- a/lib/imagekit/models/upload_post_transform_error_event.rb +++ b/lib/imagekit/models/upload_post_transform_error_event.rb @@ -31,9 +31,6 @@ class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel required :type, const: :"upload.post-transform.error" # @!method initialize(id:, created_at:, data:, request:, type: :"upload.post-transform.error") - # Triggered when a post-transformation fails. The original file remains available, - # but the requested transformation could not be generated. - # # @param id [String] Unique identifier for the event. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. diff --git a/lib/imagekit/models/upload_post_transform_success_event.rb b/lib/imagekit/models/upload_post_transform_success_event.rb index 07b856b2..9dfe77d7 100644 --- a/lib/imagekit/models/upload_post_transform_success_event.rb +++ b/lib/imagekit/models/upload_post_transform_success_event.rb @@ -31,10 +31,6 @@ class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel required :type, const: :"upload.post-transform.success" # @!method initialize(id:, created_at:, data:, request:, type: :"upload.post-transform.success") - # Triggered when a post-transformation completes successfully. The transformed - # version of the file is now ready and can be accessed via the provided URL. Note - # that each post-transformation generates a separate webhook event. - # # @param id [String] Unique identifier for the event. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. diff --git a/lib/imagekit/models/upload_pre_transform_error_event.rb b/lib/imagekit/models/upload_pre_transform_error_event.rb index d672e680..3c9b9453 100644 --- a/lib/imagekit/models/upload_pre_transform_error_event.rb +++ b/lib/imagekit/models/upload_pre_transform_error_event.rb @@ -31,9 +31,6 @@ class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel required :type, const: :"upload.pre-transform.error" # @!method initialize(id:, created_at:, data:, request:, type: :"upload.pre-transform.error") - # Triggered when a pre-transformation fails. The file upload may have been - # accepted, but the requested transformation could not be applied. - # # @param id [String] Unique identifier for the event. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. diff --git a/lib/imagekit/models/upload_pre_transform_success_event.rb b/lib/imagekit/models/upload_pre_transform_success_event.rb index 37c3be87..ca0e39c3 100644 --- a/lib/imagekit/models/upload_pre_transform_success_event.rb +++ b/lib/imagekit/models/upload_pre_transform_success_event.rb @@ -32,10 +32,6 @@ class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel required :type, const: :"upload.pre-transform.success" # @!method initialize(id:, created_at:, data:, request:, type: :"upload.pre-transform.success") - # Triggered when a pre-transformation completes successfully. The file has been - # processed with the requested transformation and is now available in the Media - # Library. - # # @param id [String] Unique identifier for the event. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. diff --git a/lib/imagekit/models/video_transformation_accepted_event.rb b/lib/imagekit/models/video_transformation_accepted_event.rb index 05cf00ab..3c90be50 100644 --- a/lib/imagekit/models/video_transformation_accepted_event.rb +++ b/lib/imagekit/models/video_transformation_accepted_event.rb @@ -32,10 +32,6 @@ class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel required :type, const: :"video.transformation.accepted" # @!method initialize(id:, created_at:, data:, request:, type: :"video.transformation.accepted") - # Triggered when a new video transformation request is accepted for processing. - # This event confirms that ImageKit has received and queued your transformation - # request. Use this for debugging and tracking transformation lifecycle. - # # @param id [String] Unique identifier for the event. # # @param created_at [Time] Timestamp when the event was created in ISO8601 format. diff --git a/lib/imagekit/models/video_transformation_error_event.rb b/lib/imagekit/models/video_transformation_error_event.rb index fe6c9a88..8b56b9f3 100644 --- a/lib/imagekit/models/video_transformation_error_event.rb +++ b/lib/imagekit/models/video_transformation_error_event.rb @@ -32,11 +32,6 @@ class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel required :type, const: :"video.transformation.error" # @!method initialize(id:, created_at:, data:, request:, type: :"video.transformation.error") - # Triggered when an error occurs during video encoding. Listen to this webhook to - # log error reasons and debug issues. Check your origin and URL endpoint settings - # if the reason is related to download failure. For other errors, contact ImageKit - # support. - # # @param id [String] Unique identifier for the event. # # @param created_at [Time] Timestamp when the event was created in ISO8601 format. diff --git a/lib/imagekit/models/video_transformation_ready_event.rb b/lib/imagekit/models/video_transformation_ready_event.rb index 076e88c4..5ab29898 100644 --- a/lib/imagekit/models/video_transformation_ready_event.rb +++ b/lib/imagekit/models/video_transformation_ready_event.rb @@ -38,11 +38,6 @@ class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel optional :timings, -> { Imagekit::VideoTransformationReadyEvent::Timings } # @!method initialize(id:, created_at:, data:, request:, timings: nil, type: :"video.transformation.ready") - # Triggered when video encoding is finished and the transformed resource is ready - # to be served. This is the key event to listen for - update your database or CMS - # flags when you receive this so your application can start showing the - # transformed video to users. - # # @param id [String] Unique identifier for the event. # # @param created_at [Time] Timestamp when the event was created in ISO8601 format. diff --git a/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi b/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi index 4dbc761c..10ea4aa8 100644 --- a/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi +++ b/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi @@ -2,9 +2,6 @@ module Imagekit module Models - # Triggered when a new video transformation request is accepted for processing. - # This event confirms that ImageKit has received and queued your transformation - # request. Use this for debugging and tracking transformation lifecycle. module UnsafeUnwrapWebhookEvent extend Imagekit::Internal::Type::Union diff --git a/rbi/imagekit/models/unwrap_webhook_event.rbi b/rbi/imagekit/models/unwrap_webhook_event.rbi index b94a7e27..3c4a71a8 100644 --- a/rbi/imagekit/models/unwrap_webhook_event.rbi +++ b/rbi/imagekit/models/unwrap_webhook_event.rbi @@ -2,9 +2,6 @@ module Imagekit module Models - # Triggered when a new video transformation request is accepted for processing. - # This event confirms that ImageKit has received and queued your transformation - # request. Use this for debugging and tracking transformation lifecycle. module UnwrapWebhookEvent extend Imagekit::Internal::Type::Union diff --git a/rbi/imagekit/models/upload_post_transform_error_event.rbi b/rbi/imagekit/models/upload_post_transform_error_event.rbi index a2fd2772..07bb8841 100644 --- a/rbi/imagekit/models/upload_post_transform_error_event.rbi +++ b/rbi/imagekit/models/upload_post_transform_error_event.rbi @@ -40,8 +40,6 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type - # Triggered when a post-transformation fails. The original file remains available, - # but the requested transformation could not be generated. sig do params( id: String, diff --git a/rbi/imagekit/models/upload_post_transform_success_event.rbi b/rbi/imagekit/models/upload_post_transform_success_event.rbi index 189c4ad9..5cee3967 100644 --- a/rbi/imagekit/models/upload_post_transform_success_event.rbi +++ b/rbi/imagekit/models/upload_post_transform_success_event.rbi @@ -42,9 +42,6 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type - # Triggered when a post-transformation completes successfully. The transformed - # version of the file is now ready and can be accessed via the provided URL. Note - # that each post-transformation generates a separate webhook event. sig do params( id: String, diff --git a/rbi/imagekit/models/upload_pre_transform_error_event.rbi b/rbi/imagekit/models/upload_pre_transform_error_event.rbi index a6338f83..ed5847ac 100644 --- a/rbi/imagekit/models/upload_pre_transform_error_event.rbi +++ b/rbi/imagekit/models/upload_pre_transform_error_event.rbi @@ -40,8 +40,6 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type - # Triggered when a pre-transformation fails. The file upload may have been - # accepted, but the requested transformation could not be applied. sig do params( id: String, diff --git a/rbi/imagekit/models/upload_pre_transform_success_event.rbi b/rbi/imagekit/models/upload_pre_transform_success_event.rbi index 92358f5d..33574306 100644 --- a/rbi/imagekit/models/upload_pre_transform_success_event.rbi +++ b/rbi/imagekit/models/upload_pre_transform_success_event.rbi @@ -43,9 +43,6 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type - # Triggered when a pre-transformation completes successfully. The file has been - # processed with the requested transformation and is now available in the Media - # Library. sig do params( id: String, diff --git a/rbi/imagekit/models/video_transformation_accepted_event.rbi b/rbi/imagekit/models/video_transformation_accepted_event.rbi index a7b609fc..a149c0c1 100644 --- a/rbi/imagekit/models/video_transformation_accepted_event.rbi +++ b/rbi/imagekit/models/video_transformation_accepted_event.rbi @@ -43,9 +43,6 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type - # Triggered when a new video transformation request is accepted for processing. - # This event confirms that ImageKit has received and queued your transformation - # request. Use this for debugging and tracking transformation lifecycle. sig do params( id: String, diff --git a/rbi/imagekit/models/video_transformation_error_event.rbi b/rbi/imagekit/models/video_transformation_error_event.rbi index 8b6b316d..94beea16 100644 --- a/rbi/imagekit/models/video_transformation_error_event.rbi +++ b/rbi/imagekit/models/video_transformation_error_event.rbi @@ -41,10 +41,6 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type - # Triggered when an error occurs during video encoding. Listen to this webhook to - # log error reasons and debug issues. Check your origin and URL endpoint settings - # if the reason is related to download failure. For other errors, contact ImageKit - # support. sig do params( id: String, diff --git a/rbi/imagekit/models/video_transformation_ready_event.rbi b/rbi/imagekit/models/video_transformation_ready_event.rbi index 3b8c06d0..1891cda8 100644 --- a/rbi/imagekit/models/video_transformation_ready_event.rbi +++ b/rbi/imagekit/models/video_transformation_ready_event.rbi @@ -54,10 +54,6 @@ module Imagekit end attr_writer :timings - # Triggered when video encoding is finished and the transformed resource is ready - # to be served. This is the key event to listen for - update your database or CMS - # flags when you receive this so your application can start showing the - # transformed video to users. sig do params( id: String, From 453e942ec2c25f3720305dcd564ca22b85815336 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 07:21:04 +0000 Subject: [PATCH 04/32] feat(api): manual updates --- .stats.yml | 2 +- lib/imagekit.rb | 1 + lib/imagekit/models.rb | 2 ++ lib/imagekit/models/base_webhook_event.rb | 24 ++++++++++++++ .../models/unsafe_unwrap_webhook_event.rb | 10 ++++++ lib/imagekit/models/unwrap_webhook_event.rb | 10 ++++++ .../upload_post_transform_error_event.rb | 15 +++------ .../upload_post_transform_success_event.rb | 16 +++------ .../upload_pre_transform_error_event.rb | 15 +++------ .../upload_pre_transform_success_event.rb | 16 +++------ .../video_transformation_accepted_event.rb | 16 +++------ .../video_transformation_error_event.rb | 17 ++++------ .../video_transformation_ready_event.rb | 18 ++++------ rbi/imagekit/models.rbi | 2 ++ rbi/imagekit/models/base_webhook_event.rbi | 33 +++++++++++++++++++ .../models/unsafe_unwrap_webhook_event.rbi | 3 ++ rbi/imagekit/models/unwrap_webhook_event.rbi | 3 ++ .../upload_post_transform_error_event.rbi | 12 ++----- .../upload_post_transform_success_event.rbi | 13 +++----- .../upload_pre_transform_error_event.rbi | 12 ++----- .../upload_pre_transform_success_event.rbi | 13 +++----- .../video_transformation_accepted_event.rbi | 13 +++----- .../video_transformation_error_event.rbi | 14 +++----- .../video_transformation_ready_event.rbi | 14 +++----- sig/imagekit/models.rbs | 2 ++ sig/imagekit/models/base_webhook_event.rbs | 15 +++++++++ .../upload_post_transform_error_event.rbs | 27 ++++++++++----- .../upload_post_transform_success_event.rbs | 27 ++++++++++----- .../upload_pre_transform_error_event.rbs | 27 ++++++++++----- .../upload_pre_transform_success_event.rbs | 27 ++++++++++----- .../video_transformation_accepted_event.rbs | 27 ++++++++++----- .../video_transformation_error_event.rbs | 27 ++++++++++----- .../video_transformation_ready_event.rbs | 31 ++++++++++------- 33 files changed, 297 insertions(+), 207 deletions(-) create mode 100644 lib/imagekit/models/base_webhook_event.rb create mode 100644 rbi/imagekit/models/base_webhook_event.rbi create mode 100644 sig/imagekit/models/base_webhook_event.rbs diff --git a/.stats.yml b/.stats.yml index 08185446..52f982ba 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a -config_hash: 4e73c7e12a531edcd1366dab7eccc360 +config_hash: 08e12746cdca1c59c897cf2e50893c3c diff --git a/lib/imagekit.rb b/lib/imagekit.rb index 4d38be1e..657d3c0d 100644 --- a/lib/imagekit.rb +++ b/lib/imagekit.rb @@ -54,6 +54,7 @@ require_relative "imagekit/models/accounts/url_endpoint_request" require_relative "imagekit/models/file" require_relative "imagekit/models/base_overlay" +require_relative "imagekit/models/base_webhook_event" require_relative "imagekit/models/accounts/origin_create_params" require_relative "imagekit/models/accounts/origin_delete_params" require_relative "imagekit/models/accounts/origin_get_params" diff --git a/lib/imagekit/models.rb b/lib/imagekit/models.rb index b8653a86..5c3ae2fe 100644 --- a/lib/imagekit/models.rb +++ b/lib/imagekit/models.rb @@ -45,6 +45,8 @@ module Imagekit BaseOverlay = Imagekit::Models::BaseOverlay + BaseWebhookEvent = Imagekit::Models::BaseWebhookEvent + Beta = Imagekit::Models::Beta Cache = Imagekit::Models::Cache diff --git a/lib/imagekit/models/base_webhook_event.rb b/lib/imagekit/models/base_webhook_event.rb new file mode 100644 index 00000000..d34435b2 --- /dev/null +++ b/lib/imagekit/models/base_webhook_event.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Imagekit + module Models + class BaseWebhookEvent < Imagekit::Internal::Type::BaseModel + # @!attribute id + # Unique identifier for the event. + # + # @return [String] + required :id, String + + # @!attribute type + # The type of webhook event. + # + # @return [String] + required :type, String + + # @!method initialize(id:, type:) + # @param id [String] Unique identifier for the event. + # + # @param type [String] The type of webhook event. + end + end +end diff --git a/lib/imagekit/models/unsafe_unwrap_webhook_event.rb b/lib/imagekit/models/unsafe_unwrap_webhook_event.rb index 8c7385c2..28e1b855 100644 --- a/lib/imagekit/models/unsafe_unwrap_webhook_event.rb +++ b/lib/imagekit/models/unsafe_unwrap_webhook_event.rb @@ -2,21 +2,31 @@ module Imagekit module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. module UnsafeUnwrapWebhookEvent extend Imagekit::Internal::Type::Union + # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. variant -> { Imagekit::VideoTransformationAcceptedEvent } + # Triggered when video encoding is finished and the transformed resource is ready to be served. This is the key event to listen for - update your database or CMS flags when you receive this so your application can start showing the transformed video to users. variant -> { Imagekit::VideoTransformationReadyEvent } + # Triggered when an error occurs during video encoding. Listen to this webhook to log error reasons and debug issues. Check your origin and URL endpoint settings if the reason is related to download failure. For other errors, contact ImageKit support. variant -> { Imagekit::VideoTransformationErrorEvent } + # Triggered when a pre-transformation completes successfully. The file has been processed with the requested transformation and is now available in the Media Library. variant -> { Imagekit::UploadPreTransformSuccessEvent } + # Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied. variant -> { Imagekit::UploadPreTransformErrorEvent } + # Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event. variant -> { Imagekit::UploadPostTransformSuccessEvent } + # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. variant -> { Imagekit::UploadPostTransformErrorEvent } # @!method self.variants diff --git a/lib/imagekit/models/unwrap_webhook_event.rb b/lib/imagekit/models/unwrap_webhook_event.rb index f01a6770..c200c085 100644 --- a/lib/imagekit/models/unwrap_webhook_event.rb +++ b/lib/imagekit/models/unwrap_webhook_event.rb @@ -2,21 +2,31 @@ module Imagekit module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. module UnwrapWebhookEvent extend Imagekit::Internal::Type::Union + # Triggered when a new video transformation request is accepted for processing. This event confirms that ImageKit has received and queued your transformation request. Use this for debugging and tracking transformation lifecycle. variant -> { Imagekit::VideoTransformationAcceptedEvent } + # Triggered when video encoding is finished and the transformed resource is ready to be served. This is the key event to listen for - update your database or CMS flags when you receive this so your application can start showing the transformed video to users. variant -> { Imagekit::VideoTransformationReadyEvent } + # Triggered when an error occurs during video encoding. Listen to this webhook to log error reasons and debug issues. Check your origin and URL endpoint settings if the reason is related to download failure. For other errors, contact ImageKit support. variant -> { Imagekit::VideoTransformationErrorEvent } + # Triggered when a pre-transformation completes successfully. The file has been processed with the requested transformation and is now available in the Media Library. variant -> { Imagekit::UploadPreTransformSuccessEvent } + # Triggered when a pre-transformation fails. The file upload may have been accepted, but the requested transformation could not be applied. variant -> { Imagekit::UploadPreTransformErrorEvent } + # Triggered when a post-transformation completes successfully. The transformed version of the file is now ready and can be accessed via the provided URL. Note that each post-transformation generates a separate webhook event. variant -> { Imagekit::UploadPostTransformSuccessEvent } + # Triggered when a post-transformation fails. The original file remains available, but the requested transformation could not be generated. variant -> { Imagekit::UploadPostTransformErrorEvent } # @!method self.variants diff --git a/lib/imagekit/models/upload_post_transform_error_event.rb b/lib/imagekit/models/upload_post_transform_error_event.rb index bf8ddb2b..31abc43b 100644 --- a/lib/imagekit/models/upload_post_transform_error_event.rb +++ b/lib/imagekit/models/upload_post_transform_error_event.rb @@ -2,13 +2,7 @@ module Imagekit module Models - class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for the event. - # - # @return [String] - required :id, String - + class UploadPostTransformErrorEvent < Imagekit::Models::BaseWebhookEvent # @!attribute created_at # Timestamp of when the event occurred in ISO8601 format. # @@ -30,8 +24,9 @@ class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel # @return [Symbol, :"upload.post-transform.error"] required :type, const: :"upload.post-transform.error" - # @!method initialize(id:, created_at:, data:, request:, type: :"upload.post-transform.error") - # @param id [String] Unique identifier for the event. + # @!method initialize(created_at:, data:, request:, type: :"upload.post-transform.error") + # Triggered when a post-transformation fails. The original file remains available, + # but the requested transformation could not be generated. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. # @@ -41,7 +36,6 @@ class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel # # @param type [Symbol, :"upload.post-transform.error"] - # @see Imagekit::Models::UploadPostTransformErrorEvent#data class Data < Imagekit::Internal::Type::BaseModel # @!attribute file_id # Unique identifier of the originally uploaded file. @@ -107,7 +101,6 @@ class Error < Imagekit::Internal::Type::BaseModel end end - # @see Imagekit::Models::UploadPostTransformErrorEvent#request class Request < Imagekit::Internal::Type::BaseModel # @!attribute transformation # diff --git a/lib/imagekit/models/upload_post_transform_success_event.rb b/lib/imagekit/models/upload_post_transform_success_event.rb index 9dfe77d7..e181c6d2 100644 --- a/lib/imagekit/models/upload_post_transform_success_event.rb +++ b/lib/imagekit/models/upload_post_transform_success_event.rb @@ -2,13 +2,7 @@ module Imagekit module Models - class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for the event. - # - # @return [String] - required :id, String - + class UploadPostTransformSuccessEvent < Imagekit::Models::BaseWebhookEvent # @!attribute created_at # Timestamp of when the event occurred in ISO8601 format. # @@ -30,8 +24,10 @@ class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel # @return [Symbol, :"upload.post-transform.success"] required :type, const: :"upload.post-transform.success" - # @!method initialize(id:, created_at:, data:, request:, type: :"upload.post-transform.success") - # @param id [String] Unique identifier for the event. + # @!method initialize(created_at:, data:, request:, type: :"upload.post-transform.success") + # Triggered when a post-transformation completes successfully. The transformed + # version of the file is now ready and can be accessed via the provided URL. Note + # that each post-transformation generates a separate webhook event. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. # @@ -41,7 +37,6 @@ class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel # # @param type [Symbol, :"upload.post-transform.success"] - # @see Imagekit::Models::UploadPostTransformSuccessEvent#data class Data < Imagekit::Internal::Type::BaseModel # @!attribute file_id # Unique identifier of the originally uploaded file. @@ -69,7 +64,6 @@ class Data < Imagekit::Internal::Type::BaseModel # @param url [String] URL of the generated post-transformation. end - # @see Imagekit::Models::UploadPostTransformSuccessEvent#request class Request < Imagekit::Internal::Type::BaseModel # @!attribute transformation # diff --git a/lib/imagekit/models/upload_pre_transform_error_event.rb b/lib/imagekit/models/upload_pre_transform_error_event.rb index 3c9b9453..76eb4981 100644 --- a/lib/imagekit/models/upload_pre_transform_error_event.rb +++ b/lib/imagekit/models/upload_pre_transform_error_event.rb @@ -2,13 +2,7 @@ module Imagekit module Models - class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for the event. - # - # @return [String] - required :id, String - + class UploadPreTransformErrorEvent < Imagekit::Models::BaseWebhookEvent # @!attribute created_at # Timestamp of when the event occurred in ISO8601 format. # @@ -30,8 +24,9 @@ class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel # @return [Symbol, :"upload.pre-transform.error"] required :type, const: :"upload.pre-transform.error" - # @!method initialize(id:, created_at:, data:, request:, type: :"upload.pre-transform.error") - # @param id [String] Unique identifier for the event. + # @!method initialize(created_at:, data:, request:, type: :"upload.pre-transform.error") + # Triggered when a pre-transformation fails. The file upload may have been + # accepted, but the requested transformation could not be applied. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. # @@ -41,7 +36,6 @@ class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel # # @param type [Symbol, :"upload.pre-transform.error"] - # @see Imagekit::Models::UploadPreTransformErrorEvent#data class Data < Imagekit::Internal::Type::BaseModel # @!attribute name # Name of the file. @@ -91,7 +85,6 @@ class Error < Imagekit::Internal::Type::BaseModel end end - # @see Imagekit::Models::UploadPreTransformErrorEvent#request class Request < Imagekit::Internal::Type::BaseModel # @!attribute transformation # The requested pre-transformation string. diff --git a/lib/imagekit/models/upload_pre_transform_success_event.rb b/lib/imagekit/models/upload_pre_transform_success_event.rb index ca0e39c3..4ba20c4e 100644 --- a/lib/imagekit/models/upload_pre_transform_success_event.rb +++ b/lib/imagekit/models/upload_pre_transform_success_event.rb @@ -2,13 +2,7 @@ module Imagekit module Models - class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for the event. - # - # @return [String] - required :id, String - + class UploadPreTransformSuccessEvent < Imagekit::Models::BaseWebhookEvent # @!attribute created_at # Timestamp of when the event occurred in ISO8601 format. # @@ -31,8 +25,10 @@ class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel # @return [Symbol, :"upload.pre-transform.success"] required :type, const: :"upload.pre-transform.success" - # @!method initialize(id:, created_at:, data:, request:, type: :"upload.pre-transform.success") - # @param id [String] Unique identifier for the event. + # @!method initialize(created_at:, data:, request:, type: :"upload.pre-transform.success") + # Triggered when a pre-transformation completes successfully. The file has been + # processed with the requested transformation and is now available in the Media + # Library. # # @param created_at [Time] Timestamp of when the event occurred in ISO8601 format. # @@ -42,7 +38,6 @@ class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel # # @param type [Symbol, :"upload.pre-transform.success"] - # @see Imagekit::Models::UploadPreTransformSuccessEvent#data class Data < Imagekit::Internal::Type::BaseModel # @!attribute ai_tags # An array of tags assigned to the uploaded file by auto tagging. @@ -439,7 +434,6 @@ class VersionInfo < Imagekit::Internal::Type::BaseModel end end - # @see Imagekit::Models::UploadPreTransformSuccessEvent#request class Request < Imagekit::Internal::Type::BaseModel # @!attribute transformation # The requested pre-transformation string. diff --git a/lib/imagekit/models/video_transformation_accepted_event.rb b/lib/imagekit/models/video_transformation_accepted_event.rb index 3c90be50..1be102a0 100644 --- a/lib/imagekit/models/video_transformation_accepted_event.rb +++ b/lib/imagekit/models/video_transformation_accepted_event.rb @@ -2,13 +2,7 @@ module Imagekit module Models - class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for the event. - # - # @return [String] - required :id, String - + class VideoTransformationAcceptedEvent < Imagekit::Models::BaseWebhookEvent # @!attribute created_at # Timestamp when the event was created in ISO8601 format. # @@ -31,8 +25,10 @@ class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel # @return [Symbol, :"video.transformation.accepted"] required :type, const: :"video.transformation.accepted" - # @!method initialize(id:, created_at:, data:, request:, type: :"video.transformation.accepted") - # @param id [String] Unique identifier for the event. + # @!method initialize(created_at:, data:, request:, type: :"video.transformation.accepted") + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. # # @param created_at [Time] Timestamp when the event was created in ISO8601 format. # @@ -42,7 +38,6 @@ class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel # # @param type [Symbol, :"video.transformation.accepted"] - # @see Imagekit::Models::VideoTransformationAcceptedEvent#data class Data < Imagekit::Internal::Type::BaseModel # @!attribute asset # Information about the source video asset being transformed. @@ -251,7 +246,6 @@ module VideoCodec end end - # @see Imagekit::Models::VideoTransformationAcceptedEvent#request class Request < Imagekit::Internal::Type::BaseModel # @!attribute url # Full URL of the transformation request that was submitted. diff --git a/lib/imagekit/models/video_transformation_error_event.rb b/lib/imagekit/models/video_transformation_error_event.rb index 8b56b9f3..8c357035 100644 --- a/lib/imagekit/models/video_transformation_error_event.rb +++ b/lib/imagekit/models/video_transformation_error_event.rb @@ -2,13 +2,7 @@ module Imagekit module Models - class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for the event. - # - # @return [String] - required :id, String - + class VideoTransformationErrorEvent < Imagekit::Models::BaseWebhookEvent # @!attribute created_at # Timestamp when the event was created in ISO8601 format. # @@ -31,8 +25,11 @@ class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel # @return [Symbol, :"video.transformation.error"] required :type, const: :"video.transformation.error" - # @!method initialize(id:, created_at:, data:, request:, type: :"video.transformation.error") - # @param id [String] Unique identifier for the event. + # @!method initialize(created_at:, data:, request:, type: :"video.transformation.error") + # Triggered when an error occurs during video encoding. Listen to this webhook to + # log error reasons and debug issues. Check your origin and URL endpoint settings + # if the reason is related to download failure. For other errors, contact ImageKit + # support. # # @param created_at [Time] Timestamp when the event was created in ISO8601 format. # @@ -42,7 +39,6 @@ class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel # # @param type [Symbol, :"video.transformation.error"] - # @see Imagekit::Models::VideoTransformationErrorEvent#data class Data < Imagekit::Internal::Type::BaseModel # @!attribute asset # Information about the source video asset being transformed. @@ -297,7 +293,6 @@ module VideoCodec end end - # @see Imagekit::Models::VideoTransformationErrorEvent#request class Request < Imagekit::Internal::Type::BaseModel # @!attribute url # Full URL of the transformation request that was submitted. diff --git a/lib/imagekit/models/video_transformation_ready_event.rb b/lib/imagekit/models/video_transformation_ready_event.rb index 5ab29898..d4053bf4 100644 --- a/lib/imagekit/models/video_transformation_ready_event.rb +++ b/lib/imagekit/models/video_transformation_ready_event.rb @@ -2,13 +2,7 @@ module Imagekit module Models - class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for the event. - # - # @return [String] - required :id, String - + class VideoTransformationReadyEvent < Imagekit::Models::BaseWebhookEvent # @!attribute created_at # Timestamp when the event was created in ISO8601 format. # @@ -37,8 +31,11 @@ class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel # @return [Imagekit::Models::VideoTransformationReadyEvent::Timings, nil] optional :timings, -> { Imagekit::VideoTransformationReadyEvent::Timings } - # @!method initialize(id:, created_at:, data:, request:, timings: nil, type: :"video.transformation.ready") - # @param id [String] Unique identifier for the event. + # @!method initialize(created_at:, data:, request:, timings: nil, type: :"video.transformation.ready") + # Triggered when video encoding is finished and the transformed resource is ready + # to be served. This is the key event to listen for - update your database or CMS + # flags when you receive this so your application can start showing the + # transformed video to users. # # @param created_at [Time] Timestamp when the event was created in ISO8601 format. # @@ -50,7 +47,6 @@ class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel # # @param type [Symbol, :"video.transformation.ready"] - # @see Imagekit::Models::VideoTransformationReadyEvent#data class Data < Imagekit::Internal::Type::BaseModel # @!attribute asset # Information about the source video asset being transformed. @@ -325,7 +321,6 @@ class VideoMetadata < Imagekit::Internal::Type::BaseModel end end - # @see Imagekit::Models::VideoTransformationReadyEvent#request class Request < Imagekit::Internal::Type::BaseModel # @!attribute url # Full URL of the transformation request that was submitted. @@ -355,7 +350,6 @@ class Request < Imagekit::Internal::Type::BaseModel # @param user_agent [String] User-Agent header from the original request that triggered the transformation. end - # @see Imagekit::Models::VideoTransformationReadyEvent#timings class Timings < Imagekit::Internal::Type::BaseModel # @!attribute download_duration # Time spent downloading the source video from your origin or media library, in diff --git a/rbi/imagekit/models.rbi b/rbi/imagekit/models.rbi index b16eec98..e14a9662 100644 --- a/rbi/imagekit/models.rbi +++ b/rbi/imagekit/models.rbi @@ -7,6 +7,8 @@ module Imagekit BaseOverlay = Imagekit::Models::BaseOverlay + BaseWebhookEvent = Imagekit::Models::BaseWebhookEvent + Beta = Imagekit::Models::Beta Cache = Imagekit::Models::Cache diff --git a/rbi/imagekit/models/base_webhook_event.rbi b/rbi/imagekit/models/base_webhook_event.rbi new file mode 100644 index 00000000..1420720c --- /dev/null +++ b/rbi/imagekit/models/base_webhook_event.rbi @@ -0,0 +1,33 @@ +# typed: strong + +module Imagekit + module Models + class BaseWebhookEvent < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Imagekit::BaseWebhookEvent, Imagekit::Internal::AnyHash) + end + + # Unique identifier for the event. + sig { returns(String) } + attr_accessor :id + + # The type of webhook event. + sig { returns(String) } + attr_accessor :type + + sig { params(id: String, type: String).returns(T.attached_class) } + def self.new( + # Unique identifier for the event. + id:, + # The type of webhook event. + type: + ) + end + + sig { override.returns({ id: String, type: String }) } + def to_hash + end + end + end +end diff --git a/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi b/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi index 10ea4aa8..4dbc761c 100644 --- a/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi +++ b/rbi/imagekit/models/unsafe_unwrap_webhook_event.rbi @@ -2,6 +2,9 @@ module Imagekit module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. module UnsafeUnwrapWebhookEvent extend Imagekit::Internal::Type::Union diff --git a/rbi/imagekit/models/unwrap_webhook_event.rbi b/rbi/imagekit/models/unwrap_webhook_event.rbi index 3c4a71a8..b94a7e27 100644 --- a/rbi/imagekit/models/unwrap_webhook_event.rbi +++ b/rbi/imagekit/models/unwrap_webhook_event.rbi @@ -2,6 +2,9 @@ module Imagekit module Models + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. module UnwrapWebhookEvent extend Imagekit::Internal::Type::Union diff --git a/rbi/imagekit/models/upload_post_transform_error_event.rbi b/rbi/imagekit/models/upload_post_transform_error_event.rbi index 07bb8841..71aa5b20 100644 --- a/rbi/imagekit/models/upload_post_transform_error_event.rbi +++ b/rbi/imagekit/models/upload_post_transform_error_event.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel + class UploadPostTransformErrorEvent < Imagekit::Models::BaseWebhookEvent OrHash = T.type_alias do T.any( @@ -11,10 +11,6 @@ module Imagekit ) end - # Unique identifier for the event. - sig { returns(String) } - attr_accessor :id - # Timestamp of when the event occurred in ISO8601 format. sig { returns(Time) } attr_accessor :created_at @@ -40,9 +36,10 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type + # Triggered when a post-transformation fails. The original file remains available, + # but the requested transformation could not be generated. sig do params( - id: String, created_at: Time, data: Imagekit::UploadPostTransformErrorEvent::Data::OrHash, request: Imagekit::UploadPostTransformErrorEvent::Request::OrHash, @@ -50,8 +47,6 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Unique identifier for the event. - id:, # Timestamp of when the event occurred in ISO8601 format. created_at:, data:, @@ -63,7 +58,6 @@ module Imagekit sig do override.returns( { - id: String, created_at: Time, data: Imagekit::UploadPostTransformErrorEvent::Data, request: Imagekit::UploadPostTransformErrorEvent::Request, diff --git a/rbi/imagekit/models/upload_post_transform_success_event.rbi b/rbi/imagekit/models/upload_post_transform_success_event.rbi index 5cee3967..c86f6212 100644 --- a/rbi/imagekit/models/upload_post_transform_success_event.rbi +++ b/rbi/imagekit/models/upload_post_transform_success_event.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + class UploadPostTransformSuccessEvent < Imagekit::Models::BaseWebhookEvent OrHash = T.type_alias do T.any( @@ -11,10 +11,6 @@ module Imagekit ) end - # Unique identifier for the event. - sig { returns(String) } - attr_accessor :id - # Timestamp of when the event occurred in ISO8601 format. sig { returns(Time) } attr_accessor :created_at @@ -42,9 +38,11 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type + # Triggered when a post-transformation completes successfully. The transformed + # version of the file is now ready and can be accessed via the provided URL. Note + # that each post-transformation generates a separate webhook event. sig do params( - id: String, created_at: Time, data: Imagekit::UploadPostTransformSuccessEvent::Data::OrHash, request: Imagekit::UploadPostTransformSuccessEvent::Request::OrHash, @@ -52,8 +50,6 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Unique identifier for the event. - id:, # Timestamp of when the event occurred in ISO8601 format. created_at:, data:, @@ -65,7 +61,6 @@ module Imagekit sig do override.returns( { - id: String, created_at: Time, data: Imagekit::UploadPostTransformSuccessEvent::Data, request: Imagekit::UploadPostTransformSuccessEvent::Request, diff --git a/rbi/imagekit/models/upload_pre_transform_error_event.rbi b/rbi/imagekit/models/upload_pre_transform_error_event.rbi index ed5847ac..d95f5534 100644 --- a/rbi/imagekit/models/upload_pre_transform_error_event.rbi +++ b/rbi/imagekit/models/upload_pre_transform_error_event.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel + class UploadPreTransformErrorEvent < Imagekit::Models::BaseWebhookEvent OrHash = T.type_alias do T.any( @@ -11,10 +11,6 @@ module Imagekit ) end - # Unique identifier for the event. - sig { returns(String) } - attr_accessor :id - # Timestamp of when the event occurred in ISO8601 format. sig { returns(Time) } attr_accessor :created_at @@ -40,9 +36,10 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type + # Triggered when a pre-transformation fails. The file upload may have been + # accepted, but the requested transformation could not be applied. sig do params( - id: String, created_at: Time, data: Imagekit::UploadPreTransformErrorEvent::Data::OrHash, request: Imagekit::UploadPreTransformErrorEvent::Request::OrHash, @@ -50,8 +47,6 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Unique identifier for the event. - id:, # Timestamp of when the event occurred in ISO8601 format. created_at:, data:, @@ -63,7 +58,6 @@ module Imagekit sig do override.returns( { - id: String, created_at: Time, data: Imagekit::UploadPreTransformErrorEvent::Data, request: Imagekit::UploadPreTransformErrorEvent::Request, diff --git a/rbi/imagekit/models/upload_pre_transform_success_event.rbi b/rbi/imagekit/models/upload_pre_transform_success_event.rbi index 33574306..b5d15c02 100644 --- a/rbi/imagekit/models/upload_pre_transform_success_event.rbi +++ b/rbi/imagekit/models/upload_pre_transform_success_event.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel + class UploadPreTransformSuccessEvent < Imagekit::Models::BaseWebhookEvent OrHash = T.type_alias do T.any( @@ -11,10 +11,6 @@ module Imagekit ) end - # Unique identifier for the event. - sig { returns(String) } - attr_accessor :id - # Timestamp of when the event occurred in ISO8601 format. sig { returns(Time) } attr_accessor :created_at @@ -43,9 +39,11 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type + # Triggered when a pre-transformation completes successfully. The file has been + # processed with the requested transformation and is now available in the Media + # Library. sig do params( - id: String, created_at: Time, data: Imagekit::UploadPreTransformSuccessEvent::Data::OrHash, request: Imagekit::UploadPreTransformSuccessEvent::Request::OrHash, @@ -53,8 +51,6 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Unique identifier for the event. - id:, # Timestamp of when the event occurred in ISO8601 format. created_at:, # Object containing details of a successful upload. @@ -67,7 +63,6 @@ module Imagekit sig do override.returns( { - id: String, created_at: Time, data: Imagekit::UploadPreTransformSuccessEvent::Data, request: Imagekit::UploadPreTransformSuccessEvent::Request, diff --git a/rbi/imagekit/models/video_transformation_accepted_event.rbi b/rbi/imagekit/models/video_transformation_accepted_event.rbi index a149c0c1..b6bb2056 100644 --- a/rbi/imagekit/models/video_transformation_accepted_event.rbi +++ b/rbi/imagekit/models/video_transformation_accepted_event.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel + class VideoTransformationAcceptedEvent < Imagekit::Models::BaseWebhookEvent OrHash = T.type_alias do T.any( @@ -11,10 +11,6 @@ module Imagekit ) end - # Unique identifier for the event. - sig { returns(String) } - attr_accessor :id - # Timestamp when the event was created in ISO8601 format. sig { returns(Time) } attr_accessor :created_at @@ -43,9 +39,11 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type + # Triggered when a new video transformation request is accepted for processing. + # This event confirms that ImageKit has received and queued your transformation + # request. Use this for debugging and tracking transformation lifecycle. sig do params( - id: String, created_at: Time, data: Imagekit::VideoTransformationAcceptedEvent::Data::OrHash, request: Imagekit::VideoTransformationAcceptedEvent::Request::OrHash, @@ -53,8 +51,6 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Unique identifier for the event. - id:, # Timestamp when the event was created in ISO8601 format. created_at:, data:, @@ -67,7 +63,6 @@ module Imagekit sig do override.returns( { - id: String, created_at: Time, data: Imagekit::VideoTransformationAcceptedEvent::Data, request: Imagekit::VideoTransformationAcceptedEvent::Request, diff --git a/rbi/imagekit/models/video_transformation_error_event.rbi b/rbi/imagekit/models/video_transformation_error_event.rbi index 94beea16..3c9c19d2 100644 --- a/rbi/imagekit/models/video_transformation_error_event.rbi +++ b/rbi/imagekit/models/video_transformation_error_event.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel + class VideoTransformationErrorEvent < Imagekit::Models::BaseWebhookEvent OrHash = T.type_alias do T.any( @@ -11,10 +11,6 @@ module Imagekit ) end - # Unique identifier for the event. - sig { returns(String) } - attr_accessor :id - # Timestamp when the event was created in ISO8601 format. sig { returns(Time) } attr_accessor :created_at @@ -41,9 +37,12 @@ module Imagekit sig { returns(Symbol) } attr_accessor :type + # Triggered when an error occurs during video encoding. Listen to this webhook to + # log error reasons and debug issues. Check your origin and URL endpoint settings + # if the reason is related to download failure. For other errors, contact ImageKit + # support. sig do params( - id: String, created_at: Time, data: Imagekit::VideoTransformationErrorEvent::Data::OrHash, request: Imagekit::VideoTransformationErrorEvent::Request::OrHash, @@ -51,8 +50,6 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Unique identifier for the event. - id:, # Timestamp when the event was created in ISO8601 format. created_at:, data:, @@ -65,7 +62,6 @@ module Imagekit sig do override.returns( { - id: String, created_at: Time, data: Imagekit::VideoTransformationErrorEvent::Data, request: Imagekit::VideoTransformationErrorEvent::Request, diff --git a/rbi/imagekit/models/video_transformation_ready_event.rbi b/rbi/imagekit/models/video_transformation_ready_event.rbi index 1891cda8..75a934d1 100644 --- a/rbi/imagekit/models/video_transformation_ready_event.rbi +++ b/rbi/imagekit/models/video_transformation_ready_event.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel + class VideoTransformationReadyEvent < Imagekit::Models::BaseWebhookEvent OrHash = T.type_alias do T.any( @@ -11,10 +11,6 @@ module Imagekit ) end - # Unique identifier for the event. - sig { returns(String) } - attr_accessor :id - # Timestamp when the event was created in ISO8601 format. sig { returns(Time) } attr_accessor :created_at @@ -54,9 +50,12 @@ module Imagekit end attr_writer :timings + # Triggered when video encoding is finished and the transformed resource is ready + # to be served. This is the key event to listen for - update your database or CMS + # flags when you receive this so your application can start showing the + # transformed video to users. sig do params( - id: String, created_at: Time, data: Imagekit::VideoTransformationReadyEvent::Data::OrHash, request: Imagekit::VideoTransformationReadyEvent::Request::OrHash, @@ -65,8 +64,6 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Unique identifier for the event. - id:, # Timestamp when the event was created in ISO8601 format. created_at:, data:, @@ -81,7 +78,6 @@ module Imagekit sig do override.returns( { - id: String, created_at: Time, data: Imagekit::VideoTransformationReadyEvent::Data, request: Imagekit::VideoTransformationReadyEvent::Request, diff --git a/sig/imagekit/models.rbs b/sig/imagekit/models.rbs index 746736e2..15ef64cd 100644 --- a/sig/imagekit/models.rbs +++ b/sig/imagekit/models.rbs @@ -5,6 +5,8 @@ module Imagekit class BaseOverlay = Imagekit::Models::BaseOverlay + class BaseWebhookEvent = Imagekit::Models::BaseWebhookEvent + module Beta = Imagekit::Models::Beta module Cache = Imagekit::Models::Cache diff --git a/sig/imagekit/models/base_webhook_event.rbs b/sig/imagekit/models/base_webhook_event.rbs new file mode 100644 index 00000000..287ff9cc --- /dev/null +++ b/sig/imagekit/models/base_webhook_event.rbs @@ -0,0 +1,15 @@ +module Imagekit + module Models + type base_webhook_event = { id: String, type: String } + + class BaseWebhookEvent < Imagekit::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor type: String + + def initialize: (id: String, type: String) -> void + + def to_hash: -> { id: String, type: String } + end + end +end diff --git a/sig/imagekit/models/upload_post_transform_error_event.rbs b/sig/imagekit/models/upload_post_transform_error_event.rbs index 09c5bd73..7ef7256c 100644 --- a/sig/imagekit/models/upload_post_transform_error_event.rbs +++ b/sig/imagekit/models/upload_post_transform_error_event.rbs @@ -2,26 +2,36 @@ module Imagekit module Models type upload_post_transform_error_event = { - id: String, created_at: Time, data: Imagekit::UploadPostTransformErrorEvent::Data, request: Imagekit::UploadPostTransformErrorEvent::Request, type: :"upload.post-transform.error" } - class UploadPostTransformErrorEvent < Imagekit::Internal::Type::BaseModel - attr_accessor id: String + class UploadPostTransformErrorEvent < Imagekit::Models::BaseWebhookEvent + def created_at: -> Time - attr_accessor created_at: Time + def created_at=: (Time _) -> Time - attr_accessor data: Imagekit::UploadPostTransformErrorEvent::Data + def data: -> Imagekit::UploadPostTransformErrorEvent::Data - attr_accessor request: Imagekit::UploadPostTransformErrorEvent::Request + def data=: ( + Imagekit::UploadPostTransformErrorEvent::Data _ + ) -> Imagekit::UploadPostTransformErrorEvent::Data - attr_accessor type: :"upload.post-transform.error" + def request: -> Imagekit::UploadPostTransformErrorEvent::Request + + def request=: ( + Imagekit::UploadPostTransformErrorEvent::Request _ + ) -> Imagekit::UploadPostTransformErrorEvent::Request + + def `type`: -> :"upload.post-transform.error" + + def type=: ( + :"upload.post-transform.error" _ + ) -> :"upload.post-transform.error" def initialize: ( - id: String, created_at: Time, data: Imagekit::UploadPostTransformErrorEvent::Data, request: Imagekit::UploadPostTransformErrorEvent::Request, @@ -29,7 +39,6 @@ module Imagekit ) -> void def to_hash: -> { - id: String, created_at: Time, data: Imagekit::UploadPostTransformErrorEvent::Data, request: Imagekit::UploadPostTransformErrorEvent::Request, diff --git a/sig/imagekit/models/upload_post_transform_success_event.rbs b/sig/imagekit/models/upload_post_transform_success_event.rbs index 01bf3180..526a877f 100644 --- a/sig/imagekit/models/upload_post_transform_success_event.rbs +++ b/sig/imagekit/models/upload_post_transform_success_event.rbs @@ -2,26 +2,36 @@ module Imagekit module Models type upload_post_transform_success_event = { - id: String, created_at: Time, data: Imagekit::UploadPostTransformSuccessEvent::Data, request: Imagekit::UploadPostTransformSuccessEvent::Request, type: :"upload.post-transform.success" } - class UploadPostTransformSuccessEvent < Imagekit::Internal::Type::BaseModel - attr_accessor id: String + class UploadPostTransformSuccessEvent < Imagekit::Models::BaseWebhookEvent + def created_at: -> Time - attr_accessor created_at: Time + def created_at=: (Time _) -> Time - attr_accessor data: Imagekit::UploadPostTransformSuccessEvent::Data + def data: -> Imagekit::UploadPostTransformSuccessEvent::Data - attr_accessor request: Imagekit::UploadPostTransformSuccessEvent::Request + def data=: ( + Imagekit::UploadPostTransformSuccessEvent::Data _ + ) -> Imagekit::UploadPostTransformSuccessEvent::Data - attr_accessor type: :"upload.post-transform.success" + def request: -> Imagekit::UploadPostTransformSuccessEvent::Request + + def request=: ( + Imagekit::UploadPostTransformSuccessEvent::Request _ + ) -> Imagekit::UploadPostTransformSuccessEvent::Request + + def `type`: -> :"upload.post-transform.success" + + def type=: ( + :"upload.post-transform.success" _ + ) -> :"upload.post-transform.success" def initialize: ( - id: String, created_at: Time, data: Imagekit::UploadPostTransformSuccessEvent::Data, request: Imagekit::UploadPostTransformSuccessEvent::Request, @@ -29,7 +39,6 @@ module Imagekit ) -> void def to_hash: -> { - id: String, created_at: Time, data: Imagekit::UploadPostTransformSuccessEvent::Data, request: Imagekit::UploadPostTransformSuccessEvent::Request, diff --git a/sig/imagekit/models/upload_pre_transform_error_event.rbs b/sig/imagekit/models/upload_pre_transform_error_event.rbs index 73935081..6af7d3e6 100644 --- a/sig/imagekit/models/upload_pre_transform_error_event.rbs +++ b/sig/imagekit/models/upload_pre_transform_error_event.rbs @@ -2,26 +2,36 @@ module Imagekit module Models type upload_pre_transform_error_event = { - id: String, created_at: Time, data: Imagekit::UploadPreTransformErrorEvent::Data, request: Imagekit::UploadPreTransformErrorEvent::Request, type: :"upload.pre-transform.error" } - class UploadPreTransformErrorEvent < Imagekit::Internal::Type::BaseModel - attr_accessor id: String + class UploadPreTransformErrorEvent < Imagekit::Models::BaseWebhookEvent + def created_at: -> Time - attr_accessor created_at: Time + def created_at=: (Time _) -> Time - attr_accessor data: Imagekit::UploadPreTransformErrorEvent::Data + def data: -> Imagekit::UploadPreTransformErrorEvent::Data - attr_accessor request: Imagekit::UploadPreTransformErrorEvent::Request + def data=: ( + Imagekit::UploadPreTransformErrorEvent::Data _ + ) -> Imagekit::UploadPreTransformErrorEvent::Data - attr_accessor type: :"upload.pre-transform.error" + def request: -> Imagekit::UploadPreTransformErrorEvent::Request + + def request=: ( + Imagekit::UploadPreTransformErrorEvent::Request _ + ) -> Imagekit::UploadPreTransformErrorEvent::Request + + def `type`: -> :"upload.pre-transform.error" + + def type=: ( + :"upload.pre-transform.error" _ + ) -> :"upload.pre-transform.error" def initialize: ( - id: String, created_at: Time, data: Imagekit::UploadPreTransformErrorEvent::Data, request: Imagekit::UploadPreTransformErrorEvent::Request, @@ -29,7 +39,6 @@ module Imagekit ) -> void def to_hash: -> { - id: String, created_at: Time, data: Imagekit::UploadPreTransformErrorEvent::Data, request: Imagekit::UploadPreTransformErrorEvent::Request, diff --git a/sig/imagekit/models/upload_pre_transform_success_event.rbs b/sig/imagekit/models/upload_pre_transform_success_event.rbs index d043704c..1efc8382 100644 --- a/sig/imagekit/models/upload_pre_transform_success_event.rbs +++ b/sig/imagekit/models/upload_pre_transform_success_event.rbs @@ -2,26 +2,36 @@ module Imagekit module Models type upload_pre_transform_success_event = { - id: String, created_at: Time, data: Imagekit::UploadPreTransformSuccessEvent::Data, request: Imagekit::UploadPreTransformSuccessEvent::Request, type: :"upload.pre-transform.success" } - class UploadPreTransformSuccessEvent < Imagekit::Internal::Type::BaseModel - attr_accessor id: String + class UploadPreTransformSuccessEvent < Imagekit::Models::BaseWebhookEvent + def created_at: -> Time - attr_accessor created_at: Time + def created_at=: (Time _) -> Time - attr_accessor data: Imagekit::UploadPreTransformSuccessEvent::Data + def data: -> Imagekit::UploadPreTransformSuccessEvent::Data - attr_accessor request: Imagekit::UploadPreTransformSuccessEvent::Request + def data=: ( + Imagekit::UploadPreTransformSuccessEvent::Data _ + ) -> Imagekit::UploadPreTransformSuccessEvent::Data - attr_accessor type: :"upload.pre-transform.success" + def request: -> Imagekit::UploadPreTransformSuccessEvent::Request + + def request=: ( + Imagekit::UploadPreTransformSuccessEvent::Request _ + ) -> Imagekit::UploadPreTransformSuccessEvent::Request + + def `type`: -> :"upload.pre-transform.success" + + def type=: ( + :"upload.pre-transform.success" _ + ) -> :"upload.pre-transform.success" def initialize: ( - id: String, created_at: Time, data: Imagekit::UploadPreTransformSuccessEvent::Data, request: Imagekit::UploadPreTransformSuccessEvent::Request, @@ -29,7 +39,6 @@ module Imagekit ) -> void def to_hash: -> { - id: String, created_at: Time, data: Imagekit::UploadPreTransformSuccessEvent::Data, request: Imagekit::UploadPreTransformSuccessEvent::Request, diff --git a/sig/imagekit/models/video_transformation_accepted_event.rbs b/sig/imagekit/models/video_transformation_accepted_event.rbs index 110ece17..f742ea55 100644 --- a/sig/imagekit/models/video_transformation_accepted_event.rbs +++ b/sig/imagekit/models/video_transformation_accepted_event.rbs @@ -2,26 +2,36 @@ module Imagekit module Models type video_transformation_accepted_event = { - id: String, created_at: Time, data: Imagekit::VideoTransformationAcceptedEvent::Data, request: Imagekit::VideoTransformationAcceptedEvent::Request, type: :"video.transformation.accepted" } - class VideoTransformationAcceptedEvent < Imagekit::Internal::Type::BaseModel - attr_accessor id: String + class VideoTransformationAcceptedEvent < Imagekit::Models::BaseWebhookEvent + def created_at: -> Time - attr_accessor created_at: Time + def created_at=: (Time _) -> Time - attr_accessor data: Imagekit::VideoTransformationAcceptedEvent::Data + def data: -> Imagekit::VideoTransformationAcceptedEvent::Data - attr_accessor request: Imagekit::VideoTransformationAcceptedEvent::Request + def data=: ( + Imagekit::VideoTransformationAcceptedEvent::Data _ + ) -> Imagekit::VideoTransformationAcceptedEvent::Data - attr_accessor type: :"video.transformation.accepted" + def request: -> Imagekit::VideoTransformationAcceptedEvent::Request + + def request=: ( + Imagekit::VideoTransformationAcceptedEvent::Request _ + ) -> Imagekit::VideoTransformationAcceptedEvent::Request + + def `type`: -> :"video.transformation.accepted" + + def type=: ( + :"video.transformation.accepted" _ + ) -> :"video.transformation.accepted" def initialize: ( - id: String, created_at: Time, data: Imagekit::VideoTransformationAcceptedEvent::Data, request: Imagekit::VideoTransformationAcceptedEvent::Request, @@ -29,7 +39,6 @@ module Imagekit ) -> void def to_hash: -> { - id: String, created_at: Time, data: Imagekit::VideoTransformationAcceptedEvent::Data, request: Imagekit::VideoTransformationAcceptedEvent::Request, diff --git a/sig/imagekit/models/video_transformation_error_event.rbs b/sig/imagekit/models/video_transformation_error_event.rbs index 18a7d33c..42a582dd 100644 --- a/sig/imagekit/models/video_transformation_error_event.rbs +++ b/sig/imagekit/models/video_transformation_error_event.rbs @@ -2,26 +2,36 @@ module Imagekit module Models type video_transformation_error_event = { - id: String, created_at: Time, data: Imagekit::VideoTransformationErrorEvent::Data, request: Imagekit::VideoTransformationErrorEvent::Request, type: :"video.transformation.error" } - class VideoTransformationErrorEvent < Imagekit::Internal::Type::BaseModel - attr_accessor id: String + class VideoTransformationErrorEvent < Imagekit::Models::BaseWebhookEvent + def created_at: -> Time - attr_accessor created_at: Time + def created_at=: (Time _) -> Time - attr_accessor data: Imagekit::VideoTransformationErrorEvent::Data + def data: -> Imagekit::VideoTransformationErrorEvent::Data - attr_accessor request: Imagekit::VideoTransformationErrorEvent::Request + def data=: ( + Imagekit::VideoTransformationErrorEvent::Data _ + ) -> Imagekit::VideoTransformationErrorEvent::Data - attr_accessor type: :"video.transformation.error" + def request: -> Imagekit::VideoTransformationErrorEvent::Request + + def request=: ( + Imagekit::VideoTransformationErrorEvent::Request _ + ) -> Imagekit::VideoTransformationErrorEvent::Request + + def `type`: -> :"video.transformation.error" + + def type=: ( + :"video.transformation.error" _ + ) -> :"video.transformation.error" def initialize: ( - id: String, created_at: Time, data: Imagekit::VideoTransformationErrorEvent::Data, request: Imagekit::VideoTransformationErrorEvent::Request, @@ -29,7 +39,6 @@ module Imagekit ) -> void def to_hash: -> { - id: String, created_at: Time, data: Imagekit::VideoTransformationErrorEvent::Data, request: Imagekit::VideoTransformationErrorEvent::Request, diff --git a/sig/imagekit/models/video_transformation_ready_event.rbs b/sig/imagekit/models/video_transformation_ready_event.rbs index 99c49603..0b4478a6 100644 --- a/sig/imagekit/models/video_transformation_ready_event.rbs +++ b/sig/imagekit/models/video_transformation_ready_event.rbs @@ -2,7 +2,6 @@ module Imagekit module Models type video_transformation_ready_event = { - id: String, created_at: Time, data: Imagekit::VideoTransformationReadyEvent::Data, request: Imagekit::VideoTransformationReadyEvent::Request, @@ -10,25 +9,36 @@ module Imagekit timings: Imagekit::VideoTransformationReadyEvent::Timings } - class VideoTransformationReadyEvent < Imagekit::Internal::Type::BaseModel - attr_accessor id: String + class VideoTransformationReadyEvent < Imagekit::Models::BaseWebhookEvent + def created_at: -> Time - attr_accessor created_at: Time + def created_at=: (Time _) -> Time - attr_accessor data: Imagekit::VideoTransformationReadyEvent::Data + def data: -> Imagekit::VideoTransformationReadyEvent::Data - attr_accessor request: Imagekit::VideoTransformationReadyEvent::Request + def data=: ( + Imagekit::VideoTransformationReadyEvent::Data _ + ) -> Imagekit::VideoTransformationReadyEvent::Data - attr_accessor type: :"video.transformation.ready" + def request: -> Imagekit::VideoTransformationReadyEvent::Request - attr_reader timings: Imagekit::VideoTransformationReadyEvent::Timings? + def request=: ( + Imagekit::VideoTransformationReadyEvent::Request _ + ) -> Imagekit::VideoTransformationReadyEvent::Request + + def `type`: -> :"video.transformation.ready" + + def type=: ( + :"video.transformation.ready" _ + ) -> :"video.transformation.ready" + + def timings: -> Imagekit::VideoTransformationReadyEvent::Timings? def timings=: ( - Imagekit::VideoTransformationReadyEvent::Timings + Imagekit::VideoTransformationReadyEvent::Timings _ ) -> Imagekit::VideoTransformationReadyEvent::Timings def initialize: ( - id: String, created_at: Time, data: Imagekit::VideoTransformationReadyEvent::Data, request: Imagekit::VideoTransformationReadyEvent::Request, @@ -37,7 +47,6 @@ module Imagekit ) -> void def to_hash: -> { - id: String, created_at: Time, data: Imagekit::VideoTransformationReadyEvent::Data, request: Imagekit::VideoTransformationReadyEvent::Request, From a4ed0dfc52e7061060aa850504f68d2aa9c7d363 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 08:16:00 +0000 Subject: [PATCH 05/32] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 52f982ba..cfcbd7f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a -config_hash: 08e12746cdca1c59c897cf2e50893c3c +config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c From c64d558fc172b4c1768d59731dc2a0e2c71de2fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 08:18:45 +0000 Subject: [PATCH 06/32] feat(api): manual updates --- .stats.yml | 4 +-- README.md | 37 +++++++--------------- lib/imagekit/models/file_upload_params.rb | 6 ++-- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models/file_upload_params.rbi | 6 ++-- rbi/imagekit/resources/files.rbi | 2 +- sig/imagekit/models/file_upload_params.rbs | 8 ++--- sig/imagekit/resources/files.rbs | 2 +- test/imagekit/client_test.rb | 30 +++++++++--------- test/imagekit/resources/files_test.rb | 3 +- 10 files changed, 43 insertions(+), 57 deletions(-) diff --git a/.stats.yml b/.stats.yml index cfcbd7f7..282d18eb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml -openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-eab9713fd85da68b41e881dfd9cd71f654e8620132da2023bab7dd01e5f7852e.yml +openapi_spec_hash: b5037b26fbe7360c6bfaf9947a65bb85 config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/README.md b/README.md index 32341ee0..5d8d2289 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,7 @@ image_kit = Imagekit::Client.new( password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) -response = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +response = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") puts(response.videoCodec) ``` @@ -49,14 +46,14 @@ Request parameters that correspond to file uploads can be passed as raw contents require "pathname" # Use `Pathname` to send the filename and/or avoid paging a large file into memory: -response = image_kit.files.upload(file: Pathname("/path/to/file")) +response = image_kit.beta.v2.files.upload(file: Pathname("/path/to/file")) # Alternatively, pass file contents or a `StringIO` directly: -response = image_kit.files.upload(file: File.read("/path/to/file")) +response = image_kit.beta.v2.files.upload(file: File.read("/path/to/file")) # Or, to control the filename and/or content type: file = Imagekit::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…") -response = image_kit.files.upload(file: file) +response = image_kit.beta.v2.files.upload(file: file) puts(response.videoCodec) ``` @@ -69,10 +66,7 @@ When the library is unable to connect to the API, or if the API returns a non-su ```ruby begin - file = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" - ) + file = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") rescue Imagekit::Errors::APIConnectionError => e puts("The server could not be reached") puts(e.cause) # an underlying Exception, likely raised within `net/http` @@ -116,7 +110,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: {max_retries: 5} ) @@ -134,7 +128,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: {timeout: 5} ) @@ -169,7 +163,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: { extra_query: {my_query_parameter: value}, @@ -216,26 +210,17 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio You can provide typesafe request parameters like so: ```ruby -image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") ``` Or, equivalently: ```ruby # Hashes work, but are not typesafe: -image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") # You can also splat a full Params class: -params = Imagekit::FileUploadParams.new( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +params = Imagekit::FileUploadParams.new(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") image_kit.files.upload(**params) ``` diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index f1a86697..6f3f74c1 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -18,8 +18,8 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # When supplying a URL, the server must receive the response headers within 8 # seconds; otherwise the request fails with 400 Bad Request. # - # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] - required :file, Imagekit::Internal::Type::FileInput + # @return [String] + required :file, String # @!attribute file_name # The name with which the file has to be uploaded. The file name can contain: @@ -240,7 +240,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Imagekit::Models::FileUploadParams} for more details. # - # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # @param file [String] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index d138d933..a436fcc2 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -221,7 +221,7 @@ def rename(params) # # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) # - # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # @param file [String] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index 4d836828..a362f96f 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -20,7 +20,7 @@ module Imagekit # # When supplying a URL, the server must receive the response headers within 8 # seconds; otherwise the request fails with 400 Bad Request. - sig { returns(Imagekit::Internal::FileInput) } + sig { returns(String) } attr_accessor :file # The name with which the file has to be uploaded. The file name can contain: @@ -290,7 +290,7 @@ module Imagekit sig do params( - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, @@ -462,7 +462,7 @@ module Imagekit sig do override.returns( { - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 9d1db383..ad9f0840 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -189,7 +189,7 @@ module Imagekit # technologies. sig do params( - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs index 4a2ea622..d8eeef40 100644 --- a/sig/imagekit/models/file_upload_params.rbs +++ b/sig/imagekit/models/file_upload_params.rbs @@ -2,7 +2,7 @@ module Imagekit module Models type file_upload_params = { - file: Imagekit::Internal::file_input, + file: String, file_name: String, token: String, checks: String, @@ -32,7 +32,7 @@ module Imagekit extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_accessor file: Imagekit::Internal::file_input + attr_accessor file: String attr_accessor file_name: String @@ -127,7 +127,7 @@ module Imagekit def webhook_url=: (String) -> String def initialize: ( - file: Imagekit::Internal::file_input, + file: String, file_name: String, ?token: String, ?checks: String, @@ -154,7 +154,7 @@ module Imagekit ) -> void def to_hash: -> { - file: Imagekit::Internal::file_input, + file: String, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 991b1f14..33303e87 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -44,7 +44,7 @@ module Imagekit ) -> Imagekit::Models::FileRenameResponse def upload: ( - file: Imagekit::Internal::file_input, + file: String, file_name: String, ?token: String, ?checks: String, diff --git a/test/imagekit/client_test.rb b/test/imagekit/client_test.rb index 22cda48d..5e42e052 100644 --- a/test/imagekit/client_test.rb +++ b/test/imagekit/client_test.rb @@ -45,7 +45,7 @@ def test_client_default_request_default_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") end assert_requested(:any, /./, times: 3) @@ -63,7 +63,7 @@ def test_client_given_request_default_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") end assert_requested(:any, /./, times: 4) @@ -81,7 +81,7 @@ def test_client_default_request_given_retry_attempts assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {max_retries: 3} ) @@ -103,7 +103,7 @@ def test_client_given_request_given_retry_attempts assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {max_retries: 4} ) @@ -128,7 +128,7 @@ def test_client_retry_after_seconds ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") end assert_requested(:any, /./, times: 2) @@ -152,7 +152,7 @@ def test_client_retry_after_date assert_raises(Imagekit::Errors::InternalServerError) do Thread.current.thread_variable_set(:time_now, Time.now) - image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") Thread.current.thread_variable_set(:time_now, nil) end @@ -176,7 +176,7 @@ def test_client_retry_after_ms ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") end assert_requested(:any, /./, times: 2) @@ -194,7 +194,7 @@ def test_retry_count_header ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") end 3.times do @@ -214,7 +214,7 @@ def test_omit_retry_count_header assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {extra_headers: {"x-stainless-retry-count" => nil}} ) @@ -237,7 +237,7 @@ def test_overwrite_retry_count_header assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {extra_headers: {"x-stainless-retry-count" => "42"}} ) @@ -266,7 +266,7 @@ def test_client_redirect_307 assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {extra_headers: {}} ) @@ -304,7 +304,7 @@ def test_client_redirect_303 assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {extra_headers: {}} ) @@ -337,7 +337,7 @@ def test_client_redirect_auth_keep_same_origin assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) @@ -373,7 +373,7 @@ def test_client_redirect_auth_strip_cross_origin assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: Pathname(__FILE__), + file: "https://www.example.com/path/to-image.jpg", file_name: "fileName", request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) @@ -395,7 +395,7 @@ def test_default_headers password: "My Password" ) - image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") assert_requested(:any, /./) do |req| headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type") diff --git a/test/imagekit/resources/files_test.rb b/test/imagekit/resources/files_test.rb index c09eb4bb..21c57e3c 100644 --- a/test/imagekit/resources/files_test.rb +++ b/test/imagekit/resources/files_test.rb @@ -113,7 +113,8 @@ def test_rename_required_params def test_upload_required_params skip("Prism tests are disabled") - response = @image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") + response = + @image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") assert_pattern do response => Imagekit::Models::FileUploadResponse From 8ac0ad3ff00d4036d52ec31777d74cb19f8d4379 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 08:21:34 +0000 Subject: [PATCH 07/32] feat(api): manual updates --- .stats.yml | 4 +-- test/imagekit/client_test.rb | 46 +++++++++------------------ test/imagekit/resources/files_test.rb | 3 +- 3 files changed, 18 insertions(+), 35 deletions(-) diff --git a/.stats.yml b/.stats.yml index 282d18eb..7698a81b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-eab9713fd85da68b41e881dfd9cd71f654e8620132da2023bab7dd01e5f7852e.yml -openapi_spec_hash: b5037b26fbe7360c6bfaf9947a65bb85 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-911102f2eaf3be4b34381f6ba089330bed099bb72eb93667ce2f6e72b5934c8c.yml +openapi_spec_hash: 637ad417a580137914441bd790b04cc2 config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/test/imagekit/client_test.rb b/test/imagekit/client_test.rb index 5e42e052..40f15aa5 100644 --- a/test/imagekit/client_test.rb +++ b/test/imagekit/client_test.rb @@ -45,7 +45,7 @@ def test_client_default_request_default_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + image_kit.files.upload(file: "file", file_name: "fileName") end assert_requested(:any, /./, times: 3) @@ -63,7 +63,7 @@ def test_client_given_request_default_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + image_kit.files.upload(file: "file", file_name: "fileName") end assert_requested(:any, /./, times: 4) @@ -80,11 +80,7 @@ def test_client_default_request_given_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", - file_name: "fileName", - request_options: {max_retries: 3} - ) + image_kit.files.upload(file: "file", file_name: "fileName", request_options: {max_retries: 3}) end assert_requested(:any, /./, times: 4) @@ -102,11 +98,7 @@ def test_client_given_request_given_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", - file_name: "fileName", - request_options: {max_retries: 4} - ) + image_kit.files.upload(file: "file", file_name: "fileName", request_options: {max_retries: 4}) end assert_requested(:any, /./, times: 5) @@ -128,7 +120,7 @@ def test_client_retry_after_seconds ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + image_kit.files.upload(file: "file", file_name: "fileName") end assert_requested(:any, /./, times: 2) @@ -152,7 +144,7 @@ def test_client_retry_after_date assert_raises(Imagekit::Errors::InternalServerError) do Thread.current.thread_variable_set(:time_now, Time.now) - image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + image_kit.files.upload(file: "file", file_name: "fileName") Thread.current.thread_variable_set(:time_now, nil) end @@ -176,7 +168,7 @@ def test_client_retry_after_ms ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + image_kit.files.upload(file: "file", file_name: "fileName") end assert_requested(:any, /./, times: 2) @@ -194,7 +186,7 @@ def test_retry_count_header ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + image_kit.files.upload(file: "file", file_name: "fileName") end 3.times do @@ -214,7 +206,7 @@ def test_omit_retry_count_header assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", + file: "file", file_name: "fileName", request_options: {extra_headers: {"x-stainless-retry-count" => nil}} ) @@ -237,7 +229,7 @@ def test_overwrite_retry_count_header assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", + file: "file", file_name: "fileName", request_options: {extra_headers: {"x-stainless-retry-count" => "42"}} ) @@ -265,11 +257,7 @@ def test_client_redirect_307 ) assert_raises(Imagekit::Errors::APIConnectionError) do - image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", - file_name: "fileName", - request_options: {extra_headers: {}} - ) + image_kit.files.upload(file: "file", file_name: "fileName", request_options: {extra_headers: {}}) end recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first @@ -303,11 +291,7 @@ def test_client_redirect_303 ) assert_raises(Imagekit::Errors::APIConnectionError) do - image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", - file_name: "fileName", - request_options: {extra_headers: {}} - ) + image_kit.files.upload(file: "file", file_name: "fileName", request_options: {extra_headers: {}}) end assert_requested(:get, "http://localhost/redirected", times: Imagekit::Client::MAX_REDIRECTS) do @@ -337,7 +321,7 @@ def test_client_redirect_auth_keep_same_origin assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", + file: "file", file_name: "fileName", request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) @@ -373,7 +357,7 @@ def test_client_redirect_auth_strip_cross_origin assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: "https://www.example.com/path/to-image.jpg", + file: "file", file_name: "fileName", request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) @@ -395,7 +379,7 @@ def test_default_headers password: "My Password" ) - image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + image_kit.files.upload(file: "file", file_name: "fileName") assert_requested(:any, /./) do |req| headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type") diff --git a/test/imagekit/resources/files_test.rb b/test/imagekit/resources/files_test.rb index 21c57e3c..ed2c44a3 100644 --- a/test/imagekit/resources/files_test.rb +++ b/test/imagekit/resources/files_test.rb @@ -113,8 +113,7 @@ def test_rename_required_params def test_upload_required_params skip("Prism tests are disabled") - response = - @image_kit.files.upload(file: "https://www.example.com/path/to-image.jpg", file_name: "fileName") + response = @image_kit.files.upload(file: "file", file_name: "fileName") assert_pattern do response => Imagekit::Models::FileUploadResponse From 24f9f11ca39e3611c621a1d5383d763a4acd87b4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 08:23:49 +0000 Subject: [PATCH 08/32] feat(api): manual updates --- .stats.yml | 4 +- README.md | 37 +++++++++++------ lib/imagekit/models/file_upload_params.rb | 6 +-- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models/file_upload_params.rbi | 6 +-- rbi/imagekit/resources/files.rbi | 2 +- sig/imagekit/models/file_upload_params.rbs | 8 ++-- sig/imagekit/resources/files.rbs | 2 +- test/imagekit/client_test.rb | 46 +++++++++++++++------- test/imagekit/resources/files_test.rb | 2 +- 10 files changed, 73 insertions(+), 42 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7698a81b..d42605f1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-911102f2eaf3be4b34381f6ba089330bed099bb72eb93667ce2f6e72b5934c8c.yml -openapi_spec_hash: 637ad417a580137914441bd790b04cc2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-0726d89b19f532c7fb92990d688a9bfb5aa4a9a871d64f49d4ba45bac6998e4a.yml +openapi_spec_hash: 9525bb02ab496b3459a1f93ac50968e3 config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/README.md b/README.md index 5d8d2289..32341ee0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,10 @@ image_kit = Imagekit::Client.new( password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) -response = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +response = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) puts(response.videoCodec) ``` @@ -46,14 +49,14 @@ Request parameters that correspond to file uploads can be passed as raw contents require "pathname" # Use `Pathname` to send the filename and/or avoid paging a large file into memory: -response = image_kit.beta.v2.files.upload(file: Pathname("/path/to/file")) +response = image_kit.files.upload(file: Pathname("/path/to/file")) # Alternatively, pass file contents or a `StringIO` directly: -response = image_kit.beta.v2.files.upload(file: File.read("/path/to/file")) +response = image_kit.files.upload(file: File.read("/path/to/file")) # Or, to control the filename and/or content type: file = Imagekit::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…") -response = image_kit.beta.v2.files.upload(file: file) +response = image_kit.files.upload(file: file) puts(response.videoCodec) ``` @@ -66,7 +69,10 @@ When the library is unable to connect to the API, or if the API returns a non-su ```ruby begin - file = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") + file = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" + ) rescue Imagekit::Errors::APIConnectionError => e puts("The server could not be reached") puts(e.cause) # an underlying Exception, likely raised within `net/http` @@ -110,7 +116,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {max_retries: 5} ) @@ -128,7 +134,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {timeout: 5} ) @@ -163,7 +169,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: { extra_query: {my_query_parameter: value}, @@ -210,17 +216,26 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio You can provide typesafe request parameters like so: ```ruby -image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) ``` Or, equivalently: ```ruby # Hashes work, but are not typesafe: -image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) # You can also splat a full Params class: -params = Imagekit::FileUploadParams.new(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +params = Imagekit::FileUploadParams.new( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) image_kit.files.upload(**params) ``` diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index 6f3f74c1..f1a86697 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -18,8 +18,8 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # When supplying a URL, the server must receive the response headers within 8 # seconds; otherwise the request fails with 400 Bad Request. # - # @return [String] - required :file, String + # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] + required :file, Imagekit::Internal::Type::FileInput # @!attribute file_name # The name with which the file has to be uploaded. The file name can contain: @@ -240,7 +240,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Imagekit::Models::FileUploadParams} for more details. # - # @param file [String] The API accepts any of the following: + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index a436fcc2..d138d933 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -221,7 +221,7 @@ def rename(params) # # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) # - # @param file [String] The API accepts any of the following: + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index a362f96f..4d836828 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -20,7 +20,7 @@ module Imagekit # # When supplying a URL, the server must receive the response headers within 8 # seconds; otherwise the request fails with 400 Bad Request. - sig { returns(String) } + sig { returns(Imagekit::Internal::FileInput) } attr_accessor :file # The name with which the file has to be uploaded. The file name can contain: @@ -290,7 +290,7 @@ module Imagekit sig do params( - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, @@ -462,7 +462,7 @@ module Imagekit sig do override.returns( { - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index ad9f0840..9d1db383 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -189,7 +189,7 @@ module Imagekit # technologies. sig do params( - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs index d8eeef40..4a2ea622 100644 --- a/sig/imagekit/models/file_upload_params.rbs +++ b/sig/imagekit/models/file_upload_params.rbs @@ -2,7 +2,7 @@ module Imagekit module Models type file_upload_params = { - file: String, + file: Imagekit::Internal::file_input, file_name: String, token: String, checks: String, @@ -32,7 +32,7 @@ module Imagekit extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_accessor file: String + attr_accessor file: Imagekit::Internal::file_input attr_accessor file_name: String @@ -127,7 +127,7 @@ module Imagekit def webhook_url=: (String) -> String def initialize: ( - file: String, + file: Imagekit::Internal::file_input, file_name: String, ?token: String, ?checks: String, @@ -154,7 +154,7 @@ module Imagekit ) -> void def to_hash: -> { - file: String, + file: Imagekit::Internal::file_input, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 33303e87..991b1f14 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -44,7 +44,7 @@ module Imagekit ) -> Imagekit::Models::FileRenameResponse def upload: ( - file: String, + file: Imagekit::Internal::file_input, file_name: String, ?token: String, ?checks: String, diff --git a/test/imagekit/client_test.rb b/test/imagekit/client_test.rb index 40f15aa5..22cda48d 100644 --- a/test/imagekit/client_test.rb +++ b/test/imagekit/client_test.rb @@ -45,7 +45,7 @@ def test_client_default_request_default_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "file", file_name: "fileName") + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end assert_requested(:any, /./, times: 3) @@ -63,7 +63,7 @@ def test_client_given_request_default_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "file", file_name: "fileName") + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end assert_requested(:any, /./, times: 4) @@ -80,7 +80,11 @@ def test_client_default_request_given_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "file", file_name: "fileName", request_options: {max_retries: 3}) + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {max_retries: 3} + ) end assert_requested(:any, /./, times: 4) @@ -98,7 +102,11 @@ def test_client_given_request_given_retry_attempts ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "file", file_name: "fileName", request_options: {max_retries: 4}) + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {max_retries: 4} + ) end assert_requested(:any, /./, times: 5) @@ -120,7 +128,7 @@ def test_client_retry_after_seconds ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "file", file_name: "fileName") + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end assert_requested(:any, /./, times: 2) @@ -144,7 +152,7 @@ def test_client_retry_after_date assert_raises(Imagekit::Errors::InternalServerError) do Thread.current.thread_variable_set(:time_now, Time.now) - image_kit.files.upload(file: "file", file_name: "fileName") + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") Thread.current.thread_variable_set(:time_now, nil) end @@ -168,7 +176,7 @@ def test_client_retry_after_ms ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "file", file_name: "fileName") + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end assert_requested(:any, /./, times: 2) @@ -186,7 +194,7 @@ def test_retry_count_header ) assert_raises(Imagekit::Errors::InternalServerError) do - image_kit.files.upload(file: "file", file_name: "fileName") + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") end 3.times do @@ -206,7 +214,7 @@ def test_omit_retry_count_header assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: "file", + file: Pathname(__FILE__), file_name: "fileName", request_options: {extra_headers: {"x-stainless-retry-count" => nil}} ) @@ -229,7 +237,7 @@ def test_overwrite_retry_count_header assert_raises(Imagekit::Errors::InternalServerError) do image_kit.files.upload( - file: "file", + file: Pathname(__FILE__), file_name: "fileName", request_options: {extra_headers: {"x-stainless-retry-count" => "42"}} ) @@ -257,7 +265,11 @@ def test_client_redirect_307 ) assert_raises(Imagekit::Errors::APIConnectionError) do - image_kit.files.upload(file: "file", file_name: "fileName", request_options: {extra_headers: {}}) + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {}} + ) end recorded, = WebMock::RequestRegistry.instance.requested_signatures.hash.first @@ -291,7 +303,11 @@ def test_client_redirect_303 ) assert_raises(Imagekit::Errors::APIConnectionError) do - image_kit.files.upload(file: "file", file_name: "fileName", request_options: {extra_headers: {}}) + image_kit.files.upload( + file: Pathname(__FILE__), + file_name: "fileName", + request_options: {extra_headers: {}} + ) end assert_requested(:get, "http://localhost/redirected", times: Imagekit::Client::MAX_REDIRECTS) do @@ -321,7 +337,7 @@ def test_client_redirect_auth_keep_same_origin assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: "file", + file: Pathname(__FILE__), file_name: "fileName", request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) @@ -357,7 +373,7 @@ def test_client_redirect_auth_strip_cross_origin assert_raises(Imagekit::Errors::APIConnectionError) do image_kit.files.upload( - file: "file", + file: Pathname(__FILE__), file_name: "fileName", request_options: {extra_headers: {"authorization" => "Bearer xyz"}} ) @@ -379,7 +395,7 @@ def test_default_headers password: "My Password" ) - image_kit.files.upload(file: "file", file_name: "fileName") + image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") assert_requested(:any, /./) do |req| headers = req.headers.transform_keys(&:downcase).fetch_values("accept", "content-type") diff --git a/test/imagekit/resources/files_test.rb b/test/imagekit/resources/files_test.rb index ed2c44a3..c09eb4bb 100644 --- a/test/imagekit/resources/files_test.rb +++ b/test/imagekit/resources/files_test.rb @@ -113,7 +113,7 @@ def test_rename_required_params def test_upload_required_params skip("Prism tests are disabled") - response = @image_kit.files.upload(file: "file", file_name: "fileName") + response = @image_kit.files.upload(file: Pathname(__FILE__), file_name: "fileName") assert_pattern do response => Imagekit::Models::FileUploadResponse From eb624fa5e58b8c95ef06e3447e7fee647682a003 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 08:32:51 +0000 Subject: [PATCH 09/32] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d42605f1..cfcbd7f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-0726d89b19f532c7fb92990d688a9bfb5aa4a9a871d64f49d4ba45bac6998e4a.yml -openapi_spec_hash: 9525bb02ab496b3459a1f93ac50968e3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml +openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c From bddb2faecc78b22888d44aeda6896bdeff0f7cf8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 09:03:29 +0000 Subject: [PATCH 10/32] feat(api): manual updates --- .stats.yml | 4 +-- README.md | 31 ++++++---------------- lib/imagekit/models/file_upload_params.rb | 18 +++++-------- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models/file_upload_params.rbi | 30 +++++++-------------- rbi/imagekit/resources/files.rbi | 14 +++------- sig/imagekit/models/file_upload_params.rbs | 8 +++--- sig/imagekit/resources/files.rbs | 2 +- 8 files changed, 35 insertions(+), 74 deletions(-) diff --git a/.stats.yml b/.stats.yml index cfcbd7f7..d458a07c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml -openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-e7bc47a9221d7da9c8c9653d3fd1d4cfdf2408588e32c4aa62bd02a50ec93c36.yml +openapi_spec_hash: 8d061396a2fff9d1add4d5baf03ab939 config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/README.md b/README.md index 32341ee0..92b56406 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,7 @@ image_kit = Imagekit::Client.new( password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) -response = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +response = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") puts(response.videoCodec) ``` @@ -69,10 +66,7 @@ When the library is unable to connect to the API, or if the API returns a non-su ```ruby begin - file = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" - ) + file = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") rescue Imagekit::Errors::APIConnectionError => e puts("The server could not be reached") puts(e.cause) # an underlying Exception, likely raised within `net/http` @@ -116,7 +110,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: {max_retries: 5} ) @@ -134,7 +128,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: {timeout: 5} ) @@ -169,7 +163,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: { extra_query: {my_query_parameter: value}, @@ -216,26 +210,17 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio You can provide typesafe request parameters like so: ```ruby -image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") ``` Or, equivalently: ```ruby # Hashes work, but are not typesafe: -image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") # You can also splat a full Params class: -params = Imagekit::FileUploadParams.new( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +params = Imagekit::FileUploadParams.new(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") image_kit.files.upload(**params) ``` diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index f1a86697..df0d2ab8 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -8,18 +8,12 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel include Imagekit::Internal::Type::RequestParameters # @!attribute file - # The API accepts any of the following: + # A publicly reachable URL that ImageKit’s servers can fetch. The server must + # receive the response headers within 8 seconds; otherwise the request fails with + # 400 Bad Request. # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. - # - # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] - required :file, Imagekit::Internal::Type::FileInput + # @return [String] + required :file, String # @!attribute file_name # The name with which the file has to be uploaded. The file name can contain: @@ -240,7 +234,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Imagekit::Models::FileUploadParams} for more details. # - # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # @param file [String] A publicly reachable URL that ImageKit’s servers can fetch. The server must rece # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index d138d933..0cc9db23 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -221,7 +221,7 @@ def rename(params) # # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) # - # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # @param file [String] A publicly reachable URL that ImageKit’s servers can fetch. The server must rece # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index 4d836828..2e7239f7 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -11,16 +11,10 @@ module Imagekit T.any(Imagekit::FileUploadParams, Imagekit::Internal::AnyHash) end - # The API accepts any of the following: - # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. - sig { returns(Imagekit::Internal::FileInput) } + # A publicly reachable URL that ImageKit’s servers can fetch. The server must + # receive the response headers within 8 seconds; otherwise the request fails with + # 400 Bad Request. + sig { returns(String) } attr_accessor :file # The name with which the file has to be uploaded. The file name can contain: @@ -290,7 +284,7 @@ module Imagekit sig do params( - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, @@ -325,15 +319,9 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # The API accepts any of the following: - # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. + # A publicly reachable URL that ImageKit’s servers can fetch. The server must + # receive the response headers within 8 seconds; otherwise the request fails with + # 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # @@ -462,7 +450,7 @@ module Imagekit sig do override.returns( { - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 9d1db383..546a6831 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -189,7 +189,7 @@ module Imagekit # technologies. sig do params( - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, @@ -224,15 +224,9 @@ module Imagekit ).returns(Imagekit::Models::FileUploadResponse) end def upload( - # The API accepts any of the following: - # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. + # A publicly reachable URL that ImageKit’s servers can fetch. The server must + # receive the response headers within 8 seconds; otherwise the request fails with + # 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs index 4a2ea622..d8eeef40 100644 --- a/sig/imagekit/models/file_upload_params.rbs +++ b/sig/imagekit/models/file_upload_params.rbs @@ -2,7 +2,7 @@ module Imagekit module Models type file_upload_params = { - file: Imagekit::Internal::file_input, + file: String, file_name: String, token: String, checks: String, @@ -32,7 +32,7 @@ module Imagekit extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_accessor file: Imagekit::Internal::file_input + attr_accessor file: String attr_accessor file_name: String @@ -127,7 +127,7 @@ module Imagekit def webhook_url=: (String) -> String def initialize: ( - file: Imagekit::Internal::file_input, + file: String, file_name: String, ?token: String, ?checks: String, @@ -154,7 +154,7 @@ module Imagekit ) -> void def to_hash: -> { - file: Imagekit::Internal::file_input, + file: String, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 991b1f14..33303e87 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -44,7 +44,7 @@ module Imagekit ) -> Imagekit::Models::FileRenameResponse def upload: ( - file: Imagekit::Internal::file_input, + file: String, file_name: String, ?token: String, ?checks: String, From c0417fbd4286fb47cbdfc154a696fcd2d34b1b5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 09:10:57 +0000 Subject: [PATCH 11/32] feat(api): manual updates --- .stats.yml | 4 +-- README.md | 31 ++++++++++++++++------ lib/imagekit/models/file_upload_params.rb | 18 ++++++++----- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models/file_upload_params.rbi | 30 ++++++++++++++------- rbi/imagekit/resources/files.rbi | 14 +++++++--- sig/imagekit/models/file_upload_params.rbs | 8 +++--- sig/imagekit/resources/files.rbs | 2 +- 8 files changed, 74 insertions(+), 35 deletions(-) diff --git a/.stats.yml b/.stats.yml index d458a07c..cfcbd7f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-e7bc47a9221d7da9c8c9653d3fd1d4cfdf2408588e32c4aa62bd02a50ec93c36.yml -openapi_spec_hash: 8d061396a2fff9d1add4d5baf03ab939 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml +openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/README.md b/README.md index 92b56406..32341ee0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,10 @@ image_kit = Imagekit::Client.new( password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) -response = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +response = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) puts(response.videoCodec) ``` @@ -66,7 +69,10 @@ When the library is unable to connect to the API, or if the API returns a non-su ```ruby begin - file = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") + file = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" + ) rescue Imagekit::Errors::APIConnectionError => e puts("The server could not be reached") puts(e.cause) # an underlying Exception, likely raised within `net/http` @@ -110,7 +116,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {max_retries: 5} ) @@ -128,7 +134,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {timeout: 5} ) @@ -163,7 +169,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: { extra_query: {my_query_parameter: value}, @@ -210,17 +216,26 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio You can provide typesafe request parameters like so: ```ruby -image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) ``` Or, equivalently: ```ruby # Hashes work, but are not typesafe: -image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) # You can also splat a full Params class: -params = Imagekit::FileUploadParams.new(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +params = Imagekit::FileUploadParams.new( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) image_kit.files.upload(**params) ``` diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index df0d2ab8..f1a86697 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -8,12 +8,18 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel include Imagekit::Internal::Type::RequestParameters # @!attribute file - # A publicly reachable URL that ImageKit’s servers can fetch. The server must - # receive the response headers within 8 seconds; otherwise the request fails with - # 400 Bad Request. + # The API accepts any of the following: # - # @return [String] - required :file, String + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + # + # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] + required :file, Imagekit::Internal::Type::FileInput # @!attribute file_name # The name with which the file has to be uploaded. The file name can contain: @@ -234,7 +240,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Imagekit::Models::FileUploadParams} for more details. # - # @param file [String] A publicly reachable URL that ImageKit’s servers can fetch. The server must rece + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index 0cc9db23..d138d933 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -221,7 +221,7 @@ def rename(params) # # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) # - # @param file [String] A publicly reachable URL that ImageKit’s servers can fetch. The server must rece + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index 2e7239f7..4d836828 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -11,10 +11,16 @@ module Imagekit T.any(Imagekit::FileUploadParams, Imagekit::Internal::AnyHash) end - # A publicly reachable URL that ImageKit’s servers can fetch. The server must - # receive the response headers within 8 seconds; otherwise the request fails with - # 400 Bad Request. - sig { returns(String) } + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + sig { returns(Imagekit::Internal::FileInput) } attr_accessor :file # The name with which the file has to be uploaded. The file name can contain: @@ -284,7 +290,7 @@ module Imagekit sig do params( - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, @@ -319,9 +325,15 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # A publicly reachable URL that ImageKit’s servers can fetch. The server must - # receive the response headers within 8 seconds; otherwise the request fails with - # 400 Bad Request. + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # @@ -450,7 +462,7 @@ module Imagekit sig do override.returns( { - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 546a6831..9d1db383 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -189,7 +189,7 @@ module Imagekit # technologies. sig do params( - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, @@ -224,9 +224,15 @@ module Imagekit ).returns(Imagekit::Models::FileUploadResponse) end def upload( - # A publicly reachable URL that ImageKit’s servers can fetch. The server must - # receive the response headers within 8 seconds; otherwise the request fails with - # 400 Bad Request. + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs index d8eeef40..4a2ea622 100644 --- a/sig/imagekit/models/file_upload_params.rbs +++ b/sig/imagekit/models/file_upload_params.rbs @@ -2,7 +2,7 @@ module Imagekit module Models type file_upload_params = { - file: String, + file: Imagekit::Internal::file_input, file_name: String, token: String, checks: String, @@ -32,7 +32,7 @@ module Imagekit extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_accessor file: String + attr_accessor file: Imagekit::Internal::file_input attr_accessor file_name: String @@ -127,7 +127,7 @@ module Imagekit def webhook_url=: (String) -> String def initialize: ( - file: String, + file: Imagekit::Internal::file_input, file_name: String, ?token: String, ?checks: String, @@ -154,7 +154,7 @@ module Imagekit ) -> void def to_hash: -> { - file: String, + file: Imagekit::Internal::file_input, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 33303e87..991b1f14 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -44,7 +44,7 @@ module Imagekit ) -> Imagekit::Models::FileRenameResponse def upload: ( - file: String, + file: Imagekit::Internal::file_input, file_name: String, ?token: String, ?checks: String, From e9bad2213d947539b07f4c71622c6bee2e826274 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 11:41:08 +0000 Subject: [PATCH 12/32] feat(api): manual updates --- .stats.yml | 4 +-- README.md | 31 ++++++---------------- lib/imagekit/models/file_upload_params.rb | 18 +++++-------- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models/file_upload_params.rbi | 30 +++++++-------------- rbi/imagekit/resources/files.rbi | 14 +++------- sig/imagekit/models/file_upload_params.rbs | 8 +++--- sig/imagekit/resources/files.rbs | 2 +- 8 files changed, 35 insertions(+), 74 deletions(-) diff --git a/.stats.yml b/.stats.yml index cfcbd7f7..db7d8f1e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml -openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-9ae7b43dcfd6208ca37c32c887630ae186ec338bcdd36902b6fe5d1cc66459dc.yml +openapi_spec_hash: 25fb64c067e64bcff6eaaabda26de397 config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/README.md b/README.md index 32341ee0..92b56406 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,7 @@ image_kit = Imagekit::Client.new( password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) -response = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +response = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") puts(response.videoCodec) ``` @@ -69,10 +66,7 @@ When the library is unable to connect to the API, or if the API returns a non-su ```ruby begin - file = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" - ) + file = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") rescue Imagekit::Errors::APIConnectionError => e puts("The server could not be reached") puts(e.cause) # an underlying Exception, likely raised within `net/http` @@ -116,7 +110,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: {max_retries: 5} ) @@ -134,7 +128,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: {timeout: 5} ) @@ -169,7 +163,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), + file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg", request_options: { extra_query: {my_query_parameter: value}, @@ -216,26 +210,17 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio You can provide typesafe request parameters like so: ```ruby -image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") ``` Or, equivalently: ```ruby # Hashes work, but are not typesafe: -image_kit.files.upload( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") # You can also splat a full Params class: -params = Imagekit::FileUploadParams.new( - file: StringIO.new("https://www.example.com/public-url.jpg"), - file_name: "file-name.jpg" -) +params = Imagekit::FileUploadParams.new(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") image_kit.files.upload(**params) ``` diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index f1a86697..49c6efff 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -8,18 +8,12 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel include Imagekit::Internal::Type::RequestParameters # @!attribute file - # The API accepts any of the following: + # The URL of the file to upload. A publicly reachable URL that ImageKit servers + # can fetch. The server must receive the response headers within 8 seconds; + # otherwise the request fails with 400 Bad Request. # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. - # - # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] - required :file, Imagekit::Internal::Type::FileInput + # @return [String] + required :file, String # @!attribute file_name # The name with which the file has to be uploaded. The file name can contain: @@ -240,7 +234,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Imagekit::Models::FileUploadParams} for more details. # - # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # @param file [String] The URL of the file to upload. A publicly reachable URL that ImageKit servers ca # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index d138d933..8f57dd29 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -221,7 +221,7 @@ def rename(params) # # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) # - # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: + # @param file [String] The URL of the file to upload. A publicly reachable URL that ImageKit servers ca # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index 4d836828..bb4da1be 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -11,16 +11,10 @@ module Imagekit T.any(Imagekit::FileUploadParams, Imagekit::Internal::AnyHash) end - # The API accepts any of the following: - # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. - sig { returns(Imagekit::Internal::FileInput) } + # The URL of the file to upload. A publicly reachable URL that ImageKit servers + # can fetch. The server must receive the response headers within 8 seconds; + # otherwise the request fails with 400 Bad Request. + sig { returns(String) } attr_accessor :file # The name with which the file has to be uploaded. The file name can contain: @@ -290,7 +284,7 @@ module Imagekit sig do params( - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, @@ -325,15 +319,9 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # The API accepts any of the following: - # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. + # The URL of the file to upload. A publicly reachable URL that ImageKit servers + # can fetch. The server must receive the response headers within 8 seconds; + # otherwise the request fails with 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # @@ -462,7 +450,7 @@ module Imagekit sig do override.returns( { - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 9d1db383..81eca148 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -189,7 +189,7 @@ module Imagekit # technologies. sig do params( - file: Imagekit::Internal::FileInput, + file: String, file_name: String, token: String, checks: String, @@ -224,15 +224,9 @@ module Imagekit ).returns(Imagekit::Models::FileUploadResponse) end def upload( - # The API accepts any of the following: - # - # - **Binary data** – send the raw bytes as `multipart/form-data`. - # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can - # fetch. - # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. - # - # When supplying a URL, the server must receive the response headers within 8 - # seconds; otherwise the request fails with 400 Bad Request. + # The URL of the file to upload. A publicly reachable URL that ImageKit servers + # can fetch. The server must receive the response headers within 8 seconds; + # otherwise the request fails with 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs index 4a2ea622..d8eeef40 100644 --- a/sig/imagekit/models/file_upload_params.rbs +++ b/sig/imagekit/models/file_upload_params.rbs @@ -2,7 +2,7 @@ module Imagekit module Models type file_upload_params = { - file: Imagekit::Internal::file_input, + file: String, file_name: String, token: String, checks: String, @@ -32,7 +32,7 @@ module Imagekit extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_accessor file: Imagekit::Internal::file_input + attr_accessor file: String attr_accessor file_name: String @@ -127,7 +127,7 @@ module Imagekit def webhook_url=: (String) -> String def initialize: ( - file: Imagekit::Internal::file_input, + file: String, file_name: String, ?token: String, ?checks: String, @@ -154,7 +154,7 @@ module Imagekit ) -> void def to_hash: -> { - file: Imagekit::Internal::file_input, + file: String, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 991b1f14..33303e87 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -44,7 +44,7 @@ module Imagekit ) -> Imagekit::Models::FileRenameResponse def upload: ( - file: Imagekit::Internal::file_input, + file: String, file_name: String, ?token: String, ?checks: String, From 6c0d9f382bd5c6f2b1e61cc69f30f5944f8c0bd7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 11:45:30 +0000 Subject: [PATCH 13/32] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index db7d8f1e..f8166f44 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-9ae7b43dcfd6208ca37c32c887630ae186ec338bcdd36902b6fe5d1cc66459dc.yml -openapi_spec_hash: 25fb64c067e64bcff6eaaabda26de397 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-5ce78cb448cc4520f5fbcc753452e0237b50a4bf64902e0548a8ad24bbdc82cf.yml +openapi_spec_hash: fd8ac4c2cdddc3d3a0b0c81be6a9edfe config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c From 4c04de93766bb15aad1784f5a4a594036fdce827 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 05:43:50 +0000 Subject: [PATCH 14/32] feat(api): manual updates --- .stats.yml | 4 +-- README.md | 31 ++++++++++++++++------ lib/imagekit/models/file_upload_params.rb | 18 ++++++++----- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models/file_upload_params.rbi | 30 ++++++++++++++------- rbi/imagekit/resources/files.rbi | 14 +++++++--- sig/imagekit/models/file_upload_params.rbs | 8 +++--- sig/imagekit/resources/files.rbs | 2 +- 8 files changed, 74 insertions(+), 35 deletions(-) diff --git a/.stats.yml b/.stats.yml index f8166f44..cfcbd7f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-5ce78cb448cc4520f5fbcc753452e0237b50a4bf64902e0548a8ad24bbdc82cf.yml -openapi_spec_hash: fd8ac4c2cdddc3d3a0b0c81be6a9edfe +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml +openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/README.md b/README.md index 92b56406..32341ee0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,10 @@ image_kit = Imagekit::Client.new( password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) -response = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +response = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) puts(response.videoCodec) ``` @@ -66,7 +69,10 @@ When the library is unable to connect to the API, or if the API returns a non-su ```ruby begin - file = image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") + file = image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" + ) rescue Imagekit::Errors::APIConnectionError => e puts("The server could not be reached") puts(e.cause) # an underlying Exception, likely raised within `net/http` @@ -110,7 +116,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {max_retries: 5} ) @@ -128,7 +134,7 @@ image_kit = Imagekit::Client.new( # Or, configure per-request: image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {timeout: 5} ) @@ -163,7 +169,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = image_kit.files.upload( - file: "https://www.example.com/public-url.jpg", + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: { extra_query: {my_query_parameter: value}, @@ -210,17 +216,26 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio You can provide typesafe request parameters like so: ```ruby -image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) ``` Or, equivalently: ```ruby # Hashes work, but are not typesafe: -image_kit.files.upload(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +image_kit.files.upload( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) # You can also splat a full Params class: -params = Imagekit::FileUploadParams.new(file: "https://www.example.com/public-url.jpg", file_name: "file-name.jpg") +params = Imagekit::FileUploadParams.new( + file: StringIO.new("https://www.example.com/public-url.jpg"), + file_name: "file-name.jpg" +) image_kit.files.upload(**params) ``` diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index 49c6efff..f1a86697 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -8,12 +8,18 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel include Imagekit::Internal::Type::RequestParameters # @!attribute file - # The URL of the file to upload. A publicly reachable URL that ImageKit servers - # can fetch. The server must receive the response headers within 8 seconds; - # otherwise the request fails with 400 Bad Request. + # The API accepts any of the following: # - # @return [String] - required :file, String + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + # + # @return [Pathname, StringIO, IO, String, Imagekit::FilePart] + required :file, Imagekit::Internal::Type::FileInput # @!attribute file_name # The name with which the file has to be uploaded. The file name can contain: @@ -234,7 +240,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Some parameter documentations has been truncated, see # {Imagekit::Models::FileUploadParams} for more details. # - # @param file [String] The URL of the file to upload. A publicly reachable URL that ImageKit servers ca + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index 8f57dd29..d138d933 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -221,7 +221,7 @@ def rename(params) # # @overload upload(file:, file_name:, token: nil, checks: nil, custom_coordinates: nil, custom_metadata: nil, description: nil, expire: nil, extensions: nil, folder: nil, is_private_file: nil, is_published: nil, overwrite_ai_tags: nil, overwrite_custom_metadata: nil, overwrite_file: nil, overwrite_tags: nil, public_key: nil, response_fields: nil, signature: nil, tags: nil, transformation: nil, use_unique_file_name: nil, webhook_url: nil, request_options: {}) # - # @param file [String] The URL of the file to upload. A publicly reachable URL that ImageKit servers ca + # @param file [Pathname, StringIO, IO, String, Imagekit::FilePart] The API accepts any of the following: # # @param file_name [String] The name with which the file has to be uploaded. # diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index bb4da1be..4d836828 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -11,10 +11,16 @@ module Imagekit T.any(Imagekit::FileUploadParams, Imagekit::Internal::AnyHash) end - # The URL of the file to upload. A publicly reachable URL that ImageKit servers - # can fetch. The server must receive the response headers within 8 seconds; - # otherwise the request fails with 400 Bad Request. - sig { returns(String) } + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. + sig { returns(Imagekit::Internal::FileInput) } attr_accessor :file # The name with which the file has to be uploaded. The file name can contain: @@ -284,7 +290,7 @@ module Imagekit sig do params( - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, @@ -319,9 +325,15 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # The URL of the file to upload. A publicly reachable URL that ImageKit servers - # can fetch. The server must receive the response headers within 8 seconds; - # otherwise the request fails with 400 Bad Request. + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # @@ -450,7 +462,7 @@ module Imagekit sig do override.returns( { - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 81eca148..9d1db383 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -189,7 +189,7 @@ module Imagekit # technologies. sig do params( - file: String, + file: Imagekit::Internal::FileInput, file_name: String, token: String, checks: String, @@ -224,9 +224,15 @@ module Imagekit ).returns(Imagekit::Models::FileUploadResponse) end def upload( - # The URL of the file to upload. A publicly reachable URL that ImageKit servers - # can fetch. The server must receive the response headers within 8 seconds; - # otherwise the request fails with 400 Bad Request. + # The API accepts any of the following: + # + # - **Binary data** – send the raw bytes as `multipart/form-data`. + # - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + # fetch. + # - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + # + # When supplying a URL, the server must receive the response headers within 8 + # seconds; otherwise the request fails with 400 Bad Request. file:, # The name with which the file has to be uploaded. The file name can contain: # diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs index d8eeef40..4a2ea622 100644 --- a/sig/imagekit/models/file_upload_params.rbs +++ b/sig/imagekit/models/file_upload_params.rbs @@ -2,7 +2,7 @@ module Imagekit module Models type file_upload_params = { - file: String, + file: Imagekit::Internal::file_input, file_name: String, token: String, checks: String, @@ -32,7 +32,7 @@ module Imagekit extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_accessor file: String + attr_accessor file: Imagekit::Internal::file_input attr_accessor file_name: String @@ -127,7 +127,7 @@ module Imagekit def webhook_url=: (String) -> String def initialize: ( - file: String, + file: Imagekit::Internal::file_input, file_name: String, ?token: String, ?checks: String, @@ -154,7 +154,7 @@ module Imagekit ) -> void def to_hash: -> { - file: String, + file: Imagekit::Internal::file_input, file_name: String, token: String, checks: String, diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 33303e87..991b1f14 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -44,7 +44,7 @@ module Imagekit ) -> Imagekit::Models::FileRenameResponse def upload: ( - file: String, + file: Imagekit::Internal::file_input, file_name: String, ?token: String, ?checks: String, From e33d6ed379d8d298f049edcf5b5b4d2ecfdd82bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 06:00:10 +0000 Subject: [PATCH 15/32] feat(api): manual updates --- .stats.yml | 4 ++-- lib/imagekit/models/beta/v2/file_upload_params.rb | 4 ++-- lib/imagekit/models/file_upload_params.rb | 4 ++-- lib/imagekit/resources/beta/v2/files.rb | 2 +- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models/beta/v2/file_upload_params.rbi | 4 ++-- rbi/imagekit/models/file_upload_params.rbi | 4 ++-- rbi/imagekit/resources/beta/v2/files.rbi | 2 +- rbi/imagekit/resources/files.rbi | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.stats.yml b/.stats.yml index cfcbd7f7..5908457a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml -openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-0470196862abd722b09f1af798d6f2bcbdeba0f82d1162f57c287b1a43233531.yml +openapi_spec_hash: 043dd7c67d741d0034b86f2fc0bce072 config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/lib/imagekit/models/beta/v2/file_upload_params.rb b/lib/imagekit/models/beta/v2/file_upload_params.rb index 044d0f30..18faeb10 100644 --- a/lib/imagekit/models/beta/v2/file_upload_params.rb +++ b/lib/imagekit/models/beta/v2/file_upload_params.rb @@ -84,7 +84,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel optional :description, String # @!attribute extensions - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # # @return [Array, nil] @@ -225,7 +225,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index f1a86697..5871d7d8 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -91,7 +91,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel optional :expire, Integer # @!attribute extensions - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # # @return [Array, nil] @@ -256,7 +256,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki # - # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekit/resources/beta/v2/files.rb b/lib/imagekit/resources/beta/v2/files.rb index c50545df..628747bc 100644 --- a/lib/imagekit/resources/beta/v2/files.rb +++ b/lib/imagekit/resources/beta/v2/files.rb @@ -52,7 +52,7 @@ class Files # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index d138d933..a125df81 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -237,7 +237,7 @@ def rename(params) # # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki # - # @param extensions [Array] Array of extensions to be applied to the image. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/rbi/imagekit/models/beta/v2/file_upload_params.rbi b/rbi/imagekit/models/beta/v2/file_upload_params.rbi index d33124a6..66e8162b 100644 --- a/rbi/imagekit/models/beta/v2/file_upload_params.rbi +++ b/rbi/imagekit/models/beta/v2/file_upload_params.rbi @@ -89,7 +89,7 @@ module Imagekit sig { params(description: String).void } attr_writer :description - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. sig do returns( @@ -347,7 +347,7 @@ module Imagekit custom_metadata: nil, # Optional text to describe the contents of the file. description: nil, - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. extensions: nil, # The folder path in which the image has to be uploaded. If the folder(s) didn't diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index 4d836828..14b9033d 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -94,7 +94,7 @@ module Imagekit sig { params(expire: Integer).void } attr_writer :expire - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. sig do returns( @@ -374,7 +374,7 @@ module Imagekit # the future. It should be in seconds. This field is only required for # authentication when uploading a file from the client side. expire: nil, - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. extensions: nil, # The folder path in which the image has to be uploaded. If the folder(s) didn't diff --git a/rbi/imagekit/resources/beta/v2/files.rbi b/rbi/imagekit/resources/beta/v2/files.rbi index 9c757f11..7dca87db 100644 --- a/rbi/imagekit/resources/beta/v2/files.rbi +++ b/rbi/imagekit/resources/beta/v2/files.rbi @@ -113,7 +113,7 @@ module Imagekit custom_metadata: nil, # Optional text to describe the contents of the file. description: nil, - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. extensions: nil, # The folder path in which the image has to be uploaded. If the folder(s) didn't diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 9d1db383..3ca11dc7 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -273,7 +273,7 @@ module Imagekit # the future. It should be in seconds. This field is only required for # authentication when uploading a file from the client side. expire: nil, - # Array of extensions to be applied to the image. Each extension can be configured + # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. extensions: nil, # The folder path in which the image has to be uploaded. If the folder(s) didn't From 8c970ed1b42cfb40e05cedf4f643096918097f67 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 06:03:12 +0000 Subject: [PATCH 16/32] feat(api): manual updates --- .stats.yml | 2 +- lib/imagekit.rb | 1 + lib/imagekit/models.rb | 5 + .../models/beta/v2/file_upload_params.rb | 136 +------- lib/imagekit/models/extensions.rb | 136 ++++++++ lib/imagekit/models/file_update_params.rb | 139 +------- lib/imagekit/models/file_upload_params.rb | 136 +------- lib/imagekit/resources/beta/v2/files.rb | 2 +- lib/imagekit/resources/files.rb | 2 +- rbi/imagekit/models.rbi | 5 + .../models/beta/v2/file_upload_params.rbi | 302 +----------------- rbi/imagekit/models/extensions.rbi | 268 ++++++++++++++++ rbi/imagekit/models/file_update_params.rbi | 302 +----------------- rbi/imagekit/models/file_upload_params.rbi | 300 +---------------- rbi/imagekit/resources/beta/v2/files.rbi | 6 +- rbi/imagekit/resources/files.rbi | 6 +- sig/imagekit/models.rbs | 4 + .../models/beta/v2/file_upload_params.rbs | 137 +------- sig/imagekit/models/extensions.rbs | 132 ++++++++ sig/imagekit/models/file_update_params.rbs | 137 +------- sig/imagekit/models/file_upload_params.rbs | 137 +------- sig/imagekit/resources/beta/v2/files.rbs | 2 +- sig/imagekit/resources/files.rbs | 2 +- 23 files changed, 625 insertions(+), 1674 deletions(-) create mode 100644 lib/imagekit/models/extensions.rb create mode 100644 rbi/imagekit/models/extensions.rbi create mode 100644 sig/imagekit/models/extensions.rbs diff --git a/.stats.yml b/.stats.yml index 5908457a..2dc65d21 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-0470196862abd722b09f1af798d6f2bcbdeba0f82d1162f57c287b1a43233531.yml openapi_spec_hash: 043dd7c67d741d0034b86f2fc0bce072 -config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c +config_hash: da949a1217f48ac01676eab81ca9d1b1 diff --git a/lib/imagekit.rb b/lib/imagekit.rb index 657d3c0d..c831bf55 100644 --- a/lib/imagekit.rb +++ b/lib/imagekit.rb @@ -86,6 +86,7 @@ require_relative "imagekit/models/custom_metadata_field_list_params" require_relative "imagekit/models/custom_metadata_field_list_response" require_relative "imagekit/models/custom_metadata_field_update_params" +require_relative "imagekit/models/extensions" require_relative "imagekit/models/file_copy_params" require_relative "imagekit/models/file_copy_response" require_relative "imagekit/models/file_delete_params" diff --git a/lib/imagekit/models.rb b/lib/imagekit/models.rb index 5c3ae2fe..1792d026 100644 --- a/lib/imagekit/models.rb +++ b/lib/imagekit/models.rb @@ -61,6 +61,11 @@ module Imagekit CustomMetadataFieldUpdateParams = Imagekit::Models::CustomMetadataFieldUpdateParams + ExtensionItem = Imagekit::Models::ExtensionItem + + # @type [Imagekit::Internal::Type::Converter] + Extensions = Imagekit::Models::Extensions + File = Imagekit::Models::File FileCopyParams = Imagekit::Models::FileCopyParams diff --git a/lib/imagekit/models/beta/v2/file_upload_params.rb b/lib/imagekit/models/beta/v2/file_upload_params.rb index 18faeb10..2b4cc97d 100644 --- a/lib/imagekit/models/beta/v2/file_upload_params.rb +++ b/lib/imagekit/models/beta/v2/file_upload_params.rb @@ -87,9 +87,8 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # - # @return [Array, nil] - optional :extensions, - -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::Beta::V2::FileUploadParams::Extension] } + # @return [Array, nil] + optional :extensions, -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem] } # @!attribute folder # The folder path in which the image has to be uploaded. If the folder(s) didn't @@ -225,7 +224,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # @@ -253,135 +252,6 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] - module Extension - extend Imagekit::Internal::Type::Union - - discriminator :name - - variant :"remove-bg", -> { Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg } - - variant :"ai-auto-description", -> { Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription } - - variant -> { Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension } - - class RemoveBg < Imagekit::Internal::Type::BaseModel - # @!attribute name - # Specifies the background removal extension. - # - # @return [Symbol, :"remove-bg"] - required :name, const: :"remove-bg" - - # @!attribute options - # - # @return [Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg::Options, nil] - optional :options, -> { Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options } - - # @!method initialize(options: nil, name: :"remove-bg") - # @param options [Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg::Options] - # - # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. - - # @see Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg#options - class Options < Imagekit::Internal::Type::BaseModel - # @!attribute add_shadow - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - # - # @return [Boolean, nil] - optional :add_shadow, Imagekit::Internal::Type::Boolean - - # @!attribute bg_color - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - # - # @return [String, nil] - optional :bg_color, String - - # @!attribute bg_image_url - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - # - # @return [String, nil] - optional :bg_image_url, String - - # @!attribute semitransparency - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - # - # @return [Boolean, nil] - optional :semitransparency, Imagekit::Internal::Type::Boolean - - # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg::Options} for - # more details. - # - # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin - # - # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col - # - # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be - # - # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp - end - end - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - # @!attribute max_tags - # Maximum number of tags to attach to the asset. - # - # @return [Integer] - required :max_tags, Integer, api_name: :maxTags - - # @!attribute min_confidence - # Minimum confidence level for tags to be considered valid. - # - # @return [Integer] - required :min_confidence, Integer, api_name: :minConfidence - - # @!attribute name - # Specifies the auto-tagging extension used. - # - # @return [Symbol, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name] - required :name, enum: -> { Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name } - - # @!method initialize(max_tags:, min_confidence:, name:) - # @param max_tags [Integer] Maximum number of tags to attach to the asset. - # - # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. - # - # @param name [Symbol, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. - - # Specifies the auto-tagging extension used. - # - # @see Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension#name - module Name - extend Imagekit::Internal::Type::Enum - - GOOGLE_AUTO_TAGGING = :"google-auto-tagging" - AWS_AUTO_TAGGING = :"aws-auto-tagging" - - # @!method self.values - # @return [Array] - end - end - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - # @!attribute name - # Specifies the auto description extension. - # - # @return [Symbol, :"ai-auto-description"] - required :name, const: :"ai-auto-description" - - # @!method initialize(name: :"ai-auto-description") - # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. - end - - # @!method self.variants - # @return [Array(Imagekit::Models::Beta::V2::FileUploadParams::Extension::RemoveBg, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AIAutoDescription, Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension)] - end - module ResponseField extend Imagekit::Internal::Type::Enum diff --git a/lib/imagekit/models/extensions.rb b/lib/imagekit/models/extensions.rb new file mode 100644 index 00000000..d0b187c3 --- /dev/null +++ b/lib/imagekit/models/extensions.rb @@ -0,0 +1,136 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module ExtensionItem + extend Imagekit::Internal::Type::Union + + discriminator :name + + variant :"remove-bg", -> { Imagekit::ExtensionItem::RemoveBg } + + variant :"ai-auto-description", -> { Imagekit::ExtensionItem::AIAutoDescription } + + variant -> { Imagekit::ExtensionItem::AutoTaggingExtension } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the background removal extension. + # + # @return [Symbol, :"remove-bg"] + required :name, const: :"remove-bg" + + # @!attribute options + # + # @return [Imagekit::Models::ExtensionItem::RemoveBg::Options, nil] + optional :options, -> { Imagekit::ExtensionItem::RemoveBg::Options } + + # @!method initialize(options: nil, name: :"remove-bg") + # @param options [Imagekit::Models::ExtensionItem::RemoveBg::Options] + # + # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. + + # @see Imagekit::Models::ExtensionItem::RemoveBg#options + class Options < Imagekit::Internal::Type::BaseModel + # @!attribute add_shadow + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + # + # @return [Boolean, nil] + optional :add_shadow, Imagekit::Internal::Type::Boolean + + # @!attribute bg_color + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + # + # @return [String, nil] + optional :bg_color, String + + # @!attribute bg_image_url + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + # + # @return [String, nil] + optional :bg_image_url, String + + # @!attribute semitransparency + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + # + # @return [Boolean, nil] + optional :semitransparency, Imagekit::Internal::Type::Boolean + + # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::ExtensionItem::RemoveBg::Options} for more details. + # + # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin + # + # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col + # + # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be + # + # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + # @!attribute max_tags + # Maximum number of tags to attach to the asset. + # + # @return [Integer] + required :max_tags, Integer, api_name: :maxTags + + # @!attribute min_confidence + # Minimum confidence level for tags to be considered valid. + # + # @return [Integer] + required :min_confidence, Integer, api_name: :minConfidence + + # @!attribute name + # Specifies the auto-tagging extension used. + # + # @return [Symbol, Imagekit::Models::ExtensionItem::AutoTaggingExtension::Name] + required :name, enum: -> { Imagekit::ExtensionItem::AutoTaggingExtension::Name } + + # @!method initialize(max_tags:, min_confidence:, name:) + # @param max_tags [Integer] Maximum number of tags to attach to the asset. + # + # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. + # + # @param name [Symbol, Imagekit::Models::ExtensionItem::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. + + # Specifies the auto-tagging extension used. + # + # @see Imagekit::Models::ExtensionItem::AutoTaggingExtension#name + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING = :"google-auto-tagging" + AWS_AUTO_TAGGING = :"aws-auto-tagging" + + # @!method self.values + # @return [Array] + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + # @!attribute name + # Specifies the auto description extension. + # + # @return [Symbol, :"ai-auto-description"] + required :name, const: :"ai-auto-description" + + # @!method initialize(name: :"ai-auto-description") + # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. + end + + # @!method self.variants + # @return [Array(Imagekit::Models::ExtensionItem::RemoveBg, Imagekit::Models::ExtensionItem::AIAutoDescription, Imagekit::Models::ExtensionItem::AutoTaggingExtension)] + end + + # @type [Imagekit::Internal::Type::Converter] + Extensions = Imagekit::Internal::Type::ArrayOf[union: -> { Imagekit::ExtensionItem }] + end +end diff --git a/lib/imagekit/models/file_update_params.rb b/lib/imagekit/models/file_update_params.rb index 7efbdd37..46e3ec4f 100644 --- a/lib/imagekit/models/file_update_params.rb +++ b/lib/imagekit/models/file_update_params.rb @@ -51,9 +51,8 @@ class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # - # @return [Array, nil] - optional :extensions, - -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension] } + # @return [Array, nil] + optional :extensions, -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem] } # @!attribute remove_ai_tags # An array of AITags associated with the file that you want to remove, e.g. @@ -97,7 +96,7 @@ class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car # @@ -105,138 +104,6 @@ class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv - module Extension - extend Imagekit::Internal::Type::Union - - discriminator :name - - variant :"remove-bg", -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg } - - variant :"ai-auto-description", - -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription } - - variant -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension } - - class RemoveBg < Imagekit::Internal::Type::BaseModel - # @!attribute name - # Specifies the background removal extension. - # - # @return [Symbol, :"remove-bg"] - required :name, const: :"remove-bg" - - # @!attribute options - # - # @return [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options, nil] - optional :options, - -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options } - - # @!method initialize(options: nil, name: :"remove-bg") - # @param options [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options] - # - # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. - - # @see Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg#options - class Options < Imagekit::Internal::Type::BaseModel - # @!attribute add_shadow - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - # - # @return [Boolean, nil] - optional :add_shadow, Imagekit::Internal::Type::Boolean - - # @!attribute bg_color - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - # - # @return [String, nil] - optional :bg_color, String - - # @!attribute bg_image_url - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - # - # @return [String, nil] - optional :bg_image_url, String - - # @!attribute semitransparency - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - # - # @return [Boolean, nil] - optional :semitransparency, Imagekit::Internal::Type::Boolean - - # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options} - # for more details. - # - # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin - # - # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col - # - # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be - # - # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp - end - end - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - # @!attribute max_tags - # Maximum number of tags to attach to the asset. - # - # @return [Integer] - required :max_tags, Integer, api_name: :maxTags - - # @!attribute min_confidence - # Minimum confidence level for tags to be considered valid. - # - # @return [Integer] - required :min_confidence, Integer, api_name: :minConfidence - - # @!attribute name - # Specifies the auto-tagging extension used. - # - # @return [Symbol, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name] - required :name, - enum: -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name } - - # @!method initialize(max_tags:, min_confidence:, name:) - # @param max_tags [Integer] Maximum number of tags to attach to the asset. - # - # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. - # - # @param name [Symbol, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. - - # Specifies the auto-tagging extension used. - # - # @see Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension#name - module Name - extend Imagekit::Internal::Type::Enum - - GOOGLE_AUTO_TAGGING = :"google-auto-tagging" - AWS_AUTO_TAGGING = :"aws-auto-tagging" - - # @!method self.values - # @return [Array] - end - end - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - # @!attribute name - # Specifies the auto description extension. - # - # @return [Symbol, :"ai-auto-description"] - required :name, const: :"ai-auto-description" - - # @!method initialize(name: :"ai-auto-description") - # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. - end - - # @!method self.variants - # @return [Array(Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension)] - end - # An array of AITags associated with the file that you want to remove, e.g. # `["car", "vehicle", "motorsports"]`. # diff --git a/lib/imagekit/models/file_upload_params.rb b/lib/imagekit/models/file_upload_params.rb index 5871d7d8..282c8f74 100644 --- a/lib/imagekit/models/file_upload_params.rb +++ b/lib/imagekit/models/file_upload_params.rb @@ -94,9 +94,8 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # Array of extensions to be applied to the asset. Each extension can be configured # with specific parameters based on the extension type. # - # @return [Array, nil] - optional :extensions, - -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::FileUploadParams::Extension] } + # @return [Array, nil] + optional :extensions, -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem] } # @!attribute folder # The folder path in which the image has to be uploaded. If the folder(s) didn't @@ -256,7 +255,7 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # @@ -288,135 +287,6 @@ class FileUploadParams < Imagekit::Internal::Type::BaseModel # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] - module Extension - extend Imagekit::Internal::Type::Union - - discriminator :name - - variant :"remove-bg", -> { Imagekit::FileUploadParams::Extension::RemoveBg } - - variant :"ai-auto-description", -> { Imagekit::FileUploadParams::Extension::AIAutoDescription } - - variant -> { Imagekit::FileUploadParams::Extension::AutoTaggingExtension } - - class RemoveBg < Imagekit::Internal::Type::BaseModel - # @!attribute name - # Specifies the background removal extension. - # - # @return [Symbol, :"remove-bg"] - required :name, const: :"remove-bg" - - # @!attribute options - # - # @return [Imagekit::Models::FileUploadParams::Extension::RemoveBg::Options, nil] - optional :options, -> { Imagekit::FileUploadParams::Extension::RemoveBg::Options } - - # @!method initialize(options: nil, name: :"remove-bg") - # @param options [Imagekit::Models::FileUploadParams::Extension::RemoveBg::Options] - # - # @param name [Symbol, :"remove-bg"] Specifies the background removal extension. - - # @see Imagekit::Models::FileUploadParams::Extension::RemoveBg#options - class Options < Imagekit::Internal::Type::BaseModel - # @!attribute add_shadow - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - # - # @return [Boolean, nil] - optional :add_shadow, Imagekit::Internal::Type::Boolean - - # @!attribute bg_color - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - # - # @return [String, nil] - optional :bg_color, String - - # @!attribute bg_image_url - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - # - # @return [String, nil] - optional :bg_image_url, String - - # @!attribute semitransparency - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - # - # @return [Boolean, nil] - optional :semitransparency, Imagekit::Internal::Type::Boolean - - # @!method initialize(add_shadow: nil, bg_color: nil, bg_image_url: nil, semitransparency: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::FileUploadParams::Extension::RemoveBg::Options} for more - # details. - # - # @param add_shadow [Boolean] Whether to add an artificial shadow to the result. Default is false. Note: Addin - # - # @param bg_color [String] Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or col - # - # @param bg_image_url [String] Sets a background image from a URL. If this parameter is set, `bg_color` must be - # - # @param semitransparency [Boolean] Allows semi-transparent regions in the result. Default is true. Note: Semitransp - end - end - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - # @!attribute max_tags - # Maximum number of tags to attach to the asset. - # - # @return [Integer] - required :max_tags, Integer, api_name: :maxTags - - # @!attribute min_confidence - # Minimum confidence level for tags to be considered valid. - # - # @return [Integer] - required :min_confidence, Integer, api_name: :minConfidence - - # @!attribute name - # Specifies the auto-tagging extension used. - # - # @return [Symbol, Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::Name] - required :name, enum: -> { Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name } - - # @!method initialize(max_tags:, min_confidence:, name:) - # @param max_tags [Integer] Maximum number of tags to attach to the asset. - # - # @param min_confidence [Integer] Minimum confidence level for tags to be considered valid. - # - # @param name [Symbol, Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::Name] Specifies the auto-tagging extension used. - - # Specifies the auto-tagging extension used. - # - # @see Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension#name - module Name - extend Imagekit::Internal::Type::Enum - - GOOGLE_AUTO_TAGGING = :"google-auto-tagging" - AWS_AUTO_TAGGING = :"aws-auto-tagging" - - # @!method self.values - # @return [Array] - end - end - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - # @!attribute name - # Specifies the auto description extension. - # - # @return [Symbol, :"ai-auto-description"] - required :name, const: :"ai-auto-description" - - # @!method initialize(name: :"ai-auto-description") - # @param name [Symbol, :"ai-auto-description"] Specifies the auto description extension. - end - - # @!method self.variants - # @return [Array(Imagekit::Models::FileUploadParams::Extension::RemoveBg, Imagekit::Models::FileUploadParams::Extension::AIAutoDescription, Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension)] - end - module ResponseField extend Imagekit::Internal::Type::Enum diff --git a/lib/imagekit/resources/beta/v2/files.rb b/lib/imagekit/resources/beta/v2/files.rb index 628747bc..670d5a60 100644 --- a/lib/imagekit/resources/beta/v2/files.rb +++ b/lib/imagekit/resources/beta/v2/files.rb @@ -52,7 +52,7 @@ class Files # # @param description [String] Optional text to describe the contents of the file. # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index a125df81..1e0d8f83 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -237,7 +237,7 @@ def rename(params) # # @param expire [Integer] The time until your signature is valid. It must be a [Unix time](https://en.wiki # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured # # @param folder [String] The folder path in which the image has to be uploaded. If the folder(s) didn't e # diff --git a/rbi/imagekit/models.rbi b/rbi/imagekit/models.rbi index e14a9662..75eeb800 100644 --- a/rbi/imagekit/models.rbi +++ b/rbi/imagekit/models.rbi @@ -27,6 +27,11 @@ module Imagekit CustomMetadataFieldUpdateParams = Imagekit::Models::CustomMetadataFieldUpdateParams + ExtensionItem = Imagekit::Models::ExtensionItem + + Extensions = + T.let(Imagekit::Models::Extensions, Imagekit::Internal::Type::Converter) + File = Imagekit::Models::File FileCopyParams = Imagekit::Models::FileCopyParams diff --git a/rbi/imagekit/models/beta/v2/file_upload_params.rbi b/rbi/imagekit/models/beta/v2/file_upload_params.rbi index 66e8162b..b09ec71f 100644 --- a/rbi/imagekit/models/beta/v2/file_upload_params.rbi +++ b/rbi/imagekit/models/beta/v2/file_upload_params.rbi @@ -96,9 +96,9 @@ module Imagekit T.nilable( T::Array[ T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, - Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension ) ] ) @@ -111,9 +111,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::OrHash, - Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription::OrHash, - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ] ).void @@ -278,9 +278,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::OrHash, - Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription::OrHash, - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ], folder: String, @@ -429,9 +429,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, - Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension ) ], folder: String, @@ -457,284 +457,6 @@ module Imagekit def to_hash end - module Extension - extend Imagekit::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, - Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension - ) - end - - class RemoveBg < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg, - Imagekit::Internal::AnyHash - ) - end - - # Specifies the background removal extension. - sig { returns(Symbol) } - attr_accessor :name - - sig do - returns( - T.nilable( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options - ) - ) - end - attr_reader :options - - sig do - params( - options: - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options::OrHash - ).void - end - attr_writer :options - - sig do - params( - options: - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options::OrHash, - name: Symbol - ).returns(T.attached_class) - end - def self.new( - options: nil, - # Specifies the background removal extension. - name: :"remove-bg" - ) - end - - sig do - override.returns( - { - name: Symbol, - options: - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options - } - ) - end - def to_hash - end - - class Options < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options, - Imagekit::Internal::AnyHash - ) - end - - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :add_shadow - - sig { params(add_shadow: T::Boolean).void } - attr_writer :add_shadow - - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - sig { returns(T.nilable(String)) } - attr_reader :bg_color - - sig { params(bg_color: String).void } - attr_writer :bg_color - - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - sig { returns(T.nilable(String)) } - attr_reader :bg_image_url - - sig { params(bg_image_url: String).void } - attr_writer :bg_image_url - - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :semitransparency - - sig { params(semitransparency: T::Boolean).void } - attr_writer :semitransparency - - sig do - params( - add_shadow: T::Boolean, - bg_color: String, - bg_image_url: String, - semitransparency: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - add_shadow: nil, - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - bg_color: nil, - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - bg_image_url: nil, - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - semitransparency: nil - ) - end - - sig do - override.returns( - { - add_shadow: T::Boolean, - bg_color: String, - bg_image_url: String, - semitransparency: T::Boolean - } - ) - end - def to_hash - end - end - end - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension, - Imagekit::Internal::AnyHash - ) - end - - # Maximum number of tags to attach to the asset. - sig { returns(Integer) } - attr_accessor :max_tags - - # Minimum confidence level for tags to be considered valid. - sig { returns(Integer) } - attr_accessor :min_confidence - - # Specifies the auto-tagging extension used. - sig do - returns( - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol - ) - end - attr_accessor :name - - sig do - params( - max_tags: Integer, - min_confidence: Integer, - name: - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol - ).returns(T.attached_class) - end - def self.new( - # Maximum number of tags to attach to the asset. - max_tags:, - # Minimum confidence level for tags to be considered valid. - min_confidence:, - # Specifies the auto-tagging extension used. - name: - ) - end - - sig do - override.returns( - { - max_tags: Integer, - min_confidence: Integer, - name: - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol - } - ) - end - def to_hash - end - - # Specifies the auto-tagging extension used. - module Name - extend Imagekit::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - GOOGLE_AUTO_TAGGING = - T.let( - :"google-auto-tagging", - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol - ) - AWS_AUTO_TAGGING = - T.let( - :"aws-auto-tagging", - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol - ] - ) - end - def self.values - end - end - end - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription, - Imagekit::Internal::AnyHash - ) - end - - # Specifies the auto description extension. - sig { returns(Symbol) } - attr_accessor :name - - sig { params(name: Symbol).returns(T.attached_class) } - def self.new( - # Specifies the auto description extension. - name: :"ai-auto-description" - ) - end - - sig { override.returns({ name: Symbol }) } - def to_hash - end - end - - sig do - override.returns( - T::Array[ - Imagekit::Beta::V2::FileUploadParams::Extension::Variants - ] - ) - end - def self.variants - end - end - module ResponseField extend Imagekit::Internal::Type::Enum diff --git a/rbi/imagekit/models/extensions.rbi b/rbi/imagekit/models/extensions.rbi new file mode 100644 index 00000000..46f00ece --- /dev/null +++ b/rbi/imagekit/models/extensions.rbi @@ -0,0 +1,268 @@ +# typed: strong + +module Imagekit + module Models + module ExtensionItem + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension + ) + end + + class RemoveBg < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::ExtensionItem::RemoveBg, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the background removal extension. + sig { returns(Symbol) } + attr_accessor :name + + sig { returns(T.nilable(Imagekit::ExtensionItem::RemoveBg::Options)) } + attr_reader :options + + sig do + params( + options: Imagekit::ExtensionItem::RemoveBg::Options::OrHash + ).void + end + attr_writer :options + + sig do + params( + options: Imagekit::ExtensionItem::RemoveBg::Options::OrHash, + name: Symbol + ).returns(T.attached_class) + end + def self.new( + options: nil, + # Specifies the background removal extension. + name: :"remove-bg" + ) + end + + sig do + override.returns( + { + name: Symbol, + options: Imagekit::ExtensionItem::RemoveBg::Options + } + ) + end + def to_hash + end + + class Options < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::ExtensionItem::RemoveBg::Options, + Imagekit::Internal::AnyHash + ) + end + + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :add_shadow + + sig { params(add_shadow: T::Boolean).void } + attr_writer :add_shadow + + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_color + + sig { params(bg_color: String).void } + attr_writer :bg_color + + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + sig { returns(T.nilable(String)) } + attr_reader :bg_image_url + + sig { params(bg_image_url: String).void } + attr_writer :bg_image_url + + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :semitransparency + + sig { params(semitransparency: T::Boolean).void } + attr_writer :semitransparency + + sig do + params( + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Whether to add an artificial shadow to the result. Default is false. Note: + # Adding shadows is currently only supported for car photos. + add_shadow: nil, + # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + # empty. + bg_color: nil, + # Sets a background image from a URL. If this parameter is set, `bg_color` must be + # empty. + bg_image_url: nil, + # Allows semi-transparent regions in the result. Default is true. Note: + # Semitransparency is currently only supported for car windows. + semitransparency: nil + ) + end + + sig do + override.returns( + { + add_shadow: T::Boolean, + bg_color: String, + bg_image_url: String, + semitransparency: T::Boolean + } + ) + end + def to_hash + end + end + end + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::ExtensionItem::AutoTaggingExtension, + Imagekit::Internal::AnyHash + ) + end + + # Maximum number of tags to attach to the asset. + sig { returns(Integer) } + attr_accessor :max_tags + + # Minimum confidence level for tags to be considered valid. + sig { returns(Integer) } + attr_accessor :min_confidence + + # Specifies the auto-tagging extension used. + sig do + returns(Imagekit::ExtensionItem::AutoTaggingExtension::Name::OrSymbol) + end + attr_accessor :name + + sig do + params( + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::ExtensionItem::AutoTaggingExtension::Name::OrSymbol + ).returns(T.attached_class) + end + def self.new( + # Maximum number of tags to attach to the asset. + max_tags:, + # Minimum confidence level for tags to be considered valid. + min_confidence:, + # Specifies the auto-tagging extension used. + name: + ) + end + + sig do + override.returns( + { + max_tags: Integer, + min_confidence: Integer, + name: + Imagekit::ExtensionItem::AutoTaggingExtension::Name::OrSymbol + } + ) + end + def to_hash + end + + # Specifies the auto-tagging extension used. + module Name + extend Imagekit::Internal::Type::Enum + + TaggedSymbol = + T.type_alias do + T.all(Symbol, Imagekit::ExtensionItem::AutoTaggingExtension::Name) + end + OrSymbol = T.type_alias { T.any(Symbol, String) } + + GOOGLE_AUTO_TAGGING = + T.let( + :"google-auto-tagging", + Imagekit::ExtensionItem::AutoTaggingExtension::Name::TaggedSymbol + ) + AWS_AUTO_TAGGING = + T.let( + :"aws-auto-tagging", + Imagekit::ExtensionItem::AutoTaggingExtension::Name::TaggedSymbol + ) + + sig do + override.returns( + T::Array[ + Imagekit::ExtensionItem::AutoTaggingExtension::Name::TaggedSymbol + ] + ) + end + def self.values + end + end + end + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::Internal::AnyHash + ) + end + + # Specifies the auto description extension. + sig { returns(Symbol) } + attr_accessor :name + + sig { params(name: Symbol).returns(T.attached_class) } + def self.new( + # Specifies the auto description extension. + name: :"ai-auto-description" + ) + end + + sig { override.returns({ name: Symbol }) } + def to_hash + end + end + + sig { override.returns(T::Array[Imagekit::ExtensionItem::Variants]) } + def self.variants + end + end + + Extensions = + T.let( + Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem], + Imagekit::Internal::Type::Converter + ) + end +end diff --git a/rbi/imagekit/models/file_update_params.rbi b/rbi/imagekit/models/file_update_params.rbi index bbe71faf..1660ce17 100644 --- a/rbi/imagekit/models/file_update_params.rbi +++ b/rbi/imagekit/models/file_update_params.rbi @@ -110,9 +110,9 @@ module Imagekit T.nilable( T::Array[ T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension ) ] ) @@ -125,9 +125,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::OrHash, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription::OrHash, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ] ).void @@ -171,9 +171,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::OrHash, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription::OrHash, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ], remove_ai_tags: T.any(T::Array[String], Symbol), @@ -223,9 +223,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension ) ], remove_ai_tags: T.any(T::Array[String], Symbol), @@ -237,284 +237,6 @@ module Imagekit def to_hash end - module Extension - extend Imagekit::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension - ) - end - - class RemoveBg < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg, - Imagekit::Internal::AnyHash - ) - end - - # Specifies the background removal extension. - sig { returns(Symbol) } - attr_accessor :name - - sig do - returns( - T.nilable( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options - ) - ) - end - attr_reader :options - - sig do - params( - options: - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options::OrHash - ).void - end - attr_writer :options - - sig do - params( - options: - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options::OrHash, - name: Symbol - ).returns(T.attached_class) - end - def self.new( - options: nil, - # Specifies the background removal extension. - name: :"remove-bg" - ) - end - - sig do - override.returns( - { - name: Symbol, - options: - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options - } - ) - end - def to_hash - end - - class Options < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options, - Imagekit::Internal::AnyHash - ) - end - - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :add_shadow - - sig { params(add_shadow: T::Boolean).void } - attr_writer :add_shadow - - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - sig { returns(T.nilable(String)) } - attr_reader :bg_color - - sig { params(bg_color: String).void } - attr_writer :bg_color - - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - sig { returns(T.nilable(String)) } - attr_reader :bg_image_url - - sig { params(bg_image_url: String).void } - attr_writer :bg_image_url - - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :semitransparency - - sig { params(semitransparency: T::Boolean).void } - attr_writer :semitransparency - - sig do - params( - add_shadow: T::Boolean, - bg_color: String, - bg_image_url: String, - semitransparency: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - add_shadow: nil, - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - bg_color: nil, - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - bg_image_url: nil, - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - semitransparency: nil - ) - end - - sig do - override.returns( - { - add_shadow: T::Boolean, - bg_color: String, - bg_image_url: String, - semitransparency: T::Boolean - } - ) - end - def to_hash - end - end - end - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension, - Imagekit::Internal::AnyHash - ) - end - - # Maximum number of tags to attach to the asset. - sig { returns(Integer) } - attr_accessor :max_tags - - # Minimum confidence level for tags to be considered valid. - sig { returns(Integer) } - attr_accessor :min_confidence - - # Specifies the auto-tagging extension used. - sig do - returns( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::OrSymbol - ) - end - attr_accessor :name - - sig do - params( - max_tags: Integer, - min_confidence: Integer, - name: - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::OrSymbol - ).returns(T.attached_class) - end - def self.new( - # Maximum number of tags to attach to the asset. - max_tags:, - # Minimum confidence level for tags to be considered valid. - min_confidence:, - # Specifies the auto-tagging extension used. - name: - ) - end - - sig do - override.returns( - { - max_tags: Integer, - min_confidence: Integer, - name: - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::OrSymbol - } - ) - end - def to_hash - end - - # Specifies the auto-tagging extension used. - module Name - extend Imagekit::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - GOOGLE_AUTO_TAGGING = - T.let( - :"google-auto-tagging", - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::TaggedSymbol - ) - AWS_AUTO_TAGGING = - T.let( - :"aws-auto-tagging", - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::Name::TaggedSymbol - ] - ) - end - def self.values - end - end - end - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription, - Imagekit::Internal::AnyHash - ) - end - - # Specifies the auto description extension. - sig { returns(Symbol) } - attr_accessor :name - - sig { params(name: Symbol).returns(T.attached_class) } - def self.new( - # Specifies the auto description extension. - name: :"ai-auto-description" - ) - end - - sig { override.returns({ name: Symbol }) } - def to_hash - end - end - - sig do - override.returns( - T::Array[ - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::Variants - ] - ) - end - def self.variants - end - end - # An array of AITags associated with the file that you want to remove, e.g. # `["car", "vehicle", "motorsports"]`. # diff --git a/rbi/imagekit/models/file_upload_params.rbi b/rbi/imagekit/models/file_upload_params.rbi index 14b9033d..3c74f2da 100644 --- a/rbi/imagekit/models/file_upload_params.rbi +++ b/rbi/imagekit/models/file_upload_params.rbi @@ -101,9 +101,9 @@ module Imagekit T.nilable( T::Array[ T.any( - Imagekit::FileUploadParams::Extension::RemoveBg, - Imagekit::FileUploadParams::Extension::AIAutoDescription, - Imagekit::FileUploadParams::Extension::AutoTaggingExtension + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension ) ] ) @@ -116,9 +116,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::FileUploadParams::Extension::RemoveBg::OrHash, - Imagekit::FileUploadParams::Extension::AIAutoDescription::OrHash, - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ] ).void @@ -301,9 +301,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::FileUploadParams::Extension::RemoveBg::OrHash, - Imagekit::FileUploadParams::Extension::AIAutoDescription::OrHash, - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ], folder: String, @@ -473,9 +473,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::FileUploadParams::Extension::RemoveBg, - Imagekit::FileUploadParams::Extension::AIAutoDescription, - Imagekit::FileUploadParams::Extension::AutoTaggingExtension + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension ) ], folder: String, @@ -500,282 +500,6 @@ module Imagekit def to_hash end - module Extension - extend Imagekit::Internal::Type::Union - - Variants = - T.type_alias do - T.any( - Imagekit::FileUploadParams::Extension::RemoveBg, - Imagekit::FileUploadParams::Extension::AIAutoDescription, - Imagekit::FileUploadParams::Extension::AutoTaggingExtension - ) - end - - class RemoveBg < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUploadParams::Extension::RemoveBg, - Imagekit::Internal::AnyHash - ) - end - - # Specifies the background removal extension. - sig { returns(Symbol) } - attr_accessor :name - - sig do - returns( - T.nilable( - Imagekit::FileUploadParams::Extension::RemoveBg::Options - ) - ) - end - attr_reader :options - - sig do - params( - options: - Imagekit::FileUploadParams::Extension::RemoveBg::Options::OrHash - ).void - end - attr_writer :options - - sig do - params( - options: - Imagekit::FileUploadParams::Extension::RemoveBg::Options::OrHash, - name: Symbol - ).returns(T.attached_class) - end - def self.new( - options: nil, - # Specifies the background removal extension. - name: :"remove-bg" - ) - end - - sig do - override.returns( - { - name: Symbol, - options: - Imagekit::FileUploadParams::Extension::RemoveBg::Options - } - ) - end - def to_hash - end - - class Options < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUploadParams::Extension::RemoveBg::Options, - Imagekit::Internal::AnyHash - ) - end - - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :add_shadow - - sig { params(add_shadow: T::Boolean).void } - attr_writer :add_shadow - - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - sig { returns(T.nilable(String)) } - attr_reader :bg_color - - sig { params(bg_color: String).void } - attr_writer :bg_color - - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - sig { returns(T.nilable(String)) } - attr_reader :bg_image_url - - sig { params(bg_image_url: String).void } - attr_writer :bg_image_url - - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :semitransparency - - sig { params(semitransparency: T::Boolean).void } - attr_writer :semitransparency - - sig do - params( - add_shadow: T::Boolean, - bg_color: String, - bg_image_url: String, - semitransparency: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Whether to add an artificial shadow to the result. Default is false. Note: - # Adding shadows is currently only supported for car photos. - add_shadow: nil, - # Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or - # color name (e.g., "green"). If this parameter is set, `bg_image_url` must be - # empty. - bg_color: nil, - # Sets a background image from a URL. If this parameter is set, `bg_color` must be - # empty. - bg_image_url: nil, - # Allows semi-transparent regions in the result. Default is true. Note: - # Semitransparency is currently only supported for car windows. - semitransparency: nil - ) - end - - sig do - override.returns( - { - add_shadow: T::Boolean, - bg_color: String, - bg_image_url: String, - semitransparency: T::Boolean - } - ) - end - def to_hash - end - end - end - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUploadParams::Extension::AutoTaggingExtension, - Imagekit::Internal::AnyHash - ) - end - - # Maximum number of tags to attach to the asset. - sig { returns(Integer) } - attr_accessor :max_tags - - # Minimum confidence level for tags to be considered valid. - sig { returns(Integer) } - attr_accessor :min_confidence - - # Specifies the auto-tagging extension used. - sig do - returns( - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol - ) - end - attr_accessor :name - - sig do - params( - max_tags: Integer, - min_confidence: Integer, - name: - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol - ).returns(T.attached_class) - end - def self.new( - # Maximum number of tags to attach to the asset. - max_tags:, - # Minimum confidence level for tags to be considered valid. - min_confidence:, - # Specifies the auto-tagging extension used. - name: - ) - end - - sig do - override.returns( - { - max_tags: Integer, - min_confidence: Integer, - name: - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::OrSymbol - } - ) - end - def to_hash - end - - # Specifies the auto-tagging extension used. - module Name - extend Imagekit::Internal::Type::Enum - - TaggedSymbol = - T.type_alias do - T.all( - Symbol, - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name - ) - end - OrSymbol = T.type_alias { T.any(Symbol, String) } - - GOOGLE_AUTO_TAGGING = - T.let( - :"google-auto-tagging", - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol - ) - AWS_AUTO_TAGGING = - T.let( - :"aws-auto-tagging", - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol - ) - - sig do - override.returns( - T::Array[ - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::Name::TaggedSymbol - ] - ) - end - def self.values - end - end - end - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUploadParams::Extension::AIAutoDescription, - Imagekit::Internal::AnyHash - ) - end - - # Specifies the auto description extension. - sig { returns(Symbol) } - attr_accessor :name - - sig { params(name: Symbol).returns(T.attached_class) } - def self.new( - # Specifies the auto description extension. - name: :"ai-auto-description" - ) - end - - sig { override.returns({ name: Symbol }) } - def to_hash - end - end - - sig do - override.returns( - T::Array[Imagekit::FileUploadParams::Extension::Variants] - ) - end - def self.variants - end - end - module ResponseField extend Imagekit::Internal::Type::Enum diff --git a/rbi/imagekit/resources/beta/v2/files.rbi b/rbi/imagekit/resources/beta/v2/files.rbi index 7dca87db..b78dc1c3 100644 --- a/rbi/imagekit/resources/beta/v2/files.rbi +++ b/rbi/imagekit/resources/beta/v2/files.rbi @@ -44,9 +44,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::OrHash, - Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription::OrHash, - Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ], folder: String, diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 3ca11dc7..e31ba244 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -200,9 +200,9 @@ module Imagekit extensions: T::Array[ T.any( - Imagekit::FileUploadParams::Extension::RemoveBg::OrHash, - Imagekit::FileUploadParams::Extension::AIAutoDescription::OrHash, - Imagekit::FileUploadParams::Extension::AutoTaggingExtension::OrHash + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash ) ], folder: String, diff --git a/sig/imagekit/models.rbs b/sig/imagekit/models.rbs index 15ef64cd..8228a4e3 100644 --- a/sig/imagekit/models.rbs +++ b/sig/imagekit/models.rbs @@ -21,6 +21,10 @@ module Imagekit class CustomMetadataFieldUpdateParams = Imagekit::Models::CustomMetadataFieldUpdateParams + type extension_item = Imagekit::Models::extension_item + + Extensions: Imagekit::Internal::Type::Converter + class File = Imagekit::Models::File class FileCopyParams = Imagekit::Models::FileCopyParams diff --git a/sig/imagekit/models/beta/v2/file_upload_params.rbs b/sig/imagekit/models/beta/v2/file_upload_params.rbs index 0546ac88..d9f7ef7f 100644 --- a/sig/imagekit/models/beta/v2/file_upload_params.rbs +++ b/sig/imagekit/models/beta/v2/file_upload_params.rbs @@ -11,7 +11,7 @@ module Imagekit custom_coordinates: String, custom_metadata: ::Hash[Symbol, top], description: String, - extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + extensions: Imagekit::Models::extensions, folder: String, is_private_file: bool, is_published: bool, @@ -55,11 +55,11 @@ module Imagekit def description=: (String) -> String - attr_reader extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension]? + attr_reader extensions: Imagekit::Models::extensions? def extensions=: ( - ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension] - ) -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension] + Imagekit::Models::extensions + ) -> Imagekit::Models::extensions attr_reader folder: String? @@ -121,7 +121,7 @@ module Imagekit ?custom_coordinates: String, ?custom_metadata: ::Hash[Symbol, top], ?description: String, - ?extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + ?extensions: Imagekit::Models::extensions, ?folder: String, ?is_private_file: bool, ?is_published: bool, @@ -145,7 +145,7 @@ module Imagekit custom_coordinates: String, custom_metadata: ::Hash[Symbol, top], description: String, - extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + extensions: Imagekit::Models::extensions, folder: String, is_private_file: bool, is_published: bool, @@ -161,131 +161,6 @@ module Imagekit request_options: Imagekit::RequestOptions } - type extension = - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg - | Imagekit::Beta::V2::FileUploadParams::Extension::AIAutoDescription - | Imagekit::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension - - module Extension - extend Imagekit::Internal::Type::Union - - type remove_bg = - { - name: :"remove-bg", - options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options - } - - class RemoveBg < Imagekit::Internal::Type::BaseModel - attr_accessor name: :"remove-bg" - - attr_reader options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options? - - def options=: ( - Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options - ) -> Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options - - def initialize: ( - ?options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options, - ?name: :"remove-bg" - ) -> void - - def to_hash: -> { - name: :"remove-bg", - options: Imagekit::Beta::V2::FileUploadParams::Extension::RemoveBg::Options - } - - type options = - { - add_shadow: bool, - bg_color: String, - bg_image_url: String, - semitransparency: bool - } - - class Options < Imagekit::Internal::Type::BaseModel - attr_reader add_shadow: bool? - - def add_shadow=: (bool) -> bool - - attr_reader bg_color: String? - - def bg_color=: (String) -> String - - attr_reader bg_image_url: String? - - def bg_image_url=: (String) -> String - - attr_reader semitransparency: bool? - - def semitransparency=: (bool) -> bool - - def initialize: ( - ?add_shadow: bool, - ?bg_color: String, - ?bg_image_url: String, - ?semitransparency: bool - ) -> void - - def to_hash: -> { - add_shadow: bool, - bg_color: String, - bg_image_url: String, - semitransparency: bool - } - end - end - - type auto_tagging_extension = - { - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ - } - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - attr_accessor max_tags: Integer - - attr_accessor min_confidence: Integer - - attr_accessor name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ - - def initialize: ( - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ - ) -> void - - def to_hash: -> { - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_ - } - - type name_ = :"google-auto-tagging" | :"aws-auto-tagging" - - module Name - extend Imagekit::Internal::Type::Enum - - GOOGLE_AUTO_TAGGING: :"google-auto-tagging" - AWS_AUTO_TAGGING: :"aws-auto-tagging" - - def self?.values: -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::Extension::AutoTaggingExtension::name_] - end - end - - type ai_auto_description = { name: :"ai-auto-description" } - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - attr_accessor name: :"ai-auto-description" - - def initialize: (?name: :"ai-auto-description") -> void - - def to_hash: -> { name: :"ai-auto-description" } - end - - def self?.variants: -> ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension] - end - type response_field = :tags | :customCoordinates diff --git a/sig/imagekit/models/extensions.rbs b/sig/imagekit/models/extensions.rbs new file mode 100644 index 00000000..783d12ea --- /dev/null +++ b/sig/imagekit/models/extensions.rbs @@ -0,0 +1,132 @@ +module Imagekit + module Models + type extension_item = + Imagekit::ExtensionItem::RemoveBg + | Imagekit::ExtensionItem::AIAutoDescription + | Imagekit::ExtensionItem::AutoTaggingExtension + + module ExtensionItem + extend Imagekit::Internal::Type::Union + + type remove_bg = + { + name: :"remove-bg", + options: Imagekit::ExtensionItem::RemoveBg::Options + } + + class RemoveBg < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"remove-bg" + + attr_reader options: Imagekit::ExtensionItem::RemoveBg::Options? + + def options=: ( + Imagekit::ExtensionItem::RemoveBg::Options + ) -> Imagekit::ExtensionItem::RemoveBg::Options + + def initialize: ( + ?options: Imagekit::ExtensionItem::RemoveBg::Options, + ?name: :"remove-bg" + ) -> void + + def to_hash: -> { + name: :"remove-bg", + options: Imagekit::ExtensionItem::RemoveBg::Options + } + + type options = + { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + + class Options < Imagekit::Internal::Type::BaseModel + attr_reader add_shadow: bool? + + def add_shadow=: (bool) -> bool + + attr_reader bg_color: String? + + def bg_color=: (String) -> String + + attr_reader bg_image_url: String? + + def bg_image_url=: (String) -> String + + attr_reader semitransparency: bool? + + def semitransparency=: (bool) -> bool + + def initialize: ( + ?add_shadow: bool, + ?bg_color: String, + ?bg_image_url: String, + ?semitransparency: bool + ) -> void + + def to_hash: -> { + add_shadow: bool, + bg_color: String, + bg_image_url: String, + semitransparency: bool + } + end + end + + type auto_tagging_extension = + { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::ExtensionItem::AutoTaggingExtension::name_ + } + + class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel + attr_accessor max_tags: Integer + + attr_accessor min_confidence: Integer + + attr_accessor name: Imagekit::Models::ExtensionItem::AutoTaggingExtension::name_ + + def initialize: ( + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::ExtensionItem::AutoTaggingExtension::name_ + ) -> void + + def to_hash: -> { + max_tags: Integer, + min_confidence: Integer, + name: Imagekit::Models::ExtensionItem::AutoTaggingExtension::name_ + } + + type name_ = :"google-auto-tagging" | :"aws-auto-tagging" + + module Name + extend Imagekit::Internal::Type::Enum + + GOOGLE_AUTO_TAGGING: :"google-auto-tagging" + AWS_AUTO_TAGGING: :"aws-auto-tagging" + + def self?.values: -> ::Array[Imagekit::Models::ExtensionItem::AutoTaggingExtension::name_] + end + end + + type ai_auto_description = { name: :"ai-auto-description" } + + class AIAutoDescription < Imagekit::Internal::Type::BaseModel + attr_accessor name: :"ai-auto-description" + + def initialize: (?name: :"ai-auto-description") -> void + + def to_hash: -> { name: :"ai-auto-description" } + end + + def self?.variants: -> ::Array[Imagekit::Models::extension_item] + end + + type extensions = ::Array[Imagekit::Models::extension_item] + + Extensions: Imagekit::Internal::Type::Converter + end +end diff --git a/sig/imagekit/models/file_update_params.rbs b/sig/imagekit/models/file_update_params.rbs index 3ffb7254..3b3bc454 100644 --- a/sig/imagekit/models/file_update_params.rbs +++ b/sig/imagekit/models/file_update_params.rbs @@ -36,7 +36,7 @@ module Imagekit custom_coordinates: String?, custom_metadata: ::Hash[Symbol, top], description: String, - extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension], + extensions: Imagekit::Models::extensions, remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, tags: ::Array[String]?, webhook_url: String @@ -53,11 +53,11 @@ module Imagekit def description=: (String) -> String - attr_reader extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension]? + attr_reader extensions: Imagekit::Models::extensions? def extensions=: ( - ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension] - ) -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension] + Imagekit::Models::extensions + ) -> Imagekit::Models::extensions attr_reader remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags? @@ -75,7 +75,7 @@ module Imagekit ?custom_coordinates: String?, ?custom_metadata: ::Hash[Symbol, top], ?description: String, - ?extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension], + ?extensions: Imagekit::Models::extensions, ?remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, ?tags: ::Array[String]?, ?webhook_url: String @@ -85,137 +85,12 @@ module Imagekit custom_coordinates: String?, custom_metadata: ::Hash[Symbol, top], description: String, - extensions: ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension], + extensions: Imagekit::Models::extensions, remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, tags: ::Array[String]?, webhook_url: String } - type extension = - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg - | Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AIAutoDescription - | Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension - - module Extension - extend Imagekit::Internal::Type::Union - - type remove_bg = - { - name: :"remove-bg", - options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options - } - - class RemoveBg < Imagekit::Internal::Type::BaseModel - attr_accessor name: :"remove-bg" - - attr_reader options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options? - - def options=: ( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options - ) -> Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options - - def initialize: ( - ?options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options, - ?name: :"remove-bg" - ) -> void - - def to_hash: -> { - name: :"remove-bg", - options: Imagekit::FileUpdateParams::Update::UpdateFileDetails::Extension::RemoveBg::Options - } - - type options = - { - add_shadow: bool, - bg_color: String, - bg_image_url: String, - semitransparency: bool - } - - class Options < Imagekit::Internal::Type::BaseModel - attr_reader add_shadow: bool? - - def add_shadow=: (bool) -> bool - - attr_reader bg_color: String? - - def bg_color=: (String) -> String - - attr_reader bg_image_url: String? - - def bg_image_url=: (String) -> String - - attr_reader semitransparency: bool? - - def semitransparency=: (bool) -> bool - - def initialize: ( - ?add_shadow: bool, - ?bg_color: String, - ?bg_image_url: String, - ?semitransparency: bool - ) -> void - - def to_hash: -> { - add_shadow: bool, - bg_color: String, - bg_image_url: String, - semitransparency: bool - } - end - end - - type auto_tagging_extension = - { - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ - } - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - attr_accessor max_tags: Integer - - attr_accessor min_confidence: Integer - - attr_accessor name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ - - def initialize: ( - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ - ) -> void - - def to_hash: -> { - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_ - } - - type name_ = :"google-auto-tagging" | :"aws-auto-tagging" - - module Name - extend Imagekit::Internal::Type::Enum - - GOOGLE_AUTO_TAGGING: :"google-auto-tagging" - AWS_AUTO_TAGGING: :"aws-auto-tagging" - - def self?.values: -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::Extension::AutoTaggingExtension::name_] - end - end - - type ai_auto_description = { name: :"ai-auto-description" } - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - attr_accessor name: :"ai-auto-description" - - def initialize: (?name: :"ai-auto-description") -> void - - def to_hash: -> { name: :"ai-auto-description" } - end - - def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::extension] - end - type remove_ai_tags = ::Array[String] | :all module RemoveAITags diff --git a/sig/imagekit/models/file_upload_params.rbs b/sig/imagekit/models/file_upload_params.rbs index 4a2ea622..62ca0281 100644 --- a/sig/imagekit/models/file_upload_params.rbs +++ b/sig/imagekit/models/file_upload_params.rbs @@ -10,7 +10,7 @@ module Imagekit custom_metadata: ::Hash[Symbol, top], description: String, expire: Integer, - extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + extensions: Imagekit::Models::extensions, folder: String, is_private_file: bool, is_published: bool, @@ -60,11 +60,11 @@ module Imagekit def expire=: (Integer) -> Integer - attr_reader extensions: ::Array[Imagekit::Models::FileUploadParams::extension]? + attr_reader extensions: Imagekit::Models::extensions? def extensions=: ( - ::Array[Imagekit::Models::FileUploadParams::extension] - ) -> ::Array[Imagekit::Models::FileUploadParams::extension] + Imagekit::Models::extensions + ) -> Imagekit::Models::extensions attr_reader folder: String? @@ -135,7 +135,7 @@ module Imagekit ?custom_metadata: ::Hash[Symbol, top], ?description: String, ?expire: Integer, - ?extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + ?extensions: Imagekit::Models::extensions, ?folder: String, ?is_private_file: bool, ?is_published: bool, @@ -162,7 +162,7 @@ module Imagekit custom_metadata: ::Hash[Symbol, top], description: String, expire: Integer, - extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + extensions: Imagekit::Models::extensions, folder: String, is_private_file: bool, is_published: bool, @@ -180,131 +180,6 @@ module Imagekit request_options: Imagekit::RequestOptions } - type extension = - Imagekit::FileUploadParams::Extension::RemoveBg - | Imagekit::FileUploadParams::Extension::AIAutoDescription - | Imagekit::FileUploadParams::Extension::AutoTaggingExtension - - module Extension - extend Imagekit::Internal::Type::Union - - type remove_bg = - { - name: :"remove-bg", - options: Imagekit::FileUploadParams::Extension::RemoveBg::Options - } - - class RemoveBg < Imagekit::Internal::Type::BaseModel - attr_accessor name: :"remove-bg" - - attr_reader options: Imagekit::FileUploadParams::Extension::RemoveBg::Options? - - def options=: ( - Imagekit::FileUploadParams::Extension::RemoveBg::Options - ) -> Imagekit::FileUploadParams::Extension::RemoveBg::Options - - def initialize: ( - ?options: Imagekit::FileUploadParams::Extension::RemoveBg::Options, - ?name: :"remove-bg" - ) -> void - - def to_hash: -> { - name: :"remove-bg", - options: Imagekit::FileUploadParams::Extension::RemoveBg::Options - } - - type options = - { - add_shadow: bool, - bg_color: String, - bg_image_url: String, - semitransparency: bool - } - - class Options < Imagekit::Internal::Type::BaseModel - attr_reader add_shadow: bool? - - def add_shadow=: (bool) -> bool - - attr_reader bg_color: String? - - def bg_color=: (String) -> String - - attr_reader bg_image_url: String? - - def bg_image_url=: (String) -> String - - attr_reader semitransparency: bool? - - def semitransparency=: (bool) -> bool - - def initialize: ( - ?add_shadow: bool, - ?bg_color: String, - ?bg_image_url: String, - ?semitransparency: bool - ) -> void - - def to_hash: -> { - add_shadow: bool, - bg_color: String, - bg_image_url: String, - semitransparency: bool - } - end - end - - type auto_tagging_extension = - { - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ - } - - class AutoTaggingExtension < Imagekit::Internal::Type::BaseModel - attr_accessor max_tags: Integer - - attr_accessor min_confidence: Integer - - attr_accessor name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ - - def initialize: ( - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ - ) -> void - - def to_hash: -> { - max_tags: Integer, - min_confidence: Integer, - name: Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_ - } - - type name_ = :"google-auto-tagging" | :"aws-auto-tagging" - - module Name - extend Imagekit::Internal::Type::Enum - - GOOGLE_AUTO_TAGGING: :"google-auto-tagging" - AWS_AUTO_TAGGING: :"aws-auto-tagging" - - def self?.values: -> ::Array[Imagekit::Models::FileUploadParams::Extension::AutoTaggingExtension::name_] - end - end - - type ai_auto_description = { name: :"ai-auto-description" } - - class AIAutoDescription < Imagekit::Internal::Type::BaseModel - attr_accessor name: :"ai-auto-description" - - def initialize: (?name: :"ai-auto-description") -> void - - def to_hash: -> { name: :"ai-auto-description" } - end - - def self?.variants: -> ::Array[Imagekit::Models::FileUploadParams::extension] - end - type response_field = :tags | :customCoordinates diff --git a/sig/imagekit/resources/beta/v2/files.rbs b/sig/imagekit/resources/beta/v2/files.rbs index 1bc818b9..a2d266ae 100644 --- a/sig/imagekit/resources/beta/v2/files.rbs +++ b/sig/imagekit/resources/beta/v2/files.rbs @@ -11,7 +11,7 @@ module Imagekit ?custom_coordinates: String, ?custom_metadata: ::Hash[Symbol, top], ?description: String, - ?extensions: ::Array[Imagekit::Models::Beta::V2::FileUploadParams::extension], + ?extensions: Imagekit::Models::extensions, ?folder: String, ?is_private_file: bool, ?is_published: bool, diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 991b1f14..ca0f846d 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -52,7 +52,7 @@ module Imagekit ?custom_metadata: ::Hash[Symbol, top], ?description: String, ?expire: Integer, - ?extensions: ::Array[Imagekit::Models::FileUploadParams::extension], + ?extensions: Imagekit::Models::extensions, ?folder: String, ?is_private_file: bool, ?is_published: bool, From 54e5bdf49a3a67eb494e7aecfd4f5300f8c07772 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 06:47:13 +0000 Subject: [PATCH 17/32] feat(api): manual updates --- .stats.yml | 2 +- .../models/accounts/origin_create_params.rb | 10 +- .../models/accounts/origin_update_params.rb | 10 +- lib/imagekit/models/file_update_params.rb | 286 +++++----- lib/imagekit/resources/accounts/origins.rb | 22 +- lib/imagekit/resources/files.rb | 20 +- .../models/accounts/origin_create_params.rbi | 57 +- .../models/accounts/origin_update_params.rbi | 57 +- rbi/imagekit/models/file_update_params.rbi | 502 +++++++----------- rbi/imagekit/resources/accounts/origins.rbi | 28 +- rbi/imagekit/resources/files.rbi | 52 +- .../models/accounts/origin_create_params.rbs | 19 +- .../models/accounts/origin_update_params.rbs | 19 +- sig/imagekit/models/file_update_params.rbs | 177 +++--- sig/imagekit/resources/accounts/origins.rbs | 4 +- sig/imagekit/resources/files.rbs | 9 +- .../resources/accounts/origins_test.rb | 28 +- 17 files changed, 651 insertions(+), 651 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2dc65d21..335e38ec 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-0470196862abd722b09f1af798d6f2bcbdeba0f82d1162f57c287b1a43233531.yml openapi_spec_hash: 043dd7c67d741d0034b86f2fc0bce072 -config_hash: da949a1217f48ac01676eab81ca9d1b1 +config_hash: a652d68098d82eaf611a49507fb4b831 diff --git a/lib/imagekit/models/accounts/origin_create_params.rb b/lib/imagekit/models/accounts/origin_create_params.rb index d3f005e4..120fed5d 100644 --- a/lib/imagekit/models/accounts/origin_create_params.rb +++ b/lib/imagekit/models/accounts/origin_create_params.rb @@ -8,7 +8,15 @@ class OriginCreateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - # @!method initialize(request_options: {}) + # @!attribute origin_request + # Schema for origin request resources. + # + # @return [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] + required :origin_request, union: -> { Imagekit::Accounts::OriginRequest } + + # @!method initialize(origin_request:, request_options: {}) + # @param origin_request [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources. + # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/imagekit/models/accounts/origin_update_params.rb b/lib/imagekit/models/accounts/origin_update_params.rb index d97a3cc0..2cbe03a7 100644 --- a/lib/imagekit/models/accounts/origin_update_params.rb +++ b/lib/imagekit/models/accounts/origin_update_params.rb @@ -8,7 +8,15 @@ class OriginUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - # @!method initialize(request_options: {}) + # @!attribute origin_request + # Schema for origin request resources. + # + # @return [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] + required :origin_request, union: -> { Imagekit::Accounts::OriginRequest } + + # @!method initialize(origin_request:, request_options: {}) + # @param origin_request [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources. + # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/imagekit/models/file_update_params.rb b/lib/imagekit/models/file_update_params.rb index 46e3ec4f..043a0f24 100644 --- a/lib/imagekit/models/file_update_params.rb +++ b/lib/imagekit/models/file_update_params.rb @@ -7,172 +7,142 @@ class FileUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - # @!attribute update + # @!attribute custom_coordinates + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. # - # @return [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus, nil] - optional :update, union: -> { Imagekit::FileUpdateParams::Update } + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true - # @!method initialize(update: nil, request_options: {}) - # @param update [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus] + # @!attribute custom_metadata + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. + # + # @return [String, nil] + optional :description, String + + # @!attribute extensions + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + # + # @return [Array, nil] + optional :extensions, -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem] } + + # @!attribute remove_ai_tags + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + # + # @return [Array, Symbol, :all, nil] + optional :remove_ai_tags, + union: -> { + Imagekit::FileUpdateParams::RemoveAITags + }, + api_name: :removeAITags + + # @!attribute tags + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute webhook_url + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + # + # @return [String, nil] + optional :webhook_url, String, api_name: :webhookUrl + + # @!attribute publish + # Configure the publication status of a file and its versions. + # + # @return [Imagekit::Models::FileUpdateParams::Publish, nil] + optional :publish, -> { Imagekit::FileUpdateParams::Publish } + + # @!method initialize(custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil, publish: nil, request_options: {}) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUpdateParams} for more details. + # + # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # + # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car + # + # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + # + # @param publish [Imagekit::Models::FileUpdateParams::Publish] Configure the publication status of a file and its versions. + # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] - module Update + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + module RemoveAITags extend Imagekit::Internal::Type::Union - variant -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails } - - variant -> { Imagekit::FileUpdateParams::Update::ChangePublicationStatus } - - class UpdateFileDetails < Imagekit::Internal::Type::BaseModel - # @!attribute custom_coordinates - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. - # - # @return [String, nil] - optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true - - # @!attribute custom_metadata - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - # - # @return [Hash{Symbol=>Object}, nil] - optional :custom_metadata, - Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], - api_name: :customMetadata - - # @!attribute description - # Optional text to describe the contents of the file. - # - # @return [String, nil] - optional :description, String - - # @!attribute extensions - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. - # - # @return [Array, nil] - optional :extensions, -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem] } - - # @!attribute remove_ai_tags - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - # - # @return [Array, Symbol, :all, nil] - optional :remove_ai_tags, - union: -> { Imagekit::FileUpdateParams::Update::UpdateFileDetails::RemoveAITags }, - api_name: :removeAITags - - # @!attribute tags - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - # - # @return [Array, nil] - optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true - - # @!attribute webhook_url - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - # - # @return [String, nil] - optional :webhook_url, String, api_name: :webhookUrl - - # @!method initialize(custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails} for more - # details. - # - # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, - # - # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va - # - # @param description [String] Optional text to describe the contents of the file. - # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured - # - # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car - # - # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul - # - # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv - - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - # - # @see Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails#remove_ai_tags - module RemoveAITags - extend Imagekit::Internal::Type::Union - - variant -> { Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::RemoveAITags::StringArray } - - variant const: :all - - # @!method self.variants - # @return [Array(Array, Symbol, :all)] - - # @type [Imagekit::Internal::Type::Converter] - StringArray = Imagekit::Internal::Type::ArrayOf[String] - end - end - - class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel - # @!attribute publish - # Configure the publication status of a file and its versions. - # - # @return [Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus::Publish, nil] - optional :publish, -> { Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish } - - # @!method initialize(publish: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus} for more - # details. - # - # @param publish [Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus::Publish] Configure the publication status of a file and its versions. - - # @see Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus#publish - class Publish < Imagekit::Internal::Type::BaseModel - # @!attribute is_published - # Set to `true` to publish the file. Set to `false` to unpublish the file. - # - # @return [Boolean] - required :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished - - # @!attribute include_file_versions - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - # - # @return [Boolean, nil] - optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions - - # @!method initialize(is_published:, include_file_versions: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus::Publish} - # for more details. - # - # Configure the publication status of a file and its versions. - # - # @param is_published [Boolean] Set to `true` to publish the file. Set to `false` to unpublish the file. - # - # @param include_file_versions [Boolean] Set to `true` to publish/unpublish all versions of the file. Set to `false` to p - end - end + variant -> { Imagekit::Models::FileUpdateParams::RemoveAITags::StringArray } + + variant const: :all # @!method self.variants - # @return [Array(Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus)] + # @return [Array(Array, Symbol, :all)] + + # @type [Imagekit::Internal::Type::Converter] + StringArray = Imagekit::Internal::Type::ArrayOf[String] + end + + class Publish < Imagekit::Internal::Type::BaseModel + # @!attribute is_published + # Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @return [Boolean] + required :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute include_file_versions + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + # + # @return [Boolean, nil] + optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions + + # @!method initialize(is_published:, include_file_versions: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::FileUpdateParams::Publish} for more details. + # + # Configure the publication status of a file and its versions. + # + # @param is_published [Boolean] Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @param include_file_versions [Boolean] Set to `true` to publish/unpublish all versions of the file. Set to `false` to p end end end diff --git a/lib/imagekit/resources/accounts/origins.rb b/lib/imagekit/resources/accounts/origins.rb index c4b0cba9..5ae00800 100644 --- a/lib/imagekit/resources/accounts/origins.rb +++ b/lib/imagekit/resources/accounts/origins.rb @@ -7,9 +7,9 @@ class Origins # **Note:** This API is currently in beta. # Creates a new origin and returns the origin object. # - # @overload create(origin:, request_options: {}) + # @overload create(origin_request:, request_options: {}) # - # @param origin [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources. + # @param origin_request [Imagekit::Accounts::OriginRequest] Schema for origin request resources. # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -18,10 +18,15 @@ class Origins # @see Imagekit::Models::Accounts::OriginCreateParams def create(params) parsed, options = Imagekit::Accounts::OriginCreateParams.dump_request(params) + case parsed + in {origin_request: Hash => union, **rest} + parsed = {**rest, **union} + else + end @client.request( method: :post, path: "v1/accounts/origins", - body: parsed[:origin], + body: parsed, model: Imagekit::Accounts::OriginResponse, options: options ) @@ -33,11 +38,11 @@ def create(params) # **Note:** This API is currently in beta. # Updates the origin identified by `id` and returns the updated origin object. # - # @overload update(id, origin:, request_options: {}) + # @overload update(id, origin_request:, request_options: {}) # # @param id [String] Unique identifier for the origin. This is generated by ImageKit when you create # - # @param origin [Imagekit::Models::Accounts::OriginRequest::S3, Imagekit::Models::Accounts::OriginRequest::S3Compatible, Imagekit::Models::Accounts::OriginRequest::CloudinaryBackup, Imagekit::Models::Accounts::OriginRequest::WebFolder, Imagekit::Models::Accounts::OriginRequest::WebProxy, Imagekit::Models::Accounts::OriginRequest::Gcs, Imagekit::Models::Accounts::OriginRequest::AzureBlob, Imagekit::Models::Accounts::OriginRequest::AkeneoPim] Schema for origin request resources. + # @param origin_request [Imagekit::Accounts::OriginRequest] Schema for origin request resources. # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -46,10 +51,15 @@ def create(params) # @see Imagekit::Models::Accounts::OriginUpdateParams def update(id, params) parsed, options = Imagekit::Accounts::OriginUpdateParams.dump_request(params) + case parsed + in {origin_request: Hash => union, **rest} + parsed = {**rest, **union} + else + end @client.request( method: :put, path: ["v1/accounts/origins/%1$s", id], - body: parsed[:origin], + body: parsed, model: Imagekit::Accounts::OriginResponse, options: options ) diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index 1e0d8f83..382667c4 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -19,11 +19,25 @@ class Files # You can update `tags`, `customCoordinates`, `customMetadata`, publication # status, remove existing `AITags` and apply extensions using this API. # - # @overload update(file_id, update: nil, request_options: {}) + # @overload update(file_id, custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil, publish: nil, request_options: {}) # # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc # - # @param update [Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails, Imagekit::Models::FileUpdateParams::Update::ChangePublicationStatus] + # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # + # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car + # + # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + # + # @param publish [Imagekit::Models::FileUpdateParams::Publish] Configure the publication status of a file and its versions. # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -35,7 +49,7 @@ def update(file_id, params = {}) @client.request( method: :patch, path: ["v1/files/%1$s/details", file_id], - body: parsed[:update], + body: parsed, model: Imagekit::Models::FileUpdateResponse, options: options ) diff --git a/rbi/imagekit/models/accounts/origin_create_params.rbi b/rbi/imagekit/models/accounts/origin_create_params.rbi index f53d55e5..96e32302 100644 --- a/rbi/imagekit/models/accounts/origin_create_params.rbi +++ b/rbi/imagekit/models/accounts/origin_create_params.rbi @@ -15,15 +15,64 @@ module Imagekit ) end + # Schema for origin request resources. sig do - params(request_options: Imagekit::RequestOptions::OrHash).returns( - T.attached_class + returns( + T.any( + Imagekit::Accounts::OriginRequest::S3, + Imagekit::Accounts::OriginRequest::S3Compatible, + Imagekit::Accounts::OriginRequest::CloudinaryBackup, + Imagekit::Accounts::OriginRequest::WebFolder, + Imagekit::Accounts::OriginRequest::WebProxy, + Imagekit::Accounts::OriginRequest::Gcs, + Imagekit::Accounts::OriginRequest::AzureBlob, + Imagekit::Accounts::OriginRequest::AkeneoPim + ) ) end - def self.new(request_options: {}) + attr_accessor :origin_request + + sig do + params( + origin_request: + T.any( + Imagekit::Accounts::OriginRequest::S3::OrHash, + Imagekit::Accounts::OriginRequest::S3Compatible::OrHash, + Imagekit::Accounts::OriginRequest::CloudinaryBackup::OrHash, + Imagekit::Accounts::OriginRequest::WebFolder::OrHash, + Imagekit::Accounts::OriginRequest::WebProxy::OrHash, + Imagekit::Accounts::OriginRequest::Gcs::OrHash, + Imagekit::Accounts::OriginRequest::AzureBlob::OrHash, + Imagekit::Accounts::OriginRequest::AkeneoPim::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Schema for origin request resources. + origin_request:, + request_options: {} + ) end - sig { override.returns({ request_options: Imagekit::RequestOptions }) } + sig do + override.returns( + { + origin_request: + T.any( + Imagekit::Accounts::OriginRequest::S3, + Imagekit::Accounts::OriginRequest::S3Compatible, + Imagekit::Accounts::OriginRequest::CloudinaryBackup, + Imagekit::Accounts::OriginRequest::WebFolder, + Imagekit::Accounts::OriginRequest::WebProxy, + Imagekit::Accounts::OriginRequest::Gcs, + Imagekit::Accounts::OriginRequest::AzureBlob, + Imagekit::Accounts::OriginRequest::AkeneoPim + ), + request_options: Imagekit::RequestOptions + } + ) + end def to_hash end end diff --git a/rbi/imagekit/models/accounts/origin_update_params.rbi b/rbi/imagekit/models/accounts/origin_update_params.rbi index 51783397..99f6e6f2 100644 --- a/rbi/imagekit/models/accounts/origin_update_params.rbi +++ b/rbi/imagekit/models/accounts/origin_update_params.rbi @@ -15,15 +15,64 @@ module Imagekit ) end + # Schema for origin request resources. sig do - params(request_options: Imagekit::RequestOptions::OrHash).returns( - T.attached_class + returns( + T.any( + Imagekit::Accounts::OriginRequest::S3, + Imagekit::Accounts::OriginRequest::S3Compatible, + Imagekit::Accounts::OriginRequest::CloudinaryBackup, + Imagekit::Accounts::OriginRequest::WebFolder, + Imagekit::Accounts::OriginRequest::WebProxy, + Imagekit::Accounts::OriginRequest::Gcs, + Imagekit::Accounts::OriginRequest::AzureBlob, + Imagekit::Accounts::OriginRequest::AkeneoPim + ) ) end - def self.new(request_options: {}) + attr_accessor :origin_request + + sig do + params( + origin_request: + T.any( + Imagekit::Accounts::OriginRequest::S3::OrHash, + Imagekit::Accounts::OriginRequest::S3Compatible::OrHash, + Imagekit::Accounts::OriginRequest::CloudinaryBackup::OrHash, + Imagekit::Accounts::OriginRequest::WebFolder::OrHash, + Imagekit::Accounts::OriginRequest::WebProxy::OrHash, + Imagekit::Accounts::OriginRequest::Gcs::OrHash, + Imagekit::Accounts::OriginRequest::AzureBlob::OrHash, + Imagekit::Accounts::OriginRequest::AkeneoPim::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Schema for origin request resources. + origin_request:, + request_options: {} + ) end - sig { override.returns({ request_options: Imagekit::RequestOptions }) } + sig do + override.returns( + { + origin_request: + T.any( + Imagekit::Accounts::OriginRequest::S3, + Imagekit::Accounts::OriginRequest::S3Compatible, + Imagekit::Accounts::OriginRequest::CloudinaryBackup, + Imagekit::Accounts::OriginRequest::WebFolder, + Imagekit::Accounts::OriginRequest::WebProxy, + Imagekit::Accounts::OriginRequest::Gcs, + Imagekit::Accounts::OriginRequest::AzureBlob, + Imagekit::Accounts::OriginRequest::AkeneoPim + ), + request_options: Imagekit::RequestOptions + } + ) + end def to_hash end end diff --git a/rbi/imagekit/models/file_update_params.rbi b/rbi/imagekit/models/file_update_params.rbi index 1660ce17..3f8f60e8 100644 --- a/rbi/imagekit/models/file_update_params.rbi +++ b/rbi/imagekit/models/file_update_params.rbi @@ -11,50 +11,168 @@ module Imagekit T.any(Imagekit::FileUpdateParams, Imagekit::Internal::AnyHash) end + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + sig { returns(T.nilable(String)) } + attr_accessor :custom_coordinates + + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. sig do returns( T.nilable( - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails, - Imagekit::FileUpdateParams::Update::ChangePublicationStatus - ) + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension + ) + ] ) ) end - attr_reader :update + attr_reader :extensions sig do params( - update: - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::OrHash, - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::OrHash - ) + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash + ) + ] ).void end - attr_writer :update + attr_writer :extensions + + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + sig { returns(T.nilable(T.any(T::Array[String], Symbol))) } + attr_reader :remove_ai_tags + + sig { params(remove_ai_tags: T.any(T::Array[String], Symbol)).void } + attr_writer :remove_ai_tags + + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :tags + + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + sig { returns(T.nilable(String)) } + attr_reader :webhook_url + + sig { params(webhook_url: String).void } + attr_writer :webhook_url + + # Configure the publication status of a file and its versions. + sig { returns(T.nilable(Imagekit::FileUpdateParams::Publish)) } + attr_reader :publish + + sig { params(publish: Imagekit::FileUpdateParams::Publish::OrHash).void } + attr_writer :publish sig do params( - update: - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::OrHash, - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::OrHash - ), + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String, + publish: Imagekit::FileUpdateParams::Publish::OrHash, request_options: Imagekit::RequestOptions::OrHash ).returns(T.attached_class) end - def self.new(update: nil, request_options: {}) + def self.new( + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + custom_coordinates: nil, + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + remove_ai_tags: nil, + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + tags: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil, + # Configure the publication status of a file and its versions. + publish: nil, + request_options: {} + ) end sig do override.returns( { - update: - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails, - Imagekit::FileUpdateParams::Update::ChangePublicationStatus - ), + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String, + publish: Imagekit::FileUpdateParams::Publish, request_options: Imagekit::RequestOptions } ) @@ -62,315 +180,77 @@ module Imagekit def to_hash end - module Update + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + module RemoveAITags extend Imagekit::Internal::Type::Union - Variants = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails, - Imagekit::FileUpdateParams::Update::ChangePublicationStatus - ) - end - - class UpdateFileDetails < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails, - Imagekit::Internal::AnyHash - ) - end - - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. - sig { returns(T.nilable(String)) } - attr_accessor :custom_coordinates - - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } - attr_reader :custom_metadata + Variants = T.type_alias { T.any(T::Array[String], Symbol) } - sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } - attr_writer :custom_metadata - - # Optional text to describe the contents of the file. - sig { returns(T.nilable(String)) } - attr_reader :description - - sig { params(description: String).void } - attr_writer :description - - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. - sig do - returns( - T.nilable( - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg, - Imagekit::ExtensionItem::AIAutoDescription, - Imagekit::ExtensionItem::AutoTaggingExtension - ) - ] - ) - ) - end - attr_reader :extensions - - sig do - params( - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg::OrHash, - Imagekit::ExtensionItem::AIAutoDescription::OrHash, - Imagekit::ExtensionItem::AutoTaggingExtension::OrHash - ) - ] - ).void - end - attr_writer :extensions - - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - sig { returns(T.nilable(T.any(T::Array[String], Symbol))) } - attr_reader :remove_ai_tags - - sig { params(remove_ai_tags: T.any(T::Array[String], Symbol)).void } - attr_writer :remove_ai_tags - - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - sig { returns(T.nilable(T::Array[String])) } - attr_accessor :tags - - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - sig { returns(T.nilable(String)) } - attr_reader :webhook_url - - sig { params(webhook_url: String).void } - attr_writer :webhook_url - - sig do - params( - custom_coordinates: T.nilable(String), - custom_metadata: T::Hash[Symbol, T.anything], - description: String, - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg::OrHash, - Imagekit::ExtensionItem::AIAutoDescription::OrHash, - Imagekit::ExtensionItem::AutoTaggingExtension::OrHash - ) - ], - remove_ai_tags: T.any(T::Array[String], Symbol), - tags: T.nilable(T::Array[String]), - webhook_url: String - ).returns(T.attached_class) - end - def self.new( - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. - custom_coordinates: nil, - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - custom_metadata: nil, - # Optional text to describe the contents of the file. - description: nil, - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. - extensions: nil, - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - remove_ai_tags: nil, - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - tags: nil, - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - webhook_url: nil + sig do + override.returns( + T::Array[Imagekit::FileUpdateParams::RemoveAITags::Variants] ) - end - - sig do - override.returns( - { - custom_coordinates: T.nilable(String), - custom_metadata: T::Hash[Symbol, T.anything], - description: String, - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg, - Imagekit::ExtensionItem::AIAutoDescription, - Imagekit::ExtensionItem::AutoTaggingExtension - ) - ], - remove_ai_tags: T.any(T::Array[String], Symbol), - tags: T.nilable(T::Array[String]), - webhook_url: String - } - ) - end - def to_hash - end - - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - module RemoveAITags - extend Imagekit::Internal::Type::Union - - Variants = T.type_alias { T.any(T::Array[String], Symbol) } - - sig do - override.returns( - T::Array[ - Imagekit::FileUpdateParams::Update::UpdateFileDetails::RemoveAITags::Variants - ] - ) - end - def self.variants - end - - StringArray = - T.let( - Imagekit::Internal::Type::ArrayOf[String], - Imagekit::Internal::Type::Converter - ) - end + end + def self.variants end - class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::ChangePublicationStatus, - Imagekit::Internal::AnyHash - ) - end - - # Configure the publication status of a file and its versions. - sig do - returns( - T.nilable( - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish - ) - ) - end - attr_reader :publish - - sig do - params( - publish: - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish::OrHash - ).void - end - attr_writer :publish - - sig do - params( - publish: - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish::OrHash - ).returns(T.attached_class) - end - def self.new( - # Configure the publication status of a file and its versions. - publish: nil + StringArray = + T.let( + Imagekit::Internal::Type::ArrayOf[String], + Imagekit::Internal::Type::Converter ) - end + end - sig do - override.returns( - { - publish: - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish - } + class Publish < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::FileUpdateParams::Publish, + Imagekit::Internal::AnyHash ) end - def to_hash - end - class Publish < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish, - Imagekit::Internal::AnyHash - ) - end - - # Set to `true` to publish the file. Set to `false` to unpublish the file. - sig { returns(T::Boolean) } - attr_accessor :is_published + # Set to `true` to publish the file. Set to `false` to unpublish the file. + sig { returns(T::Boolean) } + attr_accessor :is_published - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :include_file_versions + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_file_versions - sig { params(include_file_versions: T::Boolean).void } - attr_writer :include_file_versions + sig { params(include_file_versions: T::Boolean).void } + attr_writer :include_file_versions - # Configure the publication status of a file and its versions. - sig do - params( - is_published: T::Boolean, - include_file_versions: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Set to `true` to publish the file. Set to `false` to unpublish the file. - is_published:, - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - include_file_versions: nil - ) - end - - sig do - override.returns( - { is_published: T::Boolean, include_file_versions: T::Boolean } - ) - end - def to_hash - end - end + # Configure the publication status of a file and its versions. + sig do + params( + is_published: T::Boolean, + include_file_versions: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Set to `true` to publish the file. Set to `false` to unpublish the file. + is_published:, + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + include_file_versions: nil + ) end sig do override.returns( - T::Array[Imagekit::FileUpdateParams::Update::Variants] + { is_published: T::Boolean, include_file_versions: T::Boolean } ) end - def self.variants + def to_hash end end end diff --git a/rbi/imagekit/resources/accounts/origins.rbi b/rbi/imagekit/resources/accounts/origins.rbi index 5eb4899b..d7489d06 100644 --- a/rbi/imagekit/resources/accounts/origins.rbi +++ b/rbi/imagekit/resources/accounts/origins.rbi @@ -8,23 +8,13 @@ module Imagekit # Creates a new origin and returns the origin object. sig do params( - origin: - T.any( - Imagekit::Accounts::OriginRequest::S3::OrHash, - Imagekit::Accounts::OriginRequest::S3Compatible::OrHash, - Imagekit::Accounts::OriginRequest::CloudinaryBackup::OrHash, - Imagekit::Accounts::OriginRequest::WebFolder::OrHash, - Imagekit::Accounts::OriginRequest::WebProxy::OrHash, - Imagekit::Accounts::OriginRequest::Gcs::OrHash, - Imagekit::Accounts::OriginRequest::AzureBlob::OrHash, - Imagekit::Accounts::OriginRequest::AkeneoPim::OrHash - ), + origin_request: Imagekit::Accounts::OriginRequest, request_options: Imagekit::RequestOptions::OrHash ).returns(Imagekit::Accounts::OriginResponse::Variants) end def create( # Schema for origin request resources. - origin:, + origin_request:, request_options: {} ) end @@ -34,17 +24,7 @@ module Imagekit sig do params( id: String, - origin: - T.any( - Imagekit::Accounts::OriginRequest::S3::OrHash, - Imagekit::Accounts::OriginRequest::S3Compatible::OrHash, - Imagekit::Accounts::OriginRequest::CloudinaryBackup::OrHash, - Imagekit::Accounts::OriginRequest::WebFolder::OrHash, - Imagekit::Accounts::OriginRequest::WebProxy::OrHash, - Imagekit::Accounts::OriginRequest::Gcs::OrHash, - Imagekit::Accounts::OriginRequest::AzureBlob::OrHash, - Imagekit::Accounts::OriginRequest::AkeneoPim::OrHash - ), + origin_request: Imagekit::Accounts::OriginRequest, request_options: Imagekit::RequestOptions::OrHash ).returns(Imagekit::Accounts::OriginResponse::Variants) end @@ -53,7 +33,7 @@ module Imagekit # a new origin. id, # Schema for origin request resources. - origin:, + origin_request:, request_options: {} ) end diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index e31ba244..b8c6513c 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -18,11 +18,21 @@ module Imagekit sig do params( file_id: String, - update: - T.any( - Imagekit::FileUpdateParams::Update::UpdateFileDetails::OrHash, - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::OrHash - ), + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String, + publish: Imagekit::FileUpdateParams::Publish::OrHash, request_options: Imagekit::RequestOptions::OrHash ).returns(Imagekit::Models::FileUpdateResponse) end @@ -30,7 +40,37 @@ module Imagekit # The unique `fileId` of the uploaded file. `fileId` is returned in list and # search assets API and upload API. file_id, - update: nil, + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + custom_coordinates: nil, + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + remove_ai_tags: nil, + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + tags: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil, + # Configure the publication status of a file and its versions. + publish: nil, request_options: {} ) end diff --git a/sig/imagekit/models/accounts/origin_create_params.rbs b/sig/imagekit/models/accounts/origin_create_params.rbs index 60ad3272..a51e6472 100644 --- a/sig/imagekit/models/accounts/origin_create_params.rbs +++ b/sig/imagekit/models/accounts/origin_create_params.rbs @@ -2,15 +2,28 @@ module Imagekit module Models module Accounts type origin_create_params = - { } & Imagekit::Internal::Type::request_parameters + { origin_request: Imagekit::Models::Accounts::origin_request } + & Imagekit::Internal::Type::request_parameters class OriginCreateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - def initialize: (?request_options: Imagekit::request_opts) -> void + def origin_request: -> Imagekit::Models::Accounts::origin_request - def to_hash: -> { request_options: Imagekit::RequestOptions } + def origin_request=: ( + Imagekit::Models::Accounts::origin_request _ + ) -> Imagekit::Models::Accounts::origin_request + + def initialize: ( + origin_request: Imagekit::Models::Accounts::origin_request, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + origin_request: Imagekit::Models::Accounts::origin_request, + request_options: Imagekit::RequestOptions + } end end end diff --git a/sig/imagekit/models/accounts/origin_update_params.rbs b/sig/imagekit/models/accounts/origin_update_params.rbs index cb2744ce..e6e08583 100644 --- a/sig/imagekit/models/accounts/origin_update_params.rbs +++ b/sig/imagekit/models/accounts/origin_update_params.rbs @@ -2,15 +2,28 @@ module Imagekit module Models module Accounts type origin_update_params = - { } & Imagekit::Internal::Type::request_parameters + { origin_request: Imagekit::Models::Accounts::origin_request } + & Imagekit::Internal::Type::request_parameters class OriginUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - def initialize: (?request_options: Imagekit::request_opts) -> void + def origin_request: -> Imagekit::Models::Accounts::origin_request - def to_hash: -> { request_options: Imagekit::RequestOptions } + def origin_request=: ( + Imagekit::Models::Accounts::origin_request _ + ) -> Imagekit::Models::Accounts::origin_request + + def initialize: ( + origin_request: Imagekit::Models::Accounts::origin_request, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + origin_request: Imagekit::Models::Accounts::origin_request, + request_options: Imagekit::RequestOptions + } end end end diff --git a/sig/imagekit/models/file_update_params.rbs b/sig/imagekit/models/file_update_params.rbs index 3b3bc454..dad939dc 100644 --- a/sig/imagekit/models/file_update_params.rbs +++ b/sig/imagekit/models/file_update_params.rbs @@ -1,146 +1,105 @@ module Imagekit module Models type file_update_params = - { update: Imagekit::Models::FileUpdateParams::update } + { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: Imagekit::Models::extensions, + remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String, + publish: Imagekit::FileUpdateParams::Publish + } & Imagekit::Internal::Type::request_parameters class FileUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_reader update: Imagekit::Models::FileUpdateParams::update? - - def update=: ( - Imagekit::Models::FileUpdateParams::update - ) -> Imagekit::Models::FileUpdateParams::update - - def initialize: ( - ?update: Imagekit::Models::FileUpdateParams::update, - ?request_options: Imagekit::request_opts - ) -> void - - def to_hash: -> { - update: Imagekit::Models::FileUpdateParams::update, - request_options: Imagekit::RequestOptions - } - - type update = - Imagekit::FileUpdateParams::Update::UpdateFileDetails - | Imagekit::FileUpdateParams::Update::ChangePublicationStatus - - module Update - extend Imagekit::Internal::Type::Union - - type update_file_details = - { - custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], - description: String, - extensions: Imagekit::Models::extensions, - remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, - tags: ::Array[String]?, - webhook_url: String - } + attr_accessor custom_coordinates: String? - class UpdateFileDetails < Imagekit::Internal::Type::BaseModel - attr_accessor custom_coordinates: String? + attr_reader custom_metadata: ::Hash[Symbol, top]? - attr_reader custom_metadata: ::Hash[Symbol, top]? + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] - def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + attr_reader description: String? - attr_reader description: String? + def description=: (String) -> String - def description=: (String) -> String + attr_reader extensions: Imagekit::Models::extensions? - attr_reader extensions: Imagekit::Models::extensions? + def extensions=: ( + Imagekit::Models::extensions + ) -> Imagekit::Models::extensions - def extensions=: ( - Imagekit::Models::extensions - ) -> Imagekit::Models::extensions + attr_reader remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags? - attr_reader remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags? + def remove_ai_tags=: ( + Imagekit::Models::FileUpdateParams::remove_ai_tags + ) -> Imagekit::Models::FileUpdateParams::remove_ai_tags - def remove_ai_tags=: ( - Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags - ) -> Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags + attr_accessor tags: ::Array[String]? - attr_accessor tags: ::Array[String]? + attr_reader webhook_url: String? - attr_reader webhook_url: String? + def webhook_url=: (String) -> String - def webhook_url=: (String) -> String + attr_reader publish: Imagekit::FileUpdateParams::Publish? - def initialize: ( - ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], - ?description: String, - ?extensions: Imagekit::Models::extensions, - ?remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, - ?tags: ::Array[String]?, - ?webhook_url: String - ) -> void + def publish=: ( + Imagekit::FileUpdateParams::Publish + ) -> Imagekit::FileUpdateParams::Publish - def to_hash: -> { - custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], - description: String, - extensions: Imagekit::Models::extensions, - remove_ai_tags: Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags, - tags: ::Array[String]?, - webhook_url: String - } - - type remove_ai_tags = ::Array[String] | :all - - module RemoveAITags - extend Imagekit::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::Update::UpdateFileDetails::remove_ai_tags] - - StringArray: Imagekit::Internal::Type::Converter - end - end - - type change_publication_status = - { - publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish - } + def initialize: ( + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: Imagekit::Models::extensions, + ?remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, + ?tags: ::Array[String]?, + ?webhook_url: String, + ?publish: Imagekit::FileUpdateParams::Publish, + ?request_options: Imagekit::request_opts + ) -> void - class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel - attr_reader publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish? + def to_hash: -> { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: Imagekit::Models::extensions, + remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String, + publish: Imagekit::FileUpdateParams::Publish, + request_options: Imagekit::RequestOptions + } - def publish=: ( - Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish - ) -> Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish + type remove_ai_tags = ::Array[String] | :all - def initialize: ( - ?publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish - ) -> void + module RemoveAITags + extend Imagekit::Internal::Type::Union - def to_hash: -> { - publish: Imagekit::FileUpdateParams::Update::ChangePublicationStatus::Publish - } + def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::remove_ai_tags] - type publish = { is_published: bool, include_file_versions: bool } + StringArray: Imagekit::Internal::Type::Converter + end - class Publish < Imagekit::Internal::Type::BaseModel - attr_accessor is_published: bool + type publish = { is_published: bool, include_file_versions: bool } - attr_reader include_file_versions: bool? + class Publish < Imagekit::Internal::Type::BaseModel + attr_accessor is_published: bool - def include_file_versions=: (bool) -> bool + attr_reader include_file_versions: bool? - def initialize: ( - is_published: bool, - ?include_file_versions: bool - ) -> void + def include_file_versions=: (bool) -> bool - def to_hash: -> { is_published: bool, include_file_versions: bool } - end - end + def initialize: ( + is_published: bool, + ?include_file_versions: bool + ) -> void - def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::update] + def to_hash: -> { is_published: bool, include_file_versions: bool } end end end diff --git a/sig/imagekit/resources/accounts/origins.rbs b/sig/imagekit/resources/accounts/origins.rbs index 3cc90be7..6fe76931 100644 --- a/sig/imagekit/resources/accounts/origins.rbs +++ b/sig/imagekit/resources/accounts/origins.rbs @@ -3,13 +3,13 @@ module Imagekit class Accounts class Origins def create: ( - origin: Imagekit::Models::Accounts::origin_request, + origin_request: Imagekit::Models::Accounts::OriginRequest, ?request_options: Imagekit::request_opts ) -> Imagekit::Models::Accounts::origin_response def update: ( String id, - origin: Imagekit::Models::Accounts::origin_request, + origin_request: Imagekit::Models::Accounts::OriginRequest, ?request_options: Imagekit::request_opts ) -> Imagekit::Models::Accounts::origin_response diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index ca0f846d..496acf8f 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -9,7 +9,14 @@ module Imagekit def update: ( String file_id, - ?update: Imagekit::Models::FileUpdateParams::update, + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: Imagekit::Models::extensions, + ?remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, + ?tags: ::Array[String]?, + ?webhook_url: String, + ?publish: Imagekit::FileUpdateParams::Publish, ?request_options: Imagekit::request_opts ) -> Imagekit::Models::FileUpdateResponse diff --git a/test/imagekit/resources/accounts/origins_test.rb b/test/imagekit/resources/accounts/origins_test.rb index 55df4efe..87930425 100644 --- a/test/imagekit/resources/accounts/origins_test.rb +++ b/test/imagekit/resources/accounts/origins_test.rb @@ -8,13 +8,13 @@ def test_create_required_params response = @image_kit.accounts.origins.create( - origin: { - accessKey: "AKIATEST123", - bucket: "test-bucket", - name: "My S3 Origin", - secretKey: "secrettest123", - type: :S3 - } + base_url: "https://akeneo.company.com", + client_id: "akeneo-client-id", + client_secret: "akeneo-client-secret", + name: "US S3 Storage", + password: "strongpassword123", + type: :AKENEO_PIM, + username: "integration-user" ) assert_pattern do @@ -119,13 +119,13 @@ def test_update_required_params response = @image_kit.accounts.origins.update( "id", - origin: { - accessKey: "AKIATEST123", - bucket: "test-bucket", - name: "My S3 Origin", - secretKey: "secrettest123", - type: :S3 - } + base_url: "https://akeneo.company.com", + client_id: "akeneo-client-id", + client_secret: "akeneo-client-secret", + name: "US S3 Storage", + password: "strongpassword123", + type: :AKENEO_PIM, + username: "integration-user" ) assert_pattern do From a472b9be915ad78a7b9fa5be3368ad8394361852 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:05:29 +0000 Subject: [PATCH 18/32] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 335e38ec..e13d3275 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-0470196862abd722b09f1af798d6f2bcbdeba0f82d1162f57c287b1a43233531.yml -openapi_spec_hash: 043dd7c67d741d0034b86f2fc0bce072 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-afb67c3a2098b1a2dca37d0995d183fa6cf59dd144ed47bcdb924f14e3cc90a3.yml +openapi_spec_hash: 55a2f38df85126a87d1be0b27b9b8470 config_hash: a652d68098d82eaf611a49507fb4b831 From ba5a2111857ec95f2c8f781451c1e8f922edb524 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 07:11:09 +0000 Subject: [PATCH 19/32] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e13d3275..bbfdcb43 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-afb67c3a2098b1a2dca37d0995d183fa6cf59dd144ed47bcdb924f14e3cc90a3.yml -openapi_spec_hash: 55a2f38df85126a87d1be0b27b9b8470 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-bc7c0d27962b30c19c778656988e154b54696819389289f34420a5e5fdfbd3b8.yml +openapi_spec_hash: 1bfde02a63416c036e9545927f727459 config_hash: a652d68098d82eaf611a49507fb4b831 From 9aaa6599d67f4d077d34d0afec3c08baef271b9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 20:07:49 +0000 Subject: [PATCH 20/32] feat(api): extract UpdateFileDetailsRequest to model --- .stats.yml | 2 +- lib/imagekit.rb | 1 + lib/imagekit/models.rb | 2 + lib/imagekit/models/file_update_params.rb | 139 +------- .../models/update_file_details_request.rb | 164 +++++++++ lib/imagekit/resources/files.rb | 25 +- rbi/imagekit/models.rbi | 2 + rbi/imagekit/models/file_update_params.rbi | 235 +------------ .../models/update_file_details_request.rbi | 315 ++++++++++++++++++ rbi/imagekit/resources/files.rbi | 48 +-- sig/imagekit/models.rbs | 2 + sig/imagekit/models/file_update_params.rbs | 90 +---- .../models/update_file_details_request.rbs | 122 +++++++ sig/imagekit/resources/files.rbs | 9 +- 14 files changed, 647 insertions(+), 509 deletions(-) create mode 100644 lib/imagekit/models/update_file_details_request.rb create mode 100644 rbi/imagekit/models/update_file_details_request.rbi create mode 100644 sig/imagekit/models/update_file_details_request.rbs diff --git a/.stats.yml b/.stats.yml index bbfdcb43..b0086e96 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-bc7c0d27962b30c19c778656988e154b54696819389289f34420a5e5fdfbd3b8.yml openapi_spec_hash: 1bfde02a63416c036e9545927f727459 -config_hash: a652d68098d82eaf611a49507fb4b831 +config_hash: b415c06a3b29485af4601beb94ae1aeb diff --git a/lib/imagekit.rb b/lib/imagekit.rb index c831bf55..863d5586 100644 --- a/lib/imagekit.rb +++ b/lib/imagekit.rb @@ -52,6 +52,7 @@ require_relative "imagekit/client" require_relative "imagekit/models/accounts/origin_request" require_relative "imagekit/models/accounts/url_endpoint_request" +require_relative "imagekit/models/update_file_details_request" require_relative "imagekit/models/file" require_relative "imagekit/models/base_overlay" require_relative "imagekit/models/base_webhook_event" diff --git a/lib/imagekit/models.rb b/lib/imagekit/models.rb index 1792d026..eb9ab9d9 100644 --- a/lib/imagekit/models.rb +++ b/lib/imagekit/models.rb @@ -132,6 +132,8 @@ module Imagekit UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent + UpdateFileDetailsRequest = Imagekit::Models::UpdateFileDetailsRequest + UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent UploadPostTransformSuccessEvent = Imagekit::Models::UploadPostTransformSuccessEvent diff --git a/lib/imagekit/models/file_update_params.rb b/lib/imagekit/models/file_update_params.rb index 043a0f24..794b79be 100644 --- a/lib/imagekit/models/file_update_params.rb +++ b/lib/imagekit/models/file_update_params.rb @@ -7,143 +7,14 @@ class FileUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - # @!attribute custom_coordinates - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. + # @!attribute update_file_details_request # - # @return [String, nil] - optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true + # @return [Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails, Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus] + required :update_file_details_request, union: -> { Imagekit::UpdateFileDetailsRequest } - # @!attribute custom_metadata - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - # - # @return [Hash{Symbol=>Object}, nil] - optional :custom_metadata, - Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], - api_name: :customMetadata - - # @!attribute description - # Optional text to describe the contents of the file. - # - # @return [String, nil] - optional :description, String - - # @!attribute extensions - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. - # - # @return [Array, nil] - optional :extensions, -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem] } - - # @!attribute remove_ai_tags - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - # - # @return [Array, Symbol, :all, nil] - optional :remove_ai_tags, - union: -> { - Imagekit::FileUpdateParams::RemoveAITags - }, - api_name: :removeAITags - - # @!attribute tags - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - # - # @return [Array, nil] - optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true - - # @!attribute webhook_url - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - # - # @return [String, nil] - optional :webhook_url, String, api_name: :webhookUrl - - # @!attribute publish - # Configure the publication status of a file and its versions. - # - # @return [Imagekit::Models::FileUpdateParams::Publish, nil] - optional :publish, -> { Imagekit::FileUpdateParams::Publish } - - # @!method initialize(custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil, publish: nil, request_options: {}) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::FileUpdateParams} for more details. - # - # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, - # - # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va - # - # @param description [String] Optional text to describe the contents of the file. - # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured - # - # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car - # - # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul - # - # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv - # - # @param publish [Imagekit::Models::FileUpdateParams::Publish] Configure the publication status of a file and its versions. - # + # @!method initialize(update_file_details_request:, request_options: {}) + # @param update_file_details_request [Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails, Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus] # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] - - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - module RemoveAITags - extend Imagekit::Internal::Type::Union - - variant -> { Imagekit::Models::FileUpdateParams::RemoveAITags::StringArray } - - variant const: :all - - # @!method self.variants - # @return [Array(Array, Symbol, :all)] - - # @type [Imagekit::Internal::Type::Converter] - StringArray = Imagekit::Internal::Type::ArrayOf[String] - end - - class Publish < Imagekit::Internal::Type::BaseModel - # @!attribute is_published - # Set to `true` to publish the file. Set to `false` to unpublish the file. - # - # @return [Boolean] - required :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished - - # @!attribute include_file_versions - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - # - # @return [Boolean, nil] - optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions - - # @!method initialize(is_published:, include_file_versions: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::FileUpdateParams::Publish} for more details. - # - # Configure the publication status of a file and its versions. - # - # @param is_published [Boolean] Set to `true` to publish the file. Set to `false` to unpublish the file. - # - # @param include_file_versions [Boolean] Set to `true` to publish/unpublish all versions of the file. Set to `false` to p - end end end end diff --git a/lib/imagekit/models/update_file_details_request.rb b/lib/imagekit/models/update_file_details_request.rb new file mode 100644 index 00000000..b224fc58 --- /dev/null +++ b/lib/imagekit/models/update_file_details_request.rb @@ -0,0 +1,164 @@ +# frozen_string_literal: true + +module Imagekit + module Models + module UpdateFileDetailsRequest + extend Imagekit::Internal::Type::Union + + variant -> { Imagekit::UpdateFileDetailsRequest::UpdateFileDetails } + + variant -> { Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus } + + class UpdateFileDetails < Imagekit::Internal::Type::BaseModel + # @!attribute custom_coordinates + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + # + # @return [String, nil] + optional :custom_coordinates, String, api_name: :customCoordinates, nil?: true + + # @!attribute custom_metadata + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + # + # @return [Hash{Symbol=>Object}, nil] + optional :custom_metadata, + Imagekit::Internal::Type::HashOf[Imagekit::Internal::Type::Unknown], + api_name: :customMetadata + + # @!attribute description + # Optional text to describe the contents of the file. + # + # @return [String, nil] + optional :description, String + + # @!attribute extensions + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + # + # @return [Array, nil] + optional :extensions, -> { Imagekit::Internal::Type::ArrayOf[union: Imagekit::ExtensionItem] } + + # @!attribute remove_ai_tags + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + # + # @return [Array, Symbol, :all, nil] + optional :remove_ai_tags, + union: -> { Imagekit::UpdateFileDetailsRequest::UpdateFileDetails::RemoveAITags }, + api_name: :removeAITags + + # @!attribute tags + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + # + # @return [Array, nil] + optional :tags, Imagekit::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute webhook_url + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + # + # @return [String, nil] + optional :webhook_url, String, api_name: :webhookUrl + + # @!method initialize(custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails} for more + # details. + # + # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # + # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car + # + # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + # + # @see Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails#remove_ai_tags + module RemoveAITags + extend Imagekit::Internal::Type::Union + + variant -> { Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::RemoveAITags::StringArray } + + variant const: :all + + # @!method self.variants + # @return [Array(Array, Symbol, :all)] + + # @type [Imagekit::Internal::Type::Converter] + StringArray = Imagekit::Internal::Type::ArrayOf[String] + end + end + + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + # @!attribute publish + # Configure the publication status of a file and its versions. + # + # @return [Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus::Publish, nil] + optional :publish, -> { Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish } + + # @!method initialize(publish: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus} for more + # details. + # + # @param publish [Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus::Publish] Configure the publication status of a file and its versions. + + # @see Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus#publish + class Publish < Imagekit::Internal::Type::BaseModel + # @!attribute is_published + # Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @return [Boolean] + required :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute include_file_versions + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + # + # @return [Boolean, nil] + optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions + + # @!method initialize(is_published:, include_file_versions: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus::Publish} + # for more details. + # + # Configure the publication status of a file and its versions. + # + # @param is_published [Boolean] Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @param include_file_versions [Boolean] Set to `true` to publish/unpublish all versions of the file. Set to `false` to p + end + end + + # @!method self.variants + # @return [Array(Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails, Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus)] + end + end +end diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index 382667c4..356144c0 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -19,33 +19,24 @@ class Files # You can update `tags`, `customCoordinates`, `customMetadata`, publication # status, remove existing `AITags` and apply extensions using this API. # - # @overload update(file_id, custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil, publish: nil, request_options: {}) + # @overload update(file_id, update_file_details_request:, request_options: {}) # # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc # - # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, - # - # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va - # - # @param description [String] Optional text to describe the contents of the file. - # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured - # - # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car - # - # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul - # - # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv - # - # @param publish [Imagekit::Models::FileUpdateParams::Publish] Configure the publication status of a file and its versions. + # @param update_file_details_request [Imagekit::UpdateFileDetailsRequest] # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [Imagekit::Models::FileUpdateResponse] # # @see Imagekit::Models::FileUpdateParams - def update(file_id, params = {}) + def update(file_id, params) parsed, options = Imagekit::FileUpdateParams.dump_request(params) + case parsed + in {update_file_details_request: Hash => union, **rest} + parsed = {**rest, **union} + else + end @client.request( method: :patch, path: ["v1/files/%1$s/details", file_id], diff --git a/rbi/imagekit/models.rbi b/rbi/imagekit/models.rbi index 75eeb800..a231e8d1 100644 --- a/rbi/imagekit/models.rbi +++ b/rbi/imagekit/models.rbi @@ -100,6 +100,8 @@ module Imagekit UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent + UpdateFileDetailsRequest = Imagekit::Models::UpdateFileDetailsRequest + UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent diff --git a/rbi/imagekit/models/file_update_params.rbi b/rbi/imagekit/models/file_update_params.rbi index 3f8f60e8..7154df5d 100644 --- a/rbi/imagekit/models/file_update_params.rbi +++ b/rbi/imagekit/models/file_update_params.rbi @@ -11,248 +11,43 @@ module Imagekit T.any(Imagekit::FileUpdateParams, Imagekit::Internal::AnyHash) end - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. - sig { returns(T.nilable(String)) } - attr_accessor :custom_coordinates - - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } - attr_reader :custom_metadata - - sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } - attr_writer :custom_metadata - - # Optional text to describe the contents of the file. - sig { returns(T.nilable(String)) } - attr_reader :description - - sig { params(description: String).void } - attr_writer :description - - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. sig do returns( - T.nilable( - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg, - Imagekit::ExtensionItem::AIAutoDescription, - Imagekit::ExtensionItem::AutoTaggingExtension - ) - ] + T.any( + Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus ) ) end - attr_reader :extensions - - sig do - params( - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg::OrHash, - Imagekit::ExtensionItem::AIAutoDescription::OrHash, - Imagekit::ExtensionItem::AutoTaggingExtension::OrHash - ) - ] - ).void - end - attr_writer :extensions - - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - sig { returns(T.nilable(T.any(T::Array[String], Symbol))) } - attr_reader :remove_ai_tags - - sig { params(remove_ai_tags: T.any(T::Array[String], Symbol)).void } - attr_writer :remove_ai_tags - - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - sig { returns(T.nilable(T::Array[String])) } - attr_accessor :tags - - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - sig { returns(T.nilable(String)) } - attr_reader :webhook_url - - sig { params(webhook_url: String).void } - attr_writer :webhook_url - - # Configure the publication status of a file and its versions. - sig { returns(T.nilable(Imagekit::FileUpdateParams::Publish)) } - attr_reader :publish - - sig { params(publish: Imagekit::FileUpdateParams::Publish::OrHash).void } - attr_writer :publish + attr_accessor :update_file_details_request sig do params( - custom_coordinates: T.nilable(String), - custom_metadata: T::Hash[Symbol, T.anything], - description: String, - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg::OrHash, - Imagekit::ExtensionItem::AIAutoDescription::OrHash, - Imagekit::ExtensionItem::AutoTaggingExtension::OrHash - ) - ], - remove_ai_tags: T.any(T::Array[String], Symbol), - tags: T.nilable(T::Array[String]), - webhook_url: String, - publish: Imagekit::FileUpdateParams::Publish::OrHash, + update_file_details_request: + T.any( + Imagekit::UpdateFileDetailsRequest::UpdateFileDetails::OrHash, + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::OrHash + ), request_options: Imagekit::RequestOptions::OrHash ).returns(T.attached_class) end - def self.new( - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. - custom_coordinates: nil, - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - custom_metadata: nil, - # Optional text to describe the contents of the file. - description: nil, - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. - extensions: nil, - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - remove_ai_tags: nil, - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - tags: nil, - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - webhook_url: nil, - # Configure the publication status of a file and its versions. - publish: nil, - request_options: {} - ) + def self.new(update_file_details_request:, request_options: {}) end sig do override.returns( { - custom_coordinates: T.nilable(String), - custom_metadata: T::Hash[Symbol, T.anything], - description: String, - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg, - Imagekit::ExtensionItem::AIAutoDescription, - Imagekit::ExtensionItem::AutoTaggingExtension - ) - ], - remove_ai_tags: T.any(T::Array[String], Symbol), - tags: T.nilable(T::Array[String]), - webhook_url: String, - publish: Imagekit::FileUpdateParams::Publish, + update_file_details_request: + T.any( + Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus + ), request_options: Imagekit::RequestOptions } ) end def to_hash end - - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - module RemoveAITags - extend Imagekit::Internal::Type::Union - - Variants = T.type_alias { T.any(T::Array[String], Symbol) } - - sig do - override.returns( - T::Array[Imagekit::FileUpdateParams::RemoveAITags::Variants] - ) - end - def self.variants - end - - StringArray = - T.let( - Imagekit::Internal::Type::ArrayOf[String], - Imagekit::Internal::Type::Converter - ) - end - - class Publish < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::FileUpdateParams::Publish, - Imagekit::Internal::AnyHash - ) - end - - # Set to `true` to publish the file. Set to `false` to unpublish the file. - sig { returns(T::Boolean) } - attr_accessor :is_published - - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :include_file_versions - - sig { params(include_file_versions: T::Boolean).void } - attr_writer :include_file_versions - - # Configure the publication status of a file and its versions. - sig do - params( - is_published: T::Boolean, - include_file_versions: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Set to `true` to publish the file. Set to `false` to unpublish the file. - is_published:, - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - include_file_versions: nil - ) - end - - sig do - override.returns( - { is_published: T::Boolean, include_file_versions: T::Boolean } - ) - end - def to_hash - end - end end end end diff --git a/rbi/imagekit/models/update_file_details_request.rbi b/rbi/imagekit/models/update_file_details_request.rbi new file mode 100644 index 00000000..8b8ebba2 --- /dev/null +++ b/rbi/imagekit/models/update_file_details_request.rbi @@ -0,0 +1,315 @@ +# typed: strong + +module Imagekit + module Models + module UpdateFileDetailsRequest + extend Imagekit::Internal::Type::Union + + Variants = + T.type_alias do + T.any( + Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus + ) + end + + class UpdateFileDetails < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, + Imagekit::Internal::AnyHash + ) + end + + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + sig { returns(T.nilable(String)) } + attr_accessor :custom_coordinates + + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_reader :custom_metadata + + sig { params(custom_metadata: T::Hash[Symbol, T.anything]).void } + attr_writer :custom_metadata + + # Optional text to describe the contents of the file. + sig { returns(T.nilable(String)) } + attr_reader :description + + sig { params(description: String).void } + attr_writer :description + + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + sig do + returns( + T.nilable( + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension + ) + ] + ) + ) + end + attr_reader :extensions + + sig do + params( + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash + ) + ] + ).void + end + attr_writer :extensions + + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + sig { returns(T.nilable(T.any(T::Array[String], Symbol))) } + attr_reader :remove_ai_tags + + sig { params(remove_ai_tags: T.any(T::Array[String], Symbol)).void } + attr_writer :remove_ai_tags + + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :tags + + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + sig { returns(T.nilable(String)) } + attr_reader :webhook_url + + sig { params(webhook_url: String).void } + attr_writer :webhook_url + + sig do + params( + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String + ).returns(T.attached_class) + end + def self.new( + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + custom_coordinates: nil, + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + remove_ai_tags: nil, + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + tags: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil + ) + end + + sig do + override.returns( + { + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg, + Imagekit::ExtensionItem::AIAutoDescription, + Imagekit::ExtensionItem::AutoTaggingExtension + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String + } + ) + end + def to_hash + end + + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + module RemoveAITags + extend Imagekit::Internal::Type::Union + + Variants = T.type_alias { T.any(T::Array[String], Symbol) } + + sig do + override.returns( + T::Array[ + Imagekit::UpdateFileDetailsRequest::UpdateFileDetails::RemoveAITags::Variants + ] + ) + end + def self.variants + end + + StringArray = + T.let( + Imagekit::Internal::Type::ArrayOf[String], + Imagekit::Internal::Type::Converter + ) + end + end + + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus, + Imagekit::Internal::AnyHash + ) + end + + # Configure the publication status of a file and its versions. + sig do + returns( + T.nilable( + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish + ) + ) + end + attr_reader :publish + + sig do + params( + publish: + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish::OrHash + ).void + end + attr_writer :publish + + sig do + params( + publish: + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish::OrHash + ).returns(T.attached_class) + end + def self.new( + # Configure the publication status of a file and its versions. + publish: nil + ) + end + + sig do + override.returns( + { + publish: + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish + } + ) + end + def to_hash + end + + class Publish < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish, + Imagekit::Internal::AnyHash + ) + end + + # Set to `true` to publish the file. Set to `false` to unpublish the file. + sig { returns(T::Boolean) } + attr_accessor :is_published + + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_file_versions + + sig { params(include_file_versions: T::Boolean).void } + attr_writer :include_file_versions + + # Configure the publication status of a file and its versions. + sig do + params( + is_published: T::Boolean, + include_file_versions: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Set to `true` to publish the file. Set to `false` to unpublish the file. + is_published:, + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + include_file_versions: nil + ) + end + + sig do + override.returns( + { is_published: T::Boolean, include_file_versions: T::Boolean } + ) + end + def to_hash + end + end + end + + sig do + override.returns(T::Array[Imagekit::UpdateFileDetailsRequest::Variants]) + end + def self.variants + end + end + end +end diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index b8c6513c..33e7e9e3 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -18,21 +18,7 @@ module Imagekit sig do params( file_id: String, - custom_coordinates: T.nilable(String), - custom_metadata: T::Hash[Symbol, T.anything], - description: String, - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg::OrHash, - Imagekit::ExtensionItem::AIAutoDescription::OrHash, - Imagekit::ExtensionItem::AutoTaggingExtension::OrHash - ) - ], - remove_ai_tags: T.any(T::Array[String], Symbol), - tags: T.nilable(T::Array[String]), - webhook_url: String, - publish: Imagekit::FileUpdateParams::Publish::OrHash, + update_file_details_request: Imagekit::UpdateFileDetailsRequest, request_options: Imagekit::RequestOptions::OrHash ).returns(Imagekit::Models::FileUpdateResponse) end @@ -40,37 +26,7 @@ module Imagekit # The unique `fileId` of the uploaded file. `fileId` is returned in list and # search assets API and upload API. file_id, - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. - custom_coordinates: nil, - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - custom_metadata: nil, - # Optional text to describe the contents of the file. - description: nil, - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. - extensions: nil, - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - remove_ai_tags: nil, - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - tags: nil, - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - webhook_url: nil, - # Configure the publication status of a file and its versions. - publish: nil, + update_file_details_request:, request_options: {} ) end diff --git a/sig/imagekit/models.rbs b/sig/imagekit/models.rbs index 8228a4e3..51c5af26 100644 --- a/sig/imagekit/models.rbs +++ b/sig/imagekit/models.rbs @@ -91,6 +91,8 @@ module Imagekit module UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent + module UpdateFileDetailsRequest = Imagekit::Models::UpdateFileDetailsRequest + class UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent class UploadPostTransformSuccessEvent = Imagekit::Models::UploadPostTransformSuccessEvent diff --git a/sig/imagekit/models/file_update_params.rbs b/sig/imagekit/models/file_update_params.rbs index dad939dc..cb64fd0e 100644 --- a/sig/imagekit/models/file_update_params.rbs +++ b/sig/imagekit/models/file_update_params.rbs @@ -2,14 +2,7 @@ module Imagekit module Models type file_update_params = { - custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], - description: String, - extensions: Imagekit::Models::extensions, - remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, - tags: ::Array[String]?, - webhook_url: String, - publish: Imagekit::FileUpdateParams::Publish + update_file_details_request: Imagekit::Models::update_file_details_request } & Imagekit::Internal::Type::request_parameters @@ -17,90 +10,21 @@ module Imagekit extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - attr_accessor custom_coordinates: String? + def update_file_details_request: -> Imagekit::Models::update_file_details_request - attr_reader custom_metadata: ::Hash[Symbol, top]? - - def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] - - attr_reader description: String? - - def description=: (String) -> String - - attr_reader extensions: Imagekit::Models::extensions? - - def extensions=: ( - Imagekit::Models::extensions - ) -> Imagekit::Models::extensions - - attr_reader remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags? - - def remove_ai_tags=: ( - Imagekit::Models::FileUpdateParams::remove_ai_tags - ) -> Imagekit::Models::FileUpdateParams::remove_ai_tags - - attr_accessor tags: ::Array[String]? - - attr_reader webhook_url: String? - - def webhook_url=: (String) -> String - - attr_reader publish: Imagekit::FileUpdateParams::Publish? - - def publish=: ( - Imagekit::FileUpdateParams::Publish - ) -> Imagekit::FileUpdateParams::Publish + def update_file_details_request=: ( + Imagekit::Models::update_file_details_request _ + ) -> Imagekit::Models::update_file_details_request def initialize: ( - ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], - ?description: String, - ?extensions: Imagekit::Models::extensions, - ?remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, - ?tags: ::Array[String]?, - ?webhook_url: String, - ?publish: Imagekit::FileUpdateParams::Publish, + update_file_details_request: Imagekit::Models::update_file_details_request, ?request_options: Imagekit::request_opts ) -> void def to_hash: -> { - custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], - description: String, - extensions: Imagekit::Models::extensions, - remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, - tags: ::Array[String]?, - webhook_url: String, - publish: Imagekit::FileUpdateParams::Publish, + update_file_details_request: Imagekit::Models::update_file_details_request, request_options: Imagekit::RequestOptions } - - type remove_ai_tags = ::Array[String] | :all - - module RemoveAITags - extend Imagekit::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekit::Models::FileUpdateParams::remove_ai_tags] - - StringArray: Imagekit::Internal::Type::Converter - end - - type publish = { is_published: bool, include_file_versions: bool } - - class Publish < Imagekit::Internal::Type::BaseModel - attr_accessor is_published: bool - - attr_reader include_file_versions: bool? - - def include_file_versions=: (bool) -> bool - - def initialize: ( - is_published: bool, - ?include_file_versions: bool - ) -> void - - def to_hash: -> { is_published: bool, include_file_versions: bool } - end end end end diff --git a/sig/imagekit/models/update_file_details_request.rbs b/sig/imagekit/models/update_file_details_request.rbs new file mode 100644 index 00000000..47c46027 --- /dev/null +++ b/sig/imagekit/models/update_file_details_request.rbs @@ -0,0 +1,122 @@ +module Imagekit + module Models + type update_file_details_request = + Imagekit::UpdateFileDetailsRequest::UpdateFileDetails + | Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus + + module UpdateFileDetailsRequest + extend Imagekit::Internal::Type::Union + + type update_file_details = + { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: Imagekit::Models::extensions, + remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String + } + + class UpdateFileDetails < Imagekit::Internal::Type::BaseModel + attr_accessor custom_coordinates: String? + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader extensions: Imagekit::Models::extensions? + + def extensions=: ( + Imagekit::Models::extensions + ) -> Imagekit::Models::extensions + + attr_reader remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags? + + def remove_ai_tags=: ( + Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags + ) -> Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags + + attr_accessor tags: ::Array[String]? + + attr_reader webhook_url: String? + + def webhook_url=: (String) -> String + + def initialize: ( + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: Imagekit::Models::extensions, + ?remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags, + ?tags: ::Array[String]?, + ?webhook_url: String + ) -> void + + def to_hash: -> { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: Imagekit::Models::extensions, + remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String + } + + type remove_ai_tags = ::Array[String] | :all + + module RemoveAITags + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags] + + StringArray: Imagekit::Internal::Type::Converter + end + end + + type change_publication_status = + { + publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish + } + + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + attr_reader publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish? + + def publish=: ( + Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish + ) -> Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish + + def initialize: ( + ?publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish + ) -> void + + def to_hash: -> { + publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish + } + + type publish = { is_published: bool, include_file_versions: bool } + + class Publish < Imagekit::Internal::Type::BaseModel + attr_accessor is_published: bool + + attr_reader include_file_versions: bool? + + def include_file_versions=: (bool) -> bool + + def initialize: ( + is_published: bool, + ?include_file_versions: bool + ) -> void + + def to_hash: -> { is_published: bool, include_file_versions: bool } + end + end + + def self?.variants: -> ::Array[Imagekit::Models::update_file_details_request] + end + end +end diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 496acf8f..973f26df 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -9,14 +9,7 @@ module Imagekit def update: ( String file_id, - ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], - ?description: String, - ?extensions: Imagekit::Models::extensions, - ?remove_ai_tags: Imagekit::Models::FileUpdateParams::remove_ai_tags, - ?tags: ::Array[String]?, - ?webhook_url: String, - ?publish: Imagekit::FileUpdateParams::Publish, + update_file_details_request: Imagekit::Models::UpdateFileDetailsRequest, ?request_options: Imagekit::request_opts ) -> Imagekit::Models::FileUpdateResponse From 72c02c37a42bddc4e191b43145a562fab9e01dc7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 02:15:59 +0000 Subject: [PATCH 21/32] feat: expose response headers for both streams and errors --- lib/imagekit/errors.rb | 36 +++++++++++++------ .../internal/transport/base_client.rb | 18 ++++++---- lib/imagekit/internal/type/base_page.rb | 2 +- lib/imagekit/internal/util.rb | 2 +- rbi/imagekit/errors.rbi | 31 ++++++++++++++-- .../internal/transport/base_client.rbi | 9 +++-- rbi/imagekit/internal/type/base_page.rbi | 2 +- rbi/imagekit/internal/util.rbi | 2 +- sig/imagekit/errors.rbs | 7 ++++ 9 files changed, 80 insertions(+), 29 deletions(-) diff --git a/lib/imagekit/errors.rb b/lib/imagekit/errors.rb index b61fb677..354509a3 100644 --- a/lib/imagekit/errors.rb +++ b/lib/imagekit/errors.rb @@ -40,6 +40,9 @@ class APIError < Imagekit::Errors::Error # @return [Integer, nil] attr_accessor :status + # @return [Hash{String=>String}, nil] + attr_accessor :headers + # @return [Object, nil] attr_accessor :body @@ -47,13 +50,15 @@ class APIError < Imagekit::Errors::Error # # @param url [URI::Generic] # @param status [Integer, nil] + # @param headers [Hash{String=>String}, nil] # @param body [Object, nil] # @param request [nil] # @param response [nil] # @param message [String, nil] - def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil) + def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil) @url = url @status = status + @headers = headers @body = body @request = request @response = response @@ -74,6 +79,7 @@ class APIConnectionError < Imagekit::Errors::APIError # # @param url [URI::Generic] # @param status [nil] + # @param headers [Hash{String=>String}, nil] # @param body [nil] # @param request [nil] # @param response [nil] @@ -81,6 +87,7 @@ class APIConnectionError < Imagekit::Errors::APIError def initialize( url:, status: nil, + headers: nil, body: nil, request: nil, response: nil, @@ -95,6 +102,7 @@ class APITimeoutError < Imagekit::Errors::APIConnectionError # # @param url [URI::Generic] # @param status [nil] + # @param headers [Hash{String=>String}, nil] # @param body [nil] # @param request [nil] # @param response [nil] @@ -102,6 +110,7 @@ class APITimeoutError < Imagekit::Errors::APIConnectionError def initialize( url:, status: nil, + headers: nil, body: nil, request: nil, response: nil, @@ -116,21 +125,24 @@ class APIStatusError < Imagekit::Errors::APIError # # @param url [URI::Generic] # @param status [Integer] + # @param headers [Hash{String=>String}, nil] # @param body [Object, nil] # @param request [nil] # @param response [nil] # @param message [String, nil] # # @return [self] - def self.for(url:, status:, body:, request:, response:, message: nil) - kwargs = { - url: url, - status: status, - body: body, - request: request, - response: response, - message: message - } + def self.for(url:, status:, headers:, body:, request:, response:, message: nil) + kwargs = + { + url: url, + status: status, + headers: headers, + body: body, + request: request, + response: response, + message: message + } case status in 400 @@ -162,15 +174,17 @@ def self.for(url:, status:, body:, request:, response:, message: nil) # # @param url [URI::Generic] # @param status [Integer] + # @param headers [Hash{String=>String}, nil] # @param body [Object, nil] # @param request [nil] # @param response [nil] # @param message [String, nil] - def initialize(url:, status:, body:, request:, response:, message: nil) + def initialize(url:, status:, headers:, body:, request:, response:, message: nil) message ||= {url: url.to_s, status: status, body: body} super( url: url, status: status, + headers: headers, body: body, request: request, response: response, diff --git a/lib/imagekit/internal/transport/base_client.rb b/lib/imagekit/internal/transport/base_client.rb index 3bab4fc6..222a48cf 100644 --- a/lib/imagekit/internal/transport/base_client.rb +++ b/lib/imagekit/internal/transport/base_client.rb @@ -47,7 +47,7 @@ def validate!(req) # @api private # # @param status [Integer] - # @param headers [Hash{String=>String}, Net::HTTPHeader] + # @param headers [Hash{String=>String}] # # @return [Boolean] def should_retry?(status, headers:) @@ -85,7 +85,7 @@ def should_retry?(status, headers:) # # @param status [Integer] # - # @param response_headers [Hash{String=>String}, Net::HTTPHeader] + # @param response_headers [Hash{String=>String}] # # @return [Hash{Symbol=>Object}] def follow_redirect(request, status:, response_headers:) @@ -378,6 +378,7 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:) rescue Imagekit::Errors::APIConnectionError => e status = e end + headers = Imagekit::Internal::Util.normalized_headers(response&.each_header&.to_h) case status in ..299 @@ -390,7 +391,7 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:) in 300..399 self.class.reap_connection!(status, stream: stream) - request = self.class.follow_redirect(request, status: status, response_headers: response) + request = self.class.follow_redirect(request, status: status, response_headers: headers) send_request( request, redirect_count: redirect_count + 1, @@ -399,9 +400,9 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:) ) in Imagekit::Errors::APIConnectionError if retry_count >= max_retries raise status - in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: response) + in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers) decoded = Kernel.then do - Imagekit::Internal::Util.decode_content(response, stream: stream, suppress_error: true) + Imagekit::Internal::Util.decode_content(headers, stream: stream, suppress_error: true) ensure self.class.reap_connection!(status, stream: stream) end @@ -409,6 +410,7 @@ def send_request(request, redirect_count:, retry_count:, send_retry_header:) raise Imagekit::Errors::APIStatusError.for( url: url, status: status, + headers: headers, body: decoded, request: nil, response: response @@ -485,19 +487,21 @@ def request(req) send_retry_header: send_retry_header ) - decoded = Imagekit::Internal::Util.decode_content(response, stream: stream) + headers = Imagekit::Internal::Util.normalized_headers(response.each_header.to_h) + decoded = Imagekit::Internal::Util.decode_content(headers, stream: stream) case req in {stream: Class => st} st.new( model: model, url: url, status: status, + headers: headers, response: response, unwrap: unwrap, stream: decoded ) in {page: Class => page} - page.new(client: self, req: req, headers: response, page_data: decoded) + page.new(client: self, req: req, headers: headers, page_data: decoded) else unwrapped = Imagekit::Internal::Util.dig(decoded, unwrap) Imagekit::Internal::Type::Converter.coerce(model, unwrapped) diff --git a/lib/imagekit/internal/type/base_page.rb b/lib/imagekit/internal/type/base_page.rb index f216334d..37df829b 100644 --- a/lib/imagekit/internal/type/base_page.rb +++ b/lib/imagekit/internal/type/base_page.rb @@ -39,7 +39,7 @@ def to_enum = super(:auto_paging_each) # # @param client [Imagekit::Internal::Transport::BaseClient] # @param req [Hash{Symbol=>Object}] - # @param headers [Hash{String=>String}, Net::HTTPHeader] + # @param headers [Hash{String=>String}] # @param page_data [Object] def initialize(client:, req:, headers:, page_data:) @client = client diff --git a/lib/imagekit/internal/util.rb b/lib/imagekit/internal/util.rb index e1561bc5..14ac714a 100644 --- a/lib/imagekit/internal/util.rb +++ b/lib/imagekit/internal/util.rb @@ -647,7 +647,7 @@ def force_charset!(content_type, text:) # # Assumes each chunk in stream has `Encoding::BINARY`. # - # @param headers [Hash{String=>String}, Net::HTTPHeader] + # @param headers [Hash{String=>String}] # @param stream [Enumerable] # @param suppress_error [Boolean] # diff --git a/rbi/imagekit/errors.rbi b/rbi/imagekit/errors.rbi index 733211e0..c39dffaf 100644 --- a/rbi/imagekit/errors.rbi +++ b/rbi/imagekit/errors.rbi @@ -33,6 +33,9 @@ module Imagekit sig { returns(T.nilable(Integer)) } attr_accessor :status + sig { returns(T.nilable(T::Hash[String, String])) } + attr_accessor :headers + sig { returns(T.nilable(T.anything)) } attr_accessor :body @@ -41,6 +44,7 @@ module Imagekit params( url: URI::Generic, status: T.nilable(Integer), + headers: T.nilable(T::Hash[String, String]), body: T.nilable(Object), request: NilClass, response: NilClass, @@ -50,6 +54,7 @@ module Imagekit def self.new( url:, status: nil, + headers: nil, body: nil, request: nil, response: nil, @@ -70,6 +75,7 @@ module Imagekit params( url: URI::Generic, status: NilClass, + headers: T.nilable(T::Hash[String, String]), body: NilClass, request: NilClass, response: NilClass, @@ -79,6 +85,7 @@ module Imagekit def self.new( url:, status: nil, + headers: nil, body: nil, request: nil, response: nil, @@ -93,6 +100,7 @@ module Imagekit params( url: URI::Generic, status: NilClass, + headers: T.nilable(T::Hash[String, String]), body: NilClass, request: NilClass, response: NilClass, @@ -102,6 +110,7 @@ module Imagekit def self.new( url:, status: nil, + headers: nil, body: nil, request: nil, response: nil, @@ -116,13 +125,22 @@ module Imagekit params( url: URI::Generic, status: Integer, + headers: T.nilable(T::Hash[String, String]), body: T.nilable(Object), request: NilClass, response: NilClass, message: T.nilable(String) ).returns(T.attached_class) end - def self.for(url:, status:, body:, request:, response:, message: nil) + def self.for( + url:, + status:, + headers:, + body:, + request:, + response:, + message: nil + ) end sig { returns(Integer) } @@ -133,13 +151,22 @@ module Imagekit params( url: URI::Generic, status: Integer, + headers: T.nilable(T::Hash[String, String]), body: T.nilable(Object), request: NilClass, response: NilClass, message: T.nilable(String) ).returns(T.attached_class) end - def self.new(url:, status:, body:, request:, response:, message: nil) + def self.new( + url:, + status:, + headers:, + body:, + request:, + response:, + message: nil + ) end end diff --git a/rbi/imagekit/internal/transport/base_client.rbi b/rbi/imagekit/internal/transport/base_client.rbi index 3e5fda85..1c4bbe6b 100644 --- a/rbi/imagekit/internal/transport/base_client.rbi +++ b/rbi/imagekit/internal/transport/base_client.rbi @@ -84,10 +84,9 @@ module Imagekit # @api private sig do - params( - status: Integer, - headers: T.any(T::Hash[String, String], Net::HTTPHeader) - ).returns(T::Boolean) + params(status: Integer, headers: T::Hash[String, String]).returns( + T::Boolean + ) end def should_retry?(status, headers:) end @@ -97,7 +96,7 @@ module Imagekit params( request: Imagekit::Internal::Transport::BaseClient::RequestInput, status: Integer, - response_headers: T.any(T::Hash[String, String], Net::HTTPHeader) + response_headers: T::Hash[String, String] ).returns(Imagekit::Internal::Transport::BaseClient::RequestInput) end def follow_redirect(request, status:, response_headers:) diff --git a/rbi/imagekit/internal/type/base_page.rbi b/rbi/imagekit/internal/type/base_page.rbi index dab911be..b720ff81 100644 --- a/rbi/imagekit/internal/type/base_page.rbi +++ b/rbi/imagekit/internal/type/base_page.rbi @@ -30,7 +30,7 @@ module Imagekit params( client: Imagekit::Internal::Transport::BaseClient, req: Imagekit::Internal::Transport::BaseClient::RequestComponents, - headers: T.any(T::Hash[String, String], Net::HTTPHeader), + headers: T::Hash[String, String], page_data: T.anything ).void end diff --git a/rbi/imagekit/internal/util.rbi b/rbi/imagekit/internal/util.rbi index 268628ae..808c028d 100644 --- a/rbi/imagekit/internal/util.rbi +++ b/rbi/imagekit/internal/util.rbi @@ -361,7 +361,7 @@ module Imagekit # Assumes each chunk in stream has `Encoding::BINARY`. sig do params( - headers: T.any(T::Hash[String, String], Net::HTTPHeader), + headers: T::Hash[String, String], stream: T::Enumerable[String], suppress_error: T::Boolean ).returns(T.anything) diff --git a/sig/imagekit/errors.rbs b/sig/imagekit/errors.rbs index 40508602..c24034f6 100644 --- a/sig/imagekit/errors.rbs +++ b/sig/imagekit/errors.rbs @@ -21,11 +21,14 @@ module Imagekit attr_accessor status: Integer? + attr_accessor headers: ::Hash[String, String]? + attr_accessor body: top? def initialize: ( url: URI::Generic, ?status: Integer?, + ?headers: ::Hash[String, String]?, ?body: Object?, ?request: nil, ?response: nil, @@ -37,6 +40,7 @@ module Imagekit def initialize: ( url: URI::Generic, ?status: nil, + ?headers: ::Hash[String, String]?, ?body: nil, ?request: nil, ?response: nil, @@ -48,6 +52,7 @@ module Imagekit def initialize: ( url: URI::Generic, ?status: nil, + ?headers: ::Hash[String, String]?, ?body: nil, ?request: nil, ?response: nil, @@ -59,6 +64,7 @@ module Imagekit def self.for: ( url: URI::Generic, status: Integer, + headers: ::Hash[String, String]?, body: Object?, request: nil, response: nil, @@ -68,6 +74,7 @@ module Imagekit def initialize: ( url: URI::Generic, status: Integer, + headers: ::Hash[String, String]?, body: Object?, request: nil, response: nil, From 428829bb7d7a3e01621dcb6d9901a1b440481f7c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 12:57:59 +0000 Subject: [PATCH 22/32] feat(api): manual updates --- .stats.yml | 6 +- lib/imagekit.rb | 2 +- lib/imagekit/models.rb | 2 +- lib/imagekit/models/file_update_params.rb | 10 +- ...ails_request.rb => update_file_request.rb} | 60 ++------- lib/imagekit/resources/files.rb | 23 +++- rbi/imagekit/models.rbi | 2 +- rbi/imagekit/models/file_update_params.rbi | 36 +----- ...ls_request.rbi => update_file_request.rbi} | 113 +--------------- rbi/imagekit/resources/files.rbi | 47 ++++++- sig/imagekit/models.rbs | 2 +- sig/imagekit/models/file_update_params.rbs | 23 +--- .../models/update_file_details_request.rbs | 122 ------------------ sig/imagekit/models/update_file_request.rbs | 83 ++++++++++++ sig/imagekit/resources/files.rbs | 9 +- test/imagekit/resources/files_test.rb | 2 +- 16 files changed, 186 insertions(+), 356 deletions(-) rename lib/imagekit/models/{update_file_details_request.rb => update_file_request.rb} (63%) rename rbi/imagekit/models/{update_file_details_request.rbi => update_file_request.rbi} (68%) delete mode 100644 sig/imagekit/models/update_file_details_request.rbs create mode 100644 sig/imagekit/models/update_file_request.rbs diff --git a/.stats.yml b/.stats.yml index b0086e96..bb4a090c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-bc7c0d27962b30c19c778656988e154b54696819389289f34420a5e5fdfbd3b8.yml -openapi_spec_hash: 1bfde02a63416c036e9545927f727459 -config_hash: b415c06a3b29485af4601beb94ae1aeb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-dd864816d7f4316ae89f57394da2fd1926166d4704db5a0bb5d23461d2d75e49.yml +openapi_spec_hash: 7f7c416563a15bbaea98804ecdc1a8f9 +config_hash: 54c05a157f2cc730fac9e1df5dc3ca29 diff --git a/lib/imagekit.rb b/lib/imagekit.rb index 863d5586..a6f92b0c 100644 --- a/lib/imagekit.rb +++ b/lib/imagekit.rb @@ -52,7 +52,7 @@ require_relative "imagekit/client" require_relative "imagekit/models/accounts/origin_request" require_relative "imagekit/models/accounts/url_endpoint_request" -require_relative "imagekit/models/update_file_details_request" +require_relative "imagekit/models/update_file_request" require_relative "imagekit/models/file" require_relative "imagekit/models/base_overlay" require_relative "imagekit/models/base_webhook_event" diff --git a/lib/imagekit/models.rb b/lib/imagekit/models.rb index eb9ab9d9..03ac79a0 100644 --- a/lib/imagekit/models.rb +++ b/lib/imagekit/models.rb @@ -132,7 +132,7 @@ module Imagekit UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent - UpdateFileDetailsRequest = Imagekit::Models::UpdateFileDetailsRequest + UpdateFileRequest = Imagekit::Models::UpdateFileRequest UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent diff --git a/lib/imagekit/models/file_update_params.rb b/lib/imagekit/models/file_update_params.rb index 794b79be..fd8c7342 100644 --- a/lib/imagekit/models/file_update_params.rb +++ b/lib/imagekit/models/file_update_params.rb @@ -3,17 +3,11 @@ module Imagekit module Models # @see Imagekit::Resources::Files#update - class FileUpdateParams < Imagekit::Internal::Type::BaseModel + class FileUpdateParams < Imagekit::Models::UpdateFileRequest extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - # @!attribute update_file_details_request - # - # @return [Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails, Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus] - required :update_file_details_request, union: -> { Imagekit::UpdateFileDetailsRequest } - - # @!method initialize(update_file_details_request:, request_options: {}) - # @param update_file_details_request [Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails, Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus] + # @!method initialize(request_options: {}) # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/imagekit/models/update_file_details_request.rb b/lib/imagekit/models/update_file_request.rb similarity index 63% rename from lib/imagekit/models/update_file_details_request.rb rename to lib/imagekit/models/update_file_request.rb index b224fc58..fc200a35 100644 --- a/lib/imagekit/models/update_file_details_request.rb +++ b/lib/imagekit/models/update_file_request.rb @@ -2,12 +2,13 @@ module Imagekit module Models - module UpdateFileDetailsRequest + # Schema for update file update request. + module UpdateFileRequest extend Imagekit::Internal::Type::Union - variant -> { Imagekit::UpdateFileDetailsRequest::UpdateFileDetails } + variant -> { Imagekit::UpdateFileRequest::UpdateFileDetails } - variant -> { Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus } + variant Imagekit::Internal::Type::Unknown class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # @!attribute custom_coordinates @@ -52,7 +53,7 @@ class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # # @return [Array, Symbol, :all, nil] optional :remove_ai_tags, - union: -> { Imagekit::UpdateFileDetailsRequest::UpdateFileDetails::RemoveAITags }, + union: -> { Imagekit::UpdateFileRequest::UpdateFileDetails::RemoveAITags }, api_name: :removeAITags # @!attribute tags @@ -73,8 +74,7 @@ class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # @!method initialize(custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil) # Some parameter documentations has been truncated, see - # {Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails} for more - # details. + # {Imagekit::Models::UpdateFileRequest::UpdateFileDetails} for more details. # # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, # @@ -99,11 +99,11 @@ class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # Note: The remove operation for `AITags` executes before any of the `extensions` # are processed. # - # @see Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails#remove_ai_tags + # @see Imagekit::Models::UpdateFileRequest::UpdateFileDetails#remove_ai_tags module RemoveAITags extend Imagekit::Internal::Type::Union - variant -> { Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::RemoveAITags::StringArray } + variant -> { Imagekit::Models::UpdateFileRequest::UpdateFileDetails::RemoveAITags::StringArray } variant const: :all @@ -115,50 +115,8 @@ module RemoveAITags end end - class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel - # @!attribute publish - # Configure the publication status of a file and its versions. - # - # @return [Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus::Publish, nil] - optional :publish, -> { Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish } - - # @!method initialize(publish: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus} for more - # details. - # - # @param publish [Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus::Publish] Configure the publication status of a file and its versions. - - # @see Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus#publish - class Publish < Imagekit::Internal::Type::BaseModel - # @!attribute is_published - # Set to `true` to publish the file. Set to `false` to unpublish the file. - # - # @return [Boolean] - required :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished - - # @!attribute include_file_versions - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - # - # @return [Boolean, nil] - optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions - - # @!method initialize(is_published:, include_file_versions: nil) - # Some parameter documentations has been truncated, see - # {Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus::Publish} - # for more details. - # - # Configure the publication status of a file and its versions. - # - # @param is_published [Boolean] Set to `true` to publish the file. Set to `false` to unpublish the file. - # - # @param include_file_versions [Boolean] Set to `true` to publish/unpublish all versions of the file. Set to `false` to p - end - end - # @!method self.variants - # @return [Array(Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails, Imagekit::Models::UpdateFileDetailsRequest::ChangePublicationStatus)] + # @return [Array(Imagekit::Models::UpdateFileRequest::UpdateFileDetails, Object)] end end end diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index 356144c0..9960c440 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -19,11 +19,25 @@ class Files # You can update `tags`, `customCoordinates`, `customMetadata`, publication # status, remove existing `AITags` and apply extensions using this API. # - # @overload update(file_id, update_file_details_request:, request_options: {}) + # @overload update(file_id, body:, custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil, request_options: {}) # # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc # - # @param update_file_details_request [Imagekit::UpdateFileDetailsRequest] + # @param body [Object] + # + # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, + # + # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va + # + # @param description [String] Optional text to describe the contents of the file. + # + # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured + # + # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car + # + # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul + # + # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -32,11 +46,6 @@ class Files # @see Imagekit::Models::FileUpdateParams def update(file_id, params) parsed, options = Imagekit::FileUpdateParams.dump_request(params) - case parsed - in {update_file_details_request: Hash => union, **rest} - parsed = {**rest, **union} - else - end @client.request( method: :patch, path: ["v1/files/%1$s/details", file_id], diff --git a/rbi/imagekit/models.rbi b/rbi/imagekit/models.rbi index a231e8d1..e8fe39e0 100644 --- a/rbi/imagekit/models.rbi +++ b/rbi/imagekit/models.rbi @@ -100,7 +100,7 @@ module Imagekit UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent - UpdateFileDetailsRequest = Imagekit::Models::UpdateFileDetailsRequest + UpdateFileRequest = Imagekit::Models::UpdateFileRequest UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent diff --git a/rbi/imagekit/models/file_update_params.rbi b/rbi/imagekit/models/file_update_params.rbi index 7154df5d..a88e63be 100644 --- a/rbi/imagekit/models/file_update_params.rbi +++ b/rbi/imagekit/models/file_update_params.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class FileUpdateParams < Imagekit::Internal::Type::BaseModel + class FileUpdateParams < Imagekit::Models::UpdateFileRequest extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters @@ -12,40 +12,14 @@ module Imagekit end sig do - returns( - T.any( - Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus - ) + params(request_options: Imagekit::RequestOptions::OrHash).returns( + T.attached_class ) end - attr_accessor :update_file_details_request - - sig do - params( - update_file_details_request: - T.any( - Imagekit::UpdateFileDetailsRequest::UpdateFileDetails::OrHash, - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::OrHash - ), - request_options: Imagekit::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new(update_file_details_request:, request_options: {}) + def self.new(request_options: {}) end - sig do - override.returns( - { - update_file_details_request: - T.any( - Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus - ), - request_options: Imagekit::RequestOptions - } - ) - end + sig { override.returns({ request_options: Imagekit::RequestOptions }) } def to_hash end end diff --git a/rbi/imagekit/models/update_file_details_request.rbi b/rbi/imagekit/models/update_file_request.rbi similarity index 68% rename from rbi/imagekit/models/update_file_details_request.rbi rename to rbi/imagekit/models/update_file_request.rbi index 8b8ebba2..c345c856 100644 --- a/rbi/imagekit/models/update_file_details_request.rbi +++ b/rbi/imagekit/models/update_file_request.rbi @@ -2,22 +2,20 @@ module Imagekit module Models - module UpdateFileDetailsRequest + # Schema for update file update request. + module UpdateFileRequest extend Imagekit::Internal::Type::Union Variants = T.type_alias do - T.any( - Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus - ) + T.any(Imagekit::UpdateFileRequest::UpdateFileDetails, T.anything) end class UpdateFileDetails < Imagekit::Internal::Type::BaseModel OrHash = T.type_alias do T.any( - Imagekit::UpdateFileDetailsRequest::UpdateFileDetails, + Imagekit::UpdateFileRequest::UpdateFileDetails, Imagekit::Internal::AnyHash ) end @@ -193,7 +191,7 @@ module Imagekit sig do override.returns( T::Array[ - Imagekit::UpdateFileDetailsRequest::UpdateFileDetails::RemoveAITags::Variants + Imagekit::UpdateFileRequest::UpdateFileDetails::RemoveAITags::Variants ] ) end @@ -208,106 +206,7 @@ module Imagekit end end - class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus, - Imagekit::Internal::AnyHash - ) - end - - # Configure the publication status of a file and its versions. - sig do - returns( - T.nilable( - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish - ) - ) - end - attr_reader :publish - - sig do - params( - publish: - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish::OrHash - ).void - end - attr_writer :publish - - sig do - params( - publish: - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish::OrHash - ).returns(T.attached_class) - end - def self.new( - # Configure the publication status of a file and its versions. - publish: nil - ) - end - - sig do - override.returns( - { - publish: - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish - } - ) - end - def to_hash - end - - class Publish < Imagekit::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish, - Imagekit::Internal::AnyHash - ) - end - - # Set to `true` to publish the file. Set to `false` to unpublish the file. - sig { returns(T::Boolean) } - attr_accessor :is_published - - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :include_file_versions - - sig { params(include_file_versions: T::Boolean).void } - attr_writer :include_file_versions - - # Configure the publication status of a file and its versions. - sig do - params( - is_published: T::Boolean, - include_file_versions: T::Boolean - ).returns(T.attached_class) - end - def self.new( - # Set to `true` to publish the file. Set to `false` to unpublish the file. - is_published:, - # Set to `true` to publish/unpublish all versions of the file. Set to `false` to - # publish/unpublish only the current version of the file. - include_file_versions: nil - ) - end - - sig do - override.returns( - { is_published: T::Boolean, include_file_versions: T::Boolean } - ) - end - def to_hash - end - end - end - - sig do - override.returns(T::Array[Imagekit::UpdateFileDetailsRequest::Variants]) - end + sig { override.returns(T::Array[Imagekit::UpdateFileRequest::Variants]) } def self.variants end end diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index 33e7e9e3..d5522618 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -18,7 +18,21 @@ module Imagekit sig do params( file_id: String, - update_file_details_request: Imagekit::UpdateFileDetailsRequest, + body: T.anything, + custom_coordinates: T.nilable(String), + custom_metadata: T::Hash[Symbol, T.anything], + description: String, + extensions: + T::Array[ + T.any( + Imagekit::ExtensionItem::RemoveBg::OrHash, + Imagekit::ExtensionItem::AIAutoDescription::OrHash, + Imagekit::ExtensionItem::AutoTaggingExtension::OrHash + ) + ], + remove_ai_tags: T.any(T::Array[String], Symbol), + tags: T.nilable(T::Array[String]), + webhook_url: String, request_options: Imagekit::RequestOptions::OrHash ).returns(Imagekit::Models::FileUpdateResponse) end @@ -26,7 +40,36 @@ module Imagekit # The unique `fileId` of the uploaded file. `fileId` is returned in list and # search assets API and upload API. file_id, - update_file_details_request:, + body:, + # Define an important area in the image in the format `x,y,width,height` e.g. + # `10,10,100,100`. Send `null` to unset this value. + custom_coordinates: nil, + # A key-value data to be associated with the asset. To unset a key, send `null` + # value for that key. Before setting any custom metadata on an asset you have to + # create the field using custom metadata fields API. + custom_metadata: nil, + # Optional text to describe the contents of the file. + description: nil, + # Array of extensions to be applied to the asset. Each extension can be configured + # with specific parameters based on the extension type. + extensions: nil, + # An array of AITags associated with the file that you want to remove, e.g. + # `["car", "vehicle", "motorsports"]`. + # + # If you want to remove all AITags associated with the file, send a string - + # "all". + # + # Note: The remove operation for `AITags` executes before any of the `extensions` + # are processed. + remove_ai_tags: nil, + # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send + # `null` to unset all tags associated with the file. + tags: nil, + # The final status of extensions after they have completed execution will be + # delivered to this endpoint as a POST request. + # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + # about the webhook payload structure. + webhook_url: nil, request_options: {} ) end diff --git a/sig/imagekit/models.rbs b/sig/imagekit/models.rbs index 51c5af26..bd520b8e 100644 --- a/sig/imagekit/models.rbs +++ b/sig/imagekit/models.rbs @@ -91,7 +91,7 @@ module Imagekit module UnwrapWebhookEvent = Imagekit::Models::UnwrapWebhookEvent - module UpdateFileDetailsRequest = Imagekit::Models::UpdateFileDetailsRequest + module UpdateFileRequest = Imagekit::Models::UpdateFileRequest class UploadPostTransformErrorEvent = Imagekit::Models::UploadPostTransformErrorEvent diff --git a/sig/imagekit/models/file_update_params.rbs b/sig/imagekit/models/file_update_params.rbs index cb64fd0e..3bc2f7c8 100644 --- a/sig/imagekit/models/file_update_params.rbs +++ b/sig/imagekit/models/file_update_params.rbs @@ -1,30 +1,15 @@ module Imagekit module Models type file_update_params = - { - update_file_details_request: Imagekit::Models::update_file_details_request - } - & Imagekit::Internal::Type::request_parameters + { } & Imagekit::Internal::Type::request_parameters - class FileUpdateParams < Imagekit::Internal::Type::BaseModel + class FileUpdateParams < Imagekit::Models::UpdateFileRequest extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - def update_file_details_request: -> Imagekit::Models::update_file_details_request + def initialize: (?request_options: Imagekit::request_opts) -> void - def update_file_details_request=: ( - Imagekit::Models::update_file_details_request _ - ) -> Imagekit::Models::update_file_details_request - - def initialize: ( - update_file_details_request: Imagekit::Models::update_file_details_request, - ?request_options: Imagekit::request_opts - ) -> void - - def to_hash: -> { - update_file_details_request: Imagekit::Models::update_file_details_request, - request_options: Imagekit::RequestOptions - } + def to_hash: -> { request_options: Imagekit::RequestOptions } end end end diff --git a/sig/imagekit/models/update_file_details_request.rbs b/sig/imagekit/models/update_file_details_request.rbs deleted file mode 100644 index 47c46027..00000000 --- a/sig/imagekit/models/update_file_details_request.rbs +++ /dev/null @@ -1,122 +0,0 @@ -module Imagekit - module Models - type update_file_details_request = - Imagekit::UpdateFileDetailsRequest::UpdateFileDetails - | Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus - - module UpdateFileDetailsRequest - extend Imagekit::Internal::Type::Union - - type update_file_details = - { - custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], - description: String, - extensions: Imagekit::Models::extensions, - remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags, - tags: ::Array[String]?, - webhook_url: String - } - - class UpdateFileDetails < Imagekit::Internal::Type::BaseModel - attr_accessor custom_coordinates: String? - - attr_reader custom_metadata: ::Hash[Symbol, top]? - - def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] - - attr_reader description: String? - - def description=: (String) -> String - - attr_reader extensions: Imagekit::Models::extensions? - - def extensions=: ( - Imagekit::Models::extensions - ) -> Imagekit::Models::extensions - - attr_reader remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags? - - def remove_ai_tags=: ( - Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags - ) -> Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags - - attr_accessor tags: ::Array[String]? - - attr_reader webhook_url: String? - - def webhook_url=: (String) -> String - - def initialize: ( - ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], - ?description: String, - ?extensions: Imagekit::Models::extensions, - ?remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags, - ?tags: ::Array[String]?, - ?webhook_url: String - ) -> void - - def to_hash: -> { - custom_coordinates: String?, - custom_metadata: ::Hash[Symbol, top], - description: String, - extensions: Imagekit::Models::extensions, - remove_ai_tags: Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags, - tags: ::Array[String]?, - webhook_url: String - } - - type remove_ai_tags = ::Array[String] | :all - - module RemoveAITags - extend Imagekit::Internal::Type::Union - - def self?.variants: -> ::Array[Imagekit::Models::UpdateFileDetailsRequest::UpdateFileDetails::remove_ai_tags] - - StringArray: Imagekit::Internal::Type::Converter - end - end - - type change_publication_status = - { - publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish - } - - class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel - attr_reader publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish? - - def publish=: ( - Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish - ) -> Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish - - def initialize: ( - ?publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish - ) -> void - - def to_hash: -> { - publish: Imagekit::UpdateFileDetailsRequest::ChangePublicationStatus::Publish - } - - type publish = { is_published: bool, include_file_versions: bool } - - class Publish < Imagekit::Internal::Type::BaseModel - attr_accessor is_published: bool - - attr_reader include_file_versions: bool? - - def include_file_versions=: (bool) -> bool - - def initialize: ( - is_published: bool, - ?include_file_versions: bool - ) -> void - - def to_hash: -> { is_published: bool, include_file_versions: bool } - end - end - - def self?.variants: -> ::Array[Imagekit::Models::update_file_details_request] - end - end -end diff --git a/sig/imagekit/models/update_file_request.rbs b/sig/imagekit/models/update_file_request.rbs new file mode 100644 index 00000000..218023a8 --- /dev/null +++ b/sig/imagekit/models/update_file_request.rbs @@ -0,0 +1,83 @@ +module Imagekit + module Models + type update_file_request = + Imagekit::UpdateFileRequest::UpdateFileDetails | top + + module UpdateFileRequest + extend Imagekit::Internal::Type::Union + + type update_file_details = + { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: Imagekit::Models::extensions, + remove_ai_tags: Imagekit::Models::UpdateFileRequest::UpdateFileDetails::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String + } + + class UpdateFileDetails < Imagekit::Internal::Type::BaseModel + attr_accessor custom_coordinates: String? + + attr_reader custom_metadata: ::Hash[Symbol, top]? + + def custom_metadata=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top] + + attr_reader description: String? + + def description=: (String) -> String + + attr_reader extensions: Imagekit::Models::extensions? + + def extensions=: ( + Imagekit::Models::extensions + ) -> Imagekit::Models::extensions + + attr_reader remove_ai_tags: Imagekit::Models::UpdateFileRequest::UpdateFileDetails::remove_ai_tags? + + def remove_ai_tags=: ( + Imagekit::Models::UpdateFileRequest::UpdateFileDetails::remove_ai_tags + ) -> Imagekit::Models::UpdateFileRequest::UpdateFileDetails::remove_ai_tags + + attr_accessor tags: ::Array[String]? + + attr_reader webhook_url: String? + + def webhook_url=: (String) -> String + + def initialize: ( + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: Imagekit::Models::extensions, + ?remove_ai_tags: Imagekit::Models::UpdateFileRequest::UpdateFileDetails::remove_ai_tags, + ?tags: ::Array[String]?, + ?webhook_url: String + ) -> void + + def to_hash: -> { + custom_coordinates: String?, + custom_metadata: ::Hash[Symbol, top], + description: String, + extensions: Imagekit::Models::extensions, + remove_ai_tags: Imagekit::Models::UpdateFileRequest::UpdateFileDetails::remove_ai_tags, + tags: ::Array[String]?, + webhook_url: String + } + + type remove_ai_tags = ::Array[String] | :all + + module RemoveAITags + extend Imagekit::Internal::Type::Union + + def self?.variants: -> ::Array[Imagekit::Models::UpdateFileRequest::UpdateFileDetails::remove_ai_tags] + + StringArray: Imagekit::Internal::Type::Converter + end + end + + def self?.variants: -> ::Array[Imagekit::Models::update_file_request] + end + end +end diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 973f26df..22bf487b 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -9,7 +9,14 @@ module Imagekit def update: ( String file_id, - update_file_details_request: Imagekit::Models::UpdateFileDetailsRequest, + body: top, + ?custom_coordinates: String?, + ?custom_metadata: ::Hash[Symbol, top], + ?description: String, + ?extensions: Imagekit::Models::extensions, + ?remove_ai_tags: Imagekit::Models::UpdateFileRequest::remove_ai_tags, + ?tags: ::Array[String]?, + ?webhook_url: String, ?request_options: Imagekit::request_opts ) -> Imagekit::Models::FileUpdateResponse diff --git a/test/imagekit/resources/files_test.rb b/test/imagekit/resources/files_test.rb index c09eb4bb..dc229400 100644 --- a/test/imagekit/resources/files_test.rb +++ b/test/imagekit/resources/files_test.rb @@ -6,7 +6,7 @@ class Imagekit::Test::Resources::FilesTest < Imagekit::Test::ResourceTest def test_update skip("Prism tests are disabled") - response = @image_kit.files.update("fileId") + response = @image_kit.files.update("fileId", body: {}) assert_pattern do response => Imagekit::Models::FileUpdateResponse From 2f5a40ab9e7c3ffc0755c8c8cbf26bcfe69ab5b0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:02:32 +0000 Subject: [PATCH 23/32] feat(api): manual updates --- .stats.yml | 4 +- lib/imagekit/models/file_update_params.rb | 12 ++- lib/imagekit/models/update_file_request.rb | 45 ++++++++- lib/imagekit/resources/files.rb | 23 ++--- rbi/imagekit/models/file_update_params.rbi | 41 +++++++- rbi/imagekit/models/update_file_request.rbi | 102 +++++++++++++++++++- rbi/imagekit/resources/files.rbi | 48 +-------- sig/imagekit/models/file_update_params.rbs | 21 +++- sig/imagekit/models/update_file_request.rbs | 41 +++++++- sig/imagekit/resources/files.rbs | 9 +- test/imagekit/resources/files_test.rb | 2 +- 11 files changed, 261 insertions(+), 87 deletions(-) diff --git a/.stats.yml b/.stats.yml index bb4a090c..c9c84db9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-dd864816d7f4316ae89f57394da2fd1926166d4704db5a0bb5d23461d2d75e49.yml -openapi_spec_hash: 7f7c416563a15bbaea98804ecdc1a8f9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml +openapi_spec_hash: 1d382866fce3284f26d341f112988d9d config_hash: 54c05a157f2cc730fac9e1df5dc3ca29 diff --git a/lib/imagekit/models/file_update_params.rb b/lib/imagekit/models/file_update_params.rb index fd8c7342..1685dfad 100644 --- a/lib/imagekit/models/file_update_params.rb +++ b/lib/imagekit/models/file_update_params.rb @@ -3,11 +3,19 @@ module Imagekit module Models # @see Imagekit::Resources::Files#update - class FileUpdateParams < Imagekit::Models::UpdateFileRequest + class FileUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - # @!method initialize(request_options: {}) + # @!attribute update_file_request + # Schema for update file update request. + # + # @return [Imagekit::Models::UpdateFileRequest::UpdateFileDetails, Imagekit::Models::UpdateFileRequest::ChangePublicationStatus] + required :update_file_request, union: -> { Imagekit::UpdateFileRequest } + + # @!method initialize(update_file_request:, request_options: {}) + # @param update_file_request [Imagekit::Models::UpdateFileRequest::UpdateFileDetails, Imagekit::Models::UpdateFileRequest::ChangePublicationStatus] Schema for update file update request. + # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}] end end diff --git a/lib/imagekit/models/update_file_request.rb b/lib/imagekit/models/update_file_request.rb index fc200a35..08fcdd07 100644 --- a/lib/imagekit/models/update_file_request.rb +++ b/lib/imagekit/models/update_file_request.rb @@ -8,7 +8,7 @@ module UpdateFileRequest variant -> { Imagekit::UpdateFileRequest::UpdateFileDetails } - variant Imagekit::Internal::Type::Unknown + variant -> { Imagekit::UpdateFileRequest::ChangePublicationStatus } class UpdateFileDetails < Imagekit::Internal::Type::BaseModel # @!attribute custom_coordinates @@ -115,8 +115,49 @@ module RemoveAITags end end + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + # @!attribute publish + # Configure the publication status of a file and its versions. + # + # @return [Imagekit::Models::UpdateFileRequest::ChangePublicationStatus::Publish, nil] + optional :publish, -> { Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish } + + # @!method initialize(publish: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::UpdateFileRequest::ChangePublicationStatus} for more details. + # + # @param publish [Imagekit::Models::UpdateFileRequest::ChangePublicationStatus::Publish] Configure the publication status of a file and its versions. + + # @see Imagekit::Models::UpdateFileRequest::ChangePublicationStatus#publish + class Publish < Imagekit::Internal::Type::BaseModel + # @!attribute is_published + # Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @return [Boolean] + required :is_published, Imagekit::Internal::Type::Boolean, api_name: :isPublished + + # @!attribute include_file_versions + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + # + # @return [Boolean, nil] + optional :include_file_versions, Imagekit::Internal::Type::Boolean, api_name: :includeFileVersions + + # @!method initialize(is_published:, include_file_versions: nil) + # Some parameter documentations has been truncated, see + # {Imagekit::Models::UpdateFileRequest::ChangePublicationStatus::Publish} for more + # details. + # + # Configure the publication status of a file and its versions. + # + # @param is_published [Boolean] Set to `true` to publish the file. Set to `false` to unpublish the file. + # + # @param include_file_versions [Boolean] Set to `true` to publish/unpublish all versions of the file. Set to `false` to p + end + end + # @!method self.variants - # @return [Array(Imagekit::Models::UpdateFileRequest::UpdateFileDetails, Object)] + # @return [Array(Imagekit::Models::UpdateFileRequest::UpdateFileDetails, Imagekit::Models::UpdateFileRequest::ChangePublicationStatus)] end end end diff --git a/lib/imagekit/resources/files.rb b/lib/imagekit/resources/files.rb index 9960c440..2ddc77ef 100644 --- a/lib/imagekit/resources/files.rb +++ b/lib/imagekit/resources/files.rb @@ -19,25 +19,11 @@ class Files # You can update `tags`, `customCoordinates`, `customMetadata`, publication # status, remove existing `AITags` and apply extensions using this API. # - # @overload update(file_id, body:, custom_coordinates: nil, custom_metadata: nil, description: nil, extensions: nil, remove_ai_tags: nil, tags: nil, webhook_url: nil, request_options: {}) + # @overload update(file_id, update_file_request:, request_options: {}) # # @param file_id [String] The unique `fileId` of the uploaded file. `fileId` is returned in list and searc # - # @param body [Object] - # - # @param custom_coordinates [String, nil] Define an important area in the image in the format `x,y,width,height` e.g. `10, - # - # @param custom_metadata [Hash{Symbol=>Object}] A key-value data to be associated with the asset. To unset a key, send `null` va - # - # @param description [String] Optional text to describe the contents of the file. - # - # @param extensions [Array] Array of extensions to be applied to the asset. Each extension can be configured - # - # @param remove_ai_tags [Array, Symbol, :all] An array of AITags associated with the file that you want to remove, e.g. `["car - # - # @param tags [Array, nil] An array of tags associated with the file, such as `["tag1", "tag2"]`. Send `nul - # - # @param webhook_url [String] The final status of extensions after they have completed execution will be deliv + # @param update_file_request [Imagekit::UpdateFileRequest] Schema for update file update request. # # @param request_options [Imagekit::RequestOptions, Hash{Symbol=>Object}, nil] # @@ -46,6 +32,11 @@ class Files # @see Imagekit::Models::FileUpdateParams def update(file_id, params) parsed, options = Imagekit::FileUpdateParams.dump_request(params) + case parsed + in {update_file_request: Hash => union, **rest} + parsed = {**rest, **union} + else + end @client.request( method: :patch, path: ["v1/files/%1$s/details", file_id], diff --git a/rbi/imagekit/models/file_update_params.rbi b/rbi/imagekit/models/file_update_params.rbi index a88e63be..908bd758 100644 --- a/rbi/imagekit/models/file_update_params.rbi +++ b/rbi/imagekit/models/file_update_params.rbi @@ -2,7 +2,7 @@ module Imagekit module Models - class FileUpdateParams < Imagekit::Models::UpdateFileRequest + class FileUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters @@ -11,15 +11,46 @@ module Imagekit T.any(Imagekit::FileUpdateParams, Imagekit::Internal::AnyHash) end + # Schema for update file update request. sig do - params(request_options: Imagekit::RequestOptions::OrHash).returns( - T.attached_class + returns( + T.any( + Imagekit::UpdateFileRequest::UpdateFileDetails, + Imagekit::UpdateFileRequest::ChangePublicationStatus + ) ) end - def self.new(request_options: {}) + attr_accessor :update_file_request + + sig do + params( + update_file_request: + T.any( + Imagekit::UpdateFileRequest::UpdateFileDetails::OrHash, + Imagekit::UpdateFileRequest::ChangePublicationStatus::OrHash + ), + request_options: Imagekit::RequestOptions::OrHash + ).returns(T.attached_class) + end + def self.new( + # Schema for update file update request. + update_file_request:, + request_options: {} + ) end - sig { override.returns({ request_options: Imagekit::RequestOptions }) } + sig do + override.returns( + { + update_file_request: + T.any( + Imagekit::UpdateFileRequest::UpdateFileDetails, + Imagekit::UpdateFileRequest::ChangePublicationStatus + ), + request_options: Imagekit::RequestOptions + } + ) + end def to_hash end end diff --git a/rbi/imagekit/models/update_file_request.rbi b/rbi/imagekit/models/update_file_request.rbi index c345c856..b259bf0e 100644 --- a/rbi/imagekit/models/update_file_request.rbi +++ b/rbi/imagekit/models/update_file_request.rbi @@ -8,7 +8,10 @@ module Imagekit Variants = T.type_alias do - T.any(Imagekit::UpdateFileRequest::UpdateFileDetails, T.anything) + T.any( + Imagekit::UpdateFileRequest::UpdateFileDetails, + Imagekit::UpdateFileRequest::ChangePublicationStatus + ) end class UpdateFileDetails < Imagekit::Internal::Type::BaseModel @@ -206,6 +209,103 @@ module Imagekit end end + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UpdateFileRequest::ChangePublicationStatus, + Imagekit::Internal::AnyHash + ) + end + + # Configure the publication status of a file and its versions. + sig do + returns( + T.nilable( + Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish + ) + ) + end + attr_reader :publish + + sig do + params( + publish: + Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish::OrHash + ).void + end + attr_writer :publish + + sig do + params( + publish: + Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish::OrHash + ).returns(T.attached_class) + end + def self.new( + # Configure the publication status of a file and its versions. + publish: nil + ) + end + + sig do + override.returns( + { + publish: + Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish + } + ) + end + def to_hash + end + + class Publish < Imagekit::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any( + Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish, + Imagekit::Internal::AnyHash + ) + end + + # Set to `true` to publish the file. Set to `false` to unpublish the file. + sig { returns(T::Boolean) } + attr_accessor :is_published + + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :include_file_versions + + sig { params(include_file_versions: T::Boolean).void } + attr_writer :include_file_versions + + # Configure the publication status of a file and its versions. + sig do + params( + is_published: T::Boolean, + include_file_versions: T::Boolean + ).returns(T.attached_class) + end + def self.new( + # Set to `true` to publish the file. Set to `false` to unpublish the file. + is_published:, + # Set to `true` to publish/unpublish all versions of the file. Set to `false` to + # publish/unpublish only the current version of the file. + include_file_versions: nil + ) + end + + sig do + override.returns( + { is_published: T::Boolean, include_file_versions: T::Boolean } + ) + end + def to_hash + end + end + end + sig { override.returns(T::Array[Imagekit::UpdateFileRequest::Variants]) } def self.variants end diff --git a/rbi/imagekit/resources/files.rbi b/rbi/imagekit/resources/files.rbi index d5522618..cec1cf6e 100644 --- a/rbi/imagekit/resources/files.rbi +++ b/rbi/imagekit/resources/files.rbi @@ -18,21 +18,7 @@ module Imagekit sig do params( file_id: String, - body: T.anything, - custom_coordinates: T.nilable(String), - custom_metadata: T::Hash[Symbol, T.anything], - description: String, - extensions: - T::Array[ - T.any( - Imagekit::ExtensionItem::RemoveBg::OrHash, - Imagekit::ExtensionItem::AIAutoDescription::OrHash, - Imagekit::ExtensionItem::AutoTaggingExtension::OrHash - ) - ], - remove_ai_tags: T.any(T::Array[String], Symbol), - tags: T.nilable(T::Array[String]), - webhook_url: String, + update_file_request: Imagekit::UpdateFileRequest, request_options: Imagekit::RequestOptions::OrHash ).returns(Imagekit::Models::FileUpdateResponse) end @@ -40,36 +26,8 @@ module Imagekit # The unique `fileId` of the uploaded file. `fileId` is returned in list and # search assets API and upload API. file_id, - body:, - # Define an important area in the image in the format `x,y,width,height` e.g. - # `10,10,100,100`. Send `null` to unset this value. - custom_coordinates: nil, - # A key-value data to be associated with the asset. To unset a key, send `null` - # value for that key. Before setting any custom metadata on an asset you have to - # create the field using custom metadata fields API. - custom_metadata: nil, - # Optional text to describe the contents of the file. - description: nil, - # Array of extensions to be applied to the asset. Each extension can be configured - # with specific parameters based on the extension type. - extensions: nil, - # An array of AITags associated with the file that you want to remove, e.g. - # `["car", "vehicle", "motorsports"]`. - # - # If you want to remove all AITags associated with the file, send a string - - # "all". - # - # Note: The remove operation for `AITags` executes before any of the `extensions` - # are processed. - remove_ai_tags: nil, - # An array of tags associated with the file, such as `["tag1", "tag2"]`. Send - # `null` to unset all tags associated with the file. - tags: nil, - # The final status of extensions after they have completed execution will be - # delivered to this endpoint as a POST request. - # [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) - # about the webhook payload structure. - webhook_url: nil, + # Schema for update file update request. + update_file_request:, request_options: {} ) end diff --git a/sig/imagekit/models/file_update_params.rbs b/sig/imagekit/models/file_update_params.rbs index 3bc2f7c8..be8da6ac 100644 --- a/sig/imagekit/models/file_update_params.rbs +++ b/sig/imagekit/models/file_update_params.rbs @@ -1,15 +1,28 @@ module Imagekit module Models type file_update_params = - { } & Imagekit::Internal::Type::request_parameters + { update_file_request: Imagekit::Models::update_file_request } + & Imagekit::Internal::Type::request_parameters - class FileUpdateParams < Imagekit::Models::UpdateFileRequest + class FileUpdateParams < Imagekit::Internal::Type::BaseModel extend Imagekit::Internal::Type::RequestParameters::Converter include Imagekit::Internal::Type::RequestParameters - def initialize: (?request_options: Imagekit::request_opts) -> void + def update_file_request: -> Imagekit::Models::update_file_request - def to_hash: -> { request_options: Imagekit::RequestOptions } + def update_file_request=: ( + Imagekit::Models::update_file_request _ + ) -> Imagekit::Models::update_file_request + + def initialize: ( + update_file_request: Imagekit::Models::update_file_request, + ?request_options: Imagekit::request_opts + ) -> void + + def to_hash: -> { + update_file_request: Imagekit::Models::update_file_request, + request_options: Imagekit::RequestOptions + } end end end diff --git a/sig/imagekit/models/update_file_request.rbs b/sig/imagekit/models/update_file_request.rbs index 218023a8..68701252 100644 --- a/sig/imagekit/models/update_file_request.rbs +++ b/sig/imagekit/models/update_file_request.rbs @@ -1,7 +1,8 @@ module Imagekit module Models type update_file_request = - Imagekit::UpdateFileRequest::UpdateFileDetails | top + Imagekit::UpdateFileRequest::UpdateFileDetails + | Imagekit::UpdateFileRequest::ChangePublicationStatus module UpdateFileRequest extend Imagekit::Internal::Type::Union @@ -77,6 +78,44 @@ module Imagekit end end + type change_publication_status = + { + publish: Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish + } + + class ChangePublicationStatus < Imagekit::Internal::Type::BaseModel + attr_reader publish: Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish? + + def publish=: ( + Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish + ) -> Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish + + def initialize: ( + ?publish: Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish + ) -> void + + def to_hash: -> { + publish: Imagekit::UpdateFileRequest::ChangePublicationStatus::Publish + } + + type publish = { is_published: bool, include_file_versions: bool } + + class Publish < Imagekit::Internal::Type::BaseModel + attr_accessor is_published: bool + + attr_reader include_file_versions: bool? + + def include_file_versions=: (bool) -> bool + + def initialize: ( + is_published: bool, + ?include_file_versions: bool + ) -> void + + def to_hash: -> { is_published: bool, include_file_versions: bool } + end + end + def self?.variants: -> ::Array[Imagekit::Models::update_file_request] end end diff --git a/sig/imagekit/resources/files.rbs b/sig/imagekit/resources/files.rbs index 22bf487b..e2c281c0 100644 --- a/sig/imagekit/resources/files.rbs +++ b/sig/imagekit/resources/files.rbs @@ -9,14 +9,7 @@ module Imagekit def update: ( String file_id, - body: top, - ?custom_coordinates: String?, - ?custom_metadata: ::Hash[Symbol, top], - ?description: String, - ?extensions: Imagekit::Models::extensions, - ?remove_ai_tags: Imagekit::Models::UpdateFileRequest::remove_ai_tags, - ?tags: ::Array[String]?, - ?webhook_url: String, + update_file_request: Imagekit::Models::UpdateFileRequest, ?request_options: Imagekit::request_opts ) -> Imagekit::Models::FileUpdateResponse diff --git a/test/imagekit/resources/files_test.rb b/test/imagekit/resources/files_test.rb index dc229400..c09eb4bb 100644 --- a/test/imagekit/resources/files_test.rb +++ b/test/imagekit/resources/files_test.rb @@ -6,7 +6,7 @@ class Imagekit::Test::Resources::FilesTest < Imagekit::Test::ResourceTest def test_update skip("Prism tests are disabled") - response = @image_kit.files.update("fileId", body: {}) + response = @image_kit.files.update("fileId") assert_pattern do response => Imagekit::Models::FileUpdateResponse From f9bee8789b20c3ae42a177e8e7adc086fd6b734a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:38:28 +0000 Subject: [PATCH 24/32] feat(api): manual updates --- .stats.yml | 2 +- README.md | 2 +- lib/imagekit/client.rb | 24 ++++++++++++------------ rbi/imagekit/client.rbi | 14 +++++++------- sig/imagekit/client.rbs | 4 ++-- test/imagekit/client_test.rb | 30 +++++++++++++++--------------- test/imagekit/test_helper.rb | 2 +- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.stats.yml b/.stats.yml index c9c84db9..00fd95da 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml openapi_spec_hash: 1d382866fce3284f26d341f112988d9d -config_hash: 54c05a157f2cc730fac9e1df5dc3ca29 +config_hash: 29a2351fe2be89392b15719be8bc964f diff --git a/README.md b/README.md index 32341ee0..0636e207 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ require "bundler/setup" require "imagekit" image_kit = Imagekit::Client.new( - private_api_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], # This is the default and can be omitted + private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], # This is the default and can be omitted password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) diff --git a/lib/imagekit/client.rb b/lib/imagekit/client.rb index fd57748a..999da4c8 100644 --- a/lib/imagekit/client.rb +++ b/lib/imagekit/client.rb @@ -19,10 +19,10 @@ class Client < Imagekit::Internal::Transport::BaseClient # manage API keys in the # [dashboard](https://imagekit.io/dashboard/developer/api-keys). # @return [String] - attr_reader :private_api_key + attr_reader :private_key - # ImageKit Basic Auth only uses the username field and ignores the password. This - # field is unused. + # ImageKit Basic Auth only uses the `private_key` as username and ignores the + # password. # @return [String, nil] attr_reader :password @@ -54,9 +54,9 @@ class Client < Imagekit::Internal::Transport::BaseClient # # @return [Hash{String=>String}] private def auth_headers - return {} if @private_api_key.nil? || @password.nil? + return {} if @private_key.nil? || @password.nil? - base64_credentials = ["#{@private_api_key}:#{@password}"].pack("m0") + base64_credentials = ["#{@private_key}:#{@password}"].pack("m0") {"authorization" => "Basic #{base64_credentials}"} end @@ -67,13 +67,13 @@ def base_url_overridden? = @base_url_overridden # Creates and returns a new client for interacting with the API. # - # @param private_api_key [String, nil] Your ImageKit private API key (it starts with `private_`). You can view and + # @param private_key [String, nil] Your ImageKit private API key (it starts with `private_`). You can view and # manage API keys in the # [dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults to # `ENV["IMAGEKIT_PRIVATE_API_KEY"]` # - # @param password [String, nil] ImageKit Basic Auth only uses the username field and ignores the password. This - # field is unused. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` + # @param password [String, nil] ImageKit Basic Auth only uses the `private_key` as username and ignores the + # password. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` # # @param base_url [String, nil] Override the default base URL for the API, e.g., # `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]` @@ -86,7 +86,7 @@ def base_url_overridden? = @base_url_overridden # # @param max_retry_delay [Float] def initialize( - private_api_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], + private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"), base_url: ENV["IMAGE_KIT_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, @@ -98,11 +98,11 @@ def initialize( base_url ||= "https://api.imagekit.io" - if private_api_key.nil? - raise ArgumentError.new("private_api_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_API_KEY\"") + if private_key.nil? + raise ArgumentError.new("private_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_API_KEY\"") end - @private_api_key = private_api_key.to_s + @private_key = private_key.to_s @password = password.to_s super( diff --git a/rbi/imagekit/client.rbi b/rbi/imagekit/client.rbi index f290a74d..c97cd45b 100644 --- a/rbi/imagekit/client.rbi +++ b/rbi/imagekit/client.rbi @@ -14,10 +14,10 @@ module Imagekit # manage API keys in the # [dashboard](https://imagekit.io/dashboard/developer/api-keys). sig { returns(String) } - attr_reader :private_api_key + attr_reader :private_key - # ImageKit Basic Auth only uses the username field and ignores the password. This - # field is unused. + # ImageKit Basic Auth only uses the `private_key` as username and ignores the + # password. sig { returns(T.nilable(String)) } attr_reader :password @@ -58,7 +58,7 @@ module Imagekit # Creates and returns a new client for interacting with the API. sig do params( - private_api_key: T.nilable(String), + private_key: T.nilable(String), password: T.nilable(String), base_url: T.nilable(String), max_retries: Integer, @@ -72,9 +72,9 @@ module Imagekit # manage API keys in the # [dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults to # `ENV["IMAGEKIT_PRIVATE_API_KEY"]` - private_api_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], - # ImageKit Basic Auth only uses the username field and ignores the password. This - # field is unused. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` + private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], + # ImageKit Basic Auth only uses the `private_key` as username and ignores the + # password. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"), # Override the default base URL for the API, e.g., # `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]` diff --git a/sig/imagekit/client.rbs b/sig/imagekit/client.rbs index 5e7f6ff8..754fe43e 100644 --- a/sig/imagekit/client.rbs +++ b/sig/imagekit/client.rbs @@ -8,7 +8,7 @@ module Imagekit DEFAULT_MAX_RETRY_DELAY: Float - attr_reader private_api_key: String + attr_reader private_key: String attr_reader password: String? @@ -33,7 +33,7 @@ module Imagekit def base_url_overridden?: -> bool def initialize: ( - ?private_api_key: String?, + ?private_key: String?, ?password: String?, ?base_url: String?, ?max_retries: Integer, diff --git a/test/imagekit/client_test.rb b/test/imagekit/client_test.rb index 22cda48d..5280fad1 100644 --- a/test/imagekit/client_test.rb +++ b/test/imagekit/client_test.rb @@ -40,7 +40,7 @@ def test_client_default_request_default_retry_attempts image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -57,7 +57,7 @@ def test_client_given_request_default_retry_attempts image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password", max_retries: 3 ) @@ -75,7 +75,7 @@ def test_client_default_request_given_retry_attempts image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -96,7 +96,7 @@ def test_client_given_request_given_retry_attempts image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password", max_retries: 3 ) @@ -122,7 +122,7 @@ def test_client_retry_after_seconds image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password", max_retries: 1 ) @@ -145,7 +145,7 @@ def test_client_retry_after_date image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password", max_retries: 1 ) @@ -170,7 +170,7 @@ def test_client_retry_after_ms image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password", max_retries: 1 ) @@ -189,7 +189,7 @@ def test_retry_count_header image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -208,7 +208,7 @@ def test_omit_retry_count_header image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -231,7 +231,7 @@ def test_overwrite_retry_count_header image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -260,7 +260,7 @@ def test_client_redirect_307 image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -298,7 +298,7 @@ def test_client_redirect_303 image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -331,7 +331,7 @@ def test_client_redirect_auth_keep_same_origin image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -367,7 +367,7 @@ def test_client_redirect_auth_strip_cross_origin image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) @@ -391,7 +391,7 @@ def test_default_headers image_kit = Imagekit::Client.new( base_url: "http://localhost", - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) diff --git a/test/imagekit/test_helper.rb b/test/imagekit/test_helper.rb index 92dbd107..56fd104f 100644 --- a/test/imagekit/test_helper.rb +++ b/test/imagekit/test_helper.rb @@ -50,7 +50,7 @@ class Imagekit::Test::SingletonClient < Imagekit::Client def initialize super( base_url: Imagekit::Test::SingletonClient::TEST_API_BASE_URL, - private_api_key: "My Private API Key", + private_key: "My Private Key", password: "My Password" ) end From 0682128a78d935ba01979783050d66aac099504a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:45:53 +0000 Subject: [PATCH 25/32] feat(api): manual updates --- .stats.yml | 2 +- lib/imagekit/client.rb | 23 ++++++++++++----------- rbi/imagekit/client.rbi | 23 ++++++++++++----------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.stats.yml b/.stats.yml index 00fd95da..d3fcabb4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml openapi_spec_hash: 1d382866fce3284f26d341f112988d9d -config_hash: 29a2351fe2be89392b15719be8bc964f +config_hash: c9c7bed2a4341f915a2dc85958ce7f0e diff --git a/lib/imagekit/client.rb b/lib/imagekit/client.rb index 999da4c8..dd58cd05 100644 --- a/lib/imagekit/client.rb +++ b/lib/imagekit/client.rb @@ -15,14 +15,14 @@ class Client < Imagekit::Internal::Transport::BaseClient # Default max retry delay in seconds. DEFAULT_MAX_RETRY_DELAY = 8.0 - # Your ImageKit private API key (it starts with `private_`). You can view and - # manage API keys in the - # [dashboard](https://imagekit.io/dashboard/developer/api-keys). + # Your ImageKit private API key (starts with `private_`). You can find this in the + # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). # @return [String] attr_reader :private_key - # ImageKit Basic Auth only uses the `private_key` as username and ignores the - # password. + # Leave this field unset. ImageKit uses Basic Authentication scheme that requires + # the `private_key` as the username and empty string as the password. The password + # field is automatically managed by the SDK and should not be set. # @return [String, nil] attr_reader :password @@ -67,13 +67,14 @@ def base_url_overridden? = @base_url_overridden # Creates and returns a new client for interacting with the API. # - # @param private_key [String, nil] Your ImageKit private API key (it starts with `private_`). You can view and - # manage API keys in the - # [dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults to - # `ENV["IMAGEKIT_PRIVATE_API_KEY"]` + # @param private_key [String, nil] Your ImageKit private API key (starts with `private_`). You can find this in the + # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults + # to `ENV["IMAGEKIT_PRIVATE_API_KEY"]` # - # @param password [String, nil] ImageKit Basic Auth only uses the `private_key` as username and ignores the - # password. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` + # @param password [String, nil] Leave this field unset. ImageKit uses Basic Authentication scheme that requires + # the `private_key` as the username and empty string as the password. The password + # field is automatically managed by the SDK and should not be set. Defaults to + # `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` # # @param base_url [String, nil] Override the default base URL for the API, e.g., # `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]` diff --git a/rbi/imagekit/client.rbi b/rbi/imagekit/client.rbi index c97cd45b..4bcc13f9 100644 --- a/rbi/imagekit/client.rbi +++ b/rbi/imagekit/client.rbi @@ -10,14 +10,14 @@ module Imagekit DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float) - # Your ImageKit private API key (it starts with `private_`). You can view and - # manage API keys in the - # [dashboard](https://imagekit.io/dashboard/developer/api-keys). + # Your ImageKit private API key (starts with `private_`). You can find this in the + # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). sig { returns(String) } attr_reader :private_key - # ImageKit Basic Auth only uses the `private_key` as username and ignores the - # password. + # Leave this field unset. ImageKit uses Basic Authentication scheme that requires + # the `private_key` as the username and empty string as the password. The password + # field is automatically managed by the SDK and should not be set. sig { returns(T.nilable(String)) } attr_reader :password @@ -68,13 +68,14 @@ module Imagekit ).returns(T.attached_class) end def self.new( - # Your ImageKit private API key (it starts with `private_`). You can view and - # manage API keys in the - # [dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults to - # `ENV["IMAGEKIT_PRIVATE_API_KEY"]` + # Your ImageKit private API key (starts with `private_`). You can find this in the + # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults + # to `ENV["IMAGEKIT_PRIVATE_API_KEY"]` private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], - # ImageKit Basic Auth only uses the `private_key` as username and ignores the - # password. Defaults to `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` + # Leave this field unset. ImageKit uses Basic Authentication scheme that requires + # the `private_key` as the username and empty string as the password. The password + # field is automatically managed by the SDK and should not be set. Defaults to + # `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"), # Override the default base URL for the API, e.g., # `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]` From 9604a8eb40f6e4947075d6ff80bf919062a1556f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:52:22 +0000 Subject: [PATCH 26/32] feat(api): manual updates --- .stats.yml | 2 +- lib/imagekit/client.rb | 10 ++++------ rbi/imagekit/client.rbi | 10 ++++------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.stats.yml b/.stats.yml index d3fcabb4..ee45f3d5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml openapi_spec_hash: 1d382866fce3284f26d341f112988d9d -config_hash: c9c7bed2a4341f915a2dc85958ce7f0e +config_hash: 51a9632be24fc533ad69a5bd56934651 diff --git a/lib/imagekit/client.rb b/lib/imagekit/client.rb index dd58cd05..97dacb3a 100644 --- a/lib/imagekit/client.rb +++ b/lib/imagekit/client.rb @@ -20,9 +20,8 @@ class Client < Imagekit::Internal::Transport::BaseClient # @return [String] attr_reader :private_key - # Leave this field unset. ImageKit uses Basic Authentication scheme that requires - # the `private_key` as the username and empty string as the password. The password - # field is automatically managed by the SDK and should not be set. + # ImageKit uses your API key as username and ignores the password. The SDK sets a + # dummy value. You can ignore this field. # @return [String, nil] attr_reader :password @@ -71,9 +70,8 @@ def base_url_overridden? = @base_url_overridden # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults # to `ENV["IMAGEKIT_PRIVATE_API_KEY"]` # - # @param password [String, nil] Leave this field unset. ImageKit uses Basic Authentication scheme that requires - # the `private_key` as the username and empty string as the password. The password - # field is automatically managed by the SDK and should not be set. Defaults to + # @param password [String, nil] ImageKit uses your API key as username and ignores the password. The SDK sets a + # dummy value. You can ignore this field. Defaults to # `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` # # @param base_url [String, nil] Override the default base URL for the API, e.g., diff --git a/rbi/imagekit/client.rbi b/rbi/imagekit/client.rbi index 4bcc13f9..2d819388 100644 --- a/rbi/imagekit/client.rbi +++ b/rbi/imagekit/client.rbi @@ -15,9 +15,8 @@ module Imagekit sig { returns(String) } attr_reader :private_key - # Leave this field unset. ImageKit uses Basic Authentication scheme that requires - # the `private_key` as the username and empty string as the password. The password - # field is automatically managed by the SDK and should not be set. + # ImageKit uses your API key as username and ignores the password. The SDK sets a + # dummy value. You can ignore this field. sig { returns(T.nilable(String)) } attr_reader :password @@ -72,9 +71,8 @@ module Imagekit # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults # to `ENV["IMAGEKIT_PRIVATE_API_KEY"]` private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], - # Leave this field unset. ImageKit uses Basic Authentication scheme that requires - # the `private_key` as the username and empty string as the password. The password - # field is automatically managed by the SDK and should not be set. Defaults to + # ImageKit uses your API key as username and ignores the password. The SDK sets a + # dummy value. You can ignore this field. Defaults to # `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"), # Override the default base URL for the API, e.g., From 14104e2b691d586fe0e978a6c6e4232d2e6db650 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 02:50:03 +0000 Subject: [PATCH 27/32] chore: do not install brew dependencies in ./scripts/bootstrap by default --- scripts/bootstrap | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index cc31aa85..34878642 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd -- "$(dirname -- "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi From db61f6089520c631dccbc618453d018634e53e63 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 08:05:36 +0000 Subject: [PATCH 28/32] feat(api): Update env var name --- .stats.yml | 2 +- README.md | 2 +- lib/imagekit/client.rb | 6 +++--- rbi/imagekit/client.rbi | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index ee45f3d5..0f9a4aa3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml openapi_spec_hash: 1d382866fce3284f26d341f112988d9d -config_hash: 51a9632be24fc533ad69a5bd56934651 +config_hash: f1fafe5e607e996b58b67fd1dd3e74fa diff --git a/README.md b/README.md index 0636e207..bb1a65d3 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ require "bundler/setup" require "imagekit" image_kit = Imagekit::Client.new( - private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], # This is the default and can be omitted + private_key: ENV["IMAGEKIT_PRIVATE_KEY"], # This is the default and can be omitted password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted ) diff --git a/lib/imagekit/client.rb b/lib/imagekit/client.rb index 97dacb3a..e3f5f7c3 100644 --- a/lib/imagekit/client.rb +++ b/lib/imagekit/client.rb @@ -68,7 +68,7 @@ def base_url_overridden? = @base_url_overridden # # @param private_key [String, nil] Your ImageKit private API key (starts with `private_`). You can find this in the # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults - # to `ENV["IMAGEKIT_PRIVATE_API_KEY"]` + # to `ENV["IMAGEKIT_PRIVATE_KEY"]` # # @param password [String, nil] ImageKit uses your API key as username and ignores the password. The SDK sets a # dummy value. You can ignore this field. Defaults to @@ -85,7 +85,7 @@ def base_url_overridden? = @base_url_overridden # # @param max_retry_delay [Float] def initialize( - private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], + private_key: ENV["IMAGEKIT_PRIVATE_KEY"], password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"), base_url: ENV["IMAGE_KIT_BASE_URL"], max_retries: self.class::DEFAULT_MAX_RETRIES, @@ -98,7 +98,7 @@ def initialize( base_url ||= "https://api.imagekit.io" if private_key.nil? - raise ArgumentError.new("private_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_API_KEY\"") + raise ArgumentError.new("private_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_KEY\"") end @private_key = private_key.to_s diff --git a/rbi/imagekit/client.rbi b/rbi/imagekit/client.rbi index 2d819388..703786c5 100644 --- a/rbi/imagekit/client.rbi +++ b/rbi/imagekit/client.rbi @@ -69,8 +69,8 @@ module Imagekit def self.new( # Your ImageKit private API key (starts with `private_`). You can find this in the # [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys). Defaults - # to `ENV["IMAGEKIT_PRIVATE_API_KEY"]` - private_key: ENV["IMAGEKIT_PRIVATE_API_KEY"], + # to `ENV["IMAGEKIT_PRIVATE_KEY"]` + private_key: ENV["IMAGEKIT_PRIVATE_KEY"], # ImageKit uses your API key as username and ignores the password. The SDK sets a # dummy value. You can ignore this field. Defaults to # `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]` From 03ecbdffb5dddc16aeace01e5b86a7e525263d7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 09:24:13 +0000 Subject: [PATCH 29/32] feat(api): update api docs link --- .stats.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0f9a4aa3..7dfc3c2a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml openapi_spec_hash: 1d382866fce3284f26d341f112988d9d -config_hash: f1fafe5e607e996b58b67fd1dd3e74fa +config_hash: 5f7498f5ea66e8a544c6c37b10f77467 diff --git a/README.md b/README.md index bb1a65d3..cd2b44cd 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It is generated with [Stainless](https://www.stainless.com/). Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekit). -The REST API documentation can be found on [imagekit.io](https://imagekit.io/docs). +The REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). ## Installation From 45e7793eae012f4fcd05a30aa1ff4ef695793792 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Sep 2025 09:25:26 +0000 Subject: [PATCH 30/32] feat(api): remove Stainless attribution from readme --- .stats.yml | 2 +- README.md | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7dfc3c2a..e1604c7a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml openapi_spec_hash: 1d382866fce3284f26d341f112988d9d -config_hash: 5f7498f5ea66e8a544c6c37b10f77467 +config_hash: ff23f46fe08ef3f43c57c8cf13eff3a1 diff --git a/README.md b/README.md index cd2b44cd..6f4f19f8 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ The Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/imagekit-developer/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem. -It is generated with [Stainless](https://www.stainless.com/). - ## Documentation Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekit). From 83b1bc9311f7f70085aab38d2d22f4b054c735fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Sep 2025 03:10:22 +0000 Subject: [PATCH 31/32] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e1604c7a..031fed99 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 42 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml openapi_spec_hash: 1d382866fce3284f26d341f112988d9d -config_hash: ff23f46fe08ef3f43c57c8cf13eff3a1 +config_hash: d57f3c7c581048428b41398f30da8b9b From 4b1b4d8cc16bf4e9e049b1be3893744d763d0129 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Sep 2025 03:12:08 +0000 Subject: [PATCH 32/32] release: 0.0.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 73 +++++++++++++++++++++++++++++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/imagekit/version.rb | 2 +- 5 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1332969b..c7159c1a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1" + ".": "0.0.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..8ccad9d4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,73 @@ +# Changelog + +## 0.0.2 (2025-09-21) + +Full Changelog: [v0.0.1...v0.0.2](https://github.com/imagekit-developer/imagekit-ruby/compare/v0.0.1...v0.0.2) + +### Features + +* **api:** add BaseWebhookEvent ([b4c2a83](https://github.com/imagekit-developer/imagekit-ruby/commit/b4c2a8398c1b8bfa1df7da222ede418b047fe0b1)) +* **api:** extract UpdateFileDetailsRequest to model ([9aaa659](https://github.com/imagekit-developer/imagekit-ruby/commit/9aaa6599d67f4d077d34d0afec3c08baef271b9b)) +* **api:** manual updates ([9604a8e](https://github.com/imagekit-developer/imagekit-ruby/commit/9604a8eb40f6e4947075d6ff80bf919062a1556f)) +* **api:** manual updates ([0682128](https://github.com/imagekit-developer/imagekit-ruby/commit/0682128a78d935ba01979783050d66aac099504a)) +* **api:** manual updates ([f9bee87](https://github.com/imagekit-developer/imagekit-ruby/commit/f9bee8789b20c3ae42a177e8e7adc086fd6b734a)) +* **api:** manual updates ([2f5a40a](https://github.com/imagekit-developer/imagekit-ruby/commit/2f5a40ab9e7c3ffc0755c8c8cbf26bcfe69ab5b0)) +* **api:** manual updates ([428829b](https://github.com/imagekit-developer/imagekit-ruby/commit/428829bb7d7a3e01621dcb6d9901a1b440481f7c)) +* **api:** manual updates ([54e5bdf](https://github.com/imagekit-developer/imagekit-ruby/commit/54e5bdf49a3a67eb494e7aecfd4f5300f8c07772)) +* **api:** manual updates ([8c970ed](https://github.com/imagekit-developer/imagekit-ruby/commit/8c970ed1b42cfb40e05cedf4f643096918097f67)) +* **api:** manual updates ([e33d6ed](https://github.com/imagekit-developer/imagekit-ruby/commit/e33d6ed379d8d298f049edcf5b5b4d2ecfdd82bd)) +* **api:** manual updates ([4c04de9](https://github.com/imagekit-developer/imagekit-ruby/commit/4c04de93766bb15aad1784f5a4a594036fdce827)) +* **api:** manual updates ([e9bad22](https://github.com/imagekit-developer/imagekit-ruby/commit/e9bad2213d947539b07f4c71622c6bee2e826274)) +* **api:** manual updates ([c0417fb](https://github.com/imagekit-developer/imagekit-ruby/commit/c0417fbd4286fb47cbdfc154a696fcd2d34b1b5d)) +* **api:** manual updates ([bddb2fa](https://github.com/imagekit-developer/imagekit-ruby/commit/bddb2faecc78b22888d44aeda6896bdeff0f7cf8)) +* **api:** manual updates ([24f9f11](https://github.com/imagekit-developer/imagekit-ruby/commit/24f9f11ca39e3611c621a1d5383d763a4acd87b4)) +* **api:** manual updates ([8ac0ad3](https://github.com/imagekit-developer/imagekit-ruby/commit/8ac0ad3ff00d4036d52ec31777d74cb19f8d4379)) +* **api:** manual updates ([c64d558](https://github.com/imagekit-developer/imagekit-ruby/commit/c64d558fc172b4c1768d59731dc2a0e2c71de2fb)) +* **api:** manual updates ([453e942](https://github.com/imagekit-developer/imagekit-ruby/commit/453e942ec2c25f3720305dcd564ca22b85815336)) +* **api:** remove Stainless attribution from readme ([45e7793](https://github.com/imagekit-developer/imagekit-ruby/commit/45e7793eae012f4fcd05a30aa1ff4ef695793792)) +* **api:** update api docs link ([03ecbdf](https://github.com/imagekit-developer/imagekit-ruby/commit/03ecbdffb5dddc16aeace01e5b86a7e525263d7b)) +* **api:** Update env var name ([db61f60](https://github.com/imagekit-developer/imagekit-ruby/commit/db61f6089520c631dccbc618453d018634e53e63)) +* expose response headers for both streams and errors ([72c02c3](https://github.com/imagekit-developer/imagekit-ruby/commit/72c02c37a42bddc4e191b43145a562fab9e01dc7)) + + +### Bug Fixes + +* carrierwave bump to rm mimemagic dep ([ab4c2cf](https://github.com/imagekit-developer/imagekit-ruby/commit/ab4c2cf5856de50a9cb9deb7fb2168d67258083d)) +* change to dev dep ([22b98f8](https://github.com/imagekit-developer/imagekit-ruby/commit/22b98f8a9f482f11c0e6c3cfe9650a75e62d7f17)) +* conflict resolving ([9014f4f](https://github.com/imagekit-developer/imagekit-ruby/commit/9014f4f876914ab73f12ff79b3dd11132cc0f8a4)) +* Gemfile.lock remove and added to .gitignore ([b1a3bd7](https://github.com/imagekit-developer/imagekit-ruby/commit/b1a3bd7850397668f49770e75636acc592547878)) +* import issue fixed ([3a49fc5](https://github.com/imagekit-developer/imagekit-ruby/commit/3a49fc55bd7032d65c72016dab7d5669f2e17227)) +* import related to issue ([83a3f5a](https://github.com/imagekit-developer/imagekit-ruby/commit/83a3f5a10559dc863b0f6e149f9edbea8a2793ee)) +* rails 5~6 conflict issue and version build updates ([47aaf01](https://github.com/imagekit-developer/imagekit-ruby/commit/47aaf01727ccf9600db945f75338c73509691319)) +* rails dependency as development ([3d90b7b](https://github.com/imagekit-developer/imagekit-ruby/commit/3d90b7bc435499535d427e7e20893c419b39ed8a)) +* README.md linking sections ([9101ca2](https://github.com/imagekit-developer/imagekit-ruby/commit/9101ca2f3676a28d92c84c3b1b2c1c78ab5d027d)) +* spelling typo ([8debe83](https://github.com/imagekit-developer/imagekit-ruby/commit/8debe8379dbebdc7aad334acd1d8ac69283b0f94)) +* upload dir issue ([ce5754b](https://github.com/imagekit-developer/imagekit-ruby/commit/ce5754b24330cd2beb47ac12bb11985f10a5b93b)) + + +### Chores + +* carrierwave rails implemented ([9e130d4](https://github.com/imagekit-developer/imagekit-ruby/commit/9e130d484421a11b45e6884b2780194ffcb59173)) +* constants added ([59b760d](https://github.com/imagekit-developer/imagekit-ruby/commit/59b760dbee284b981bb3cc793fad5e6ce87c98f6)) +* do not install brew dependencies in ./scripts/bootstrap by default ([14104e2](https://github.com/imagekit-developer/imagekit-ruby/commit/14104e2b691d586fe0e978a6c6e4232d2e6db650)) +* file operation added ([11f2685](https://github.com/imagekit-developer/imagekit-ruby/commit/11f2685bccf80730b6da2855c2362f7287800ea8)) +* samle ruby app added ([21f88b8](https://github.com/imagekit-developer/imagekit-ruby/commit/21f88b8be03339265dc32548be7fb394fdc057b4)) +* sample rails project added ([2bf0cbe](https://github.com/imagekit-developer/imagekit-ruby/commit/2bf0cbed22811bb7e600febd5cb88e524cc07d7b)) +* sync repo ([0200fb8](https://github.com/imagekit-developer/imagekit-ruby/commit/0200fb885ff82f4960f401169d728b48c9d900cf)) +* update SDK settings ([5ce5d1f](https://github.com/imagekit-developer/imagekit-ruby/commit/5ce5d1f2370b6b31c1d2927856bfeac5eb592a23)) +* url generation implemented ([dda02cd](https://github.com/imagekit-developer/imagekit-ruby/commit/dda02cdcb05846b870b530f23cd40e478028bad1)) + + +### Build System + +* **deps:** bump addressable from 2.7.0 to 2.8.0 in /samples/rails_app ([db074cc](https://github.com/imagekit-developer/imagekit-ruby/commit/db074cc81e5aa59fa962b5e26c25d327bb4cac87)) +* **deps:** bump carrierwave from 2.1.0 to 2.1.1 in /samples/rails_app ([c109b9b](https://github.com/imagekit-developer/imagekit-ruby/commit/c109b9bd0effff643b8062dbe9d1157dad0210d8)) +* **deps:** bump nokogiri from 1.10.10 to 1.11.4 in /samples/rails_app ([9497849](https://github.com/imagekit-developer/imagekit-ruby/commit/9497849e1caa72bc5bbc582da3fc5f6575f2b455)) +* **deps:** bump rack from 2.2.2 to 2.2.3 in /samples/rails_app ([50c7336](https://github.com/imagekit-developer/imagekit-ruby/commit/50c7336a5c568d7fcbae99b15c5a646f96ac74d3)) +* **deps:** bump websocket-extensions in /samples/rails_app ([07d8ffa](https://github.com/imagekit-developer/imagekit-ruby/commit/07d8ffa895f8ad5c6c52c0d7e58824de602da8e2)) +* gem server added ([8046ad2](https://github.com/imagekit-developer/imagekit-ruby/commit/8046ad2ae832a47dc270b7b7b8d41cad3dcaecda)) +* gem server added ([32dfe99](https://github.com/imagekit-developer/imagekit-ruby/commit/32dfe99fe44da450a1a800c04ce2e86151f407e0)) +* gemspec modification ([0a4d32d](https://github.com/imagekit-developer/imagekit-ruby/commit/0a4d32d6c2b1d663f3074d6fac8cdf3f8200096e)) +* imagekit-sdk to imagekitio changing ([ca8c01e](https://github.com/imagekit-developer/imagekit-ruby/commit/ca8c01eefd657016f74aad0053e51899702dcd87)) +* version 1.0.1 added ([3193eb7](https://github.com/imagekit-developer/imagekit-ruby/commit/3193eb7ea55fa1f75643ab07bc4f8c7698f62852)) +* version chinging to 1.0.3 ([fa54abb](https://github.com/imagekit-developer/imagekit-ruby/commit/fa54abbc34aba78a2e895323c2bd02548a25063f)) diff --git a/Gemfile.lock b/Gemfile.lock index 2c4ef551..b85ec310 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - imagekit (0.0.1) + imagekit (0.0.2) connection_pool GEM diff --git a/README.md b/README.md index 6f4f19f8..0d7cf3f0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "imagekit", "~> 0.0.1" +gem "imagekit", "~> 0.0.2" ``` diff --git a/lib/imagekit/version.rb b/lib/imagekit/version.rb index 2350f394..8165ed7d 100644 --- a/lib/imagekit/version.rb +++ b/lib/imagekit/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Imagekit - VERSION = "0.0.1" + VERSION = "0.0.2" end