diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26e6e002..aa5d164b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,48 @@ on: - 'stl-preview-base/**' jobs: + build: + timeout-minutes: 10 + name: build + permissions: + contents: read + id-token: write + runs-on: ${{ github.repository == 'stainless-sdks/imagekit-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: |- + github.repository == 'stainless-sdks/imagekit-ruby' && + (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Set up Ruby + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Get GitHub OIDC Token + if: |- + github.repository == 'stainless-sdks/imagekit-ruby' && + !startsWith(github.ref, 'refs/heads/stl/') + id: github-oidc + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Build and upload gem artifacts + if: |- + github.repository == 'stainless-sdks/imagekit-ruby' && + !startsWith(github.ref, 'refs/heads/stl/') + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + PACKAGE_NAME: imagekitio + run: ./scripts/utils/upload-artifact.sh lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + 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: @@ -32,3 +70,19 @@ jobs: - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Set up Ruby + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + with: + bundler-cache: false + - run: |- + bundle install + + - name: Run tests + run: ./scripts/test diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 12d6856e..bd2fe0ef 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -2,7 +2,7 @@ name: Release Doctor on: pull_request: branches: - - main + - master workflow_dispatch: jobs: @@ -18,6 +18,5 @@ jobs: run: | bash ./bin/check-release-environment env: - RELEASE_PLEASE_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} 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-please.yml b/.github/workflows/release-please.yml deleted file mode 100644 index dddbf9bf..00000000 --- a/.github/workflows/release-please.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Release Please -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - -jobs: - release-please: - if: github.repository == 'imagekit-developer/imagekit-ruby' - runs-on: ubuntu-latest - - steps: - - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 - id: release - with: - token: ${{ secrets.RELEASE_PLEASE_TOKEN }} diff --git a/.github/workflows/sync-release-as.yml b/.github/workflows/sync-release-as.yml deleted file mode 100644 index 6ce6a7a1..00000000 --- a/.github/workflows/sync-release-as.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Sync Release-As from release PR title - -on: - pull_request: - types: [edited] - -permissions: - contents: write - -jobs: - sync: - if: >- - github.event.pull_request.base.ref == 'main' && - startsWith(github.event.pull_request.head.ref, 'release-please--') && - github.event.changes.title != null - runs-on: ubuntu-latest - steps: - - name: Extract versions from old and new title - id: parse - env: - NEW_TITLE: ${{ github.event.pull_request.title }} - OLD_TITLE: ${{ github.event.changes.title.from }} - run: | - # Anchored on pull-request-title-pattern "release: ${version}" from release-please-config.json. - extract() { - echo "$1" | grep -oE '^release:[[:space:]]+v?[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?' \ - | sed -E 's/^release:[[:space:]]+v?//' - } - NEW_VERSION=$(extract "$NEW_TITLE") - OLD_VERSION=$(extract "$OLD_TITLE") - echo "old=$OLD_VERSION" - echo "new=$NEW_VERSION" - if [ -z "$NEW_VERSION" ]; then - echo "::notice::No semver in new title; nothing to do." - echo "skip=true" >> "$GITHUB_OUTPUT" - exit 0 - fi - if [ "$NEW_VERSION" = "$OLD_VERSION" ]; then - echo "::notice::Version unchanged ($NEW_VERSION); not pushing." - echo "skip=true" >> "$GITHUB_OUTPUT" - exit 0 - fi - echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" - - - name: Check out main - if: steps.parse.outputs.skip != 'true' - uses: actions/checkout@v6 - with: - ref: main - token: ${{ secrets.RELEASE_PLEASE_TOKEN }} - fetch-depth: 1 - - - name: Push empty Release-As commit - if: steps.parse.outputs.skip != 'true' - env: - VERSION: ${{ steps.parse.outputs.version }} - run: | - git config user.name "release-as-bot" - git config user.email "release-as-bot@users.noreply.github.com" - git commit --allow-empty -m "chore: pin next release - - Release-As: ${VERSION}" - git push origin main diff --git a/.gitignore b/.gitignore index 288f572c..fc9eb287 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ bin/tapioca Brewfile.lock.json doc/ sorbet/tapioca/* -examples/temp* \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b467676..1eec10e9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.9.0" + ".": "4.7.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 847bd32c..c1c7ec9d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1,4 @@ -configured_endpoints: 53 +configured_endpoints: 47 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc/imagekit-5280e65473c0c42b7f41216fd22aeb469acb5f54b6ee1a3181f3ec9b7a19dc17.yml +openapi_spec_hash: 7c103e2dff0edcbeea82057e62f58d4d +config_hash: 7960882e624d385c4d9aecca2132adad diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index f2cb4f63..00000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "recommendations": [ - "shopify.ruby-lsp", - "sorbet.sorbet-vscode-extension", - "soutaro.rbs-syntax", - "bradlc.vscode-tailwindcss", - "github.copilot", - "github.copilot-chat" - ], - "unwantedRecommendations": [ - "rebornix.ruby", - "castwide.solargraph" - ] -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index f52f0aeb..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "ruby.interpreter": "ruby", - "ruby.pathToBundler": "bundle", - "ruby.useLanguageServer": true, - "ruby.lint": { - "rubocop": true, - "ruby": true - }, - "ruby.format": "rubocop", - "sorbet.enabled": true, - "sorbet.typeCheckingMode": "strict", - "sorbet.watchmanPath": "watchman", - "files.associations": { - "*.rb": "ruby", - "*.rbi": "ruby", - "*.rbs": "rbs", - "Gemfile": "ruby", - "Rakefile": "ruby" - }, - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.fixAll.rubocop": "explicit" - }, - "[ruby]": { - "editor.defaultFormatter": "Shopify.ruby-lsp", - "editor.formatOnSave": true, - "editor.tabSize": 2, - "editor.insertSpaces": true, - "editor.semanticHighlighting.enabled": true, - "editor.suggest.insertMode": "replace" - }, - "[rbs]": { - "editor.defaultFormatter": "soutaro.rbs-syntax", - "editor.tabSize": 2, - "editor.insertSpaces": true - } -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 5509ce0b..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,348 +0,0 @@ -# Changelog - -## [4.9.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.8.0...v4.9.0) (2026-08-15) - - -### Features - -* add description field in custom metadata field api ([f86bf8e](https://github.com/imagekit-developer/imagekit-ruby/commit/f86bf8e78a5fc75323bfeb1a529b2e4045a62729)) -* **api:** Named Transformations ([512b517](https://github.com/imagekit-developer/imagekit-ruby/commit/512b517e3c7c7fa22c9a20e0a20715f3381c66ac)) - - -### Chores - -* change default branch name ([9b3e035](https://github.com/imagekit-developer/imagekit-ruby/commit/9b3e0352461524f45131bc23b5a466116cc26745)) -* move to one repo structure ([c5b6c51](https://github.com/imagekit-developer/imagekit-ruby/commit/c5b6c513b4da32c2426a699c27f90225aae7e346)) -* pin next release ([431111b](https://github.com/imagekit-developer/imagekit-ruby/commit/431111b97b244e213eb0ba6de36a9255c125cbfc)) - -## [4.8.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.7.0...v4.8.0) (2026-07-14) - - -### Features - -* **api:** add usage analytics breakdown endpoint ([82b2909](https://github.com/imagekit-developer/imagekit-ruby/commit/82b29099bc232601ad99dd3b304be8edf59e2179)) - -## [4.7.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.6.0...v4.7.0) (2026-06-18) - - -### Features - -* **origins:** add useIAMRole for IAM role authentication ([c38cc1b](https://github.com/imagekit-developer/imagekit-ruby/commit/c38cc1bea8028c2c10ae543e027dc71a63170222)) - - -### Documentation - -* update default value in description for intensity in colorize transformation ([7b128c5](https://github.com/imagekit-developer/imagekit-ruby/commit/7b128c59d1da7435e6137ebad7a60251e941defa)) - -## [4.6.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.5.1...v4.6.0) (2026-06-03) - - -### Features - -* initial stlc build ([a2757e4](https://github.com/imagekit-developer/imagekit-ruby/commit/a2757e46e00bd414fd2de73c11eb53e01a7633dc)) - - -### Bug Fixes - -* metadata response shape ([34e58cd](https://github.com/imagekit-developer/imagekit-ruby/commit/34e58cd2b3d0923881fc15d38e5dfbb32bef2991)) - - -### Chores - -* Update webhook description ([1581227](https://github.com/imagekit-developer/imagekit-ruby/commit/15812270ccbe7e45a61ee94a4006fb5d02cf9921)) -* Update webhook description ([7e2d29e](https://github.com/imagekit-developer/imagekit-ruby/commit/7e2d29e79c23729d2c2bf5ecbc0439ce53f66099)) - -## 4.5.1 (2026-05-17) - -Full Changelog: [v4.5.0...v4.5.1](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.5.0...v4.5.1) - -### Bug Fixes - -* **client:** elide content type header on requests without body ([9ae7bf6](https://github.com/imagekit-developer/imagekit-ruby/commit/9ae7bf673a15fc01cf7e25b6c508dd20fa6a38f7)) - -## 4.5.0 (2026-05-13) - -Full Changelog: [v4.4.1...v4.5.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.4.1...v4.5.0) - -### Features - -* **api:** add no-enlarge crop modes and colorize transformation ([1b56303](https://github.com/imagekit-developer/imagekit-ruby/commit/1b56303ef5c67cb1a4b36d4a1c06b147f22c5987)) -* support setting headers via env ([cd32783](https://github.com/imagekit-developer/imagekit-ruby/commit/cd32783efe49d795b8a5de49eb44039cda375d2e)) -* **transformation:** add colorize transformation support in URL generation ([3454064](https://github.com/imagekit-developer/imagekit-ruby/commit/34540646f7ee8a1deabeea629f366d28bc71f734)) - - -### Chores - -* **internal:** codegen related update ([7e0543d](https://github.com/imagekit-developer/imagekit-ruby/commit/7e0543d8714ff251de1a32f471dc7bd8bfa17dab)) - -## 4.4.1 (2026-04-24) - -Full Changelog: [v4.4.0...v4.4.1](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.4.0...v4.4.1) - -### Features - -* **api:** manual updates ([7b8cad3](https://github.com/imagekit-developer/imagekit-ruby/commit/7b8cad330f21f2e8f94fc6fbee3a70fe87bc30a1)) -* **api:** manual updates ([f462715](https://github.com/imagekit-developer/imagekit-ruby/commit/f462715e564b25253986276423572442c1d20d29)) - - -### Chores - -* configure new SDK language ([6e8aa01](https://github.com/imagekit-developer/imagekit-ruby/commit/6e8aa014bbf00f69237d9a787de2c03f27b19c56)) -* **internal:** more robust bootstrap script ([3192433](https://github.com/imagekit-developer/imagekit-ruby/commit/31924332fb8e956f8dc2c2c72c0285122197522f)) - -## 4.4.0 (2026-04-13) - -Full Changelog: [v4.3.0...v4.4.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.3.0...v4.4.0) - -### Features - -* **api:** add missing types in ruby ([6a074df](https://github.com/imagekit-developer/imagekit-ruby/commit/6a074df0249e9ac9969c2bc4b8d12d9abbd1e233)) -* **api:** dam related webhook events ([d2ffbf3](https://github.com/imagekit-developer/imagekit-ruby/commit/d2ffbf33cabaddffbb97d4c7bc7e54be100a3c67)) -* **api:** fix spec indentation ([74e7a6a](https://github.com/imagekit-developer/imagekit-ruby/commit/74e7a6ae49a83d6faa29796443309f20633b430d)) -* **api:** indentation fix ([fae3b74](https://github.com/imagekit-developer/imagekit-ruby/commit/fae3b74e0de1bdd3e5a29c6061f546aacfc423cb)) -* **api:** merge with main to bring back missing parameters ([78377b5](https://github.com/imagekit-developer/imagekit-ruby/commit/78377b55c03f7818a5f2ae57d19464dfae58763a)) -* **api:** update webhook event names and remove DAM prefix ([c621b14](https://github.com/imagekit-developer/imagekit-ruby/commit/c621b14ca3a92b3428bd3a41156539aba3668097)) - - -### Bug Fixes - -* **api:** extract shared schemas to prevent Go webhook union breaking changes ([0325862](https://github.com/imagekit-developer/imagekit-ruby/commit/032586298410662b5f45b9b4189cc23ef74c1e40)) -* **api:** fix references of schema ([3d07367](https://github.com/imagekit-developer/imagekit-ruby/commit/3d073676557eaac1a3ce9447866936e707f45566)) -* **api:** rename DamFile events to File for consistency ([5998787](https://github.com/imagekit-developer/imagekit-ruby/commit/5998787a6607eb936b51b46b92e24679ac2dd321)) -* **docs:** remove redundant information about versioning in README ([a546963](https://github.com/imagekit-developer/imagekit-ruby/commit/a546963ec88a011e18426a2a9ad46893e8e45eec)) -* **docs:** remove redundant sub-item for webhook signature verification in README ([03f4b45](https://github.com/imagekit-developer/imagekit-ruby/commit/03f4b4580157f6c5a81905b549801e9abb2f3c2c)) -* **docs:** remove unnecessary password parameter from example ([77c9134](https://github.com/imagekit-developer/imagekit-ruby/commit/77c9134775b106ac5107579f3059390870ced790)) -* multipart encoding for file arrays ([5f02f3a](https://github.com/imagekit-developer/imagekit-ruby/commit/5f02f3a700d92bdcba063ce82d64c82fc70d37f8)) -* **webhooks:** encode webhook key in Base64 before verification ([db0b711](https://github.com/imagekit-developer/imagekit-ruby/commit/db0b711f50b3e992f36dd3f30ef74dac502a44a2)) - - -### Documentation - -* add webhook verification section to README ([ceb1927](https://github.com/imagekit-developer/imagekit-ruby/commit/ceb1927213edf8467e8e584a4b43999f0cedcf20)) - - -### Refactors - -* AITags to singular AITag schema with array items pattern ([01a4f00](https://github.com/imagekit-developer/imagekit-ruby/commit/01a4f00f0ce0b7f308f8f84351327c2a25a77408)) - -## 4.3.0 (2026-04-06) - -Full Changelog: [v4.2.0...v4.3.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.2.0...v4.3.0) - -### Features - -* **api:** add support for x_center, y_center, and anchor_point in overlay positioning ([dcbcf76](https://github.com/imagekit-developer/imagekit-ruby/commit/dcbcf7610f2a484689f5c83a8779ab3dd4c5b092)) -* **api:** dpr type update ([650aa0f](https://github.com/imagekit-developer/imagekit-ruby/commit/650aa0f905b4a586c036ae2f019bd7cfb7775d40)) -* **api:** Introduce lxc, lyc, lap parameters in overlays. ([5a87ef0](https://github.com/imagekit-developer/imagekit-ruby/commit/5a87ef064bc9c14d1d62bbd338b64d7718888460)) -* **api:** revert dpr breaking change ([525e6a8](https://github.com/imagekit-developer/imagekit-ruby/commit/525e6a8a59f0f4a17ab17468aebc4b8ccdce182c)) -* **client:** add webhook support ([2a65217](https://github.com/imagekit-developer/imagekit-ruby/commit/2a65217314672d643372aafed4c83adf19c0566f)) - - -### Bug Fixes - -* align path encoding with RFC 3986 section 3.3 ([88f5590](https://github.com/imagekit-developer/imagekit-ruby/commit/88f5590fc3bb8b7766d4698892aff762f80d3629)) -* **client:** add types for path params, and update structure of unions nested in params ([dd1e1ec](https://github.com/imagekit-developer/imagekit-ruby/commit/dd1e1ec791f563877bc2262b0aea91f4df9b2ced)) -* **client:** always add content-length to post body, even when empty ([e156b70](https://github.com/imagekit-developer/imagekit-ruby/commit/e156b70c82c9b38de49307218fb3f687f651aa5b)) -* **client:** loosen json header parsing ([9fc1fc6](https://github.com/imagekit-developer/imagekit-ruby/commit/9fc1fc60c60173f92f1f99fabe38f9ec826d940d)) -* **client:** serialize query parameters properly ([bbfc6e0](https://github.com/imagekit-developer/imagekit-ruby/commit/bbfc6e0d80da5661600a888e8c915d336919fe36)) -* **internal:** correct multipart form field name encoding ([f3c20a9](https://github.com/imagekit-developer/imagekit-ruby/commit/f3c20a9740682cb96e90eecfd617f204cd28a491)) -* properly mock time in ruby ci tests ([8f0a0a9](https://github.com/imagekit-developer/imagekit-ruby/commit/8f0a0a93ebc66d8d56d5e47950607f8d67f37514)) -* variable name typo ([1d32dc3](https://github.com/imagekit-developer/imagekit-ruby/commit/1d32dc3ec09c80961cc58ecfd40b2449957a2ac9)) - - -### Chores - -* **ci:** add build step ([c213724](https://github.com/imagekit-developer/imagekit-ruby/commit/c213724d793c735b09c784a5a285cf394f79d528)) -* **ci:** skip lint on metadata-only changes ([62e401f](https://github.com/imagekit-developer/imagekit-ruby/commit/62e401f6fc35fa3bc0e16593bab8e4a477536d4f)) -* **ci:** skip uploading artifacts on stainless-internal branches ([fbc0465](https://github.com/imagekit-developer/imagekit-ruby/commit/fbc0465b3c2fc05da7a61fe74fab19189be90305)) -* **ci:** support opting out of skipping builds on metadata-only commits ([af71b49](https://github.com/imagekit-developer/imagekit-ruby/commit/af71b4919ea7eb3bf704ed6a83eaa9301b5201f9)) -* **docs:** remove www prefix ([a4b9610](https://github.com/imagekit-developer/imagekit-ruby/commit/a4b961058ac8967dcfef109421dbca9ee3eedf0b)) -* **internal:** remove mock server code ([c8aa3b8](https://github.com/imagekit-developer/imagekit-ruby/commit/c8aa3b8c2320102d8e29941f78f1f1ade06cab00)) -* **internal:** tweak CI branches ([125e8b4](https://github.com/imagekit-developer/imagekit-ruby/commit/125e8b4b0f3676378a863bacfc3cc93bf7b3f6ee)) -* **internal:** update gitignore ([741331c](https://github.com/imagekit-developer/imagekit-ruby/commit/741331c210a1af49f43ff77f593293e42882c15b)) -* update mock server docs ([1e5ed9e](https://github.com/imagekit-developer/imagekit-ruby/commit/1e5ed9ea31388b76995c292fc22f9ed773ad6f40)) -* update placeholder string ([cff7f1b](https://github.com/imagekit-developer/imagekit-ruby/commit/cff7f1b4cf7a249e7dd6f426c992472238a8c6e1)) - -## 4.2.0 (2026-02-02) - -Full Changelog: [v4.1.2...v4.2.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.1.2...v4.2.0) - -### Features - -* **api:** add customMetadata property to folder schema ([8038b9e](https://github.com/imagekit-developer/imagekit-ruby/commit/8038b9ecc161c7d25c65a35c2d54149ace184479)) - - -### Bug Fixes - -* **api:** add missing embeddedMetadata and video properties to FileDetails ([898add4](https://github.com/imagekit-developer/imagekit-ruby/commit/898add425e5839e85fc8cca8bd8035923ec39463)) - -## 4.1.2 (2026-01-29) - -Full Changelog: [v4.1.1...v4.1.2](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.1.1...v4.1.2) - -### Bug Fixes - -* **docs:** fix mcp installation instructions for remote servers ([84672e6](https://github.com/imagekit-developer/imagekit-ruby/commit/84672e63bc4b4621e1c35ce3d1a9029566b0e1e7)) -* update overlay parameter from 'l-subtitle' to 'l-subtitles' in URL generation ([2acbe47](https://github.com/imagekit-developer/imagekit-ruby/commit/2acbe47f75d0235bd8bfc6213acac361e0b3a07e)) - -## 4.1.1 (2026-01-20) - -Full Changelog: [v4.1.0...v4.1.1](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.1.0...v4.1.1) - -### Bug Fixes - -* vocab field is required ([1ebdd2d](https://github.com/imagekit-developer/imagekit-ruby/commit/1ebdd2dff81b620d7d7dd7dea842424790b503f4)) - - -### Chores - -* **internal:** update `actions/checkout` version ([1e2d69e](https://github.com/imagekit-developer/imagekit-ruby/commit/1e2d69e80f0550dc26aea92609f1a355f5335270)) - -## 4.1.0 (2026-01-16) - -Full Changelog: [v4.0.0...v4.1.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v4.0.0...v4.1.0) - -### Features - -* add layer_mode property to overlays and new transformation options ([97042ce](https://github.com/imagekit-developer/imagekit-ruby/commit/97042ce9bffaf101ab98dd7394caaf4df9a873ea)) -* **api:** Add saved extensions API and enhance transformation options ([f1dc75e](https://github.com/imagekit-developer/imagekit-ruby/commit/f1dc75ecbe0a4a39472fdc10e9dc8f02e75ddc07)) - - -### Bug Fixes - -* add ai-tasks property to response schemas with enum values ([aad5e54](https://github.com/imagekit-developer/imagekit-ruby/commit/aad5e5413676af916e8149f07ae78aaff7c5c313)) -* better thread safety via early initializing SSL store during HTTP client creation ([2bc0835](https://github.com/imagekit-developer/imagekit-ruby/commit/2bc0835981c29b717f0ad3a7d78c3c78027874e0)) -* calling `break` out of streams should be instantaneous ([55bf4a9](https://github.com/imagekit-developer/imagekit-ruby/commit/55bf4a9b768f18f4adad903b2c9d93178a670151)) -* issue where json.parse errors when receiving HTTP 204 with nobody ([dd32cb1](https://github.com/imagekit-developer/imagekit-ruby/commit/dd32cb1572bc155db85ed898011374889996b3fd)) -* remove redundant base64 require statement ([4c73b42](https://github.com/imagekit-developer/imagekit-ruby/commit/4c73b425564e980b21dfd1f3554f8a2e45aaeecf)) - - -### Chores - -* bump dependency version and update sorbet types ([8d89fb2](https://github.com/imagekit-developer/imagekit-ruby/commit/8d89fb2c1654420f83bb7efedcc9056c5a7e3c79)) -* **client:** send user-agent header ([796027d](https://github.com/imagekit-developer/imagekit-ruby/commit/796027d185c93067c32bac98323d8a82aeaf9bfe)) -* explicitly require "base64" gem ([1b4181d](https://github.com/imagekit-developer/imagekit-ruby/commit/1b4181d4e57d2c12306f6d3f43b832f63ab68053)) -* **internal:** codegen related update ([3a93def](https://github.com/imagekit-developer/imagekit-ruby/commit/3a93def2d09609b359824a627183833ae59d74e1)) -* **internal:** codegen related update ([4c161f0](https://github.com/imagekit-developer/imagekit-ruby/commit/4c161f048927df137a12d33a5a1b79af1c561b8b)) -* move `cgi` into dependencies for ruby 4 ([54261ef](https://github.com/imagekit-developer/imagekit-ruby/commit/54261ef9f24e206d2180dc0a205464154af4c3ed)) - - -### Documentation - -* prominently feature MCP server setup in root SDK readmes ([777f8cf](https://github.com/imagekit-developer/imagekit-ruby/commit/777f8cf5cc692eed3e8f6217caf25a85d17201f7)) -* remove MCP Server section from README ([db0f71c](https://github.com/imagekit-developer/imagekit-ruby/commit/db0f71cce159f4c395fe8c7c0526d4108934fc6b)) - -## 4.0.0 (2025-11-03) - -Full Changelog: [v0.0.1...v4.0.0](https://github.com/imagekit-developer/imagekit-ruby/compare/v0.0.1...v4.0.0) - -### Features - -* add get_responsive_image_attributes method with options parameter ([766ded9](https://github.com/imagekit-developer/imagekit-ruby/commit/766ded9f6644cdc0f4638980ca78b51a877fe309)) -* add responsive image attributes generation for HTML <img> tags ([13edc3d](https://github.com/imagekit-developer/imagekit-ruby/commit/13edc3d82f92d19869f672bd955a9045a13e0a16)) -* **api:** add BaseWebhookEvent ([b4c2a83](https://github.com/imagekit-developer/imagekit-ruby/commit/b4c2a8398c1b8bfa1df7da222ede418b047fe0b1)) -* **api:** add GetImageAttributesOptions and ResponsiveImageAttributes schemas; update resource references in main.yaml; remove dummy endpoint ([08560d4](https://github.com/imagekit-developer/imagekit-ruby/commit/08560d45c6390460f14c8b76ce42292ed3303047)) -* **api:** add path policy related non-breaking changes ([b24e025](https://github.com/imagekit-developer/imagekit-ruby/commit/b24e025ed565cd1a0f3906838c24d1fc5588f3fd)) -* **api:** add selectedFieldsSchema in upload and list API response ([557f058](https://github.com/imagekit-developer/imagekit-ruby/commit/557f0588a6352568ca0b7be28fe1759717c59aa5)) -* **api:** extract UpdateFileDetailsRequest to model ([9aaa659](https://github.com/imagekit-developer/imagekit-ruby/commit/9aaa6599d67f4d077d34d0afec3c08baef271b9b)) -* **api:** fix go sdk breaking changes ([525a5aa](https://github.com/imagekit-developer/imagekit-ruby/commit/525a5aa25dba80a109fc5d53535cf2f8fa2250dd)) -* **api:** fix upload API request params ([0ac922a](https://github.com/imagekit-developer/imagekit-ruby/commit/0ac922a79db6de564a0ec9dc5405a5171c1d7109)) -* **api:** manual updates ([eaa294e](https://github.com/imagekit-developer/imagekit-ruby/commit/eaa294e74f32dea948ceaec8a5e44223075dabf8)) -* **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:** modify upload options serialization for backend API compatibility ([2d9cda5](https://github.com/imagekit-developer/imagekit-ruby/commit/2d9cda5fd408c5359f455c989585a8a8e3528676)) -* **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)) -* **api:** update gem name ([a966137](https://github.com/imagekit-developer/imagekit-ruby/commit/a966137abb937faa25451baafcd41e32c0d16b7e)) -* **api:** updated docs ([c2d983e](https://github.com/imagekit-developer/imagekit-ruby/commit/c2d983ed07adab3c0031f18174b0dcf95a5ba26d)) -* expose response headers for both streams and errors ([72c02c3](https://github.com/imagekit-developer/imagekit-ruby/commit/72c02c37a42bddc4e191b43145a562fab9e01dc7)) -* handle thread interrupts in the core HTTP client ([4d258e9](https://github.com/imagekit-developer/imagekit-ruby/commit/4d258e9d5fc3cb2d2e74e26d605e87b7852736a4)) -* pass all test cases ([1cfd9cb](https://github.com/imagekit-developer/imagekit-ruby/commit/1cfd9cb2229352e8d2ba4a005fc214fbfd73c1ba)) -* **tests:** add support for plain hashes in various helper methods and tests ([f7a8f2d](https://github.com/imagekit-developer/imagekit-ruby/commit/f7a8f2d0cdb258abbc04d73eb7458d371948f2d8)) -* **tests:** add test for generating signed URLs in responsive image attributes ([41b17ab](https://github.com/imagekit-developer/imagekit-ruby/commit/41b17abff1fdd1dc63e7b5cb1b3eff765f8955f4)) -* **tests:** add tests to ensure integer descriptors in srcset for responsive image attributes ([fab9156](https://github.com/imagekit-developer/imagekit-ruby/commit/fab915681615569c608439025992325210391e61)) - - -### Bug Fixes - -* absolutely qualified uris should always override the default ([eebaf5e](https://github.com/imagekit-developer/imagekit-ruby/commit/eebaf5ef3d7b60eb051d4e1a146dee8e0eae66ec)) -* add examples/temp* to .gitignore ([2e76262](https://github.com/imagekit-developer/imagekit-ruby/commit/2e762620a6e8179d3f873306596ea623bd6e539d)) -* always send `filename=...` for multipart requests where a file is expected ([9cf2e92](https://github.com/imagekit-developer/imagekit-ruby/commit/9cf2e92f6bd271a6ffa538176d836786f9ae72bc)) -* 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)) -* coroutine leaks from connection pool ([62e54e5](https://github.com/imagekit-developer/imagekit-ruby/commit/62e54e54eaa2201beeedbacd41452e7eb7d6b1d7)) -* **deps:** update gem dependencies to latest versions in Gemfile.lock ([0cfea18](https://github.com/imagekit-developer/imagekit-ruby/commit/0cfea1897d6c71f8a24bf4795b46553d5d937693)) -* **docs:** enhance README to clarify features and integration with Ruby on Rails ([22c2cec](https://github.com/imagekit-developer/imagekit-ruby/commit/22c2cec88e2c6a37f10dce061eb555e70fe7715d)) -* **docs:** remove unnecessary Bundler setup requirement from usage example in README ([b3355da](https://github.com/imagekit-developer/imagekit-ruby/commit/b3355dad701bb557b5f93281330cc68b6b49011c)) -* **docs:** streamline documentation for Ruby on Rails integration and remove redundant sections ([855c7f9](https://github.com/imagekit-developer/imagekit-ruby/commit/855c7f95644f493d5d670a76c571b9c245493e73)) -* **docs:** update README examples for file uploads and remove obsolete parameters ([17a776a](https://github.com/imagekit-developer/imagekit-ruby/commit/17a776a445401889f0624bf05de2317408f9c1e1)) -* **docs:** update README examples to use File.read instead of StringIO for file uploads ([ca62b83](https://github.com/imagekit-developer/imagekit-ruby/commit/ca62b8326f92b584d805bbe22f133b46f3f84423)) -* **docs:** update README to enhance clarity on Ruby documentation and Rails integration ([e5f64f1](https://github.com/imagekit-developer/imagekit-ruby/commit/e5f64f1a20cb2fb02f23378636053bc0e1bf4957)) -* **docs:** update README to enhance documentation for Ruby on Rails integration and remove outdated sections ([d1760a3](https://github.com/imagekit-developer/imagekit-ruby/commit/d1760a31d0cde39067114c1d913d4c0d0ce8d1c1)) -* **docs:** update README to reflect gem name change from imagekit to imagekitio ([6beb35d](https://github.com/imagekit-developer/imagekit-ruby/commit/6beb35d38eb07ae157a000b953380f948a550c5f)) -* README.md linking sections ([9101ca2](https://github.com/imagekit-developer/imagekit-ruby/commit/9101ca2f3676a28d92c84c3b1b2c1c78ab5d027d)) -* shorten multipart boundary sep to less than RFC specificed max length ([b2ffa6a](https://github.com/imagekit-developer/imagekit-ruby/commit/b2ffa6a8b489b151c50f76f56ad79376aabbcbcb)) -* should not reuse buffers for `IO.copy_stream` interop ([80dcda6](https://github.com/imagekit-developer/imagekit-ruby/commit/80dcda667c50f379514018fbf9db84b1a624fc2e)) -* spelling typo ([8debe83](https://github.com/imagekit-developer/imagekit-ruby/commit/8debe8379dbebdc7aad334acd1d8ac69283b0f94)) -* standardize naming from "Image Kit" to "ImageKit" across documentation and gemspec ([c427415](https://github.com/imagekit-developer/imagekit-ruby/commit/c427415b3424b544bd0b61188d95b1fa90846a38)) -* update namespace for coerce_hash! method in file upload parameters ([f3e7216](https://github.com/imagekit-developer/imagekit-ruby/commit/f3e72163a0000d8f526ad67f1183c1d185772cf4)) - - -### Performance Improvements - -* faster code formatting ([8005df1](https://github.com/imagekit-developer/imagekit-ruby/commit/8005df172660b8610889bd2a478774c38b26cb7d)) - - -### Chores - -* allow fast-format to use bsd sed as well ([81093a0](https://github.com/imagekit-developer/imagekit-ruby/commit/81093a0420de0f10a331fb8d878cc2d9322ca1ec)) -* do not install brew dependencies in ./scripts/bootstrap by default ([14104e2](https://github.com/imagekit-developer/imagekit-ruby/commit/14104e2b691d586fe0e978a6c6e4232d2e6db650)) -* ignore linter error for tests having large collections ([86d5b43](https://github.com/imagekit-developer/imagekit-ruby/commit/86d5b4308f574b456e7f4fd8f094cf02fba39114)) -* **internal:** codegen related update ([d13a1d7](https://github.com/imagekit-developer/imagekit-ruby/commit/d13a1d73432f2ed5a54a7ad624cdc8237b15eb81)) -* remove example upload script ([efe2092](https://github.com/imagekit-developer/imagekit-ruby/commit/efe2092315ca68b4d9b7ede16ba4e624ec1f3adc)) -* sync repo ([0200fb8](https://github.com/imagekit-developer/imagekit-ruby/commit/0200fb885ff82f4960f401169d728b48c9d900cf)) -* update SDK settings ([15d893e](https://github.com/imagekit-developer/imagekit-ruby/commit/15d893e96bc5ae52e5e0cefe24818c248a047d3e)) -* update SDK settings ([5ce5d1f](https://github.com/imagekit-developer/imagekit-ruby/commit/5ce5d1f2370b6b31c1d2927856bfeac5eb592a23)) - - -### Documentation - -* correct typo in default value description for custom metadata field ([c16e257](https://github.com/imagekit-developer/imagekit-ruby/commit/c16e257b541f1fd5063f8feeac74ba7b214d0507)) -* update README to enhance URL generation section with detailed examples and new features ([f1687c0](https://github.com/imagekit-developer/imagekit-ruby/commit/f1687c0784b4633a3e55165f62f14ef7d8bbd5c8)) - - -### Refactors - -* consolidate handling of tags and responseFields for improved clarity ([2b7d54e](https://github.com/imagekit-developer/imagekit-ruby/commit/2b7d54e8592d36f8db8eaebffdae65aa4f1527e7)) -* format and fix all lint issues ([091e6d2](https://github.com/imagekit-developer/imagekit-ruby/commit/091e6d29618ee8337f4fe4ea6d82c77748520b65)) -* remove unnecessary require statements for improved clarity ([75820cd](https://github.com/imagekit-developer/imagekit-ruby/commit/75820cdc78cae2383c7e6061f359b1cc40a93d52)) -* rename generateTransformationString to buildTransformationString for consistency ([028871e](https://github.com/imagekit-developer/imagekit-ruby/commit/028871e9aa23e61b7ba1432874ed99943aec4c0f)) -* simplify overlay processing and enhance safe property access ([f35d7eb](https://github.com/imagekit-developer/imagekit-ruby/commit/f35d7eb50bd2eafd74f355d9a6edd992ae9b995c)) -* standardize method naming for URL and transformation string generation ([f736fef](https://github.com/imagekit-developer/imagekit-ruby/commit/f736fefcd85bf65204fce105969671608551ee89)) -* streamline model object handling and enhance safe property access ([ebf5887](https://github.com/imagekit-developer/imagekit-ruby/commit/ebf5887fb945ae99807327e2361263612a734c00)) -* **tests:** remove password parameter from client setup in URL generation tests ([3cf2616](https://github.com/imagekit-developer/imagekit-ruby/commit/3cf26166baf9369b3e32203c202b3d44f68d177b)) -* unify helper attribute naming across client and test files ([67d2ecb](https://github.com/imagekit-developer/imagekit-ruby/commit/67d2ecb8de8f2889c7473d2635a172b5346bcfde)) -* update method calls to use fully qualified names for clarity ([a45cc83](https://github.com/imagekit-developer/imagekit-ruby/commit/a45cc83d04301758db54a1cfa96364ddb7002959)) -* update parameter naming for build_url method to use options ([cd3618c](https://github.com/imagekit-developer/imagekit-ruby/commit/cd3618c5bb747640da0b255d46206bdd6ee0d300)) - - -### 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)) diff --git a/Gemfile.lock b/Gemfile.lock index b7057abf..f972d443 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - imagekitio (4.9.0) + imagekitio (4.7.0) cgi connection_pool standardwebhooks @@ -202,7 +202,6 @@ PLATFORMS arm64-darwin universal-darwin x86_64-darwin - x86_64-linux x86_64-linux-gnu x86_64-linux-musl @@ -228,4 +227,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.7.1 + 2.4.1 diff --git a/README.md b/README.md index 61cef4a3..486b8ac9 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,21 @@ -# ImageKit.io Ruby SDK +# Image Kit Ruby API library -The ImageKit Ruby library provides convenient access to the ImageKit REST API from any Ruby 3.2.0+ application. The library supports building and transforming URLs, generating signed URLs for secure content delivery, and handling file uploads. 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. +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. + +## MCP Server + +Use the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. + +[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19) +[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D) + +> Note: You may need to set environment variables in your MCP client. ## Documentation -The official [ImageKit Ruby documentation](https://imagekit.io/docs/integration/ruby) provides complete integration guides and examples. - -If you're using Ruby on Rails, the [ImageKit Rails gem](https://github.com/imagekit-developer/imagekit-rails) builds on top of this SDK to provide [Rails-specific integrations](https://imagekit.io/docs/integration/ruby/ruby-on-rails) including Active Storage and view helpers. - -## Table of Contents - -- [Documentation](#documentation) -- [Installation](#installation) -- [Usage](#usage) - - [File uploads](#file-uploads) -- [URL Generation](#url-generation) - - [Basic URL generation](#basic-url-generation) - - [URL generation with transformations](#url-generation-with-transformations) - - [URL generation with image overlay](#url-generation-with-image-overlay) - - [URL generation with text overlay](#url-generation-with-text-overlay) - - [Signed URLs for secure delivery](#signed-urls-for-secure-delivery) - - [Chained transformations](#chained-transformations) - - [Using raw parameter for custom transformations](#using-raw-parameter-for-custom-transformations) -- [Helper Methods](#helper-methods) - - [Authentication parameters for client-side uploads](#authentication-parameters-for-client-side-uploads) - - [Responsive image attributes](#responsive-image-attributes) -- [Webhook verification](#webhook-verification) -- [Handling errors](#handling-errors) - - [Retries](#retries) - - [Timeouts](#timeouts) -- [Advanced concepts](#advanced-concepts) - - [BaseModel](#basemodel) - - [Making custom or undocumented requests](#making-custom-or-undocumented-requests) - - [Concurrency & connection pooling](#concurrency--connection-pooling) -- [Sorbet](#sorbet) - - [Enums](#enums) -- [Versioning](#versioning) -- [Requirements](#requirements) -- [Contributing](#contributing) +Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekitio). + +The REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). ## Installation @@ -46,7 +24,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "imagekitio", "~> 4.9.0" +gem "imagekitio", "~> 4.7.0" ``` @@ -54,484 +32,44 @@ gem "imagekitio", "~> 4.9.0" ## Usage ```ruby +require "bundler/setup" require "imagekitio" image_kit = Imagekitio::Client.new( 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 ) response = image_kit.files.upload( - file: Pathname("/path/to/file"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg" ) -puts(response.file_id) +puts(response.videoCodec) ``` ### File uploads -Request parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, or an `IO` stream. +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 require "pathname" -# Use `Pathname` to stream from disk (memory efficient, supports retries): +# 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")) -# Or pass file contents directly +# Alternatively, pass file contents or a `StringIO` directly: response = image_kit.files.upload(file: File.read("/path/to/file")) # Or, to control the filename and/or content type: file = Imagekitio::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…") response = image_kit.files.upload(file: file) -puts(response.file_id) +puts(response.videoCodec) ``` 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). -## URL Generation - -The ImageKit SDK provides a powerful `helper.build_url()` method for generating optimized image and video URLs with transformations. Here are examples ranging from simple URLs to complex transformations with overlays and signed URLs. - -### Basic URL generation - -Generate a simple URL without any transformations: - -```ruby -require "imagekitio" - -image_kit = Imagekitio::Client.new( - private_key: ENV["IMAGEKIT_PRIVATE_KEY"] -) - -# Basic URL without transformations -url = image_kit.helper.build_url({ - src: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id" -}) - -puts url -# Output: https://ik.imagekit.io/your_imagekit_id/default-image.jpg -``` - -You can also use absolute URLs: - -```ruby -url = image_kit.helper.build_url({ - src: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id" -}) -``` - -### URL generation with transformations - -Apply common transformations like resizing, cropping, and format conversion: - -```ruby -# URL with basic transformations -url = image_kit.helper.build_url({ - src: "/path/to/image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 400, - height: 300, - crop: :maintain_ratio, - quality: 80, - format_: :webp - } - ] -}) -# Output: https://ik.imagekit.io/your_imagekit_id/path/to/image.jpg?tr=w-400,h-300,c-maintain_ratio,q-80,f-webp -``` - -More transformation examples: - -```ruby -# Image resizing and cropping -url = image_kit.helper.build_url({ - src: "/product.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 800, - height: 600, - crop: :at_max, - focus: "auto" - } - ] -}) - -# Image effects -url = image_kit.helper.build_url({ - src: "/photo.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - blur: 10, - grayscale: true, - radius: 20 - } - ] -}) - -# Format and quality optimization -url = image_kit.helper.build_url({ - src: "/image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - format_: :auto, - quality: 85, - progressive: true - } - ] -}) -``` - -### URL generation with image overlay - -Add image overlays to your base image: - -```ruby -# URL with image overlay -url = image_kit.helper.build_url({ - src: "/path/to/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 500, - height: 400, - overlay: { - type: :image, - input: "/path/to/overlay-logo.png", - position: { - x: 10, - y_: 10 - }, - transformation: [ - { - width: 100, - height: 50 - } - ] - } - } - ] -}) -# Output: URL with image overlay positioned at x:10, y:10 -``` - -### URL generation with text overlay - -Add customized text overlays: - -```ruby -# URL with text overlay -url = image_kit.helper.build_url({ - src: "/path/to/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 600, - height: 400, - overlay: { - type: :text, - text: "Sample Text Overlay", - position: { - x: 50, - y_: 50, - focus: :center - }, - transformation: [ - { - font_size: 40, - font_family: "Arial", - font_color: "FFFFFF", - typography: "b" # bold - } - ] - } - } - ] -}) -# Output: URL with bold white Arial text overlay at center position -``` - -You can combine multiple overlays for complex compositions: - -```ruby -# URL with multiple overlays (text + image) -url = image_kit.helper.build_url({ - src: "/path/to/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 800, - height: 600, - overlay: { - type: :text, - text: "Header Text", - position: { x: 20, y_: 20 }, - transformation: [{ font_size: 30, font_color: "000000" }] - } - }, - { - overlay: { - type: :image, - input: "/watermark.png", - position: { focus: :bottom_right }, - transformation: [{ width: 100, opacity: 70 }] - } - } - ] -}) -# Output: URL with text overlay at top-left and semi-transparent watermark at bottom-right -``` - -### Signed URLs for secure delivery - -Generate signed URLs that expire after a specified time for secure content delivery: - -```ruby -# Generate a signed URL that expires in 1 hour (3600 seconds) -url = image_kit.helper.build_url({ - src: "/private/secure-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 400, - height: 300, - quality: 90 - } - ], - signed: true, - expires_in: 3600 # URL expires in 1 hour -}) -# Output: URL with signature parameters (?ik-t=timestamp&ik-s=signature) - -# Generate a signed URL that doesn't expire -url = image_kit.helper.build_url({ - src: "/private/secure-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - signed: true - # No expires_in means the URL won't expire -}) -# Output: URL with signature parameter (?ik-s=signature) -``` - -### Chained transformations - -Apply multiple transformation steps by passing multiple transformation objects. Each transformation is applied sequentially: - -```ruby -# First resize, then apply effects -url = image_kit.helper.build_url({ - src: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 400, - height: 300 - }, - { - rotation: 90, - blur: 5 - } - ] -}) -# Output: https://ik.imagekit.io/your_imagekit_id/default-image.jpg?tr=w-400,h-300:rt-90,bl-5 -``` - -### Using raw parameter for custom transformations - -ImageKit frequently adds new transformation parameters that might not yet be documented in the SDK. You can use the `raw` parameter to access these features or create custom transformation strings: - -```ruby -# Using raw parameter for custom transformations -url = image_kit.helper.build_url({ - src: "/path/to/image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation: [ - { - width: 400, - height: 300, - raw: "something-new" - } - ] -}) -# Output: https://ik.imagekit.io/your_imagekit_id/path/to/image.jpg?tr=w-400,h-300,something-new -``` - -You can control where transformations appear in the URL: - -```ruby -# Add transformations to the URL path instead of query parameters -url = image_kit.helper.build_url({ - src: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - transformation_position: :path, - transformation: [ - { - width: 400, - height: 300 - } - ] -}) -# Output: https://ik.imagekit.io/your_imagekit_id/tr:w-400,h-300/default-image.jpg -``` - -Add custom query parameters: - -```ruby -url = image_kit.helper.build_url({ - src: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - query_parameters: { - version: "1", - cache: "max" - } -}) -``` - -## Helper Methods - -The SDK provides several helper methods for common ImageKit operations. - -### Authentication parameters for client-side uploads - -Generate authentication parameters for secure client-side file uploads. These parameters allow you to securely upload files directly from the browser without exposing your private API key: - -```ruby -require "imagekitio" - -image_kit = Imagekitio::Client.new( - private_key: ENV["IMAGEKIT_PRIVATE_KEY"] -) - -# Generate authentication parameters with default expiry (30 minutes) -auth_params = image_kit.helper.get_authentication_parameters - -puts auth_params -# Output: { token: "unique-token", expire: 1234567890, signature: "signature-hash" } -``` - -Customize the token and expiration: - -```ruby -# Custom token and expiry (1 hour from now) -auth_params = image_kit.helper.get_authentication_parameters( - token: "my-custom-token", - expire: Time.now.to_i + 3600 -) -# Output: { token: "my-custom-token", expire: 1234567890, signature: "generated-signature" } -``` - -These authentication parameters can be used in client-side upload forms to securely upload files without exposing your private API key. - -### Responsive image attributes - -Generate responsive image attributes for HTML `` tags. This creates optimized `srcset` and `sizes` attributes for responsive images: - -```ruby -# Width-based responsive images (generates w descriptors) -attrs = image_kit.helper.get_responsive_image_attributes({ - src: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - sizes: "(min-width: 768px) 50vw, 100vw", - transformation: [ - { - quality: 80, - format_: :auto - } - ] -}) - -puts attrs.src -# Largest candidate URL - -puts attrs.src_set -# URL1 640w, URL2 750w, URL3 1080w, ... - -puts attrs.sizes -# (min-width: 768px) 50vw, 100vw -``` - -DPR-based responsive images (generates x descriptors): - -```ruby -# When width is provided without sizes, generates 1x and 2x variants -attrs = image_kit.helper.get_responsive_image_attributes({ - src: "/profile.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - width: 400, - transformation: [ - { - quality: 85 - } - ] -}) - -puts attrs.src_set -# URL1 1x, URL2 2x - -puts attrs.width -# 400 -``` - -Custom breakpoints for device widths: - -```ruby -attrs = image_kit.helper.get_responsive_image_attributes({ - src: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - sizes: "100vw", - device_breakpoints: [320, 640, 1024, 1920], - image_breakpoints: [16, 32, 64], - transformation: [ - { - crop: :at_max - } - ] -}) -``` - -The returned attributes can be directly used in your HTML: - -```erb -Responsive image -``` - -Generate signed responsive image URLs: - -```ruby -# Generate signed responsive image URLs -attrs = image_kit.helper.get_responsive_image_attributes({ - src: "/default-image.jpg", - url_endpoint: "https://ik.imagekit.io/your_imagekit_id", - sizes: "100vw", - signed: true, - expires_in: 3600, - transformation: [ - { - quality: 80 - } - ] -}) -``` - -## Webhook verification - -The ImageKit SDK provides utilities to verify webhook signatures for secure event handling. This ensures that webhook requests are actually coming from ImageKit and haven't been tampered with. - -For detailed information about webhook setup, signature verification, and handling different webhook events, refer to the [ImageKit webhook documentation](https://imagekit.io/docs/webhooks#verify-webhook-signature). - ### Handling errors When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Imagekitio::Errors::APIError` will be thrown: @@ -539,7 +77,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: File.read("/path/to/file.jpg"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg" ) rescue Imagekitio::Errors::APIConnectionError => e @@ -585,7 +123,7 @@ image_kit = Imagekitio::Client.new( # Or, configure per-request: image_kit.files.upload( - file: File.read("/path/to/file.jpg"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {max_retries: 5} ) @@ -603,7 +141,7 @@ image_kit = Imagekitio::Client.new( # Or, configure per-request: image_kit.files.upload( - file: File.read("/path/to/file.jpg"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: {timeout: 5} ) @@ -638,7 +176,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete ```ruby response = image_kit.files.upload( - file: File.read("/path/to/file.jpg"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg", request_options: { extra_query: {my_query_parameter: value}, @@ -686,7 +224,7 @@ You can provide typesafe request parameters like so: ```ruby image_kit.files.upload( - file: File.read("/path/to/file.jpg"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg" ) ``` @@ -696,13 +234,13 @@ Or, equivalently: ```ruby # Hashes work, but are not typesafe: image_kit.files.upload( - file: File.read("/path/to/file.jpg"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg" ) # You can also splat a full Params class: params = Imagekitio::FileUploadParams.new( - file: File.read("/path/to/file.jpg"), + file: StringIO.new("https://www.example.com/public-url.jpg"), file_name: "file-name.jpg" ) image_kit.files.upload(**params) @@ -738,7 +276,7 @@ image_kit.assets.list( ## Versioning -This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. +This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time. This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes. @@ -748,4 +286,4 @@ Ruby 3.2.0 or higher. ## Contributing -See [the contributing documentation](https://github.com/imagekit-developer/imagekit-ruby/tree/main/CONTRIBUTING.md). +See [the contributing documentation](https://github.com/imagekit-developer/imagekit-ruby/tree/master/CONTRIBUTING.md). diff --git a/Rakefile b/Rakefile index 1b154dad..a0c9e54e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "etc" require "pathname" require "securerandom" require "shellwords" @@ -38,11 +37,7 @@ multitask(:test) do ruby(*%w[-w -e], rb, verbose: false) { fail unless _1 } end -# Cap parallelism at the CPU count. `--max-procs=0` spawns one process per -# 300-file batch with no upper bound; on large SDKs (thousands of files) that -# oversubscribes CPUs and stacks up rubocop processes, exhausting memory and -# slowing CI to the point of timing out. -xargs = %W[xargs --no-run-if-empty --null --max-procs=#{Etc.nprocessors} --max-args=300 --] +xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --] ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")} filtered = ->(ext, dirs) do diff --git a/SECURITY.md b/SECURITY.md index 2ed9bbbf..8e64327a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,9 +16,9 @@ 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 ImageKit, please follow the respective company's security reporting guidelines. +or products provided by Image Kit, please follow the respective company's security reporting guidelines. -### ImageKit Terms and Policies +### Image Kit Terms and Policies Please contact developer@imagekit.io for any questions or concerns regarding the security of our services. diff --git a/bin/check-release-environment b/bin/check-release-environment index 4ec6c753..c05436e8 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${RELEASE_PLEASE_TOKEN}" ]; then - errors+=("The RELEASE_PLEASE_TOKEN secret has not been set. Create a fine-grained GitHub PAT and add it as a repository secret.") -fi - 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 diff --git a/imagekitio.gemspec b/imagekitio.gemspec index 853c9192..a84121b1 100644 --- a/imagekitio.gemspec +++ b/imagekitio.gemspec @@ -5,8 +5,8 @@ require_relative "lib/imagekitio/version" Gem::Specification.new do |s| s.name = "imagekitio" s.version = Imagekitio::VERSION - s.summary = "Ruby library to access the ImageKit API" - s.authors = ["ImageKit"] + 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/imagekitio" s.metadata["homepage_uri"] = s.homepage diff --git a/lib/imagekitio.rb b/lib/imagekitio.rb index 56e023ac..bf4dd4e0 100644 --- a/lib/imagekitio.rb +++ b/lib/imagekitio.rb @@ -55,7 +55,6 @@ require_relative "imagekitio/client" require_relative "imagekitio/models/accounts/origin_request" require_relative "imagekitio/models/accounts/url_endpoint_request" -require_relative "imagekitio/models/accounts/request_bandwidth_entry" require_relative "imagekitio/models/base_webhook_event" require_relative "imagekitio/models/update_file_request" require_relative "imagekitio/models/file" @@ -75,8 +74,6 @@ require_relative "imagekitio/models/accounts/url_endpoint_list_response" require_relative "imagekitio/models/accounts/url_endpoint_response" require_relative "imagekitio/models/accounts/url_endpoint_update_params" -require_relative "imagekitio/models/accounts/usage_analytics_get_params" -require_relative "imagekitio/models/accounts/usage_analytics_response" require_relative "imagekitio/models/accounts/usage_get_params" require_relative "imagekitio/models/accounts/usage_get_response" require_relative "imagekitio/models/ai_tag" @@ -149,13 +146,6 @@ require_relative "imagekitio/models/get_image_attributes_options" require_relative "imagekitio/models/image_overlay" require_relative "imagekitio/models/metadata" -require_relative "imagekitio/models/named_transformation" -require_relative "imagekitio/models/named_transformation_create_params" -require_relative "imagekitio/models/named_transformation_delete_params" -require_relative "imagekitio/models/named_transformation_get_params" -require_relative "imagekitio/models/named_transformation_list_params" -require_relative "imagekitio/models/named_transformation_list_response" -require_relative "imagekitio/models/named_transformation_update_params" require_relative "imagekitio/models/overlay" require_relative "imagekitio/models/overlay_position" require_relative "imagekitio/models/overlay_timing" @@ -195,7 +185,6 @@ require_relative "imagekitio/resources/accounts/origins" require_relative "imagekitio/resources/accounts/url_endpoints" require_relative "imagekitio/resources/accounts/usage" -require_relative "imagekitio/resources/accounts/usage_analytics" require_relative "imagekitio/resources/assets" require_relative "imagekitio/resources/beta" require_relative "imagekitio/resources/beta/v2" @@ -209,7 +198,5 @@ require_relative "imagekitio/resources/files/versions" require_relative "imagekitio/resources/folders" require_relative "imagekitio/resources/folders/job" -require_relative "imagekitio/resources/named_transformations" require_relative "imagekitio/resources/saved_extensions" require_relative "imagekitio/resources/webhooks" -require_relative "imagekitio/helpers/helper" diff --git a/lib/imagekitio/client.rb b/lib/imagekitio/client.rb index d9b6a586..0f9f986e 100644 --- a/lib/imagekitio/client.rb +++ b/lib/imagekitio/client.rb @@ -28,7 +28,7 @@ class Client < Imagekitio::Internal::Transport::BaseClient # Your ImageKit webhook secret for verifying webhook signatures (starts with # `whsec_`). You can find this in the # [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only - # required if you are using webhooks. + # required if you're using webhooks. # @return [String, nil] attr_reader :webhook_secret @@ -41,9 +41,6 @@ class Client < Imagekitio::Internal::Transport::BaseClient # @return [Imagekitio::Resources::SavedExtensions] attr_reader :saved_extensions - # @return [Imagekitio::Resources::NamedTransformations] - attr_reader :named_transformations - # @return [Imagekitio::Resources::Assets] attr_reader :assets @@ -62,9 +59,6 @@ class Client < Imagekitio::Internal::Transport::BaseClient # @return [Imagekitio::Resources::Webhooks] attr_reader :webhooks - # @return [Imagekitio::Helper] - attr_reader :helper - # @api private # # @return [Hash{String=>String}] @@ -93,7 +87,7 @@ def base_url_overridden? = @base_url_overridden # @param webhook_secret [String, nil] Your ImageKit webhook secret for verifying webhook signatures (starts with # `whsec_`). You can find this in the # [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only - # required if you are using webhooks. Defaults to `ENV["IMAGEKIT_WEBHOOK_SECRET"]` + # required if you're using webhooks. Defaults to `ENV["IMAGEKIT_WEBHOOK_SECRET"]` # # @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"]` @@ -119,7 +113,7 @@ def initialize( base_url ||= "https://api.imagekit.io" - if private_key.nil? || private_key.to_s.empty? + if private_key.nil? raise ArgumentError.new("private_key is required, and can be set via environ: \"IMAGEKIT_PRIVATE_KEY\"") end @@ -152,14 +146,12 @@ def initialize( @custom_metadata_fields = Imagekitio::Resources::CustomMetadataFields.new(client: self) @files = Imagekitio::Resources::Files.new(client: self) @saved_extensions = Imagekitio::Resources::SavedExtensions.new(client: self) - @named_transformations = Imagekitio::Resources::NamedTransformations.new(client: self) @assets = Imagekitio::Resources::Assets.new(client: self) @cache = Imagekitio::Resources::Cache.new(client: self) @folders = Imagekitio::Resources::Folders.new(client: self) @accounts = Imagekitio::Resources::Accounts.new(client: self) @beta = Imagekitio::Resources::Beta.new(client: self) @webhooks = Imagekitio::Resources::Webhooks.new(client: self) - @helper = Imagekitio::Helper.new(client: self) end end end diff --git a/lib/imagekitio/helpers/crypto_utils.rb b/lib/imagekitio/helpers/crypto_utils.rb deleted file mode 100644 index 1d0be449..00000000 --- a/lib/imagekitio/helpers/crypto_utils.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -require "openssl" -require "digest" - -module Imagekitio - # @api private - # Crypto utilities for ImageKit SDK - # Provides HMAC-SHA1 functionality for URL signing and authentication - module CryptoUtils - class << self - # Creates an HMAC-SHA1 hash - # - # @param key [String] The secret key for HMAC generation - # @param data [String] The data to be signed - # @return [String] Hex-encoded HMAC-SHA1 hash - # @raise [StandardError] if HMAC generation fails - def create_hmac_sha1(key, data) - OpenSSL::HMAC.hexdigest("SHA1", key, data) - rescue StandardError => e - raise StandardError, "Failed to generate HMAC-SHA1 signature: #{e.message}" - end - end - end -end diff --git a/lib/imagekitio/helpers/helper.rb b/lib/imagekitio/helpers/helper.rb deleted file mode 100644 index 69a275cb..00000000 --- a/lib/imagekitio/helpers/helper.rb +++ /dev/null @@ -1,699 +0,0 @@ -# frozen_string_literal: true - -require_relative "transformation_utils" -require_relative "crypto_utils" -require_relative "uuid_utils" - -module Imagekitio - class Helper - TRANSFORMATION_PARAMETER = "tr" - SIGNATURE_PARAMETER = "ik-s" - TIMESTAMP_PARAMETER = "ik-t" - DEFAULT_TIMESTAMP = 9_999_999_999 - SIMPLE_OVERLAY_PATH_REGEX = %r{^[a-zA-Z0-9\-._/ ]*$} - SIMPLE_OVERLAY_TEXT_REGEX = /^[a-zA-Z0-9\-._ ]*$/ - - private_constant :TRANSFORMATION_PARAMETER, - :SIGNATURE_PARAMETER, - :TIMESTAMP_PARAMETER, - :DEFAULT_TIMESTAMP, - :SIMPLE_OVERLAY_PATH_REGEX, - :SIMPLE_OVERLAY_TEXT_REGEX - - # Builds a URL with transformations applied - # - # @param options [Imagekitio::Models::SrcOptions] Options for generating ImageKit URLs with transformations - # @return [String] The built URL with transformations - def build_url(options) - # Convert model to hash - all inputs are expected to be BaseModel objects - opts = options.to_h - - # Set defaults - opts[:url_endpoint] ||= "" - opts[:src] ||= "" - opts[:transformation_position] ||= :query - - return "" if opts[:src].nil? || opts[:src].empty? - - src = opts[:src].to_s - is_absolute_url = src.start_with?("http://", "https://") - - begin - if is_absolute_url - url_obj = URI.parse(src) - is_src_parameter_used_for_url = true - else - url_obj = URI.parse(opts[:url_endpoint].to_s) - end - rescue URI::InvalidURIError - return "" - end - - # Add query parameters - query_params = opts[:query_parameters] || {} - existing_params = CGI.parse(url_obj.query || "") - query_params.each do |key, value| - existing_params[key.to_s] = [value.to_s] - end - - # Build transformation string - transformation_string = build_transformation_string(opts[:transformation]) - - add_as_query = Imagekitio::TransformationUtils.add_as_query_parameter?(opts) || - is_src_parameter_used_for_url - transformation_placeholder = "PLEASEREPLACEJUSTBEFORESIGN" - - unless is_absolute_url - # For non-absolute URLs, construct the path - endpoint_path = url_obj.path - path_parts = [] - - # Add endpoint path if it's not empty - if !endpoint_path.empty? && endpoint_path != "/" - path_parts << endpoint_path - end - - if !transformation_string.empty? && !add_as_query - path_parts << "#{TRANSFORMATION_PARAMETER}#{Imagekitio::TransformationUtils.get_chain_transform_delimiter}#{transformation_placeholder}" - end - - path_parts << src - url_obj.path = path_join(path_parts) - end - - # Build query string - unless existing_params.empty? - url_obj.query = existing_params.map { |k, v| "#{CGI.escape(k)}=#{CGI.escape(v.first)}" }.join("&") - end - - # Build final URL - final_url = url_obj.to_s - - # Add transformation parameter manually to avoid URL encoding - if !transformation_string.empty? && add_as_query - separator = url_obj.query && !url_obj.query.empty? ? "&" : "?" - final_url = "#{final_url}#{separator}#{TRANSFORMATION_PARAMETER}=#{transformation_placeholder}" - end - - # Replace placeholder with actual transformation string - unless transformation_string.empty? - final_url = final_url.gsub(transformation_placeholder, transformation_string) - end - - # Sign the URL if needed - if opts[:signed] == true || (opts[:expires_in] && opts[:expires_in].to_i.positive?) - expiry_timestamp = get_signature_timestamp(opts[:expires_in]) - - url_signature = get_signature( - private_key: @client.private_key, - url: final_url, - url_endpoint: opts[:url_endpoint].to_s, - expiry_timestamp: expiry_timestamp - ) - - # Add signature parameters - final_url_uri = URI.parse(final_url) - has_existing_params = final_url_uri.query && !final_url_uri.query.empty? - separator = has_existing_params ? "&" : "?" - - if expiry_timestamp && expiry_timestamp != DEFAULT_TIMESTAMP - final_url = "#{final_url}#{separator}#{TIMESTAMP_PARAMETER}=#{expiry_timestamp}" - final_url = "#{final_url}&#{SIGNATURE_PARAMETER}=#{url_signature}" - else - final_url = "#{final_url}#{separator}#{SIGNATURE_PARAMETER}=#{url_signature}" - end - end - - final_url - end - - # Generates transformation string from transformation objects - # - # @param transformations [Array] Array of transformation objects - # @return [String] The transformation string (e.g., "w-400,h-300") - def build_transformation_string(transformations) - return "" unless transformations.is_a?(Array) - - parsed_transforms = [] - - # rubocop:disable Metrics/BlockLength - transformations.each do |transform| - next unless transform - - # Convert model to hash - all transformation inputs are expected to be BaseModel objects - current_transform = transform.to_h - - parsed_transform_step = [] - - # rubocop:disable Metrics/BlockLength - current_transform.each do |key, value| - next if value.nil? || value.to_s.empty? - - # Handle overlay separately - if key.to_s == "overlay" && value - # Pass model object directly to process_overlay - raw_string = process_overlay(value) - if raw_string && !raw_string.strip.empty? - parsed_transform_step << raw_string - end - next - end - - transform_key = Imagekitio::TransformationUtils.get_transform_key(key) - transform_key = key.to_s if transform_key.empty? - - next if transform_key.empty? - - # Handle special boolean effects - boolean_effects = %w[e-grayscale e-contrast e-removedotbg e-bgremove e-upscale e-retouch e-genvar] - if boolean_effects.include?(transform_key) - if value == true || value == "-" || value == "true" - parsed_transform_step << transform_key - end - next - end - - # Handle effects that can be boolean or have values - value_effects = %w[e-sharpen e-shadow e-gradient e-usm e-dropshadow] - if value_effects.include?(transform_key) && - (value.to_s.strip.empty? || value == true || value == "true") - parsed_transform_step << transform_key - next - end - - # Handle raw parameter - if key.to_s == "raw" - parsed_transform_step << value.to_s - next - end - - # Handle special cases for di and ff (need special encoding) - if %w[di ff].include?(transform_key) - processed_value = remove_leading_slash(remove_trailing_slash(value.to_s)) - processed_value = processed_value.gsub("/", "@@") - value = processed_value - end - - # Handle streaming resolutions array - if transform_key == "sr" && value.is_a?(Array) - value = value.join("_") - end - - # Special case for trim with empty string - if transform_key == "t" && value.to_s.strip.empty? - value = "true" - end - - # Convert numeric values to integers if they're whole numbers - if value.is_a?(Numeric) - value = value.to_i if value == value.to_i - end - - parsed_transform_step << "#{transform_key}#{Imagekitio::TransformationUtils.get_transform_key_value_delimiter}#{value}" - end - # rubocop:enable Metrics/BlockLength - - unless parsed_transform_step.empty? - parsed_transforms << parsed_transform_step.join(Imagekitio::TransformationUtils.get_transform_delimiter) - end - end - # rubocop:enable Metrics/BlockLength - - parsed_transforms.join(Imagekitio::TransformationUtils.get_chain_transform_delimiter) - end - - # Generates authentication parameters for client-side file uploads using ImageKit's Upload API V1. - # - # This method creates the required authentication signature that allows secure file uploads - # directly from the browser or mobile applications without exposing your private API key. - # The generated parameters include a unique token, expiration timestamp, and HMAC signature. - # - # @param token [String, nil] Custom token for the upload session. If not provided, a UUID v4 will be generated automatically. - # @param expire [Integer, nil] Expiration time in seconds from now. If not provided, defaults to 1800 seconds (30 minutes). - # @return [Hash{Symbol => String, Integer}] Authentication parameters object containing: - # - :token (String): Unique identifier for this upload session - # - :expire (Integer): Unix timestamp when these parameters expire - # - :signature (String): HMAC-SHA1 signature for authenticating the upload - def get_authentication_parameters(token: nil, expire: nil) - default_time_diff = 60 * 30 - default_expire = Time.now.to_i + default_time_diff - - # Handle falsy values - empty string and nil should generate new token - final_token = token.nil? || token.to_s.empty? ? generate_token : token - # Handle falsy values - nil and 0 should use default expire - final_expire = expire.nil? || expire.zero? ? default_expire : expire - - get_authentication_parameters_internal(final_token, final_expire, @client.private_key) - end - - # Generates responsive image attributes for use in HTML tags. - # - # This method creates optimized srcset and sizes attributes for responsive images, - # enabling browsers to select the most appropriate image size based on the device's - # screen width and resolution. Supports three strategies: - # - Width-based (w descriptors): When sizes attribute is provided - # - DPR-based (x descriptors): When width is provided without sizes - # - Fallback (w descriptors): Uses device breakpoints when neither is provided - # - # @param options [Imagekitio::Models::GetImageAttributesOptions] Options for generating responsive image attributes - # @return [Imagekitio::Models::ResponsiveImageAttributes] Responsive image attributes suitable for an HTML element - def get_responsive_image_attributes(options) - # Convert model to hash for easier access - opts = options.is_a?(Imagekitio::Internal::Type::BaseModel) ? options.to_h : options - - # Default breakpoint pools - default_device_breakpoints = [640, 750, 828, 1080, 1200, 1920, 2048, 3840] - default_image_breakpoints = [16, 32, 48, 64, 96, 128, 256, 384] - - # Extract options - src = opts[:src] - url_endpoint = opts[:url_endpoint] - width = opts[:width] - sizes = opts[:sizes] - device_breakpoints = opts[:device_breakpoints] || default_device_breakpoints - image_breakpoints = opts[:image_breakpoints] || default_image_breakpoints - transformation = opts[:transformation] || [] - transformation_position = opts[:transformation_position] - query_parameters = opts[:query_parameters] - expires_in = opts[:expires_in] - signed = opts[:signed] - - # Sort and merge breakpoints - sorted_device_breakpoints = device_breakpoints.sort - sorted_image_breakpoints = image_breakpoints.sort - all_breakpoints = (sorted_image_breakpoints + sorted_device_breakpoints).sort.uniq - - # Compute candidate widths and descriptor kind - result = compute_candidate_widths( - all_breakpoints: all_breakpoints, - device_breakpoints: sorted_device_breakpoints, - explicit_width: width, - sizes_attr: sizes - ) - candidates = result[:candidates] - descriptor_kind = result[:descriptor_kind] - - # Helper to build a single ImageKit URL - build_url_fn = lambda do |w| - build_url( - Imagekitio::Models::SrcOptions.new( - src: src, - url_endpoint: url_endpoint, - query_parameters: query_parameters, - transformation_position: transformation_position, - expires_in: expires_in, - signed: signed, - transformation: transformation + [ - Imagekitio::Models::Transformation.new(width: w, crop: "at_max") # never upscale beyond original - ] - ) - ) - end - - # Build srcset - src_set_entries = candidates.map.with_index do |w, i| - # Ensure width is an integer for proper descriptor format (e.g., "640w" not "640.0w") - width_int = w.to_i - descriptor = descriptor_kind == :w ? "#{width_int}w" : "#{i + 1}x" - "#{build_url_fn.call(width_int)} #{descriptor}" - end - src_set = src_set_entries.empty? ? nil : src_set_entries.join(", ") - - final_sizes = sizes || (descriptor_kind == :w ? "100vw" : nil) - - # Build and return ResponsiveImageAttributes model - Imagekitio::Models::ResponsiveImageAttributes.new( - src: build_url_fn.call(candidates.last.to_i), # largest candidate as integer - src_set: src_set, - sizes: final_sizes, - width: width - ) - end - - # @api private - # - # @param client [Imagekitio::Client] - def initialize(client:) - @client = client - end - - private - - # Compute candidate widths for responsive images. - # Implements three strategies: - # 1. Width-based srcSet (w) when sizes attribute contains vw units - # 2. Fallback to device breakpoints when no width or sizes provided - # 3. DPR-based srcSet (x) with 1x and 2x variants when width is provided - def compute_candidate_widths( - all_breakpoints:, - device_breakpoints:, - explicit_width: nil, - sizes_attr: nil - ) - # Strategy 1: Width-based srcSet (w) using viewport vw hints - if sizes_attr - vw_tokens = sizes_attr.scan(/(?:^|\s)(1?\d{1,2})vw/).flatten.map(&:to_i) - - if vw_tokens.any? - # Find the smallest vw percentage - smallest_ratio = vw_tokens.min / 100.0 - # Calculate minimum required pixels - min_required_px = device_breakpoints.first * smallest_ratio - # Filter breakpoints >= min_required_px - candidates = all_breakpoints.select { |bp| bp >= min_required_px } - return {candidates: candidates, descriptor_kind: :w} - end - - # No usable vw found: fallback to all breakpoints - return {candidates: all_breakpoints, descriptor_kind: :w} - end - - # Strategy 2: Fallback using device breakpoints if no explicit width - return {candidates: device_breakpoints, descriptor_kind: :w} unless explicit_width - - # Strategy 3: Use 1x and 2x nearest breakpoints for x descriptor - # Find the first breakpoint >= target (or use the largest) - nearest = lambda do |target| - all_breakpoints.find { |bp| bp >= target } || all_breakpoints.last - end - - # Generate unique 1x and 2x variants - unique = [nearest.call(explicit_width), nearest.call(explicit_width * 2)].uniq - - {candidates: unique, descriptor_kind: :x} - end - - # Generate a 32-character hex token - def generate_token - # Generate 16 random bytes and convert to hex (32 characters) - require("securerandom") - SecureRandom.hex(16) - end - - # Internal method to generate authentication parameters - def get_authentication_parameters_internal(token, expire, private_key) - auth_parameters = { - token: token, - expire: expire, - signature: "" - } - - signature = Imagekitio::CryptoUtils.create_hmac_sha1(private_key, token.to_s + expire.to_s) - auth_parameters[:signature] = signature - - auth_parameters - end - - # Remove trailing slash from string - def remove_trailing_slash(str) - return str unless str.is_a?(String) && str.end_with?("/") - str.chomp("/") - end - - # Remove leading slash from string - def remove_leading_slash(str) - return str unless str.is_a?(String) && str.start_with?("/") - str[1..] - end - - # RFC 3986 path encoding - matches Node.js encodeURIPath exactly - # From Node.js: str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent) - def encode_uri_path(str) - # Only encode characters that are NOT in the RFC 3986 path character set - # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - # sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" - # pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - str.gsub(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/) { |match| CGI.escape(match) } - end - - # Join path parts (Node.js pathJoin algorithm without encoding) - def path_join(parts, separator = "/") - return "" if parts.nil? || parts.empty? - - # Clean up parts and join - cleaned_parts = [] - - parts.each do |part| - part = part.to_s.strip - next if part.empty? - - # Remove leading slashes from all parts - part = part[1..] while part.start_with?(separator) - - # Remove trailing slashes from all parts - part = part[0..-2] while part.end_with?(separator) - - cleaned_parts << part unless part.empty? - end - - return "" if cleaned_parts.empty? - - # Join with separator and add leading slash (Node.js style) - result = separator + cleaned_parts.join(separator) - - # Apply encoding to special characters only, preserving path structure - result.gsub(/[^\x00-\x7F]/) { |char| CGI.escape(char) } - end - - # Process overlay transformation (full implementation) - def process_overlay(overlay) - return "" unless overlay - - # Support both BaseModel objects and plain hashes - type = if overlay.is_a?(Hash) - overlay[:type] || overlay["type"] - else - overlay.type - end - return "" unless type - - # Determine overlay type based on explicit type field - case type.to_s - when "text" - process_text_overlay(overlay) - when "image" - process_image_overlay(overlay) - when "video" - process_video_overlay(overlay) - when "subtitle" - process_subtitle_overlay(overlay) - when "solidColor" - process_solid_color_overlay(overlay) - else - "" - end - end - - # Process input path for image/video/subtitle overlays (matching Node.js processInputPath) - def process_input_path(str, encoding) - # Remove leading and trailing slashes - str = remove_trailing_slash(remove_leading_slash(str)) - - case encoding.to_s - when "plain" - "i-#{str.gsub('/', '@@')}" - when "base64" - "ie-#{CGI.escape(Base64.strict_encode64(str))}" - else # auto - if str.match?(SIMPLE_OVERLAY_PATH_REGEX) - "i-#{str.gsub('/', '@@')}" - else - "ie-#{CGI.escape(Base64.strict_encode64(str))}" - end - end - end - - # Process text content for text overlays (matching Node.js processText) - def process_text(str, encoding) - case encoding.to_s - when "plain" - "i-#{uri_encode(str)}" - when "base64" - "ie-#{uri_encode(Base64.strict_encode64(str))}" - else # auto - if str.match?(SIMPLE_OVERLAY_TEXT_REGEX) - "i-#{uri_encode(str)}" - else - "ie-#{uri_encode(Base64.strict_encode64(str))}" - end - end - end - - # URI encode like JavaScript's encodeURIComponent (uses %20 instead of +) - def uri_encode(str) - CGI.escape(str).gsub("+", "%20") - end - - # Process text overlay - def process_text_overlay(overlay) - text = safe_get(overlay, :text) - return "" unless text && !text.to_s.empty? - - parts = ["l-text"] - - # Handle encoding using the processText function - encoding = safe_get(overlay, :encoding) || "auto" - parts << process_text(text, encoding) - - # Add other overlay properties (position, timing, transformations) - add_overlay_properties(parts, overlay) - - parts << "l-end" - parts.join(",") - end - - # Process image overlay - def process_image_overlay(overlay) - input = safe_get(overlay, :input) - return "" unless input && !input.to_s.empty? - - parts = ["l-image"] - - # Handle encoding using the process_input_path function - encoding = safe_get(overlay, :encoding) || "auto" - parts << process_input_path(input, encoding) - - # Add other overlay properties - add_overlay_properties(parts, overlay) - - parts << "l-end" - parts.join(",") - end - - # Process video overlay - def process_video_overlay(overlay) - input = safe_get(overlay, :input) - return "" unless input && !input.to_s.empty? - - parts = ["l-video"] - - # Handle encoding using the process_input_path function - encoding = safe_get(overlay, :encoding) || "auto" - parts << process_input_path(input, encoding) - - # Add other overlay properties - add_overlay_properties(parts, overlay) - - parts << "l-end" - parts.join(",") - end - - # Process subtitle overlay - def process_subtitle_overlay(overlay) - input = safe_get(overlay, :input) - return "" unless input && !input.to_s.empty? - - parts = ["l-subtitles"] - - # Handle encoding using the process_input_path function - encoding = safe_get(overlay, :encoding) || "auto" - parts << process_input_path(input, encoding) - - # Add other overlay properties - add_overlay_properties(parts, overlay) - - parts << "l-end" - parts.join(",") - end - - # Process solid color overlay - def process_solid_color_overlay(overlay) - color = safe_get(overlay, :color) - return "" unless color && !color.to_s.empty? - - parts = ["l-image", "i-ik_canvas", "bg-#{color}"] - - # Add other overlay properties - add_overlay_properties(parts, overlay) - - parts << "l-end" - parts.join(",") - end - - # Safe property access for model objects and hashes - def safe_get(obj, key) - return nil unless obj - - # Support both BaseModel objects and plain hashes - if obj.is_a?(Hash) - obj[key.to_sym] || obj[key.to_s] - elsif obj.respond_to?(key.to_sym) - obj.send(key.to_sym) - else - nil - end - end - - # Add overlay properties like position, timing, transformations (matching Node.js) - def add_overlay_properties(parts, overlay) - # Add layer_mode property - layer_mode = safe_get(overlay, :layer_mode) - parts << "lm-#{layer_mode}" if layer_mode - - # Add position properties - position = safe_get(overlay, :position) - if position - x = safe_get(position, :x) - y = safe_get(position, :y_) - x_center = safe_get(position, :x_center) - y_center = safe_get(position, :y_center) - focus = safe_get(position, :focus) - anchor_point = safe_get(position, :anchor_point) - - parts << "lx-#{x}" if x - parts << "ly-#{y}" if y - parts << "lxc-#{x_center}" if x_center - parts << "lyc-#{y_center}" if y_center - parts << "lfo-#{focus}" if focus - parts << "lap-#{anchor_point}" if anchor_point - end - - # Add timing properties - timing = safe_get(overlay, :timing) - if timing - start = safe_get(timing, :start) - end_time = safe_get(timing, :end_) - duration = safe_get(timing, :duration) - - parts << "lso-#{start.to_i}" if start - parts << "leo-#{end_time.to_i}" if end_time - parts << "ldu-#{duration}" if duration - end - - # Add transformation properties - transformations = safe_get(overlay, :transformation) - return unless transformations && transformations.is_a?(Array) - transformation_string = build_transformation_string(transformations) - return unless transformation_string && !transformation_string.strip.empty? - parts << transformation_string - end - - # Calculate expiry timestamp for URL signing - def get_signature_timestamp(seconds) - return DEFAULT_TIMESTAMP unless seconds && seconds.to_i.positive? - - sec = seconds.to_i - return DEFAULT_TIMESTAMP if sec <= 0 - - Time.now.to_i + sec - end - - # Generate HMAC-SHA1 signature for URL signing - def get_signature(private_key:, url:, url_endpoint:, expiry_timestamp:) - return "" if private_key.nil? || private_key.empty? || url.nil? || url.empty? || url_endpoint.nil? - - # Create string to sign: relative path + expiry timestamp - endpoint_with_slash = add_trailing_slash(url_endpoint) - string_to_sign = url.gsub(endpoint_with_slash, "") + expiry_timestamp.to_s - - Imagekitio::CryptoUtils.create_hmac_sha1(private_key, string_to_sign) - end - - # Add trailing slash to string if not present - def add_trailing_slash(str) - return str unless str.is_a?(String) - return str if str.end_with?("/") - "#{str}/" - end - end -end diff --git a/lib/imagekitio/helpers/transformation_utils.rb b/lib/imagekitio/helpers/transformation_utils.rb deleted file mode 100644 index 03a385b8..00000000 --- a/lib/imagekitio/helpers/transformation_utils.rb +++ /dev/null @@ -1,172 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - # @api private - # Transformation utilities for building ImageKit URLs - # Ported from the Node.js SDK - module TransformationUtils - # Constants for transformation parsing - QUERY_TRANSFORMATION_POSITION = :query - PATH_TRANSFORMATION_POSITION = :path - CHAIN_TRANSFORM_DELIMITER = ":" - TRANSFORM_DELIMITER = "," - TRANSFORM_KEY_VALUE_DELIMITER = "-" - - # Supported transformations mapping - # Based on https://imagekit.io/docs/transformations - SUPPORTED_TRANSFORMS = { - # Basic sizing & layout - "width" => "w", - "height" => "h", - "aspect_ratio" => "ar", - "aspectRatio" => "ar", - "background" => "bg", - "border" => "b", - "crop" => "c", - "crop_mode" => "cm", - "cropMode" => "cm", - "dpr" => "dpr", - "focus" => "fo", - "quality" => "q", - "x" => "x", - "x_center" => "xc", - "xCenter" => "xc", - "y" => "y", - "y_" => "y", - "y_center" => "yc", - "yCenter" => "yc", - "format" => "f", - "format_" => "f", - "video_codec" => "vc", - "videoCodec" => "vc", - "audio_codec" => "ac", - "audioCodec" => "ac", - "radius" => "r", - "rotation" => "rt", - "blur" => "bl", - "named" => "n", - "default_image" => "di", - "defaultImage" => "di", - "flip" => "fl", - "original" => "orig", - "start_offset" => "so", - "startOffset" => "so", - "end_offset" => "eo", - "endOffset" => "eo", - "duration" => "du", - "streaming_resolutions" => "sr", - "streamingResolutions" => "sr", - - # AI & advanced effects - "grayscale" => "e-grayscale", - "ai_upscale" => "e-upscale", - "aiUpscale" => "e-upscale", - "ai_retouch" => "e-retouch", - "aiRetouch" => "e-retouch", - "ai_variation" => "e-genvar", - "aiVariation" => "e-genvar", - "ai_drop_shadow" => "e-dropshadow", - "aiDropShadow" => "e-dropshadow", - "ai_change_background" => "e-changebg", - "aiChangeBackground" => "e-changebg", - "ai_remove_background" => "e-bgremove", - "aiRemoveBackground" => "e-bgremove", - "ai_remove_background_external" => "e-removedotbg", - "aiRemoveBackgroundExternal" => "e-removedotbg", - "ai_edit" => "e-edit", - "aiEdit" => "e-edit", - "contrast_stretch" => "e-contrast", - "contrastStretch" => "e-contrast", - "shadow" => "e-shadow", - "sharpen" => "e-sharpen", - "unsharp_mask" => "e-usm", - "unsharpMask" => "e-usm", - "gradient" => "e-gradient", - "color_replace" => "cr", - "colorReplace" => "cr", - "colorize" => "e-colorize", - "distort" => "e-distort", - - # Other flags & finishing - "progressive" => "pr", - "lossless" => "lo", - "color_profile" => "cp", - "colorProfile" => "cp", - "metadata" => "md", - "opacity" => "o", - "trim" => "t", - "zoom" => "z", - "page" => "pg", - - # Text overlay transformations - "font_size" => "fs", - "fontSize" => "fs", - "font_family" => "ff", - "fontFamily" => "ff", - "font_color" => "co", - "fontColor" => "co", - "inner_alignment" => "ia", - "innerAlignment" => "ia", - "padding" => "pa", - "alpha" => "al", - "typography" => "tg", - "line_height" => "lh", - "lineHeight" => "lh", - - # Overlay transformations - "layer_mode" => "lm", - "layerMode" => "lm", - - # Subtitles transformations - "font_outline" => "fol", - "fontOutline" => "fol", - "font_shadow" => "fsh", - "fontShadow" => "fsh", - "color" => "co", - - # Raw pass-through - "raw" => "raw" - }.freeze - - class << self - # Check if transformations should be added as query parameter - def add_as_query_parameter?(options) - options[:transformation_position] == QUERY_TRANSFORMATION_POSITION || - options["transformation_position"] == QUERY_TRANSFORMATION_POSITION || - options[:transformation_position] == "query" || - options["transformation_position"] == "query" - end - - # Get transformation key from supported transforms - def get_transform_key(transform) - return "" if transform.nil? || transform.to_s.empty? - - transform_str = transform.to_s - SUPPORTED_TRANSFORMS[transform_str] || - SUPPORTED_TRANSFORMS[transform_str.downcase] || - "" - end - - # Get chain transform delimiter - def get_chain_transform_delimiter - CHAIN_TRANSFORM_DELIMITER - end - - # Get transform delimiter - def get_transform_delimiter - TRANSFORM_DELIMITER - end - - # Get transform key-value delimiter - def get_transform_key_value_delimiter - TRANSFORM_KEY_VALUE_DELIMITER - end - - # Safe base64 encoding - def safe_btoa(str) - require("base64") - Base64.strict_encode64(str) - end - end - end -end diff --git a/lib/imagekitio/helpers/uuid_utils.rb b/lib/imagekitio/helpers/uuid_utils.rb deleted file mode 100644 index 6840505e..00000000 --- a/lib/imagekitio/helpers/uuid_utils.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" - -module Imagekitio - # @api private - # UUID utilities for ImageKit SDK - module UuidUtils - class << self - # Generates a UUID v4 string - # - # @return [String] A UUID v4 string - def uuid4 - SecureRandom.uuid - end - end - end -end diff --git a/lib/imagekitio/models.rb b/lib/imagekitio/models.rb index 044cee5b..755cec6d 100644 --- a/lib/imagekitio/models.rb +++ b/lib/imagekitio/models.rb @@ -124,18 +124,6 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata - NamedTransformation = Imagekitio::Models::NamedTransformation - - NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams - - NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams - - NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams - - NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams - - NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams - Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/lib/imagekitio/models/accounts/origin_request.rb b/lib/imagekitio/models/accounts/origin_request.rb index 285c45bf..091b669d 100644 --- a/lib/imagekitio/models/accounts/origin_request.rb +++ b/lib/imagekitio/models/accounts/origin_request.rb @@ -27,7 +27,7 @@ module OriginRequest class S3 < Imagekitio::Internal::Type::BaseModel # @!attribute access_key - # Access key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Access key for the bucket. # # @return [String] required :access_key, String, api_name: :accessKey @@ -45,7 +45,7 @@ class S3 < Imagekitio::Internal::Type::BaseModel required :name, String # @!attribute secret_key - # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Secret key for the bucket. # # @return [String] required :secret_key, String, api_name: :secretKey @@ -75,24 +75,14 @@ class S3 < Imagekitio::Internal::Type::BaseModel # @return [String, nil] optional :prefix, String - # @!attribute use_iam_role - # Use IAM role for authentication instead of access/secret keys. When set to - # `true`, send an empty string for both `accessKey` and `secretKey`. - # - # @return [Boolean, nil] - optional :use_iam_role, Imagekitio::Internal::Type::Boolean, api_name: :useIAMRole - - # @!method initialize(access_key:, bucket:, name:, secret_key:, base_url_for_canonical_header: nil, include_canonical_header: nil, prefix: nil, use_iam_role: nil, type: :S3) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::OriginRequest::S3} for more details. - # - # @param access_key [String] Access key for the bucket. When `useIAMRole` is `true`, send an empty 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. When `useIAMRole` is `true`, send an empty string. + # @param secret_key [String] Secret key for the bucket. # # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). # @@ -100,8 +90,6 @@ class S3 < Imagekitio::Internal::Type::BaseModel # # @param prefix [String] Path prefix inside the bucket. # - # @param use_iam_role [Boolean] Use IAM role for authentication instead of access/secret keys. When set to `true - # # @param type [Symbol, :S3] end @@ -191,7 +179,7 @@ class S3Compatible < Imagekitio::Internal::Type::BaseModel class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel # @!attribute access_key - # Access key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Access key for the bucket. # # @return [String] required :access_key, String, api_name: :accessKey @@ -209,7 +197,7 @@ class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel required :name, String # @!attribute secret_key - # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Secret key for the bucket. # # @return [String] required :secret_key, String, api_name: :secretKey @@ -239,25 +227,14 @@ class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel # @return [String, nil] optional :prefix, String - # @!attribute use_iam_role - # Use IAM role for authentication instead of access/secret keys. When set to - # `true`, send an empty string for both `accessKey` and `secretKey`. - # - # @return [Boolean, nil] - optional :use_iam_role, Imagekitio::Internal::Type::Boolean, api_name: :useIAMRole - - # @!method initialize(access_key:, bucket:, name:, secret_key:, base_url_for_canonical_header: nil, include_canonical_header: nil, prefix: nil, use_iam_role: nil, type: :CLOUDINARY_BACKUP) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::OriginRequest::CloudinaryBackup} for more - # details. - # - # @param access_key [String] Access key for the bucket. When `useIAMRole` is `true`, send an empty 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. When `useIAMRole` is `true`, send an empty string. + # @param secret_key [String] Secret key for the bucket. # # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). # @@ -265,8 +242,6 @@ class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel # # @param prefix [String] Path prefix inside the bucket. # - # @param use_iam_role [Boolean] Use IAM role for authentication instead of access/secret keys. When set to `true - # # @param type [Symbol, :CLOUDINARY_BACKUP] end diff --git a/lib/imagekitio/models/accounts/origin_response.rb b/lib/imagekitio/models/accounts/origin_response.rb index f5da6b41..71d255ad 100644 --- a/lib/imagekitio/models/accounts/origin_response.rb +++ b/lib/imagekitio/models/accounts/origin_response.rb @@ -65,13 +65,6 @@ class S3 < Imagekitio::Internal::Type::BaseModel # @return [String, nil] optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader - # @!attribute use_iam_role - # Whether the origin authenticates using an IAM role instead of access/secret - # keys. - # - # @return [Boolean, nil] - optional :use_iam_role, Imagekitio::Internal::Type::Boolean, api_name: :useIAMRole - response_only do # @!attribute id # Unique identifier for the origin. This is generated by ImageKit when you create @@ -81,7 +74,7 @@ class S3 < Imagekitio::Internal::Type::BaseModel required :id, String end - # @!method initialize(id:, bucket:, include_canonical_header:, name:, prefix:, base_url_for_canonical_header: nil, use_iam_role: nil, type: :S3) + # @!method initialize(id:, bucket:, include_canonical_header:, name:, prefix:, base_url_for_canonical_header: nil, type: :S3) # Some parameter documentations has been truncated, see # {Imagekitio::Models::Accounts::OriginResponse::S3} for more details. # @@ -97,8 +90,6 @@ class S3 < Imagekitio::Internal::Type::BaseModel # # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). # - # @param use_iam_role [Boolean] Whether the origin authenticates using an IAM role instead of access/secret keys - # # @param type [Symbol, :S3] end @@ -222,13 +213,6 @@ class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel # @return [String, nil] optional :base_url_for_canonical_header, String, api_name: :baseUrlForCanonicalHeader - # @!attribute use_iam_role - # Whether the origin authenticates using an IAM role instead of access/secret - # keys. - # - # @return [Boolean, nil] - optional :use_iam_role, Imagekitio::Internal::Type::Boolean, api_name: :useIAMRole - response_only do # @!attribute id # Unique identifier for the origin. This is generated by ImageKit when you create @@ -238,7 +222,7 @@ class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel required :id, String end - # @!method initialize(id:, bucket:, include_canonical_header:, name:, prefix:, base_url_for_canonical_header: nil, use_iam_role: nil, type: :CLOUDINARY_BACKUP) + # @!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 # {Imagekitio::Models::Accounts::OriginResponse::CloudinaryBackup} for more # details. @@ -255,8 +239,6 @@ class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel # # @param base_url_for_canonical_header [String] URL used in the Canonical header (if enabled). # - # @param use_iam_role [Boolean] Whether the origin authenticates using an IAM role instead of access/secret keys - # # @param type [Symbol, :CLOUDINARY_BACKUP] end diff --git a/lib/imagekitio/models/accounts/request_bandwidth_entry.rb b/lib/imagekitio/models/accounts/request_bandwidth_entry.rb deleted file mode 100644 index db008827..00000000 --- a/lib/imagekitio/models/accounts/request_bandwidth_entry.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - module Accounts - class RequestBandwidthEntry < Imagekitio::Internal::Type::BaseModel - # @!attribute bandwidth_bytes - # Total bandwidth used in bytes. - # - # @return [Float] - required :bandwidth_bytes, Float, api_name: :bandwidthBytes - - # @!attribute request_count - # Number of requests. - # - # @return [Float] - required :request_count, Float, api_name: :requestCount - - # @!method initialize(bandwidth_bytes:, request_count:) - # @param bandwidth_bytes [Float] Total bandwidth used in bytes. - # - # @param request_count [Float] Number of requests. - end - end - end -end diff --git a/lib/imagekitio/models/accounts/usage_analytics_get_params.rb b/lib/imagekitio/models/accounts/usage_analytics_get_params.rb deleted file mode 100644 index d0adcff2..00000000 --- a/lib/imagekitio/models/accounts/usage_analytics_get_params.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - module Accounts - # @see Imagekitio::Resources::Accounts::UsageAnalytics#get - class UsageAnalyticsGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute end_date - # Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # 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, interpreted as a UTC calendar day. - # 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 - # {Imagekitio::Models::Accounts::UsageAnalyticsGetParams} for more details. - # - # @param end_date [Date] Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # - # @param start_date [Date] Specify a `startDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end - end -end diff --git a/lib/imagekitio/models/accounts/usage_analytics_response.rb b/lib/imagekitio/models/accounts/usage_analytics_response.rb deleted file mode 100644 index 696cfd57..00000000 --- a/lib/imagekitio/models/accounts/usage_analytics_response.rb +++ /dev/null @@ -1,1044 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - module Accounts - # @see Imagekitio::Resources::Accounts::UsageAnalytics#get - class UsageAnalyticsResponse < Imagekitio::Internal::Type::BaseModel - # @!attribute bandwidth_bytes - # Total bandwidth, in bytes, utilized during the specified date range. - # - # @return [Float] - required :bandwidth_bytes, Float, api_name: :bandwidthBytes - - # @!attribute browser - # CDN traffic grouped by browser. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Browser] - required :browser, -> { Imagekitio::Accounts::UsageAnalyticsResponse::Browser } - - # @!attribute cache - # CDN cache hit, miss and error counts for the date range. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Cache] - required :cache, -> { Imagekitio::Accounts::UsageAnalyticsResponse::Cache } - - # @!attribute country - # CDN traffic grouped by country. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Country] - required :country, -> { Imagekitio::Accounts::UsageAnalyticsResponse::Country } - - # @!attribute device - # CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`, - # `Smartphone - Apple iPhone`). - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Device] - required :device, -> { Imagekitio::Accounts::UsageAnalyticsResponse::Device } - - # @!attribute end_date - # End date of the computed analytics data. - # - # @return [Date] - required :end_date, Date, api_name: :endDate - - # @!attribute error_reasons - # Request count grouped by origin error reason. This covers failed origin fetches, - # such as an asset not found at origin or an origin timeout. It is not the HTTP - # status code returned to the client, see `statusCodes` for that. - # - # @return [Array] - required :error_reasons, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason] - }, - api_name: :errorReasons - - # @!attribute extensions - # Raw per-extension operation counts for the date range. These are raw operation - # counts, not billable extension units. For billable usage, use the - # `/v1/accounts/usage` endpoint. - # - # @return [Array] - required :extensions, - -> { Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Extension] } - - # @!attribute format_ - # CDN traffic grouped by response `Content-Type`. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Format] - required :format_, -> { Imagekitio::Accounts::UsageAnalyticsResponse::Format }, api_name: :format - - # @!attribute generated_at - # Date and time when the analytics data was computed. Use this to gauge how fresh - # the returned data is. The date and time is in ISO8601 format. - # - # @return [Time] - required :generated_at, Time, api_name: :generatedAt - - # @!attribute request_count - # Total number of requests made during the specified date range. - # - # @return [Float] - required :request_count, Float, api_name: :requestCount - - # @!attribute start_date - # Start date of the computed analytics data. - # - # @return [Date] - required :start_date, Date, api_name: :startDate - - # @!attribute status_codes - # Request count grouped by HTTP status code. - # - # @return [Array] - required :status_codes, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode] - }, - api_name: :statusCodes - - # @!attribute top404_assets - # Top URLs that returned a 404 response. - # - # @return [Array] - required :top404_assets, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset] - }, - api_name: :top404Assets - - # @!attribute top_images - # Top image assets by traffic. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopImages] - required :top_images, - -> { - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages - }, - api_name: :topImages - - # @!attribute top_image_transforms - # Top image transformation strings by traffic. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopImageTransforms] - required :top_image_transforms, - -> { Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms }, - api_name: :topImageTransforms - - # @!attribute top_other_assets - # Top non-image, non-video assets by traffic. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopOtherAssets] - required :top_other_assets, - -> { Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets }, - api_name: :topOtherAssets - - # @!attribute top_referrers - # Top HTTP referrers by traffic. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopReferrers] - required :top_referrers, - -> { Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers }, - api_name: :topReferrers - - # @!attribute top_user_agents - # Top user agents by traffic. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopUserAgents] - required :top_user_agents, - -> { Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents }, - api_name: :topUserAgents - - # @!attribute top_videos - # Top video assets by traffic. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopVideos] - required :top_videos, - -> { - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos - }, - api_name: :topVideos - - # @!attribute top_video_transforms - # Top video transformation strings by traffic. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopVideoTransforms] - required :top_video_transforms, - -> { Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms }, - api_name: :topVideoTransforms - - # @!attribute url_endpoints - # CDN traffic grouped by configured URL endpoint. Traffic that does not match any - # named URL endpoint pattern is grouped under `Default`. - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse::URLEndpoints] - required :url_endpoints, - -> { Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints }, - api_name: :urlEndpoints - - # @!attribute video_processing - # Raw observed video transcode output duration, in seconds, grouped by resolution - # and codec. These are raw seconds, not billable Video Processing Units (VPU). For - # billable VPU totals, use the `/v1/accounts/usage` endpoint. - # - # @return [Array] - required :video_processing, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing] - }, - api_name: :videoProcessing - - # @!method initialize(bandwidth_bytes:, browser:, cache:, country:, device:, end_date:, error_reasons:, extensions:, format_:, generated_at:, request_count:, start_date:, status_codes:, top404_assets:, top_images:, top_image_transforms:, top_other_assets:, top_referrers:, top_user_agents:, top_videos:, top_video_transforms:, url_endpoints:, video_processing:) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::UsageAnalyticsResponse} for more details. - # - # @param bandwidth_bytes [Float] Total bandwidth, in bytes, utilized during the specified date range. - # - # @param browser [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Browser] CDN traffic grouped by browser. - # - # @param cache [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Cache] CDN cache hit, miss and error counts for the date range. - # - # @param country [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Country] CDN traffic grouped by country. - # - # @param device [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Device] CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`, - # - # @param end_date [Date] End date of the computed analytics data. - # - # @param error_reasons [Array] Request count grouped by origin error reason. This covers failed origin fetches, - # - # @param extensions [Array] Raw per-extension operation counts for the date range. These are raw operation c - # - # @param format_ [Imagekitio::Models::Accounts::UsageAnalyticsResponse::Format] CDN traffic grouped by response `Content-Type`. - # - # @param generated_at [Time] Date and time when the analytics data was computed. Use this to gauge how fresh - # - # @param request_count [Float] Total number of requests made during the specified date range. - # - # @param start_date [Date] Start date of the computed analytics data. - # - # @param status_codes [Array] Request count grouped by HTTP status code. - # - # @param top404_assets [Array] Top URLs that returned a 404 response. - # - # @param top_images [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopImages] Top image assets by traffic. - # - # @param top_image_transforms [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopImageTransforms] Top image transformation strings by traffic. - # - # @param top_other_assets [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopOtherAssets] Top non-image, non-video assets by traffic. - # - # @param top_referrers [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopReferrers] Top HTTP referrers by traffic. - # - # @param top_user_agents [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopUserAgents] Top user agents by traffic. - # - # @param top_videos [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopVideos] Top video assets by traffic. - # - # @param top_video_transforms [Imagekitio::Models::Accounts::UsageAnalyticsResponse::TopVideoTransforms] Top video transformation strings by traffic. - # - # @param url_endpoints [Imagekitio::Models::Accounts::UsageAnalyticsResponse::URLEndpoints] CDN traffic grouped by configured URL endpoint. Traffic that does not match any - # - # @param video_processing [Array] Raw observed video transcode output duration, in seconds, grouped by resolution - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#browser - class Browser < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top browsers sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top browsers sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # CDN traffic grouped by browser. - # - # @param by_bandwidth [Array] Top browsers sorted by bandwidth utilized. - # - # @param by_requests [Array] Top browsers sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Browser name (e.g. `Chrome`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Browser name (e.g. `Chrome`). - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Browser name (e.g. `Chrome`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Browser name (e.g. `Chrome`). - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#cache - class Cache < Imagekitio::Internal::Type::BaseModel - # @!attribute error_count - # Number of requests where the CDN encountered a cache error or exceeded capacity - # while serving the response. - # - # @return [Float] - required :error_count, Float, api_name: :errorCount - - # @!attribute hit_count - # Number of requests served from cache, including full hits and revalidated hits. - # - # @return [Float] - required :hit_count, Float, api_name: :hitCount - - # @!attribute miss_count - # Number of requests that were not found in cache and had to be fetched from - # origin. - # - # @return [Float] - required :miss_count, Float, api_name: :missCount - - # @!method initialize(error_count:, hit_count:, miss_count:) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::UsageAnalyticsResponse::Cache} for more details. - # - # CDN cache hit, miss and error counts for the date range. - # - # @param error_count [Float] Number of requests where the CDN encountered a cache error or exceeded capacity - # - # @param hit_count [Float] Number of requests served from cache, including full hits and revalidated hits. - # - # @param miss_count [Float] Number of requests that were not found in cache and had to be fetched from origi - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#country - class Country < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top requesting countries sorted by total bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top requesting countries sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # CDN traffic grouped by country. - # - # @param by_bandwidth [Array] Top requesting countries sorted by total bandwidth utilized. - # - # @param by_requests [Array] Top requesting countries sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute code - # ISO country code. - # - # @return [String] - required :code, String - - # @!attribute name - # Country name. - # - # @return [String] - required :name, String - - # @!method initialize(code:, name:) - # @param code [String] ISO country code. - # - # @param name [String] Country name. - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute code - # ISO country code. - # - # @return [String] - required :code, String - - # @!attribute name - # Country name. - # - # @return [String] - required :name, String - - # @!method initialize(code:, name:) - # @param code [String] ISO country code. - # - # @param name [String] Country name. - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#device - class Device < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top device/OS combinations sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top device/OS combinations sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`, - # `Smartphone - Apple iPhone`). - # - # @param by_bandwidth [Array] Top device/OS combinations sorted by bandwidth utilized. - # - # @param by_requests [Array] Top device/OS combinations sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Device category combined with operating system or vendor (e.g. - # `Desktop - Windows PC`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::UsageAnalyticsResponse::Device::ByBandwidth} for - # more details. - # - # @param name [String] Device category combined with operating system or vendor (e.g. `Desktop - Window - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Device category combined with operating system or vendor (e.g. - # `Desktop - Windows PC`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::UsageAnalyticsResponse::Device::ByRequest} for - # more details. - # - # @param name [String] Device category combined with operating system or vendor (e.g. `Desktop - Window - end - end - - class ErrorReason < Imagekitio::Internal::Type::BaseModel - # @!attribute name - # Description of the error reason. - # - # @return [String] - required :name, String - - # @!attribute request_count - # Number of requests that failed with this error reason. - # - # @return [Float] - required :request_count, Float, api_name: :requestCount - - # @!method initialize(name:, request_count:) - # @param name [String] Description of the error reason. - # - # @param request_count [Float] Number of requests that failed with this error reason. - end - - class Extension < Imagekitio::Internal::Type::BaseModel - # @!attribute name - # Extension identifier. - # - # @return [String] - required :name, String - - # @!attribute operation_count - # Number of times this extension ran during the date range. - # - # @return [Float] - required :operation_count, Float, api_name: :operationCount - - # @!method initialize(name:, operation_count:) - # @param name [String] Extension identifier. - # - # @param operation_count [Float] Number of times this extension ran during the date range. - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#format_ - class Format < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top content types sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top content types sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # CDN traffic grouped by response `Content-Type`. - # - # @param by_bandwidth [Array] Top content types sorted by bandwidth utilized. - # - # @param by_requests [Array] Top content types sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # MIME type (e.g. `image/webp`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] MIME type (e.g. `image/webp`). - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # MIME type (e.g. `image/webp`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] MIME type (e.g. `image/webp`). - end - end - - class StatusCode < Imagekitio::Internal::Type::BaseModel - # @!attribute name - # HTTP status code. - # - # @return [String] - required :name, String - - # @!attribute request_count - # Number of requests that received this status code. - # - # @return [Float] - required :request_count, Float, api_name: :requestCount - - # @!method initialize(name:, request_count:) - # @param name [String] HTTP status code. - # - # @param request_count [Float] Number of requests that received this status code. - end - - class Top404Asset < Imagekitio::Internal::Type::BaseModel - # @!attribute name - # URL that returned a 404 response. - # - # @return [String] - required :name, String - - # @!attribute request_count - # Number of requests to this URL that returned a 404 response. - # - # @return [Float] - required :request_count, Float, api_name: :requestCount - - # @!method initialize(name:, request_count:) - # @param name [String] URL that returned a 404 response. - # - # @param request_count [Float] Number of requests to this URL that returned a 404 response. - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#top_images - class TopImages < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top image assets sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top image assets sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # Top image assets by traffic. - # - # @param by_bandwidth [Array] Top image assets sorted by bandwidth utilized. - # - # @param by_requests [Array] Top image assets sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # URL of the image asset. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] URL of the image asset. - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # URL of the image asset. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] URL of the image asset. - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#top_image_transforms - class TopImageTransforms < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top image transformation strings sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top image transformation strings sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # Top image transformation strings by traffic. - # - # @param by_bandwidth [Array] Top image transformation strings sorted by bandwidth utilized. - # - # @param by_requests [Array] Top image transformation strings sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Image transformation string (e.g. `tr:w-400,h-400`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Image transformation string (e.g. `tr:w-400,h-400`). - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Image transformation string (e.g. `tr:w-400,h-400`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Image transformation string (e.g. `tr:w-400,h-400`). - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#top_other_assets - class TopOtherAssets < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top non-image, non-video assets sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top non-image, non-video assets sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # Top non-image, non-video assets by traffic. - # - # @param by_bandwidth [Array] Top non-image, non-video assets sorted by bandwidth utilized. - # - # @param by_requests [Array] Top non-image, non-video assets sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # URL of the non-image, non-video asset. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] URL of the non-image, non-video asset. - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # URL of the non-image, non-video asset. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] URL of the non-image, non-video asset. - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#top_referrers - class TopReferrers < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top HTTP referrers sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top HTTP referrers sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # Top HTTP referrers by traffic. - # - # @param by_bandwidth [Array] Top HTTP referrers sorted by bandwidth utilized. - # - # @param by_requests [Array] Top HTTP referrers sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Referrer URL. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Referrer URL. - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Referrer URL. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Referrer URL. - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#top_user_agents - class TopUserAgents < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top user agents sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top user agents sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # Top user agents by traffic. - # - # @param by_bandwidth [Array] Top user agents sorted by bandwidth utilized. - # - # @param by_requests [Array] Top user agents sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # User agent string. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] User agent string. - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # User agent string. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] User agent string. - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#top_videos - class TopVideos < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top video assets sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top video assets sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # Top video assets by traffic. - # - # @param by_bandwidth [Array] Top video assets sorted by bandwidth utilized. - # - # @param by_requests [Array] Top video assets sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # URL of the video asset. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] URL of the video asset. - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Full URL of the video asset (e.g. `https://ik.imagekit.io/demo/clip.mp4`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Full URL of the video asset (e.g. `https://ik.imagekit.io/demo/clip.mp4`). - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#top_video_transforms - class TopVideoTransforms < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top video transformation strings sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top video transformation strings sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # Top video transformation strings by traffic. - # - # @param by_bandwidth [Array] Top video transformation strings sorted by bandwidth utilized. - # - # @param by_requests [Array] Top video transformation strings sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Video transformation string (e.g. `tr:h-720,f-mp4`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Video transformation string (e.g. `tr:h-720,f-mp4`). - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # Video transformation string (e.g. `tr:h-720,f-mp4`). - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # @param name [String] Video transformation string (e.g. `tr:h-720,f-mp4`). - end - end - - # @see Imagekitio::Models::Accounts::UsageAnalyticsResponse#url_endpoints - class URLEndpoints < Imagekitio::Internal::Type::BaseModel - # @!attribute by_bandwidth - # Top URL endpoints sorted by bandwidth utilized. - # - # @return [Array] - required :by_bandwidth, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth] - }, - api_name: :byBandwidth - - # @!attribute by_requests - # Top URL endpoints sorted by request count. - # - # @return [Array] - required :by_requests, - -> { - Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest] - }, - api_name: :byRequests - - # @!method initialize(by_bandwidth:, by_requests:) - # CDN traffic grouped by configured URL endpoint. Traffic that does not match any - # named URL endpoint pattern is grouped under `Default`. - # - # @param by_bandwidth [Array] Top URL endpoints sorted by bandwidth utilized. - # - # @param by_requests [Array] Top URL endpoints sorted by request count. - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # URL endpoint name, or `Default` for traffic that does not match a named - # endpoint. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth} - # for more details. - # - # @param name [String] URL endpoint name, or `Default` for traffic that does not match a named endpoint - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - # @!attribute name - # URL endpoint name, or `Default` for traffic that does not match a named - # endpoint. - # - # @return [String] - required :name, String - - # @!method initialize(name:) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest} - # for more details. - # - # @param name [String] URL endpoint name, or `Default` for traffic that does not match a named endpoint - end - end - - class VideoProcessing < Imagekitio::Internal::Type::BaseModel - # @!attribute codec - # Video codec used for the output (e.g. `h264`, `av1`). - # - # @return [String] - required :codec, String - - # @!attribute duration_seconds - # Total output duration, in seconds, for this resolution and codec combination. - # - # @return [Float] - required :duration_seconds, Float, api_name: :durationSeconds - - # @!attribute resolution - # Output resolution tier (e.g. `SD`, `HD`, `4K`). - # - # @return [String] - required :resolution, String - - # @!method initialize(codec:, duration_seconds:, resolution:) - # @param codec [String] Video codec used for the output (e.g. `h264`, `av1`). - # - # @param duration_seconds [Float] Total output duration, in seconds, for this resolution and codec combination. - # - # @param resolution [String] Output resolution tier (e.g. `SD`, `HD`, `4K`). - end - end - end - end -end diff --git a/lib/imagekitio/models/beta/v2/file_upload_params.rb b/lib/imagekitio/models/beta/v2/file_upload_params.rb index c348da39..adcadbd0 100644 --- a/lib/imagekitio/models/beta/v2/file_upload_params.rb +++ b/lib/imagekitio/models/beta/v2/file_upload_params.rb @@ -9,68 +9,6 @@ class FileUploadParams < Imagekitio::Internal::Type::BaseModel extend Imagekitio::Internal::Type::RequestParameters::Converter include Imagekitio::Internal::Type::RequestParameters - # Serialize upload options to handle proper formatting for ImageKit backend API. - # Special cases handled: - # - tags: converted to comma-separated string - # - responseFields: converted to comma-separated string - # - extensions: JSON stringified - # - customMetadata: JSON stringified - # - transformation: JSON stringified - # - # @api private - # - # @param params [Object] - # - # @return [Array(Object, Hash{Symbol=>Object})] - def self.dump_request(params) - state = {can_retry: true} - case (dumped = dump(params, state: state)) - in Hash - serialized = serialize_upload_options(dumped) - options = Imagekitio::Internal::Util.coerce_hash!(serialized[:request_options]).to_h - request_options = state.fetch(:can_retry) ? options : {**options, max_retries: 0} - [serialized.except(:request_options), request_options] - else - [dumped, nil] - end - end - - # @api private - # - # @param upload_options [Hash{Symbol=>Object}] - # - # @return [Hash{Symbol=>Object}] - def self.serialize_upload_options(upload_options) - serialized = {} - - upload_options.each do |key, value| - # Skip nil values - if value.nil? - serialized[key] = value - next - end - - serialized[key] = case key - when :tags, :responseFields - # Tags and response fields should be comma-separated strings - value.is_a?(Array) ? value.join(",") : value - when :extensions - # Extensions should be JSON stringified - value.is_a?(Array) ? JSON.generate(value) : value - when :customMetadata - # Custom metadata should be JSON stringified - value.is_a?(Hash) ? JSON.generate(value) : value - when :transformation - # Transformation should be JSON stringified - value.is_a?(Hash) || value.respond_to?(:to_h) ? JSON.generate(value) : value - else - value - end - end - - serialized - end - # @!attribute file # The API accepts any of the following: # diff --git a/lib/imagekitio/models/custom_metadata_field.rb b/lib/imagekitio/models/custom_metadata_field.rb index 786b98dd..bf69f73f 100644 --- a/lib/imagekitio/models/custom_metadata_field.rb +++ b/lib/imagekitio/models/custom_metadata_field.rb @@ -31,15 +31,7 @@ class CustomMetadataField < Imagekitio::Internal::Type::BaseModel # @return [Imagekitio::Models::CustomMetadataField::Schema] required :schema, -> { Imagekitio::CustomMetadataField::Schema } - # @!attribute description - # Optional description of the custom metadata field. Only present when a - # description has been set. Shown as a hint to the users while setting the field's - # value on an asset in the media library UI. - # - # @return [String, nil] - optional :description, String - - # @!method initialize(id:, label:, name:, schema:, description: nil) + # @!method initialize(id:, label:, name:, schema:) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataField} for more details. # @@ -52,8 +44,6 @@ class CustomMetadataField < Imagekitio::Internal::Type::BaseModel # @param name [String] API name of the custom metadata field. This becomes the key while setting `custo # # @param schema [Imagekitio::Models::CustomMetadataField::Schema] An object that describes the rules for the custom metadata field value. - # - # @param description [String] Optional description of the custom metadata field. Only present when a descripti # @see Imagekitio::Models::CustomMetadataField#schema class Schema < Imagekitio::Internal::Type::BaseModel diff --git a/lib/imagekitio/models/custom_metadata_field_create_params.rb b/lib/imagekitio/models/custom_metadata_field_create_params.rb index c3c0a08c..570b94cb 100644 --- a/lib/imagekitio/models/custom_metadata_field_create_params.rb +++ b/lib/imagekitio/models/custom_metadata_field_create_params.rb @@ -28,15 +28,7 @@ class CustomMetadataFieldCreateParams < Imagekitio::Internal::Type::BaseModel # @return [Imagekitio::Models::CustomMetadataFieldCreateParams::Schema] required :schema, -> { Imagekitio::CustomMetadataFieldCreateParams::Schema } - # @!attribute description - # Optional description for the custom metadata field. Can be up to 500 characters. - # This is shown as a hint to the users while setting the field's value on an asset - # in the media library UI. - # - # @return [String, nil] - optional :description, String - - # @!method initialize(label:, name:, schema:, description: nil, request_options: {}) + # @!method initialize(label:, name:, schema:, request_options: {}) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataFieldCreateParams} for more details. # @@ -46,8 +38,6 @@ class CustomMetadataFieldCreateParams < Imagekitio::Internal::Type::BaseModel # # @param schema [Imagekitio::Models::CustomMetadataFieldCreateParams::Schema] # - # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. - # # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] class Schema < Imagekitio::Internal::Type::BaseModel diff --git a/lib/imagekitio/models/custom_metadata_field_update_params.rb b/lib/imagekitio/models/custom_metadata_field_update_params.rb index 3eb7ec90..49cda636 100644 --- a/lib/imagekitio/models/custom_metadata_field_update_params.rb +++ b/lib/imagekitio/models/custom_metadata_field_update_params.rb @@ -12,15 +12,6 @@ class CustomMetadataFieldUpdateParams < Imagekitio::Internal::Type::BaseModel # @return [String] required :id, String - # @!attribute description - # Optional description for the custom metadata field. Can be up to 500 characters. - # Send an empty string to clear an existing description. This is shown as a hint - # to the users while setting the field's value on an asset in the media library - # UI. - # - # @return [String, nil] - optional :description, String - # @!attribute label # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field @@ -39,14 +30,12 @@ class CustomMetadataFieldUpdateParams < Imagekitio::Internal::Type::BaseModel # @return [Imagekitio::Models::CustomMetadataFieldUpdateParams::Schema, nil] optional :schema, -> { Imagekitio::CustomMetadataFieldUpdateParams::Schema } - # @!method initialize(id:, description: nil, label: nil, schema: nil, request_options: {}) + # @!method initialize(id:, label: nil, schema: nil, request_options: {}) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataFieldUpdateParams} for more details. # # @param id [String] # - # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. - # # @param label [String] Human readable name of the custom metadata field. This should be unique across a # # @param schema [Imagekitio::Models::CustomMetadataFieldUpdateParams::Schema] An object that describes the rules for the custom metadata key. This parameter i diff --git a/lib/imagekitio/models/file_upload_params.rb b/lib/imagekitio/models/file_upload_params.rb index b7586513..e30764f5 100644 --- a/lib/imagekitio/models/file_upload_params.rb +++ b/lib/imagekitio/models/file_upload_params.rb @@ -7,68 +7,6 @@ class FileUploadParams < Imagekitio::Internal::Type::BaseModel extend Imagekitio::Internal::Type::RequestParameters::Converter include Imagekitio::Internal::Type::RequestParameters - # Serialize upload options to handle proper formatting for ImageKit backend API. - # Special cases handled: - # - tags: converted to comma-separated string - # - responseFields: converted to comma-separated string - # - extensions: JSON stringified - # - customMetadata: JSON stringified - # - transformation: JSON stringified - # - # @api private - # - # @param params [Object] - # - # @return [Array(Object, Hash{Symbol=>Object})] - def self.dump_request(params) - state = {can_retry: true} - case (dumped = dump(params, state: state)) - in Hash - serialized = serialize_upload_options(dumped) - options = Imagekitio::Internal::Util.coerce_hash!(serialized[:request_options]).to_h - request_options = state.fetch(:can_retry) ? options : {**options, max_retries: 0} - [serialized.except(:request_options), request_options] - else - [dumped, nil] - end - end - - # @api private - # - # @param upload_options [Hash{Symbol=>Object}] - # - # @return [Hash{Symbol=>Object}] - def self.serialize_upload_options(upload_options) - serialized = {} - - upload_options.each do |key, value| - # Skip nil values - if value.nil? - serialized[key] = value - next - end - - serialized[key] = case key - when :tags, :responseFields - # Tags and response fields should be comma-separated strings - value.is_a?(Array) ? value.join(",") : value - when :extensions - # Extensions should be JSON stringified - value.is_a?(Array) ? JSON.generate(value) : value - when :customMetadata - # Custom metadata should be JSON stringified - value.is_a?(Hash) ? JSON.generate(value) : value - when :transformation - # Transformation should be JSON stringified - value.is_a?(Hash) || value.respond_to?(:to_h) ? JSON.generate(value) : value - else - value - end - end - - serialized - end - # @!attribute file # The API accepts any of the following: # diff --git a/lib/imagekitio/models/metadata.rb b/lib/imagekitio/models/metadata.rb index 562cc518..371ebc3b 100644 --- a/lib/imagekitio/models/metadata.rb +++ b/lib/imagekitio/models/metadata.rb @@ -174,11 +174,6 @@ class Exif < Imagekitio::Internal::Type::BaseModel # @return [Float, nil] optional :aperture_value, Float, api_name: :ApertureValue - # @!attribute brightness_value - # - # @return [Float, nil] - optional :brightness_value, Float, api_name: :BrightnessValue - # @!attribute color_space # # @return [Integer, nil] @@ -251,13 +246,8 @@ class Exif < Imagekitio::Internal::Type::BaseModel # @!attribute focal_length # - # @return [Float, nil] - optional :focal_length, Float, api_name: :FocalLength - - # @!attribute focal_length_in35mm_format - # # @return [Integer, nil] - optional :focal_length_in35mm_format, Integer, api_name: :FocalLengthIn35mmFormat + optional :focal_length, Integer, api_name: :FocalLength # @!attribute focal_plane_resolution_unit # @@ -284,21 +274,6 @@ class Exif < Imagekitio::Internal::Type::BaseModel # @return [Integer, nil] optional :iso, Integer, api_name: :ISO - # @!attribute lens_model - # - # @return [String, nil] - optional :lens_model, String, api_name: :LensModel - - # @!attribute light_source - # - # @return [Integer, nil] - optional :light_source, Integer, api_name: :LightSource - - # @!attribute max_aperture_value - # - # @return [Float, nil] - optional :max_aperture_value, Float, api_name: :MaxApertureValue - # @!attribute metering_mode # # @return [Integer, nil] @@ -309,16 +284,6 @@ class Exif < Imagekitio::Internal::Type::BaseModel # @return [Integer, nil] optional :scene_capture_type, Integer, api_name: :SceneCaptureType - # @!attribute scene_type - # - # @return [String, nil] - optional :scene_type, String, api_name: :SceneType - - # @!attribute sensing_method - # - # @return [Integer, nil] - optional :sensing_method, Integer, api_name: :SensingMethod - # @!attribute shutter_speed_value # # @return [Float, nil] @@ -329,21 +294,15 @@ class Exif < Imagekitio::Internal::Type::BaseModel # @return [String, nil] optional :sub_sec_time, String, api_name: :SubSecTime - # @!attribute user_comment - # - # @return [String, nil] - optional :user_comment, String, api_name: :UserComment - # @!attribute white_balance # # @return [Integer, nil] optional :white_balance, Integer, api_name: :WhiteBalance - # @!method initialize(aperture_value: nil, brightness_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_length_in35mm_format: nil, focal_plane_resolution_unit: nil, focal_plane_x_resolution: nil, focal_plane_y_resolution: nil, interop_offset: nil, iso: nil, lens_model: nil, light_source: nil, max_aperture_value: nil, metering_mode: nil, scene_capture_type: nil, scene_type: nil, sensing_method: nil, shutter_speed_value: nil, sub_sec_time: nil, user_comment: nil, white_balance: nil) + # @!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 brightness_value [Float] # @param color_space [Integer] # @param create_date [String] # @param custom_rendered [Integer] @@ -358,111 +317,34 @@ class Exif < Imagekitio::Internal::Type::BaseModel # @param flash [Integer] # @param flashpix_version [String] # @param f_number [Float] - # @param focal_length [Float] - # @param focal_length_in35mm_format [Integer] + # @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 lens_model [String] - # @param light_source [Integer] - # @param max_aperture_value [Float] # @param metering_mode [Integer] # @param scene_capture_type [Integer] - # @param scene_type [String] - # @param sensing_method [Integer] # @param shutter_speed_value [Float] # @param sub_sec_time [String] - # @param user_comment [String] # @param white_balance [Integer] end # @see Imagekitio::Models::Metadata::Exif#gps class Gps < Imagekitio::Internal::Type::BaseModel - # @!attribute gps_altitude - # - # @return [Float, nil] - optional :gps_altitude, Float, api_name: :GPSAltitude - - # @!attribute gps_altitude_ref - # - # @return [Integer, nil] - optional :gps_altitude_ref, Integer, api_name: :GPSAltitudeRef - - # @!attribute gps_date_stamp - # - # @return [String, nil] - optional :gps_date_stamp, String, api_name: :GPSDateStamp - - # @!attribute gps_img_direction - # - # @return [Float, nil] - optional :gps_img_direction, Float, api_name: :GPSImgDirection - - # @!attribute gps_img_direction_ref - # - # @return [String, nil] - optional :gps_img_direction_ref, String, api_name: :GPSImgDirectionRef - - # @!attribute gps_latitude - # - # @return [Array, nil] - optional :gps_latitude, Imagekitio::Internal::Type::ArrayOf[Float], api_name: :GPSLatitude - - # @!attribute gps_latitude_ref - # - # @return [String, nil] - optional :gps_latitude_ref, String, api_name: :GPSLatitudeRef - - # @!attribute gps_longitude - # - # @return [Array, nil] - optional :gps_longitude, Imagekitio::Internal::Type::ArrayOf[Float], api_name: :GPSLongitude - - # @!attribute gps_longitude_ref - # - # @return [String, nil] - optional :gps_longitude_ref, String, api_name: :GPSLongitudeRef - - # @!attribute gps_time_stamp - # - # @return [Array, nil] - optional :gps_time_stamp, Imagekitio::Internal::Type::ArrayOf[Float], api_name: :GPSTimeStamp - # @!attribute gps_version_id # # @return [Array, nil] optional :gps_version_id, Imagekitio::Internal::Type::ArrayOf[Integer], api_name: :GPSVersionID - # @!method initialize(gps_altitude: nil, gps_altitude_ref: nil, gps_date_stamp: nil, gps_img_direction: nil, gps_img_direction_ref: nil, gps_latitude: nil, gps_latitude_ref: nil, gps_longitude: nil, gps_longitude_ref: nil, gps_time_stamp: nil, gps_version_id: nil) + # @!method initialize(gps_version_id: nil) # Object containing GPS information. # - # @param gps_altitude [Float] - # @param gps_altitude_ref [Integer] - # @param gps_date_stamp [String] - # @param gps_img_direction [Float] - # @param gps_img_direction_ref [String] - # @param gps_latitude [Array] - # @param gps_latitude_ref [String] - # @param gps_longitude [Array] - # @param gps_longitude_ref [String] - # @param gps_time_stamp [Array] # @param gps_version_id [Array] end # @see Imagekitio::Models::Metadata::Exif#image class Image < Imagekitio::Internal::Type::BaseModel - # @!attribute artist - # - # @return [String, nil] - optional :artist, String, api_name: :Artist - - # @!attribute copyright - # - # @return [String, nil] - optional :copyright, String, api_name: :Copyright - # @!attribute exif_offset # # @return [Integer, nil] @@ -473,11 +355,6 @@ class Image < Imagekitio::Internal::Type::BaseModel # @return [Integer, nil] optional :gps_info, Integer, api_name: :GPSInfo - # @!attribute image_description - # - # @return [String, nil] - optional :image_description, String, api_name: :ImageDescription - # @!attribute make # # @return [String, nil] @@ -510,8 +387,8 @@ class Image < Imagekitio::Internal::Type::BaseModel # @!attribute x_resolution # - # @return [Float, nil] - optional :x_resolution, Float, api_name: :XResolution + # @return [Integer, nil] + optional :x_resolution, Integer, api_name: :XResolution # @!attribute y_cb_cr_positioning # @@ -520,26 +397,23 @@ class Image < Imagekitio::Internal::Type::BaseModel # @!attribute y_resolution # - # @return [Float, nil] - optional :y_resolution, Float, api_name: :YResolution + # @return [Integer, nil] + optional :y_resolution, Integer, api_name: :YResolution - # @!method initialize(artist: nil, copyright: nil, exif_offset: nil, gps_info: nil, image_description: 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) + # @!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 artist [String] - # @param copyright [String] # @param exif_offset [Integer] # @param gps_info [Integer] - # @param image_description [String] # @param make [String] # @param model [String] # @param modify_date [String] # @param orientation [Integer] # @param resolution_unit [Integer] # @param software [String] - # @param x_resolution [Float] + # @param x_resolution [Integer] # @param y_cb_cr_positioning [Integer] - # @param y_resolution [Float] + # @param y_resolution [Integer] end # @see Imagekitio::Models::Metadata::Exif#interoperability @@ -585,13 +459,13 @@ class Thumbnail < Imagekitio::Internal::Type::BaseModel # @!attribute x_resolution # - # @return [Float, nil] - optional :x_resolution, Float, api_name: :XResolution + # @return [Integer, nil] + optional :x_resolution, Integer, api_name: :XResolution # @!attribute y_resolution # - # @return [Float, nil] - optional :y_resolution, Float, api_name: :YResolution + # @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. @@ -600,8 +474,8 @@ class Thumbnail < Imagekitio::Internal::Type::BaseModel # @param resolution_unit [Integer] # @param thumbnail_length [Integer] # @param thumbnail_offset [Integer] - # @param x_resolution [Float] - # @param y_resolution [Float] + # @param x_resolution [Integer] + # @param y_resolution [Integer] end end end diff --git a/lib/imagekitio/models/named_transformation.rb b/lib/imagekitio/models/named_transformation.rb deleted file mode 100644 index de72dff4..00000000 --- a/lib/imagekitio/models/named_transformation.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - class NamedTransformation < Imagekitio::Internal::Type::BaseModel - # @!attribute id - # Unique identifier for a named transformation. - # - # @return [String] - required :id, String - - # @!attribute created_at - # ISO 8601 timestamp of when the named transformation was created. - # - # @return [Time] - required :created_at, Time, api_name: :createdAt - - # @!attribute enabled - # Whether the named transformation is currently enabled. When set to `false`, - # requests using this named transformation fail at delivery time. - # - # @return [Boolean] - required :enabled, Imagekitio::Internal::Type::Boolean - - # @!attribute name - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - # - # @return [String] - required :name, String - - # @!attribute transformation - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - # - # @return [String] - required :transformation, String - - # @!method initialize(id:, created_at:, enabled:, name:, transformation:) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformation} for more details. - # - # A named transformation is an alias for a transformation string, letting you - # apply and later update complex transformations without changing your image or - # video URLs. Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - # - # @param id [String] Unique identifier for a named transformation. - # - # @param created_at [Time] ISO 8601 timestamp of when the named transformation was created. - # - # @param enabled [Boolean] Whether the named transformation is currently enabled. When set to `false`, requ - # - # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case - # - # @param transformation [String] The transformation string this named transformation refers to. Learn more about - end - end -end diff --git a/lib/imagekitio/models/named_transformation_create_params.rb b/lib/imagekitio/models/named_transformation_create_params.rb deleted file mode 100644 index 7f7721d2..00000000 --- a/lib/imagekitio/models/named_transformation_create_params.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#create - class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute name - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - # - # @return [String] - required :name, String - - # @!attribute transformation - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - # - # @return [String] - required :transformation, String - - # @!attribute enabled - # Whether the named transformation is currently enabled. When set to `false`, - # requests using this named transformation fail at delivery time. - # - # @return [Boolean, nil] - optional :enabled, Imagekitio::Internal::Type::Boolean - - # @!method initialize(name:, transformation:, enabled: nil, request_options: {}) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationCreateParams} for more details. - # - # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case - # - # @param transformation [String] The transformation string this named transformation refers to. Learn more about - # - # @param enabled [Boolean] Whether the named transformation is currently enabled. When set to `false`, requ - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/named_transformation_delete_params.rb b/lib/imagekitio/models/named_transformation_delete_params.rb deleted file mode 100644 index 1ee3960a..00000000 --- a/lib/imagekitio/models/named_transformation_delete_params.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#delete - class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute id - # Unique identifier for a named transformation. - # - # @return [String] - required :id, String - - # @!method initialize(id:, request_options: {}) - # @param id [String] Unique identifier for a named transformation. - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/named_transformation_get_params.rb b/lib/imagekitio/models/named_transformation_get_params.rb deleted file mode 100644 index b2fd0287..00000000 --- a/lib/imagekitio/models/named_transformation_get_params.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#get - class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute id - # Unique identifier for a named transformation. - # - # @return [String] - required :id, String - - # @!method initialize(id:, request_options: {}) - # @param id [String] Unique identifier for a named transformation. - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/named_transformation_list_params.rb b/lib/imagekitio/models/named_transformation_list_params.rb deleted file mode 100644 index d455f5a9..00000000 --- a/lib/imagekitio/models/named_transformation_list_params.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#list - class NamedTransformationListParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!method initialize(request_options: {}) - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/named_transformation_list_response.rb b/lib/imagekitio/models/named_transformation_list_response.rb deleted file mode 100644 index d7ac92ec..00000000 --- a/lib/imagekitio/models/named_transformation_list_response.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @type [Imagekitio::Internal::Type::Converter] - NamedTransformationListResponse = - Imagekitio::Internal::Type::ArrayOf[-> { Imagekitio::NamedTransformation }] - end -end diff --git a/lib/imagekitio/models/named_transformation_update_params.rb b/lib/imagekitio/models/named_transformation_update_params.rb deleted file mode 100644 index 5187bb96..00000000 --- a/lib/imagekitio/models/named_transformation_update_params.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Models - # @see Imagekitio::Resources::NamedTransformations#update - class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - # @!attribute id - # Unique identifier for a named transformation. - # - # @return [String] - required :id, String - - # @!attribute enabled - # Whether the named transformation is enabled. Omit to leave the current value - # unchanged. - # - # @return [Boolean, nil] - optional :enabled, Imagekitio::Internal::Type::Boolean - - # @!attribute name - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - # - # @return [String, nil] - optional :name, String - - # @!attribute transformation - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - # - # @return [String, nil] - optional :transformation, String - - # @!method initialize(id:, enabled: nil, name: nil, transformation: nil, request_options: {}) - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. - # - # @param id [String] Unique identifier for a named transformation. - # - # @param enabled [Boolean] Whether the named transformation is enabled. Omit to leave the current value unc - # - # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case - # - # @param transformation [String] The transformation string this named transformation refers to. Learn more about - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}] - end - end -end diff --git a/lib/imagekitio/models/transformation.rb b/lib/imagekitio/models/transformation.rb index b44d5f22..4e41bbde 100644 --- a/lib/imagekitio/models/transformation.rb +++ b/lib/imagekitio/models/transformation.rb @@ -144,7 +144,7 @@ class Transformation < Imagekitio::Internal::Type::BaseModel # # - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray # color. - # - `in-intensity` - Intensity of the color (0-100). Default is 100. See + # - `in-intensity` - Intensity of the color (0-100). Default is 35. See # [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize). # # @return [String, nil] diff --git a/lib/imagekitio/resources/accounts.rb b/lib/imagekitio/resources/accounts.rb index 342f4ea7..54395573 100644 --- a/lib/imagekitio/resources/accounts.rb +++ b/lib/imagekitio/resources/accounts.rb @@ -6,9 +6,6 @@ class Accounts # @return [Imagekitio::Resources::Accounts::Usage] attr_reader :usage - # @return [Imagekitio::Resources::Accounts::UsageAnalytics] - attr_reader :usage_analytics - # @return [Imagekitio::Resources::Accounts::Origins] attr_reader :origins @@ -21,7 +18,6 @@ class Accounts def initialize(client:) @client = client @usage = Imagekitio::Resources::Accounts::Usage.new(client: client) - @usage_analytics = Imagekitio::Resources::Accounts::UsageAnalytics.new(client: client) @origins = Imagekitio::Resources::Accounts::Origins.new(client: client) @url_endpoints = Imagekitio::Resources::Accounts::URLEndpoints.new(client: client) end diff --git a/lib/imagekitio/resources/accounts/usage.rb b/lib/imagekitio/resources/accounts/usage.rb index c64c4934..bbb3fc36 100644 --- a/lib/imagekitio/resources/accounts/usage.rb +++ b/lib/imagekitio/resources/accounts/usage.rb @@ -12,12 +12,6 @@ class Usage # other words, the data covers the period starting from the specified start date # up to, but not including, the end date. # - # For an agency account, the returned usage is aggregated across the agency and - # all of its child accounts that are billed to it. - # - # The response is cached for 6 hours per account, date range and requested - # metrics. - # # @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`. diff --git a/lib/imagekitio/resources/accounts/usage_analytics.rb b/lib/imagekitio/resources/accounts/usage_analytics.rb deleted file mode 100644 index 2bb311fc..00000000 --- a/lib/imagekitio/resources/accounts/usage_analytics.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Resources - class Accounts - class UsageAnalytics - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::Accounts::UsageAnalyticsGetParams} for more details. - # - # **Note:** This API is currently in beta. - # - # Get the account analytics data between two dates. The response covers the period - # from the start date to the end date, both dates inclusive. Both dates are - # interpreted as UTC calendar days. - # - # The returned data is scoped to the requesting account only. Unlike - # `/v1/accounts/usage`, an agency account's analytics are not aggregated across - # its child accounts. - # - # The response is cached for 5 minutes per account and date range. Use - # `generatedAt` to check how fresh the returned data is. - # - # @overload get(end_date:, start_date:, request_options: {}) - # - # @param end_date [Date] Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # - # @param start_date [Date] Specify a `startDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::Accounts::UsageAnalyticsResponse] - # - # @see Imagekitio::Models::Accounts::UsageAnalyticsGetParams - def get(params) - parsed, options = Imagekitio::Accounts::UsageAnalyticsGetParams.dump_request(params) - query = Imagekitio::Internal::Util.encode_query_params(parsed) - @client.request( - method: :get, - path: "v1/accounts/usage-analytics", - query: query.transform_keys(end_date: "endDate", start_date: "startDate"), - model: Imagekitio::Accounts::UsageAnalyticsResponse, - options: options - ) - end - - # @api private - # - # @param client [Imagekitio::Client] - def initialize(client:) - @client = client - end - end - end - end -end diff --git a/lib/imagekitio/resources/custom_metadata_fields.rb b/lib/imagekitio/resources/custom_metadata_fields.rb index 4feb3241..73971d27 100644 --- a/lib/imagekitio/resources/custom_metadata_fields.rb +++ b/lib/imagekitio/resources/custom_metadata_fields.rb @@ -11,7 +11,7 @@ class CustomMetadataFields # on the assets. The value of a field for an asset can be set using the media # library UI or programmatically through upload or update assets API. # - # @overload create(label:, name:, schema:, description: nil, request_options: {}) + # @overload create(label:, name:, schema:, request_options: {}) # # @param label [String] Human readable name of the custom metadata field. This should be unique across a # @@ -19,8 +19,6 @@ class CustomMetadataFields # # @param schema [Imagekitio::Models::CustomMetadataFieldCreateParams::Schema] # - # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. - # # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] # # @return [Imagekitio::Models::CustomMetadataField] @@ -40,15 +38,12 @@ def create(params) # Some parameter documentations has been truncated, see # {Imagekitio::Models::CustomMetadataFieldUpdateParams} for more details. # - # This API updates the label, description, or schema of an existing custom - # metadata field. + # This API updates the label or schema of an existing custom metadata field. # - # @overload update(id, description: nil, label: nil, schema: nil, request_options: {}) + # @overload update(id, label: nil, schema: nil, request_options: {}) # # @param id [String] Should be a valid custom metadata field id. # - # @param description [String] Optional description for the custom metadata field. Can be up to 500 characters. - # # @param label [String] Human readable name of the custom metadata field. This should be unique across a # # @param schema [Imagekitio::Models::CustomMetadataFieldUpdateParams::Schema] An object that describes the rules for the custom metadata key. This parameter i diff --git a/lib/imagekitio/resources/named_transformations.rb b/lib/imagekitio/resources/named_transformations.rb deleted file mode 100644 index c845d42a..00000000 --- a/lib/imagekitio/resources/named_transformations.rb +++ /dev/null @@ -1,151 +0,0 @@ -# frozen_string_literal: true - -module Imagekitio - module Resources - class NamedTransformations - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationCreateParams} for more details. - # - # Creates a new named transformation and returns the created object. - # - # A named transformation is a short, reusable name for a transformation string. - # Use it in image and video URLs as `tr:n-`, and update the underlying - # transformation later without changing existing URLs. Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - # - # You can create up to 250 named transformations per account. - # - # @overload create(name:, transformation:, enabled: nil, request_options: {}) - # - # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case - # - # @param transformation [String] The transformation string this named transformation refers to. Learn more about - # - # @param enabled [Boolean] Whether the named transformation is currently enabled. When set to `false`, requ - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::NamedTransformation] - # - # @see Imagekitio::Models::NamedTransformationCreateParams - def create(params) - parsed, options = Imagekitio::NamedTransformationCreateParams.dump_request(params) - @client.request( - method: :post, - path: "v1/named-transformations", - body: parsed, - model: Imagekitio::NamedTransformation, - options: options - ) - end - - # Some parameter documentations has been truncated, see - # {Imagekitio::Models::NamedTransformationUpdateParams} for more details. - # - # Updates the named transformation identified by `id` and returns the updated - # object. Only the fields present in the request body are updated; other fields - # stay unchanged. - # - # Renaming or disabling a named transformation fails with a `409` error if it is - # still referenced (via the `n-` token) by an upload pre-transformation or - # post-transformation setting. This check is best-effort and can't detect - # references in your own application code or in previously generated URLs. - # - # @overload update(id, enabled: nil, name: nil, transformation: nil, request_options: {}) - # - # @param id [String] Unique identifier for a named transformation. - # - # @param enabled [Boolean] Whether the named transformation is enabled. Omit to leave the current value unc - # - # @param name [String] Alias for the transformation string, used in URLs as `tr:n-`. This is case - # - # @param transformation [String] The transformation string this named transformation refers to. Learn more about - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::NamedTransformation] - # - # @see Imagekitio::Models::NamedTransformationUpdateParams - def update(id, params = {}) - parsed, options = Imagekitio::NamedTransformationUpdateParams.dump_request(params) - @client.request( - method: :patch, - path: ["v1/named-transformations/%1$s", id], - body: parsed, - model: Imagekitio::NamedTransformation, - options: options - ) - end - - # Returns an array of all named transformations configured for your account. - # - # @overload list(request_options: {}) - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Array] - # - # @see Imagekitio::Models::NamedTransformationListParams - def list(params = {}) - @client.request( - method: :get, - path: "v1/named-transformations", - model: Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], - options: params[:request_options] - ) - end - - # Permanently deletes the named transformation identified by `id`. - # - # Deletion fails with a `409` error if the named transformation is still - # referenced (via the `n-` token) by an upload pre-transformation or - # post-transformation setting. This check is best-effort and can't detect - # references in your own application code or in previously generated URLs. - # - # @overload delete(id, request_options: {}) - # - # @param id [String] Unique identifier for a named transformation. - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [nil] - # - # @see Imagekitio::Models::NamedTransformationDeleteParams - def delete(id, params = {}) - @client.request( - method: :delete, - path: ["v1/named-transformations/%1$s", id], - model: NilClass, - options: params[:request_options] - ) - end - - # Retrieves the named transformation identified by `id`. - # - # @overload get(id, request_options: {}) - # - # @param id [String] Unique identifier for a named transformation. - # - # @param request_options [Imagekitio::RequestOptions, Hash{Symbol=>Object}, nil] - # - # @return [Imagekitio::Models::NamedTransformation] - # - # @see Imagekitio::Models::NamedTransformationGetParams - def get(id, params = {}) - @client.request( - method: :get, - path: ["v1/named-transformations/%1$s", id], - model: Imagekitio::NamedTransformation, - options: params[:request_options] - ) - end - - # @api private - # - # @param client [Imagekitio::Client] - def initialize(client:) - @client = client - end - end - end -end diff --git a/lib/imagekitio/resources/webhooks.rb b/lib/imagekitio/resources/webhooks.rb index b9ae15bc..266396d2 100644 --- a/lib/imagekitio/resources/webhooks.rb +++ b/lib/imagekitio/resources/webhooks.rb @@ -23,8 +23,7 @@ def unwrap(payload, headers:, key: @client.webhook_secret) raise ArgumentError.new("Cannot verify a webhook without a key on either the client's webhook_secret or passed in as an argument") end - encoded_key = Base64.strict_encode64(key) - ::StandardWebhooks::Webhook.new(encoded_key).verify(payload, headers) + ::StandardWebhooks::Webhook.new(key).verify(payload, headers) parsed = JSON.parse(payload, symbolize_names: true) Imagekitio::Internal::Type::Converter.coerce(Imagekitio::Models::UnwrapWebhookEvent, parsed) diff --git a/lib/imagekitio/version.rb b/lib/imagekitio/version.rb index 01521bad..dfef486f 100644 --- a/lib/imagekitio/version.rb +++ b/lib/imagekitio/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Imagekitio - VERSION = "4.9.0" + VERSION = "4.7.0" end diff --git a/rbi/imagekitio/client.rbi b/rbi/imagekitio/client.rbi index c04d2374..0cf951b0 100644 --- a/rbi/imagekitio/client.rbi +++ b/rbi/imagekitio/client.rbi @@ -23,7 +23,7 @@ module Imagekitio # Your ImageKit webhook secret for verifying webhook signatures (starts with # `whsec_`). You can find this in the # [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only - # required if you are using webhooks. + # required if you're using webhooks. sig { returns(T.nilable(String)) } attr_reader :webhook_secret @@ -36,9 +36,6 @@ module Imagekitio sig { returns(Imagekitio::Resources::SavedExtensions) } attr_reader :saved_extensions - sig { returns(Imagekitio::Resources::NamedTransformations) } - attr_reader :named_transformations - sig { returns(Imagekitio::Resources::Assets) } attr_reader :assets @@ -57,9 +54,6 @@ module Imagekitio sig { returns(Imagekitio::Resources::Webhooks) } attr_reader :webhooks - sig { returns(Imagekitio::Helper) } - attr_reader :helper - # @api private sig { override.returns(T::Hash[String, String]) } private def auth_headers @@ -95,7 +89,7 @@ module Imagekitio # Your ImageKit webhook secret for verifying webhook signatures (starts with # `whsec_`). You can find this in the # [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only - # required if you are using webhooks. Defaults to `ENV["IMAGEKIT_WEBHOOK_SECRET"]` + # required if you're using webhooks. Defaults to `ENV["IMAGEKIT_WEBHOOK_SECRET"]` webhook_secret: ENV["IMAGEKIT_WEBHOOK_SECRET"], # 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/imagekitio/helpers/helper.rbi b/rbi/imagekitio/helpers/helper.rbi deleted file mode 100644 index f3babc75..00000000 --- a/rbi/imagekitio/helpers/helper.rbi +++ /dev/null @@ -1,41 +0,0 @@ -# typed: strong - -module Imagekitio - class Helper - sig { params(client: Imagekitio::Client).void } - def initialize(client:) - end - - # Builds a URL with transformations applied - sig { params(options: Imagekitio::Models::SrcOptions).returns(String) } - def build_url(options) - end - - # Generates transformation string from transformation objects - sig do - params( - transformations: T::Array[Imagekitio::Models::Transformation] - ).returns(String) - end - def build_transformation_string(transformations) - end - - # Generates authentication parameters for client-side file uploads - sig do - params(token: T.nilable(String), expire: T.nilable(Integer)).returns( - T::Hash[Symbol, T.any(String, Integer)] - ) - end - def get_authentication_parameters(token = nil, expire = nil) - end - - # Generates responsive image attributes for use in HTML tags - sig do - params(options: Imagekitio::Models::GetImageAttributesOptions).returns( - Imagekitio::Models::ResponsiveImageAttributes - ) - end - def get_responsive_image_attributes(options) - end - end -end diff --git a/rbi/imagekitio/models.rbi b/rbi/imagekitio/models.rbi index 6bbbe1a7..9bd10e61 100644 --- a/rbi/imagekitio/models.rbi +++ b/rbi/imagekitio/models.rbi @@ -96,23 +96,6 @@ module Imagekitio Metadata = Imagekitio::Models::Metadata - NamedTransformation = Imagekitio::Models::NamedTransformation - - NamedTransformationCreateParams = - Imagekitio::Models::NamedTransformationCreateParams - - NamedTransformationDeleteParams = - Imagekitio::Models::NamedTransformationDeleteParams - - NamedTransformationGetParams = - Imagekitio::Models::NamedTransformationGetParams - - NamedTransformationListParams = - Imagekitio::Models::NamedTransformationListParams - - NamedTransformationUpdateParams = - Imagekitio::Models::NamedTransformationUpdateParams - Overlay = Imagekitio::Models::Overlay OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/rbi/imagekitio/models/accounts/origin_request.rbi b/rbi/imagekitio/models/accounts/origin_request.rbi index a2eced0d..00020cf4 100644 --- a/rbi/imagekitio/models/accounts/origin_request.rbi +++ b/rbi/imagekitio/models/accounts/origin_request.rbi @@ -30,7 +30,7 @@ module Imagekitio ) end - # Access key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Access key for the bucket. sig { returns(String) } attr_accessor :access_key @@ -42,7 +42,7 @@ module Imagekitio sig { returns(String) } attr_accessor :name - # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Secret key for the bucket. sig { returns(String) } attr_accessor :secret_key @@ -70,14 +70,6 @@ module Imagekitio sig { params(prefix: String).void } attr_writer :prefix - # Use IAM role for authentication instead of access/secret keys. When set to - # `true`, send an empty string for both `accessKey` and `secretKey`. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :use_iam_role - - sig { params(use_iam_role: T::Boolean).void } - attr_writer :use_iam_role - sig do params( access_key: String, @@ -87,18 +79,17 @@ module Imagekitio base_url_for_canonical_header: String, include_canonical_header: T::Boolean, prefix: String, - use_iam_role: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( - # Access key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Access key for the bucket. access_key:, # S3 bucket name. bucket:, # Display name of the origin. name:, - # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Secret key for the bucket. secret_key:, # URL used in the Canonical header (if enabled). base_url_for_canonical_header: nil, @@ -106,9 +97,6 @@ module Imagekitio include_canonical_header: nil, # Path prefix inside the bucket. prefix: nil, - # Use IAM role for authentication instead of access/secret keys. When set to - # `true`, send an empty string for both `accessKey` and `secretKey`. - use_iam_role: nil, type: :S3 ) end @@ -123,8 +111,7 @@ module Imagekitio type: Symbol, base_url_for_canonical_header: String, include_canonical_header: T::Boolean, - prefix: String, - use_iam_role: T::Boolean + prefix: String } ) end @@ -258,7 +245,7 @@ module Imagekitio ) end - # Access key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Access key for the bucket. sig { returns(String) } attr_accessor :access_key @@ -270,7 +257,7 @@ module Imagekitio sig { returns(String) } attr_accessor :name - # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Secret key for the bucket. sig { returns(String) } attr_accessor :secret_key @@ -298,14 +285,6 @@ module Imagekitio sig { params(prefix: String).void } attr_writer :prefix - # Use IAM role for authentication instead of access/secret keys. When set to - # `true`, send an empty string for both `accessKey` and `secretKey`. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :use_iam_role - - sig { params(use_iam_role: T::Boolean).void } - attr_writer :use_iam_role - sig do params( access_key: String, @@ -315,18 +294,17 @@ module Imagekitio base_url_for_canonical_header: String, include_canonical_header: T::Boolean, prefix: String, - use_iam_role: T::Boolean, type: Symbol ).returns(T.attached_class) end def self.new( - # Access key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Access key for the bucket. access_key:, # S3 bucket name. bucket:, # Display name of the origin. name:, - # Secret key for the bucket. When `useIAMRole` is `true`, send an empty string. + # Secret key for the bucket. secret_key:, # URL used in the Canonical header (if enabled). base_url_for_canonical_header: nil, @@ -334,9 +312,6 @@ module Imagekitio include_canonical_header: nil, # Path prefix inside the bucket. prefix: nil, - # Use IAM role for authentication instead of access/secret keys. When set to - # `true`, send an empty string for both `accessKey` and `secretKey`. - use_iam_role: nil, type: :CLOUDINARY_BACKUP ) end @@ -351,8 +326,7 @@ module Imagekitio type: Symbol, base_url_for_canonical_header: String, include_canonical_header: T::Boolean, - prefix: String, - use_iam_role: T::Boolean + prefix: String } ) end diff --git a/rbi/imagekitio/models/accounts/origin_response.rbi b/rbi/imagekitio/models/accounts/origin_response.rbi index 876b58fc..d5eb1027 100644 --- a/rbi/imagekitio/models/accounts/origin_response.rbi +++ b/rbi/imagekitio/models/accounts/origin_response.rbi @@ -56,14 +56,6 @@ module Imagekitio sig { params(base_url_for_canonical_header: String).void } attr_writer :base_url_for_canonical_header - # Whether the origin authenticates using an IAM role instead of access/secret - # keys. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :use_iam_role - - sig { params(use_iam_role: T::Boolean).void } - attr_writer :use_iam_role - # Unique identifier for the origin. This is generated by ImageKit when you create # a new origin. sig { returns(String) } @@ -77,7 +69,6 @@ module Imagekitio name: String, prefix: String, base_url_for_canonical_header: String, - use_iam_role: T::Boolean, type: Symbol ).returns(T.attached_class) end @@ -95,9 +86,6 @@ module Imagekitio prefix:, # URL used in the Canonical header (if enabled). base_url_for_canonical_header: nil, - # Whether the origin authenticates using an IAM role instead of access/secret - # keys. - use_iam_role: nil, type: :S3 ) end @@ -111,8 +99,7 @@ module Imagekitio name: String, prefix: String, type: Symbol, - base_url_for_canonical_header: String, - use_iam_role: T::Boolean + base_url_for_canonical_header: String } ) end @@ -257,14 +244,6 @@ module Imagekitio sig { params(base_url_for_canonical_header: String).void } attr_writer :base_url_for_canonical_header - # Whether the origin authenticates using an IAM role instead of access/secret - # keys. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :use_iam_role - - sig { params(use_iam_role: T::Boolean).void } - attr_writer :use_iam_role - # Unique identifier for the origin. This is generated by ImageKit when you create # a new origin. sig { returns(String) } @@ -278,7 +257,6 @@ module Imagekitio name: String, prefix: String, base_url_for_canonical_header: String, - use_iam_role: T::Boolean, type: Symbol ).returns(T.attached_class) end @@ -296,9 +274,6 @@ module Imagekitio prefix:, # URL used in the Canonical header (if enabled). base_url_for_canonical_header: nil, - # Whether the origin authenticates using an IAM role instead of access/secret - # keys. - use_iam_role: nil, type: :CLOUDINARY_BACKUP ) end @@ -312,8 +287,7 @@ module Imagekitio name: String, prefix: String, type: Symbol, - base_url_for_canonical_header: String, - use_iam_role: T::Boolean + base_url_for_canonical_header: String } ) end diff --git a/rbi/imagekitio/models/accounts/request_bandwidth_entry.rbi b/rbi/imagekitio/models/accounts/request_bandwidth_entry.rbi deleted file mode 100644 index 47597761..00000000 --- a/rbi/imagekitio/models/accounts/request_bandwidth_entry.rbi +++ /dev/null @@ -1,44 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - module Accounts - class RequestBandwidthEntry < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::RequestBandwidthEntry, - Imagekitio::Internal::AnyHash - ) - end - - # Total bandwidth used in bytes. - sig { returns(Float) } - attr_accessor :bandwidth_bytes - - # Number of requests. - sig { returns(Float) } - attr_accessor :request_count - - sig do - params(bandwidth_bytes: Float, request_count: Float).returns( - T.attached_class - ) - end - def self.new( - # Total bandwidth used in bytes. - bandwidth_bytes:, - # Number of requests. - request_count: - ) - end - - sig do - override.returns({ bandwidth_bytes: Float, request_count: Float }) - end - def to_hash - end - end - end - end -end diff --git a/rbi/imagekitio/models/accounts/usage_analytics_get_params.rbi b/rbi/imagekitio/models/accounts/usage_analytics_get_params.rbi deleted file mode 100644 index 99d0cb7f..00000000 --- a/rbi/imagekitio/models/accounts/usage_analytics_get_params.rbi +++ /dev/null @@ -1,64 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - module Accounts - class UsageAnalyticsGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsGetParams, - Imagekitio::Internal::AnyHash - ) - end - - # Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # 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, interpreted as a UTC calendar day. - # 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: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new( - # Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # 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, interpreted as a UTC calendar day. - # 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: Imagekitio::RequestOptions - } - ) - end - def to_hash - end - end - end - end -end diff --git a/rbi/imagekitio/models/accounts/usage_analytics_response.rbi b/rbi/imagekitio/models/accounts/usage_analytics_response.rbi deleted file mode 100644 index e1241f66..00000000 --- a/rbi/imagekitio/models/accounts/usage_analytics_response.rbi +++ /dev/null @@ -1,2097 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - module Accounts - class UsageAnalyticsResponse < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse, - Imagekitio::Internal::AnyHash - ) - end - - # Total bandwidth, in bytes, utilized during the specified date range. - sig { returns(Float) } - attr_accessor :bandwidth_bytes - - # CDN traffic grouped by browser. - sig { returns(Imagekitio::Accounts::UsageAnalyticsResponse::Browser) } - attr_reader :browser - - sig do - params( - browser: - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::OrHash - ).void - end - attr_writer :browser - - # CDN cache hit, miss and error counts for the date range. - sig { returns(Imagekitio::Accounts::UsageAnalyticsResponse::Cache) } - attr_reader :cache - - sig do - params( - cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache::OrHash - ).void - end - attr_writer :cache - - # CDN traffic grouped by country. - sig { returns(Imagekitio::Accounts::UsageAnalyticsResponse::Country) } - attr_reader :country - - sig do - params( - country: - Imagekitio::Accounts::UsageAnalyticsResponse::Country::OrHash - ).void - end - attr_writer :country - - # CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`, - # `Smartphone - Apple iPhone`). - sig { returns(Imagekitio::Accounts::UsageAnalyticsResponse::Device) } - attr_reader :device - - sig do - params( - device: Imagekitio::Accounts::UsageAnalyticsResponse::Device::OrHash - ).void - end - attr_writer :device - - # End date of the computed analytics data. - sig { returns(Date) } - attr_accessor :end_date - - # Request count grouped by origin error reason. This covers failed origin fetches, - # such as an asset not found at origin or an origin timeout. It is not the HTTP - # status code returned to the client, see `statusCodes` for that. - sig do - returns( - T::Array[Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason] - ) - end - attr_accessor :error_reasons - - # Raw per-extension operation counts for the date range. These are raw operation - # counts, not billable extension units. For billable usage, use the - # `/v1/accounts/usage` endpoint. - sig do - returns( - T::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Extension] - ) - end - attr_accessor :extensions - - # CDN traffic grouped by response `Content-Type`. - sig { returns(Imagekitio::Accounts::UsageAnalyticsResponse::Format) } - attr_reader :format_ - - sig do - params( - format_: - Imagekitio::Accounts::UsageAnalyticsResponse::Format::OrHash - ).void - end - attr_writer :format_ - - # Date and time when the analytics data was computed. Use this to gauge how fresh - # the returned data is. The date and time is in ISO8601 format. - sig { returns(Time) } - attr_accessor :generated_at - - # Total number of requests made during the specified date range. - sig { returns(Float) } - attr_accessor :request_count - - # Start date of the computed analytics data. - sig { returns(Date) } - attr_accessor :start_date - - # Request count grouped by HTTP status code. - sig do - returns( - T::Array[Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode] - ) - end - attr_accessor :status_codes - - # Top URLs that returned a 404 response. - sig do - returns( - T::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset] - ) - end - attr_accessor :top404_assets - - # Top image assets by traffic. - sig { returns(Imagekitio::Accounts::UsageAnalyticsResponse::TopImages) } - attr_reader :top_images - - sig do - params( - top_images: - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::OrHash - ).void - end - attr_writer :top_images - - # Top image transformation strings by traffic. - sig do - returns( - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms - ) - end - attr_reader :top_image_transforms - - sig do - params( - top_image_transforms: - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::OrHash - ).void - end - attr_writer :top_image_transforms - - # Top non-image, non-video assets by traffic. - sig do - returns(Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets) - end - attr_reader :top_other_assets - - sig do - params( - top_other_assets: - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::OrHash - ).void - end - attr_writer :top_other_assets - - # Top HTTP referrers by traffic. - sig do - returns(Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers) - end - attr_reader :top_referrers - - sig do - params( - top_referrers: - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::OrHash - ).void - end - attr_writer :top_referrers - - # Top user agents by traffic. - sig do - returns(Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents) - end - attr_reader :top_user_agents - - sig do - params( - top_user_agents: - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::OrHash - ).void - end - attr_writer :top_user_agents - - # Top video assets by traffic. - sig { returns(Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos) } - attr_reader :top_videos - - sig do - params( - top_videos: - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::OrHash - ).void - end - attr_writer :top_videos - - # Top video transformation strings by traffic. - sig do - returns( - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms - ) - end - attr_reader :top_video_transforms - - sig do - params( - top_video_transforms: - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::OrHash - ).void - end - attr_writer :top_video_transforms - - # CDN traffic grouped by configured URL endpoint. Traffic that does not match any - # named URL endpoint pattern is grouped under `Default`. - sig do - returns(Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints) - end - attr_reader :url_endpoints - - sig do - params( - url_endpoints: - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::OrHash - ).void - end - attr_writer :url_endpoints - - # Raw observed video transcode output duration, in seconds, grouped by resolution - # and codec. These are raw seconds, not billable Video Processing Units (VPU). For - # billable VPU totals, use the `/v1/accounts/usage` endpoint. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing - ] - ) - end - attr_accessor :video_processing - - sig do - params( - bandwidth_bytes: Float, - browser: - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::OrHash, - cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache::OrHash, - country: - Imagekitio::Accounts::UsageAnalyticsResponse::Country::OrHash, - device: - Imagekitio::Accounts::UsageAnalyticsResponse::Device::OrHash, - end_date: Date, - error_reasons: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason::OrHash - ], - extensions: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Extension::OrHash - ], - format_: - Imagekitio::Accounts::UsageAnalyticsResponse::Format::OrHash, - generated_at: Time, - request_count: Float, - start_date: Date, - status_codes: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode::OrHash - ], - top404_assets: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset::OrHash - ], - top_images: - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::OrHash, - top_image_transforms: - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::OrHash, - top_other_assets: - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::OrHash, - top_referrers: - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::OrHash, - top_user_agents: - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::OrHash, - top_videos: - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::OrHash, - top_video_transforms: - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::OrHash, - url_endpoints: - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::OrHash, - video_processing: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Total bandwidth, in bytes, utilized during the specified date range. - bandwidth_bytes:, - # CDN traffic grouped by browser. - browser:, - # CDN cache hit, miss and error counts for the date range. - cache:, - # CDN traffic grouped by country. - country:, - # CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`, - # `Smartphone - Apple iPhone`). - device:, - # End date of the computed analytics data. - end_date:, - # Request count grouped by origin error reason. This covers failed origin fetches, - # such as an asset not found at origin or an origin timeout. It is not the HTTP - # status code returned to the client, see `statusCodes` for that. - error_reasons:, - # Raw per-extension operation counts for the date range. These are raw operation - # counts, not billable extension units. For billable usage, use the - # `/v1/accounts/usage` endpoint. - extensions:, - # CDN traffic grouped by response `Content-Type`. - format_:, - # Date and time when the analytics data was computed. Use this to gauge how fresh - # the returned data is. The date and time is in ISO8601 format. - generated_at:, - # Total number of requests made during the specified date range. - request_count:, - # Start date of the computed analytics data. - start_date:, - # Request count grouped by HTTP status code. - status_codes:, - # Top URLs that returned a 404 response. - top404_assets:, - # Top image assets by traffic. - top_images:, - # Top image transformation strings by traffic. - top_image_transforms:, - # Top non-image, non-video assets by traffic. - top_other_assets:, - # Top HTTP referrers by traffic. - top_referrers:, - # Top user agents by traffic. - top_user_agents:, - # Top video assets by traffic. - top_videos:, - # Top video transformation strings by traffic. - top_video_transforms:, - # CDN traffic grouped by configured URL endpoint. Traffic that does not match any - # named URL endpoint pattern is grouped under `Default`. - url_endpoints:, - # Raw observed video transcode output duration, in seconds, grouped by resolution - # and codec. These are raw seconds, not billable Video Processing Units (VPU). For - # billable VPU totals, use the `/v1/accounts/usage` endpoint. - video_processing: - ) - end - - sig do - override.returns( - { - bandwidth_bytes: Float, - browser: Imagekitio::Accounts::UsageAnalyticsResponse::Browser, - cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache, - country: Imagekitio::Accounts::UsageAnalyticsResponse::Country, - device: Imagekitio::Accounts::UsageAnalyticsResponse::Device, - end_date: Date, - error_reasons: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason - ], - extensions: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Extension - ], - format_: Imagekitio::Accounts::UsageAnalyticsResponse::Format, - generated_at: Time, - request_count: Float, - start_date: Date, - status_codes: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode - ], - top404_assets: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset - ], - top_images: - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages, - top_image_transforms: - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms, - top_other_assets: - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets, - top_referrers: - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers, - top_user_agents: - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents, - top_videos: - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos, - top_video_transforms: - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms, - url_endpoints: - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints, - video_processing: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing - ] - } - ) - end - def to_hash - end - - class Browser < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Browser, - Imagekitio::Internal::AnyHash - ) - end - - # Top browsers sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top browsers sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest - ] - ) - end - attr_accessor :by_requests - - # CDN traffic grouped by browser. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top browsers sorted by bandwidth utilized. - by_bandwidth:, - # Top browsers sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # Browser name (e.g. `Chrome`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Browser name (e.g. `Chrome`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # Browser name (e.g. `Chrome`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Browser name (e.g. `Chrome`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class Cache < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Cache, - Imagekitio::Internal::AnyHash - ) - end - - # Number of requests where the CDN encountered a cache error or exceeded capacity - # while serving the response. - sig { returns(Float) } - attr_accessor :error_count - - # Number of requests served from cache, including full hits and revalidated hits. - sig { returns(Float) } - attr_accessor :hit_count - - # Number of requests that were not found in cache and had to be fetched from - # origin. - sig { returns(Float) } - attr_accessor :miss_count - - # CDN cache hit, miss and error counts for the date range. - sig do - params( - error_count: Float, - hit_count: Float, - miss_count: Float - ).returns(T.attached_class) - end - def self.new( - # Number of requests where the CDN encountered a cache error or exceeded capacity - # while serving the response. - error_count:, - # Number of requests served from cache, including full hits and revalidated hits. - hit_count:, - # Number of requests that were not found in cache and had to be fetched from - # origin. - miss_count: - ) - end - - sig do - override.returns( - { error_count: Float, hit_count: Float, miss_count: Float } - ) - end - def to_hash - end - end - - class Country < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Country, - Imagekitio::Internal::AnyHash - ) - end - - # Top requesting countries sorted by total bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top requesting countries sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest - ] - ) - end - attr_accessor :by_requests - - # CDN traffic grouped by country. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top requesting countries sorted by total bandwidth utilized. - by_bandwidth:, - # Top requesting countries sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # ISO country code. - sig { returns(String) } - attr_accessor :code - - # Country name. - sig { returns(String) } - attr_accessor :name - - sig { params(code: String, name: String).returns(T.attached_class) } - def self.new( - # ISO country code. - code:, - # Country name. - name: - ) - end - - sig { override.returns({ code: String, name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # ISO country code. - sig { returns(String) } - attr_accessor :code - - # Country name. - sig { returns(String) } - attr_accessor :name - - sig { params(code: String, name: String).returns(T.attached_class) } - def self.new( - # ISO country code. - code:, - # Country name. - name: - ) - end - - sig { override.returns({ code: String, name: String }) } - def to_hash - end - end - end - - class Device < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Device, - Imagekitio::Internal::AnyHash - ) - end - - # Top device/OS combinations sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top device/OS combinations sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest - ] - ) - end - attr_accessor :by_requests - - # CDN traffic grouped by device and operating system (e.g. `Desktop - Apple Mac`, - # `Smartphone - Apple iPhone`). - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top device/OS combinations sorted by bandwidth utilized. - by_bandwidth:, - # Top device/OS combinations sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # Device category combined with operating system or vendor (e.g. - # `Desktop - Windows PC`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Device category combined with operating system or vendor (e.g. - # `Desktop - Windows PC`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # Device category combined with operating system or vendor (e.g. - # `Desktop - Windows PC`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Device category combined with operating system or vendor (e.g. - # `Desktop - Windows PC`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class ErrorReason < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason, - Imagekitio::Internal::AnyHash - ) - end - - # Description of the error reason. - sig { returns(String) } - attr_accessor :name - - # Number of requests that failed with this error reason. - sig { returns(Float) } - attr_accessor :request_count - - sig do - params(name: String, request_count: Float).returns(T.attached_class) - end - def self.new( - # Description of the error reason. - name:, - # Number of requests that failed with this error reason. - request_count: - ) - end - - sig { override.returns({ name: String, request_count: Float }) } - def to_hash - end - end - - class Extension < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Extension, - Imagekitio::Internal::AnyHash - ) - end - - # Extension identifier. - sig { returns(String) } - attr_accessor :name - - # Number of times this extension ran during the date range. - sig { returns(Float) } - attr_accessor :operation_count - - sig do - params(name: String, operation_count: Float).returns( - T.attached_class - ) - end - def self.new( - # Extension identifier. - name:, - # Number of times this extension ran during the date range. - operation_count: - ) - end - - sig { override.returns({ name: String, operation_count: Float }) } - def to_hash - end - end - - class Format < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Format, - Imagekitio::Internal::AnyHash - ) - end - - # Top content types sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top content types sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest - ] - ) - end - attr_accessor :by_requests - - # CDN traffic grouped by response `Content-Type`. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top content types sorted by bandwidth utilized. - by_bandwidth:, - # Top content types sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # MIME type (e.g. `image/webp`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # MIME type (e.g. `image/webp`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # MIME type (e.g. `image/webp`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # MIME type (e.g. `image/webp`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class StatusCode < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode, - Imagekitio::Internal::AnyHash - ) - end - - # HTTP status code. - sig { returns(String) } - attr_accessor :name - - # Number of requests that received this status code. - sig { returns(Float) } - attr_accessor :request_count - - sig do - params(name: String, request_count: Float).returns(T.attached_class) - end - def self.new( - # HTTP status code. - name:, - # Number of requests that received this status code. - request_count: - ) - end - - sig { override.returns({ name: String, request_count: Float }) } - def to_hash - end - end - - class Top404Asset < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset, - Imagekitio::Internal::AnyHash - ) - end - - # URL that returned a 404 response. - sig { returns(String) } - attr_accessor :name - - # Number of requests to this URL that returned a 404 response. - sig { returns(Float) } - attr_accessor :request_count - - sig do - params(name: String, request_count: Float).returns(T.attached_class) - end - def self.new( - # URL that returned a 404 response. - name:, - # Number of requests to this URL that returned a 404 response. - request_count: - ) - end - - sig { override.returns({ name: String, request_count: Float }) } - def to_hash - end - end - - class TopImages < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages, - Imagekitio::Internal::AnyHash - ) - end - - # Top image assets sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top image assets sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest - ] - ) - end - attr_accessor :by_requests - - # Top image assets by traffic. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top image assets sorted by bandwidth utilized. - by_bandwidth:, - # Top image assets sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # URL of the image asset. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # URL of the image asset. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # URL of the image asset. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # URL of the image asset. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class TopImageTransforms < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms, - Imagekitio::Internal::AnyHash - ) - end - - # Top image transformation strings sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top image transformation strings sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest - ] - ) - end - attr_accessor :by_requests - - # Top image transformation strings by traffic. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top image transformation strings sorted by bandwidth utilized. - by_bandwidth:, - # Top image transformation strings sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # Image transformation string (e.g. `tr:w-400,h-400`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Image transformation string (e.g. `tr:w-400,h-400`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # Image transformation string (e.g. `tr:w-400,h-400`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Image transformation string (e.g. `tr:w-400,h-400`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class TopOtherAssets < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets, - Imagekitio::Internal::AnyHash - ) - end - - # Top non-image, non-video assets sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top non-image, non-video assets sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest - ] - ) - end - attr_accessor :by_requests - - # Top non-image, non-video assets by traffic. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top non-image, non-video assets sorted by bandwidth utilized. - by_bandwidth:, - # Top non-image, non-video assets sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # URL of the non-image, non-video asset. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # URL of the non-image, non-video asset. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # URL of the non-image, non-video asset. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # URL of the non-image, non-video asset. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class TopReferrers < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers, - Imagekitio::Internal::AnyHash - ) - end - - # Top HTTP referrers sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top HTTP referrers sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest - ] - ) - end - attr_accessor :by_requests - - # Top HTTP referrers by traffic. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top HTTP referrers sorted by bandwidth utilized. - by_bandwidth:, - # Top HTTP referrers sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # Referrer URL. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Referrer URL. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # Referrer URL. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Referrer URL. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class TopUserAgents < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents, - Imagekitio::Internal::AnyHash - ) - end - - # Top user agents sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top user agents sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest - ] - ) - end - attr_accessor :by_requests - - # Top user agents by traffic. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top user agents sorted by bandwidth utilized. - by_bandwidth:, - # Top user agents sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # User agent string. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # User agent string. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # User agent string. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # User agent string. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class TopVideos < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos, - Imagekitio::Internal::AnyHash - ) - end - - # Top video assets sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top video assets sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest - ] - ) - end - attr_accessor :by_requests - - # Top video assets by traffic. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top video assets sorted by bandwidth utilized. - by_bandwidth:, - # Top video assets sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # URL of the video asset. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # URL of the video asset. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # Full URL of the video asset (e.g. `https://ik.imagekit.io/demo/clip.mp4`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Full URL of the video asset (e.g. `https://ik.imagekit.io/demo/clip.mp4`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class TopVideoTransforms < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms, - Imagekitio::Internal::AnyHash - ) - end - - # Top video transformation strings sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top video transformation strings sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest - ] - ) - end - attr_accessor :by_requests - - # Top video transformation strings by traffic. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top video transformation strings sorted by bandwidth utilized. - by_bandwidth:, - # Top video transformation strings sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # Video transformation string (e.g. `tr:h-720,f-mp4`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Video transformation string (e.g. `tr:h-720,f-mp4`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # Video transformation string (e.g. `tr:h-720,f-mp4`). - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # Video transformation string (e.g. `tr:h-720,f-mp4`). - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class URLEndpoints < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints, - Imagekitio::Internal::AnyHash - ) - end - - # Top URL endpoints sorted by bandwidth utilized. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth - ] - ) - end - attr_accessor :by_bandwidth - - # Top URL endpoints sorted by request count. - sig do - returns( - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest - ] - ) - end - attr_accessor :by_requests - - # CDN traffic grouped by configured URL endpoint. Traffic that does not match any - # named URL endpoint pattern is grouped under `Default`. - sig do - params( - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth::OrHash - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest::OrHash - ] - ).returns(T.attached_class) - end - def self.new( - # Top URL endpoints sorted by bandwidth utilized. - by_bandwidth:, - # Top URL endpoints sorted by request count. - by_requests: - ) - end - - sig do - override.returns( - { - by_bandwidth: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth - ], - by_requests: - T::Array[ - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest - ] - } - ) - end - def to_hash - end - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth, - Imagekitio::Internal::AnyHash - ) - end - - # URL endpoint name, or `Default` for traffic that does not match a named - # endpoint. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # URL endpoint name, or `Default` for traffic that does not match a named - # endpoint. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest, - Imagekitio::Internal::AnyHash - ) - end - - # URL endpoint name, or `Default` for traffic that does not match a named - # endpoint. - sig { returns(String) } - attr_accessor :name - - sig { params(name: String).returns(T.attached_class) } - def self.new( - # URL endpoint name, or `Default` for traffic that does not match a named - # endpoint. - name: - ) - end - - sig { override.returns({ name: String }) } - def to_hash - end - end - end - - class VideoProcessing < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any( - Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing, - Imagekitio::Internal::AnyHash - ) - end - - # Video codec used for the output (e.g. `h264`, `av1`). - sig { returns(String) } - attr_accessor :codec - - # Total output duration, in seconds, for this resolution and codec combination. - sig { returns(Float) } - attr_accessor :duration_seconds - - # Output resolution tier (e.g. `SD`, `HD`, `4K`). - sig { returns(String) } - attr_accessor :resolution - - sig do - params( - codec: String, - duration_seconds: Float, - resolution: String - ).returns(T.attached_class) - end - def self.new( - # Video codec used for the output (e.g. `h264`, `av1`). - codec:, - # Total output duration, in seconds, for this resolution and codec combination. - duration_seconds:, - # Output resolution tier (e.g. `SD`, `HD`, `4K`). - resolution: - ) - end - - sig do - override.returns( - { codec: String, duration_seconds: Float, resolution: String } - ) - end - def to_hash - end - end - end - end - end -end diff --git a/rbi/imagekitio/models/custom_metadata_field.rbi b/rbi/imagekitio/models/custom_metadata_field.rbi index 43a725e7..d727d437 100644 --- a/rbi/imagekitio/models/custom_metadata_field.rbi +++ b/rbi/imagekitio/models/custom_metadata_field.rbi @@ -32,23 +32,13 @@ module Imagekitio end attr_writer :schema - # Optional description of the custom metadata field. Only present when a - # description has been set. Shown as a hint to the users while setting the field's - # value on an asset in the media library UI. - sig { returns(T.nilable(String)) } - attr_reader :description - - sig { params(description: String).void } - attr_writer :description - # Object containing details of a custom metadata field. sig do params( id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema::OrHash, - description: String + schema: Imagekitio::CustomMetadataField::Schema::OrHash ).returns(T.attached_class) end def self.new( @@ -62,11 +52,7 @@ module Imagekitio # `customMetadata` (key-value object) for an asset using upload or update API. name:, # An object that describes the rules for the custom metadata field value. - schema:, - # Optional description of the custom metadata field. Only present when a - # description has been set. Shown as a hint to the users while setting the field's - # value on an asset in the media library UI. - description: nil + schema: ) end @@ -76,8 +62,7 @@ module Imagekitio id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema, - description: String + schema: Imagekitio::CustomMetadataField::Schema } ) end diff --git a/rbi/imagekitio/models/custom_metadata_field_create_params.rbi b/rbi/imagekitio/models/custom_metadata_field_create_params.rbi index 2eae77da..a6622776 100644 --- a/rbi/imagekitio/models/custom_metadata_field_create_params.rbi +++ b/rbi/imagekitio/models/custom_metadata_field_create_params.rbi @@ -36,21 +36,11 @@ module Imagekitio end attr_writer :schema - # Optional description for the custom metadata field. Can be up to 500 characters. - # This is shown as a hint to the users while setting the field's value on an asset - # in the media library UI. - sig { returns(T.nilable(String)) } - attr_reader :description - - sig { params(description: String).void } - attr_writer :description - sig do params( label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema::OrHash, - description: String, request_options: Imagekitio::RequestOptions::OrHash ).returns(T.attached_class) end @@ -64,10 +54,6 @@ module Imagekitio # (including deleted) custom metadata fields. name:, schema:, - # Optional description for the custom metadata field. Can be up to 500 characters. - # This is shown as a hint to the users while setting the field's value on an asset - # in the media library UI. - description: nil, request_options: {} ) end @@ -78,7 +64,6 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, - description: String, request_options: Imagekitio::RequestOptions } ) diff --git a/rbi/imagekitio/models/custom_metadata_field_update_params.rbi b/rbi/imagekitio/models/custom_metadata_field_update_params.rbi index 0f7e57dc..a7c631ae 100644 --- a/rbi/imagekitio/models/custom_metadata_field_update_params.rbi +++ b/rbi/imagekitio/models/custom_metadata_field_update_params.rbi @@ -17,16 +17,6 @@ module Imagekitio sig { returns(String) } attr_accessor :id - # Optional description for the custom metadata field. Can be up to 500 characters. - # Send an empty string to clear an existing description. This is shown as a hint - # to the users while setting the field's value on an asset in the media library - # UI. - sig { returns(T.nilable(String)) } - attr_reader :description - - sig { params(description: String).void } - attr_writer :description - # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field # label to the users while setting field value on an asset in the media library @@ -56,7 +46,6 @@ module Imagekitio sig do params( id: String, - description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema::OrHash, request_options: Imagekitio::RequestOptions::OrHash @@ -64,11 +53,6 @@ module Imagekitio end def self.new( id:, - # Optional description for the custom metadata field. Can be up to 500 characters. - # Send an empty string to clear an existing description. This is shown as a hint - # to the users while setting the field's value on an asset in the media library - # UI. - description: nil, # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field # label to the users while setting field value on an asset in the media library @@ -87,7 +71,6 @@ module Imagekitio override.returns( { id: String, - description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, request_options: Imagekitio::RequestOptions diff --git a/rbi/imagekitio/models/metadata.rbi b/rbi/imagekitio/models/metadata.rbi index d9ca188a..dea32d8f 100644 --- a/rbi/imagekitio/models/metadata.rbi +++ b/rbi/imagekitio/models/metadata.rbi @@ -288,12 +288,6 @@ module Imagekitio sig { params(aperture_value: Float).void } attr_writer :aperture_value - sig { returns(T.nilable(Float)) } - attr_reader :brightness_value - - sig { params(brightness_value: Float).void } - attr_writer :brightness_value - sig { returns(T.nilable(Integer)) } attr_reader :color_space @@ -378,18 +372,12 @@ module Imagekitio sig { params(f_number: Float).void } attr_writer :f_number - sig { returns(T.nilable(Float)) } + sig { returns(T.nilable(Integer)) } attr_reader :focal_length - sig { params(focal_length: Float).void } + sig { params(focal_length: Integer).void } attr_writer :focal_length - sig { returns(T.nilable(Integer)) } - attr_reader :focal_length_in35mm_format - - sig { params(focal_length_in35mm_format: Integer).void } - attr_writer :focal_length_in35mm_format - sig { returns(T.nilable(Integer)) } attr_reader :focal_plane_resolution_unit @@ -420,24 +408,6 @@ module Imagekitio sig { params(iso: Integer).void } attr_writer :iso - sig { returns(T.nilable(String)) } - attr_reader :lens_model - - sig { params(lens_model: String).void } - attr_writer :lens_model - - sig { returns(T.nilable(Integer)) } - attr_reader :light_source - - sig { params(light_source: Integer).void } - attr_writer :light_source - - sig { returns(T.nilable(Float)) } - attr_reader :max_aperture_value - - sig { params(max_aperture_value: Float).void } - attr_writer :max_aperture_value - sig { returns(T.nilable(Integer)) } attr_reader :metering_mode @@ -450,18 +420,6 @@ module Imagekitio sig { params(scene_capture_type: Integer).void } attr_writer :scene_capture_type - sig { returns(T.nilable(String)) } - attr_reader :scene_type - - sig { params(scene_type: String).void } - attr_writer :scene_type - - sig { returns(T.nilable(Integer)) } - attr_reader :sensing_method - - sig { params(sensing_method: Integer).void } - attr_writer :sensing_method - sig { returns(T.nilable(Float)) } attr_reader :shutter_speed_value @@ -474,12 +432,6 @@ module Imagekitio sig { params(sub_sec_time: String).void } attr_writer :sub_sec_time - sig { returns(T.nilable(String)) } - attr_reader :user_comment - - sig { params(user_comment: String).void } - attr_writer :user_comment - sig { returns(T.nilable(Integer)) } attr_reader :white_balance @@ -490,7 +442,6 @@ module Imagekitio sig do params( aperture_value: Float, - brightness_value: Float, color_space: Integer, create_date: String, custom_rendered: Integer, @@ -505,29 +456,21 @@ module Imagekitio flash: Integer, flashpix_version: String, f_number: Float, - focal_length: Float, - focal_length_in35mm_format: Integer, + focal_length: Integer, focal_plane_resolution_unit: Integer, focal_plane_x_resolution: Float, focal_plane_y_resolution: Float, interop_offset: Integer, iso: Integer, - lens_model: String, - light_source: Integer, - max_aperture_value: Float, metering_mode: Integer, scene_capture_type: Integer, - scene_type: String, - sensing_method: Integer, shutter_speed_value: Float, sub_sec_time: String, - user_comment: String, white_balance: Integer ).returns(T.attached_class) end def self.new( aperture_value: nil, - brightness_value: nil, color_space: nil, create_date: nil, custom_rendered: nil, @@ -543,22 +486,15 @@ module Imagekitio flashpix_version: nil, f_number: nil, focal_length: nil, - focal_length_in35mm_format: nil, focal_plane_resolution_unit: nil, focal_plane_x_resolution: nil, focal_plane_y_resolution: nil, interop_offset: nil, iso: nil, - lens_model: nil, - light_source: nil, - max_aperture_value: nil, metering_mode: nil, scene_capture_type: nil, - scene_type: nil, - sensing_method: nil, shutter_speed_value: nil, sub_sec_time: nil, - user_comment: nil, white_balance: nil ) end @@ -567,7 +503,6 @@ module Imagekitio override.returns( { aperture_value: Float, - brightness_value: Float, color_space: Integer, create_date: String, custom_rendered: Integer, @@ -582,23 +517,16 @@ module Imagekitio flash: Integer, flashpix_version: String, f_number: Float, - focal_length: Float, - focal_length_in35mm_format: Integer, + focal_length: Integer, focal_plane_resolution_unit: Integer, focal_plane_x_resolution: Float, focal_plane_y_resolution: Float, interop_offset: Integer, iso: Integer, - lens_model: String, - light_source: Integer, - max_aperture_value: Float, metering_mode: Integer, scene_capture_type: Integer, - scene_type: String, - sensing_method: Integer, shutter_speed_value: Float, sub_sec_time: String, - user_comment: String, white_balance: Integer } ) @@ -616,66 +544,6 @@ module Imagekitio ) end - sig { returns(T.nilable(Float)) } - attr_reader :gps_altitude - - sig { params(gps_altitude: Float).void } - attr_writer :gps_altitude - - sig { returns(T.nilable(Integer)) } - attr_reader :gps_altitude_ref - - sig { params(gps_altitude_ref: Integer).void } - attr_writer :gps_altitude_ref - - sig { returns(T.nilable(String)) } - attr_reader :gps_date_stamp - - sig { params(gps_date_stamp: String).void } - attr_writer :gps_date_stamp - - sig { returns(T.nilable(Float)) } - attr_reader :gps_img_direction - - sig { params(gps_img_direction: Float).void } - attr_writer :gps_img_direction - - sig { returns(T.nilable(String)) } - attr_reader :gps_img_direction_ref - - sig { params(gps_img_direction_ref: String).void } - attr_writer :gps_img_direction_ref - - sig { returns(T.nilable(T::Array[Float])) } - attr_reader :gps_latitude - - sig { params(gps_latitude: T::Array[Float]).void } - attr_writer :gps_latitude - - sig { returns(T.nilable(String)) } - attr_reader :gps_latitude_ref - - sig { params(gps_latitude_ref: String).void } - attr_writer :gps_latitude_ref - - sig { returns(T.nilable(T::Array[Float])) } - attr_reader :gps_longitude - - sig { params(gps_longitude: T::Array[Float]).void } - attr_writer :gps_longitude - - sig { returns(T.nilable(String)) } - attr_reader :gps_longitude_ref - - sig { params(gps_longitude_ref: String).void } - attr_writer :gps_longitude_ref - - sig { returns(T.nilable(T::Array[Float])) } - attr_reader :gps_time_stamp - - sig { params(gps_time_stamp: T::Array[Float]).void } - attr_writer :gps_time_stamp - sig { returns(T.nilable(T::Array[Integer])) } attr_reader :gps_version_id @@ -684,52 +552,12 @@ module Imagekitio # Object containing GPS information. sig do - params( - gps_altitude: Float, - gps_altitude_ref: Integer, - gps_date_stamp: String, - gps_img_direction: Float, - gps_img_direction_ref: String, - gps_latitude: T::Array[Float], - gps_latitude_ref: String, - gps_longitude: T::Array[Float], - gps_longitude_ref: String, - gps_time_stamp: T::Array[Float], - gps_version_id: T::Array[Integer] - ).returns(T.attached_class) + params(gps_version_id: T::Array[Integer]).returns(T.attached_class) end - def self.new( - gps_altitude: nil, - gps_altitude_ref: nil, - gps_date_stamp: nil, - gps_img_direction: nil, - gps_img_direction_ref: nil, - gps_latitude: nil, - gps_latitude_ref: nil, - gps_longitude: nil, - gps_longitude_ref: nil, - gps_time_stamp: nil, - gps_version_id: nil - ) + def self.new(gps_version_id: nil) end - sig do - override.returns( - { - gps_altitude: Float, - gps_altitude_ref: Integer, - gps_date_stamp: String, - gps_img_direction: Float, - gps_img_direction_ref: String, - gps_latitude: T::Array[Float], - gps_latitude_ref: String, - gps_longitude: T::Array[Float], - gps_longitude_ref: String, - gps_time_stamp: T::Array[Float], - gps_version_id: T::Array[Integer] - } - ) - end + sig { override.returns({ gps_version_id: T::Array[Integer] }) } def to_hash end end @@ -743,18 +571,6 @@ module Imagekitio ) end - sig { returns(T.nilable(String)) } - attr_reader :artist - - sig { params(artist: String).void } - attr_writer :artist - - sig { returns(T.nilable(String)) } - attr_reader :copyright - - sig { params(copyright: String).void } - attr_writer :copyright - sig { returns(T.nilable(Integer)) } attr_reader :exif_offset @@ -767,12 +583,6 @@ module Imagekitio sig { params(gps_info: Integer).void } attr_writer :gps_info - sig { returns(T.nilable(String)) } - attr_reader :image_description - - sig { params(image_description: String).void } - attr_writer :image_description - sig { returns(T.nilable(String)) } attr_reader :make @@ -809,10 +619,10 @@ module Imagekitio sig { params(software: String).void } attr_writer :software - sig { returns(T.nilable(Float)) } + sig { returns(T.nilable(Integer)) } attr_reader :x_resolution - sig { params(x_resolution: Float).void } + sig { params(x_resolution: Integer).void } attr_writer :x_resolution sig { returns(T.nilable(Integer)) } @@ -821,37 +631,31 @@ module Imagekitio sig { params(y_cb_cr_positioning: Integer).void } attr_writer :y_cb_cr_positioning - sig { returns(T.nilable(Float)) } + sig { returns(T.nilable(Integer)) } attr_reader :y_resolution - sig { params(y_resolution: Float).void } + sig { params(y_resolution: Integer).void } attr_writer :y_resolution # Object containing EXIF image information. sig do params( - artist: String, - copyright: String, exif_offset: Integer, gps_info: Integer, - image_description: String, make: String, model: String, modify_date: String, orientation: Integer, resolution_unit: Integer, software: String, - x_resolution: Float, + x_resolution: Integer, y_cb_cr_positioning: Integer, - y_resolution: Float + y_resolution: Integer ).returns(T.attached_class) end def self.new( - artist: nil, - copyright: nil, exif_offset: nil, gps_info: nil, - image_description: nil, make: nil, model: nil, modify_date: nil, @@ -867,20 +671,17 @@ module Imagekitio sig do override.returns( { - artist: String, - copyright: String, exif_offset: Integer, gps_info: Integer, - image_description: String, make: String, model: String, modify_date: String, orientation: Integer, resolution_unit: Integer, software: String, - x_resolution: Float, + x_resolution: Integer, y_cb_cr_positioning: Integer, - y_resolution: Float + y_resolution: Integer } ) end @@ -958,16 +759,16 @@ module Imagekitio sig { params(thumbnail_offset: Integer).void } attr_writer :thumbnail_offset - sig { returns(T.nilable(Float)) } + sig { returns(T.nilable(Integer)) } attr_reader :x_resolution - sig { params(x_resolution: Float).void } + sig { params(x_resolution: Integer).void } attr_writer :x_resolution - sig { returns(T.nilable(Float)) } + sig { returns(T.nilable(Integer)) } attr_reader :y_resolution - sig { params(y_resolution: Float).void } + sig { params(y_resolution: Integer).void } attr_writer :y_resolution # Object containing Thumbnail information. @@ -977,8 +778,8 @@ module Imagekitio resolution_unit: Integer, thumbnail_length: Integer, thumbnail_offset: Integer, - x_resolution: Float, - y_resolution: Float + x_resolution: Integer, + y_resolution: Integer ).returns(T.attached_class) end def self.new( @@ -998,8 +799,8 @@ module Imagekitio resolution_unit: Integer, thumbnail_length: Integer, thumbnail_offset: Integer, - x_resolution: Float, - y_resolution: Float + x_resolution: Integer, + y_resolution: Integer } ) end diff --git a/rbi/imagekitio/models/named_transformation.rbi b/rbi/imagekitio/models/named_transformation.rbi deleted file mode 100644 index 00a2fcd0..00000000 --- a/rbi/imagekitio/models/named_transformation.rbi +++ /dev/null @@ -1,81 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformation < Imagekitio::Internal::Type::BaseModel - OrHash = - T.type_alias do - T.any(Imagekitio::NamedTransformation, Imagekitio::Internal::AnyHash) - end - - # Unique identifier for a named transformation. - sig { returns(String) } - attr_accessor :id - - # ISO 8601 timestamp of when the named transformation was created. - sig { returns(Time) } - attr_accessor :created_at - - # Whether the named transformation is currently enabled. When set to `false`, - # requests using this named transformation fail at delivery time. - sig { returns(T::Boolean) } - attr_accessor :enabled - - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - sig { returns(String) } - attr_accessor :name - - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - sig { returns(String) } - attr_accessor :transformation - - # A named transformation is an alias for a transformation string, letting you - # apply and later update complex transformations without changing your image or - # video URLs. Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - sig do - params( - id: String, - created_at: Time, - enabled: T::Boolean, - name: String, - transformation: String - ).returns(T.attached_class) - end - def self.new( - # Unique identifier for a named transformation. - id:, - # ISO 8601 timestamp of when the named transformation was created. - created_at:, - # Whether the named transformation is currently enabled. When set to `false`, - # requests using this named transformation fail at delivery time. - enabled:, - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - name:, - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - transformation: - ) - end - - sig do - override.returns( - { - id: String, - created_at: Time, - enabled: T::Boolean, - name: String, - transformation: String - } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_create_params.rbi b/rbi/imagekitio/models/named_transformation_create_params.rbi deleted file mode 100644 index b1a2becd..00000000 --- a/rbi/imagekitio/models/named_transformation_create_params.rbi +++ /dev/null @@ -1,73 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationCreateParams, - Imagekitio::Internal::AnyHash - ) - end - - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - sig { returns(String) } - attr_accessor :name - - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - sig { returns(String) } - attr_accessor :transformation - - # Whether the named transformation is currently enabled. When set to `false`, - # requests using this named transformation fail at delivery time. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :enabled - - sig { params(enabled: T::Boolean).void } - attr_writer :enabled - - sig do - params( - name: String, - transformation: String, - enabled: T::Boolean, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new( - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - name:, - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - transformation:, - # Whether the named transformation is currently enabled. When set to `false`, - # requests using this named transformation fail at delivery time. - enabled: nil, - request_options: {} - ) - end - - sig do - override.returns( - { - name: String, - transformation: String, - enabled: T::Boolean, - request_options: Imagekitio::RequestOptions - } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_delete_params.rbi b/rbi/imagekitio/models/named_transformation_delete_params.rbi deleted file mode 100644 index 8519763a..00000000 --- a/rbi/imagekitio/models/named_transformation_delete_params.rbi +++ /dev/null @@ -1,43 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationDeleteParams, - Imagekitio::Internal::AnyHash - ) - end - - # Unique identifier for a named transformation. - sig { returns(String) } - attr_accessor :id - - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new( - # Unique identifier for a named transformation. - id:, - request_options: {} - ) - end - - sig do - override.returns( - { id: String, request_options: Imagekitio::RequestOptions } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_get_params.rbi b/rbi/imagekitio/models/named_transformation_get_params.rbi deleted file mode 100644 index 62fc3f84..00000000 --- a/rbi/imagekitio/models/named_transformation_get_params.rbi +++ /dev/null @@ -1,43 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationGetParams, - Imagekitio::Internal::AnyHash - ) - end - - # Unique identifier for a named transformation. - sig { returns(String) } - attr_accessor :id - - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new( - # Unique identifier for a named transformation. - id:, - request_options: {} - ) - end - - sig do - override.returns( - { id: String, request_options: Imagekitio::RequestOptions } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_list_params.rbi b/rbi/imagekitio/models/named_transformation_list_params.rbi deleted file mode 100644 index c26ca9cf..00000000 --- a/rbi/imagekitio/models/named_transformation_list_params.rbi +++ /dev/null @@ -1,30 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationListParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationListParams, - Imagekitio::Internal::AnyHash - ) - end - - sig do - params(request_options: Imagekitio::RequestOptions::OrHash).returns( - T.attached_class - ) - end - def self.new(request_options: {}) - end - - sig { override.returns({ request_options: Imagekitio::RequestOptions }) } - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/named_transformation_list_response.rbi b/rbi/imagekitio/models/named_transformation_list_response.rbi deleted file mode 100644 index d344b117..00000000 --- a/rbi/imagekitio/models/named_transformation_list_response.rbi +++ /dev/null @@ -1,11 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - NamedTransformationListResponse = - T.let( - Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation], - Imagekitio::Internal::Type::Converter - ) - end -end diff --git a/rbi/imagekitio/models/named_transformation_update_params.rbi b/rbi/imagekitio/models/named_transformation_update_params.rbi deleted file mode 100644 index a35fd2b0..00000000 --- a/rbi/imagekitio/models/named_transformation_update_params.rbi +++ /dev/null @@ -1,87 +0,0 @@ -# typed: strong - -module Imagekitio - module Models - class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - OrHash = - T.type_alias do - T.any( - Imagekitio::NamedTransformationUpdateParams, - Imagekitio::Internal::AnyHash - ) - end - - # Unique identifier for a named transformation. - sig { returns(String) } - attr_accessor :id - - # Whether the named transformation is enabled. Omit to leave the current value - # unchanged. - sig { returns(T.nilable(T::Boolean)) } - attr_reader :enabled - - sig { params(enabled: T::Boolean).void } - attr_writer :enabled - - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - sig { returns(T.nilable(String)) } - attr_reader :name - - sig { params(name: String).void } - attr_writer :name - - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - sig { returns(T.nilable(String)) } - attr_reader :transformation - - sig { params(transformation: String).void } - attr_writer :transformation - - sig do - params( - id: String, - enabled: T::Boolean, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(T.attached_class) - end - def self.new( - # Unique identifier for a named transformation. - id:, - # Whether the named transformation is enabled. Omit to leave the current value - # unchanged. - enabled: nil, - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - name: nil, - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - transformation: nil, - request_options: {} - ) - end - - sig do - override.returns( - { - id: String, - enabled: T::Boolean, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions - } - ) - end - def to_hash - end - end - end -end diff --git a/rbi/imagekitio/models/transformation.rbi b/rbi/imagekitio/models/transformation.rbi index a9f6664c..ffb8de76 100644 --- a/rbi/imagekitio/models/transformation.rbi +++ b/rbi/imagekitio/models/transformation.rbi @@ -203,7 +203,7 @@ module Imagekitio # # - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray # color. - # - `in-intensity` - Intensity of the color (0-100). Default is 100. See + # - `in-intensity` - Intensity of the color (0-100). Default is 35. See # [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize). sig { returns(T.nilable(String)) } attr_reader :colorize @@ -804,7 +804,7 @@ module Imagekitio # # - `co-color` - Color to apply (e.g., `red`, `blue`, `FF0022`). Default is gray # color. - # - `in-intensity` - Intensity of the color (0-100). Default is 100. See + # - `in-intensity` - Intensity of the color (0-100). Default is 35. See # [Colorize](https://imagekit.io/docs/effects-and-enhancements#colorize---e-colorize). colorize: nil, # Indicates whether the output image should retain the original color profile. See diff --git a/rbi/imagekitio/resources/accounts.rbi b/rbi/imagekitio/resources/accounts.rbi index e9e93e6b..19a20e7f 100644 --- a/rbi/imagekitio/resources/accounts.rbi +++ b/rbi/imagekitio/resources/accounts.rbi @@ -6,9 +6,6 @@ module Imagekitio sig { returns(Imagekitio::Resources::Accounts::Usage) } attr_reader :usage - sig { returns(Imagekitio::Resources::Accounts::UsageAnalytics) } - attr_reader :usage_analytics - sig { returns(Imagekitio::Resources::Accounts::Origins) } attr_reader :origins diff --git a/rbi/imagekitio/resources/accounts/usage.rbi b/rbi/imagekitio/resources/accounts/usage.rbi index 3f27aeec..83fb3b2d 100644 --- a/rbi/imagekitio/resources/accounts/usage.rbi +++ b/rbi/imagekitio/resources/accounts/usage.rbi @@ -8,12 +8,6 @@ module Imagekitio # 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. - # - # For an agency account, the returned usage is aggregated across the agency and - # all of its child accounts that are billed to it. - # - # The response is cached for 6 hours per account, date range and requested - # metrics. sig do params( end_date: Date, diff --git a/rbi/imagekitio/resources/accounts/usage_analytics.rbi b/rbi/imagekitio/resources/accounts/usage_analytics.rbi deleted file mode 100644 index b324f883..00000000 --- a/rbi/imagekitio/resources/accounts/usage_analytics.rbi +++ /dev/null @@ -1,46 +0,0 @@ -# typed: strong - -module Imagekitio - module Resources - class Accounts - class UsageAnalytics - # **Note:** This API is currently in beta. - # - # Get the account analytics data between two dates. The response covers the period - # from the start date to the end date, both dates inclusive. Both dates are - # interpreted as UTC calendar days. - # - # The returned data is scoped to the requesting account only. Unlike - # `/v1/accounts/usage`, an agency account's analytics are not aggregated across - # its child accounts. - # - # The response is cached for 5 minutes per account and date range. Use - # `generatedAt` to check how fresh the returned data is. - sig do - params( - end_date: Date, - start_date: Date, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::Accounts::UsageAnalyticsResponse) - end - def get( - # Specify an `endDate` in `YYYY-MM-DD` format, interpreted as a UTC calendar day. - # 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, interpreted as a UTC calendar day. - # 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: Imagekitio::Client).returns(T.attached_class) } - def self.new(client:) - end - end - end - end -end diff --git a/rbi/imagekitio/resources/custom_metadata_fields.rbi b/rbi/imagekitio/resources/custom_metadata_fields.rbi index ee08b726..c3f0a4cb 100644 --- a/rbi/imagekitio/resources/custom_metadata_fields.rbi +++ b/rbi/imagekitio/resources/custom_metadata_fields.rbi @@ -12,7 +12,6 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema::OrHash, - description: String, request_options: Imagekitio::RequestOptions::OrHash ).returns(Imagekitio::CustomMetadataField) end @@ -26,20 +25,14 @@ module Imagekitio # (including deleted) custom metadata fields. name:, schema:, - # Optional description for the custom metadata field. Can be up to 500 characters. - # This is shown as a hint to the users while setting the field's value on an asset - # in the media library UI. - description: nil, request_options: {} ) end - # This API updates the label, description, or schema of an existing custom - # metadata field. + # This API updates the label or schema of an existing custom metadata field. sig do params( id: String, - description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema::OrHash, request_options: Imagekitio::RequestOptions::OrHash @@ -48,11 +41,6 @@ module Imagekitio def update( # Should be a valid custom metadata field id. id, - # Optional description for the custom metadata field. Can be up to 500 characters. - # Send an empty string to clear an existing description. This is shown as a hint - # to the users while setting the field's value on an asset in the media library - # UI. - description: nil, # Human readable name of the custom metadata field. This should be unique across # all non deleted custom metadata fields. This name is displayed as form field # label to the users while setting field value on an asset in the media library diff --git a/rbi/imagekitio/resources/named_transformations.rbi b/rbi/imagekitio/resources/named_transformations.rbi deleted file mode 100644 index 65eaa1ce..00000000 --- a/rbi/imagekitio/resources/named_transformations.rbi +++ /dev/null @@ -1,119 +0,0 @@ -# typed: strong - -module Imagekitio - module Resources - class NamedTransformations - # Creates a new named transformation and returns the created object. - # - # A named transformation is a short, reusable name for a transformation string. - # Use it in image and video URLs as `tr:n-`, and update the underlying - # transformation later without changing existing URLs. Learn more about - # [named transformations](https://imagekit.io/docs/transformations#named-transformations). - # - # You can create up to 250 named transformations per account. - sig do - params( - name: String, - transformation: String, - enabled: T::Boolean, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::NamedTransformation) - end - def create( - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - name:, - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - transformation:, - # Whether the named transformation is currently enabled. When set to `false`, - # requests using this named transformation fail at delivery time. - enabled: nil, - request_options: {} - ) - end - - # Updates the named transformation identified by `id` and returns the updated - # object. Only the fields present in the request body are updated; other fields - # stay unchanged. - # - # Renaming or disabling a named transformation fails with a `409` error if it is - # still referenced (via the `n-` token) by an upload pre-transformation or - # post-transformation setting. This check is best-effort and can't detect - # references in your own application code or in previously generated URLs. - sig do - params( - id: String, - enabled: T::Boolean, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::NamedTransformation) - end - def update( - # Unique identifier for a named transformation. - id, - # Whether the named transformation is enabled. Omit to leave the current value - # unchanged. - enabled: nil, - # Alias for the transformation string, used in URLs as `tr:n-`. This is - # case-sensitive, contains only alphanumeric characters or `_` (underscore), and - # is unique across all named transformations for your account. - name: nil, - # The transformation string this named transformation refers to. Learn more about - # the [transformation string syntax](https://imagekit.io/docs/transformations). - transformation: nil, - request_options: {} - ) - end - - # Returns an array of all named transformations configured for your account. - sig do - params(request_options: Imagekitio::RequestOptions::OrHash).returns( - T::Array[Imagekitio::NamedTransformation] - ) - end - def list(request_options: {}) - end - - # Permanently deletes the named transformation identified by `id`. - # - # Deletion fails with a `409` error if the named transformation is still - # referenced (via the `n-` token) by an upload pre-transformation or - # post-transformation setting. This check is best-effort and can't detect - # references in your own application code or in previously generated URLs. - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).void - end - def delete( - # Unique identifier for a named transformation. - id, - request_options: {} - ) - end - - # Retrieves the named transformation identified by `id`. - sig do - params( - id: String, - request_options: Imagekitio::RequestOptions::OrHash - ).returns(Imagekitio::NamedTransformation) - end - def get( - # Unique identifier for a named transformation. - id, - request_options: {} - ) - end - - # @api private - sig { params(client: Imagekitio::Client).returns(T.attached_class) } - def self.new(client:) - end - end - end -end diff --git a/release-please-config.json b/release-please-config.json index a708bb63..70a47571 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -2,11 +2,11 @@ "packages": { ".": {} }, - "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "$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": false, + "prerelease": true, "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": false, "pull-request-header": "Automated Release PR", @@ -62,6 +62,9 @@ "release-type": "ruby", "version-file": "lib/imagekitio/version.rb", "extra-files": [ - "README.md" + { + "type": "ruby-readme", + "path": "README.md" + } ] } \ No newline at end of file diff --git a/sig/imagekitio/client.rbs b/sig/imagekitio/client.rbs index 57af63f0..f6c2de5a 100644 --- a/sig/imagekitio/client.rbs +++ b/sig/imagekitio/client.rbs @@ -20,8 +20,6 @@ module Imagekitio attr_reader saved_extensions: Imagekitio::Resources::SavedExtensions - attr_reader named_transformations: Imagekitio::Resources::NamedTransformations - attr_reader assets: Imagekitio::Resources::Assets attr_reader cache: Imagekitio::Resources::Cache @@ -34,8 +32,6 @@ module Imagekitio attr_reader webhooks: Imagekitio::Resources::Webhooks - attr_reader helper: Imagekitio::Helper - private def auth_headers: -> ::Hash[String, String] def base_url_overridden?: -> bool diff --git a/sig/imagekitio/helpers/helper.rbs b/sig/imagekitio/helpers/helper.rbs deleted file mode 100644 index 9756e66b..00000000 --- a/sig/imagekitio/helpers/helper.rbs +++ /dev/null @@ -1,24 +0,0 @@ -module Imagekitio - class Helper - def initialize: (client: Imagekitio::Client) -> void - - # Builds a URL with transformations applied - def build_url: (Imagekitio::Models::SrcOptions options) -> String - - # Generates transformation string from transformation objects - def build_transformation_string: ( - Array[Imagekitio::Models::Transformation] transformations - ) -> String - - # Generates authentication parameters for client-side file uploads - def get_authentication_parameters: ( - ?String? token, - ?Integer? expire - ) -> Hash[Symbol, (String | Integer)] - - # Generates responsive image attributes for use in HTML tags - def get_responsive_image_attributes: ( - Imagekitio::Models::GetImageAttributesOptions options - ) -> Imagekitio::Models::ResponsiveImageAttributes - end -end diff --git a/sig/imagekitio/models.rbs b/sig/imagekitio/models.rbs index ce6b4abe..c63f18f8 100644 --- a/sig/imagekitio/models.rbs +++ b/sig/imagekitio/models.rbs @@ -81,18 +81,6 @@ module Imagekitio class Metadata = Imagekitio::Models::Metadata - class NamedTransformation = Imagekitio::Models::NamedTransformation - - class NamedTransformationCreateParams = Imagekitio::Models::NamedTransformationCreateParams - - class NamedTransformationDeleteParams = Imagekitio::Models::NamedTransformationDeleteParams - - class NamedTransformationGetParams = Imagekitio::Models::NamedTransformationGetParams - - class NamedTransformationListParams = Imagekitio::Models::NamedTransformationListParams - - class NamedTransformationUpdateParams = Imagekitio::Models::NamedTransformationUpdateParams - module Overlay = Imagekitio::Models::Overlay class OverlayPosition = Imagekitio::Models::OverlayPosition diff --git a/sig/imagekitio/models/accounts/origin_request.rbs b/sig/imagekitio/models/accounts/origin_request.rbs index 8e898511..2a315a07 100644 --- a/sig/imagekitio/models/accounts/origin_request.rbs +++ b/sig/imagekitio/models/accounts/origin_request.rbs @@ -23,8 +23,7 @@ module Imagekitio type: :S3, base_url_for_canonical_header: String, include_canonical_header: bool, - prefix: String, - use_iam_role: bool + prefix: String } class S3 < Imagekitio::Internal::Type::BaseModel @@ -50,10 +49,6 @@ module Imagekitio def prefix=: (String) -> String - attr_reader use_iam_role: bool? - - def use_iam_role=: (bool) -> bool - def initialize: ( access_key: String, bucket: String, @@ -62,7 +57,6 @@ module Imagekitio ?base_url_for_canonical_header: String, ?include_canonical_header: bool, ?prefix: String, - ?use_iam_role: bool, ?type: :S3 ) -> void @@ -74,8 +68,7 @@ module Imagekitio type: :S3, base_url_for_canonical_header: String, include_canonical_header: bool, - prefix: String, - use_iam_role: bool + prefix: String } end @@ -158,8 +151,7 @@ module Imagekitio type: :CLOUDINARY_BACKUP, base_url_for_canonical_header: String, include_canonical_header: bool, - prefix: String, - use_iam_role: bool + prefix: String } class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel @@ -185,10 +177,6 @@ module Imagekitio def prefix=: (String) -> String - attr_reader use_iam_role: bool? - - def use_iam_role=: (bool) -> bool - def initialize: ( access_key: String, bucket: String, @@ -197,7 +185,6 @@ module Imagekitio ?base_url_for_canonical_header: String, ?include_canonical_header: bool, ?prefix: String, - ?use_iam_role: bool, ?type: :CLOUDINARY_BACKUP ) -> void @@ -209,8 +196,7 @@ module Imagekitio type: :CLOUDINARY_BACKUP, base_url_for_canonical_header: String, include_canonical_header: bool, - prefix: String, - use_iam_role: bool + prefix: String } end diff --git a/sig/imagekitio/models/accounts/origin_response.rbs b/sig/imagekitio/models/accounts/origin_response.rbs index dda5dd1f..b6dbf227 100644 --- a/sig/imagekitio/models/accounts/origin_response.rbs +++ b/sig/imagekitio/models/accounts/origin_response.rbs @@ -22,8 +22,7 @@ module Imagekitio name: String, prefix: String, type: :S3, - base_url_for_canonical_header: String, - use_iam_role: bool + base_url_for_canonical_header: String } class S3 < Imagekitio::Internal::Type::BaseModel @@ -41,10 +40,6 @@ module Imagekitio def base_url_for_canonical_header=: (String) -> String - attr_reader use_iam_role: bool? - - def use_iam_role=: (bool) -> bool - attr_accessor id: String def initialize: ( @@ -54,7 +49,6 @@ module Imagekitio name: String, prefix: String, ?base_url_for_canonical_header: String, - ?use_iam_role: bool, ?type: :S3 ) -> void @@ -65,8 +59,7 @@ module Imagekitio name: String, prefix: String, type: :S3, - base_url_for_canonical_header: String, - use_iam_role: bool + base_url_for_canonical_header: String } end @@ -137,8 +130,7 @@ module Imagekitio name: String, prefix: String, type: :CLOUDINARY_BACKUP, - base_url_for_canonical_header: String, - use_iam_role: bool + base_url_for_canonical_header: String } class CloudinaryBackup < Imagekitio::Internal::Type::BaseModel @@ -156,10 +148,6 @@ module Imagekitio def base_url_for_canonical_header=: (String) -> String - attr_reader use_iam_role: bool? - - def use_iam_role=: (bool) -> bool - attr_accessor id: String def initialize: ( @@ -169,7 +157,6 @@ module Imagekitio name: String, prefix: String, ?base_url_for_canonical_header: String, - ?use_iam_role: bool, ?type: :CLOUDINARY_BACKUP ) -> void @@ -180,8 +167,7 @@ module Imagekitio name: String, prefix: String, type: :CLOUDINARY_BACKUP, - base_url_for_canonical_header: String, - use_iam_role: bool + base_url_for_canonical_header: String } end diff --git a/sig/imagekitio/models/accounts/request_bandwidth_entry.rbs b/sig/imagekitio/models/accounts/request_bandwidth_entry.rbs deleted file mode 100644 index 0c8644aa..00000000 --- a/sig/imagekitio/models/accounts/request_bandwidth_entry.rbs +++ /dev/null @@ -1,18 +0,0 @@ -module Imagekitio - module Models - module Accounts - type request_bandwidth_entry = - { bandwidth_bytes: Float, request_count: Float } - - class RequestBandwidthEntry < Imagekitio::Internal::Type::BaseModel - attr_accessor bandwidth_bytes: Float - - attr_accessor request_count: Float - - def initialize: (bandwidth_bytes: Float, request_count: Float) -> void - - def to_hash: -> { bandwidth_bytes: Float, request_count: Float } - end - end - end -end diff --git a/sig/imagekitio/models/accounts/usage_analytics_get_params.rbs b/sig/imagekitio/models/accounts/usage_analytics_get_params.rbs deleted file mode 100644 index a1db53d7..00000000 --- a/sig/imagekitio/models/accounts/usage_analytics_get_params.rbs +++ /dev/null @@ -1,30 +0,0 @@ -module Imagekitio - module Models - module Accounts - type usage_analytics_get_params = - { end_date: Date, start_date: Date } - & Imagekitio::Internal::Type::request_parameters - - class UsageAnalyticsGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor end_date: Date - - attr_accessor start_date: Date - - def initialize: ( - end_date: Date, - start_date: Date, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - end_date: Date, - start_date: Date, - request_options: Imagekitio::RequestOptions - } - end - end - end -end diff --git a/sig/imagekitio/models/accounts/usage_analytics_response.rbs b/sig/imagekitio/models/accounts/usage_analytics_response.rbs deleted file mode 100644 index 6062a30f..00000000 --- a/sig/imagekitio/models/accounts/usage_analytics_response.rbs +++ /dev/null @@ -1,785 +0,0 @@ -module Imagekitio - module Models - module Accounts - type usage_analytics_response = - { - bandwidth_bytes: Float, - browser: Imagekitio::Accounts::UsageAnalyticsResponse::Browser, - cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache, - country: Imagekitio::Accounts::UsageAnalyticsResponse::Country, - device: Imagekitio::Accounts::UsageAnalyticsResponse::Device, - end_date: Date, - error_reasons: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason], - extensions: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Extension], - format_: Imagekitio::Accounts::UsageAnalyticsResponse::Format, - generated_at: Time, - request_count: Float, - start_date: Date, - status_codes: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode], - :top404_assets => ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset], - top_images: Imagekitio::Accounts::UsageAnalyticsResponse::TopImages, - top_image_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms, - top_other_assets: Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets, - top_referrers: Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers, - top_user_agents: Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents, - top_videos: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos, - top_video_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms, - url_endpoints: Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints, - video_processing: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing] - } - - class UsageAnalyticsResponse < Imagekitio::Internal::Type::BaseModel - attr_accessor bandwidth_bytes: Float - - attr_accessor browser: Imagekitio::Accounts::UsageAnalyticsResponse::Browser - - attr_accessor cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache - - attr_accessor country: Imagekitio::Accounts::UsageAnalyticsResponse::Country - - attr_accessor device: Imagekitio::Accounts::UsageAnalyticsResponse::Device - - attr_accessor end_date: Date - - attr_accessor error_reasons: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason] - - attr_accessor extensions: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Extension] - - attr_accessor format_: Imagekitio::Accounts::UsageAnalyticsResponse::Format - - attr_accessor generated_at: Time - - attr_accessor request_count: Float - - attr_accessor start_date: Date - - attr_accessor status_codes: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode] - - attr_accessor top404_assets: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset] - - attr_accessor top_images: Imagekitio::Accounts::UsageAnalyticsResponse::TopImages - - attr_accessor top_image_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms - - attr_accessor top_other_assets: Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets - - attr_accessor top_referrers: Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers - - attr_accessor top_user_agents: Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents - - attr_accessor top_videos: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos - - attr_accessor top_video_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms - - attr_accessor url_endpoints: Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints - - attr_accessor video_processing: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing] - - def initialize: ( - bandwidth_bytes: Float, - browser: Imagekitio::Accounts::UsageAnalyticsResponse::Browser, - cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache, - country: Imagekitio::Accounts::UsageAnalyticsResponse::Country, - device: Imagekitio::Accounts::UsageAnalyticsResponse::Device, - end_date: Date, - error_reasons: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason], - extensions: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Extension], - format_: Imagekitio::Accounts::UsageAnalyticsResponse::Format, - generated_at: Time, - request_count: Float, - start_date: Date, - status_codes: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode], - top404_assets: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset], - top_images: Imagekitio::Accounts::UsageAnalyticsResponse::TopImages, - top_image_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms, - top_other_assets: Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets, - top_referrers: Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers, - top_user_agents: Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents, - top_videos: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos, - top_video_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms, - url_endpoints: Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints, - video_processing: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing] - ) -> void - - def to_hash: -> { - bandwidth_bytes: Float, - browser: Imagekitio::Accounts::UsageAnalyticsResponse::Browser, - cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache, - country: Imagekitio::Accounts::UsageAnalyticsResponse::Country, - device: Imagekitio::Accounts::UsageAnalyticsResponse::Device, - end_date: Date, - error_reasons: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason], - extensions: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Extension], - format_: Imagekitio::Accounts::UsageAnalyticsResponse::Format, - generated_at: Time, - request_count: Float, - start_date: Date, - status_codes: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode], - :top404_assets => ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset], - top_images: Imagekitio::Accounts::UsageAnalyticsResponse::TopImages, - top_image_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms, - top_other_assets: Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets, - top_referrers: Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers, - top_user_agents: Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents, - top_videos: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos, - top_video_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms, - url_endpoints: Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints, - video_processing: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing] - } - - type browser = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest] - } - - class Browser < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Browser::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type cache = { error_count: Float, hit_count: Float, miss_count: Float } - - class Cache < Imagekitio::Internal::Type::BaseModel - attr_accessor error_count: Float - - attr_accessor hit_count: Float - - attr_accessor miss_count: Float - - def initialize: ( - error_count: Float, - hit_count: Float, - miss_count: Float - ) -> void - - def to_hash: -> { - error_count: Float, - hit_count: Float, - miss_count: Float - } - end - - type country = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest] - } - - class Country < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Country::ByRequest] - } - - type by_bandwidth = { code: String, name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def code: -> String - - def code=: (String _) -> String - - def name: -> String - - def name=: (String _) -> String - - def initialize: (code: String, name: String) -> void - - def to_hash: -> { code: String, name: String } - end - - type by_request = { code: String, name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def code: -> String - - def code=: (String _) -> String - - def name: -> String - - def name=: (String _) -> String - - def initialize: (code: String, name: String) -> void - - def to_hash: -> { code: String, name: String } - end - end - - type device = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest] - } - - class Device < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Device::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type error_reason = { name: String, request_count: Float } - - class ErrorReason < Imagekitio::Internal::Type::BaseModel - attr_accessor name: String - - attr_accessor request_count: Float - - def initialize: (name: String, request_count: Float) -> void - - def to_hash: -> { name: String, request_count: Float } - end - - type extension = { name: String, operation_count: Float } - - class Extension < Imagekitio::Internal::Type::BaseModel - attr_accessor name: String - - attr_accessor operation_count: Float - - def initialize: (name: String, operation_count: Float) -> void - - def to_hash: -> { name: String, operation_count: Float } - end - - type format_ = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest] - } - - class Format < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::Format::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type status_code = { name: String, request_count: Float } - - class StatusCode < Imagekitio::Internal::Type::BaseModel - attr_accessor name: String - - attr_accessor request_count: Float - - def initialize: (name: String, request_count: Float) -> void - - def to_hash: -> { name: String, request_count: Float } - end - - type top404_asset = { name: String, request_count: Float } - - class Top404Asset < Imagekitio::Internal::Type::BaseModel - attr_accessor name: String - - attr_accessor request_count: Float - - def initialize: (name: String, request_count: Float) -> void - - def to_hash: -> { name: String, request_count: Float } - end - - type top_images = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest] - } - - class TopImages < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImages::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type top_image_transforms = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest] - } - - class TopImageTransforms < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type top_other_assets = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest] - } - - class TopOtherAssets < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type top_referrers = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest] - } - - class TopReferrers < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type top_user_agents = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest] - } - - class TopUserAgents < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type top_videos = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest] - } - - class TopVideos < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type top_video_transforms = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest] - } - - class TopVideoTransforms < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type url_endpoints = - { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest] - } - - class URLEndpoints < Imagekitio::Internal::Type::BaseModel - attr_accessor by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth] - - attr_accessor by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest] - - def initialize: ( - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest] - ) -> void - - def to_hash: -> { - by_bandwidth: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByBandwidth], - by_requests: ::Array[Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints::ByRequest] - } - - type by_bandwidth = { name: String } - - class ByBandwidth < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - - type by_request = { name: String } - - class ByRequest < Imagekitio::Models::Accounts::RequestBandwidthEntry - def name: -> String - - def name=: (String _) -> String - - def initialize: (name: String) -> void - - def to_hash: -> { name: String } - end - end - - type video_processing = - { codec: String, duration_seconds: Float, resolution: String } - - class VideoProcessing < Imagekitio::Internal::Type::BaseModel - attr_accessor codec: String - - attr_accessor duration_seconds: Float - - attr_accessor resolution: String - - def initialize: ( - codec: String, - duration_seconds: Float, - resolution: String - ) -> void - - def to_hash: -> { - codec: String, - duration_seconds: Float, - resolution: String - } - end - end - end - end -end diff --git a/sig/imagekitio/models/custom_metadata_field.rbs b/sig/imagekitio/models/custom_metadata_field.rbs index 63a2d006..3c2071f5 100644 --- a/sig/imagekitio/models/custom_metadata_field.rbs +++ b/sig/imagekitio/models/custom_metadata_field.rbs @@ -5,8 +5,7 @@ module Imagekitio id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema, - description: String + schema: Imagekitio::CustomMetadataField::Schema } class CustomMetadataField < Imagekitio::Internal::Type::BaseModel @@ -18,24 +17,18 @@ module Imagekitio attr_accessor schema: Imagekitio::CustomMetadataField::Schema - attr_reader description: String? - - def description=: (String) -> String - def initialize: ( id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema, - ?description: String + schema: Imagekitio::CustomMetadataField::Schema ) -> void def to_hash: -> { id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema, - description: String + schema: Imagekitio::CustomMetadataField::Schema } type schema = diff --git a/sig/imagekitio/models/custom_metadata_field_create_params.rbs b/sig/imagekitio/models/custom_metadata_field_create_params.rbs index 4be05e40..78f2ab99 100644 --- a/sig/imagekitio/models/custom_metadata_field_create_params.rbs +++ b/sig/imagekitio/models/custom_metadata_field_create_params.rbs @@ -4,8 +4,7 @@ module Imagekitio { label: String, name: String, - schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, - description: String + schema: Imagekitio::CustomMetadataFieldCreateParams::Schema } & Imagekitio::Internal::Type::request_parameters @@ -19,15 +18,10 @@ module Imagekitio attr_accessor schema: Imagekitio::CustomMetadataFieldCreateParams::Schema - attr_reader description: String? - - def description=: (String) -> String - def initialize: ( label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, - ?description: String, ?request_options: Imagekitio::request_opts ) -> void @@ -35,7 +29,6 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, - description: String, request_options: Imagekitio::RequestOptions } diff --git a/sig/imagekitio/models/custom_metadata_field_update_params.rbs b/sig/imagekitio/models/custom_metadata_field_update_params.rbs index 1da43c1c..99db4963 100644 --- a/sig/imagekitio/models/custom_metadata_field_update_params.rbs +++ b/sig/imagekitio/models/custom_metadata_field_update_params.rbs @@ -3,7 +3,6 @@ module Imagekitio type custom_metadata_field_update_params = { id: String, - description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema } @@ -15,10 +14,6 @@ module Imagekitio attr_accessor id: String - attr_reader description: String? - - def description=: (String) -> String - attr_reader label: String? def label=: (String) -> String @@ -31,7 +26,6 @@ module Imagekitio def initialize: ( id: String, - ?description: String, ?label: String, ?schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, ?request_options: Imagekitio::request_opts @@ -39,7 +33,6 @@ module Imagekitio def to_hash: -> { id: String, - description: String, label: String, schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, request_options: Imagekitio::RequestOptions diff --git a/sig/imagekitio/models/metadata.rbs b/sig/imagekitio/models/metadata.rbs index b3a2d1d1..082ac3ac 100644 --- a/sig/imagekitio/models/metadata.rbs +++ b/sig/imagekitio/models/metadata.rbs @@ -175,7 +175,6 @@ module Imagekitio type exif = { aperture_value: Float, - brightness_value: Float, color_space: Integer, create_date: String, custom_rendered: Integer, @@ -190,23 +189,16 @@ module Imagekitio flash: Integer, flashpix_version: String, f_number: Float, - focal_length: Float, - :focal_length_in35mm_format => Integer, + focal_length: Integer, focal_plane_resolution_unit: Integer, focal_plane_x_resolution: Float, focal_plane_y_resolution: Float, interop_offset: Integer, iso: Integer, - lens_model: String, - light_source: Integer, - max_aperture_value: Float, metering_mode: Integer, scene_capture_type: Integer, - scene_type: String, - sensing_method: Integer, shutter_speed_value: Float, sub_sec_time: String, - user_comment: String, white_balance: Integer } @@ -215,10 +207,6 @@ module Imagekitio def aperture_value=: (Float) -> Float - attr_reader brightness_value: Float? - - def brightness_value=: (Float) -> Float - attr_reader color_space: Integer? def color_space=: (Integer) -> Integer @@ -275,13 +263,9 @@ module Imagekitio def f_number=: (Float) -> Float - attr_reader focal_length: Float? - - def focal_length=: (Float) -> Float + attr_reader focal_length: Integer? - attr_reader focal_length_in35mm_format: Integer? - - def focal_length_in35mm_format=: (Integer) -> Integer + def focal_length=: (Integer) -> Integer attr_reader focal_plane_resolution_unit: Integer? @@ -303,18 +287,6 @@ module Imagekitio def iso=: (Integer) -> Integer - attr_reader lens_model: String? - - def lens_model=: (String) -> String - - attr_reader light_source: Integer? - - def light_source=: (Integer) -> Integer - - attr_reader max_aperture_value: Float? - - def max_aperture_value=: (Float) -> Float - attr_reader metering_mode: Integer? def metering_mode=: (Integer) -> Integer @@ -323,14 +295,6 @@ module Imagekitio def scene_capture_type=: (Integer) -> Integer - attr_reader scene_type: String? - - def scene_type=: (String) -> String - - attr_reader sensing_method: Integer? - - def sensing_method=: (Integer) -> Integer - attr_reader shutter_speed_value: Float? def shutter_speed_value=: (Float) -> Float @@ -339,17 +303,12 @@ module Imagekitio def sub_sec_time=: (String) -> String - attr_reader user_comment: String? - - def user_comment=: (String) -> String - attr_reader white_balance: Integer? def white_balance=: (Integer) -> Integer def initialize: ( ?aperture_value: Float, - ?brightness_value: Float, ?color_space: Integer, ?create_date: String, ?custom_rendered: Integer, @@ -364,29 +323,21 @@ module Imagekitio ?flash: Integer, ?flashpix_version: String, ?f_number: Float, - ?focal_length: Float, - ?focal_length_in35mm_format: Integer, + ?focal_length: Integer, ?focal_plane_resolution_unit: Integer, ?focal_plane_x_resolution: Float, ?focal_plane_y_resolution: Float, ?interop_offset: Integer, ?iso: Integer, - ?lens_model: String, - ?light_source: Integer, - ?max_aperture_value: Float, ?metering_mode: Integer, ?scene_capture_type: Integer, - ?scene_type: String, - ?sensing_method: Integer, ?shutter_speed_value: Float, ?sub_sec_time: String, - ?user_comment: String, ?white_balance: Integer ) -> void def to_hash: -> { aperture_value: Float, - brightness_value: Float, color_space: Integer, create_date: String, custom_rendered: Integer, @@ -401,143 +352,48 @@ module Imagekitio flash: Integer, flashpix_version: String, f_number: Float, - focal_length: Float, - :focal_length_in35mm_format => Integer, + focal_length: Integer, focal_plane_resolution_unit: Integer, focal_plane_x_resolution: Float, focal_plane_y_resolution: Float, interop_offset: Integer, iso: Integer, - lens_model: String, - light_source: Integer, - max_aperture_value: Float, metering_mode: Integer, scene_capture_type: Integer, - scene_type: String, - sensing_method: Integer, shutter_speed_value: Float, sub_sec_time: String, - user_comment: String, white_balance: Integer } end - type gps = - { - gps_altitude: Float, - gps_altitude_ref: Integer, - gps_date_stamp: String, - gps_img_direction: Float, - gps_img_direction_ref: String, - gps_latitude: ::Array[Float], - gps_latitude_ref: String, - gps_longitude: ::Array[Float], - gps_longitude_ref: String, - gps_time_stamp: ::Array[Float], - gps_version_id: ::Array[Integer] - } + type gps = { gps_version_id: ::Array[Integer] } class Gps < Imagekitio::Internal::Type::BaseModel - attr_reader gps_altitude: Float? - - def gps_altitude=: (Float) -> Float - - attr_reader gps_altitude_ref: Integer? - - def gps_altitude_ref=: (Integer) -> Integer - - attr_reader gps_date_stamp: String? - - def gps_date_stamp=: (String) -> String - - attr_reader gps_img_direction: Float? - - def gps_img_direction=: (Float) -> Float - - attr_reader gps_img_direction_ref: String? - - def gps_img_direction_ref=: (String) -> String - - attr_reader gps_latitude: ::Array[Float]? - - def gps_latitude=: (::Array[Float]) -> ::Array[Float] - - attr_reader gps_latitude_ref: String? - - def gps_latitude_ref=: (String) -> String - - attr_reader gps_longitude: ::Array[Float]? - - def gps_longitude=: (::Array[Float]) -> ::Array[Float] - - attr_reader gps_longitude_ref: String? - - def gps_longitude_ref=: (String) -> String - - attr_reader gps_time_stamp: ::Array[Float]? - - def gps_time_stamp=: (::Array[Float]) -> ::Array[Float] - attr_reader gps_version_id: ::Array[Integer]? def gps_version_id=: (::Array[Integer]) -> ::Array[Integer] - def initialize: ( - ?gps_altitude: Float, - ?gps_altitude_ref: Integer, - ?gps_date_stamp: String, - ?gps_img_direction: Float, - ?gps_img_direction_ref: String, - ?gps_latitude: ::Array[Float], - ?gps_latitude_ref: String, - ?gps_longitude: ::Array[Float], - ?gps_longitude_ref: String, - ?gps_time_stamp: ::Array[Float], - ?gps_version_id: ::Array[Integer] - ) -> void + def initialize: (?gps_version_id: ::Array[Integer]) -> void - def to_hash: -> { - gps_altitude: Float, - gps_altitude_ref: Integer, - gps_date_stamp: String, - gps_img_direction: Float, - gps_img_direction_ref: String, - gps_latitude: ::Array[Float], - gps_latitude_ref: String, - gps_longitude: ::Array[Float], - gps_longitude_ref: String, - gps_time_stamp: ::Array[Float], - gps_version_id: ::Array[Integer] - } + def to_hash: -> { gps_version_id: ::Array[Integer] } end type image = { - artist: String, - copyright: String, exif_offset: Integer, gps_info: Integer, - image_description: String, make: String, model: String, modify_date: String, orientation: Integer, resolution_unit: Integer, software: String, - x_resolution: Float, + x_resolution: Integer, y_cb_cr_positioning: Integer, - y_resolution: Float + y_resolution: Integer } class Image < Imagekitio::Internal::Type::BaseModel - attr_reader artist: String? - - def artist=: (String) -> String - - attr_reader copyright: String? - - def copyright=: (String) -> String - attr_reader exif_offset: Integer? def exif_offset=: (Integer) -> Integer @@ -546,10 +402,6 @@ module Imagekitio def gps_info=: (Integer) -> Integer - attr_reader image_description: String? - - def image_description=: (String) -> String - attr_reader make: String? def make=: (String) -> String @@ -574,50 +426,44 @@ module Imagekitio def software=: (String) -> String - attr_reader x_resolution: Float? + attr_reader x_resolution: Integer? - def x_resolution=: (Float) -> Float + def x_resolution=: (Integer) -> Integer attr_reader y_cb_cr_positioning: Integer? def y_cb_cr_positioning=: (Integer) -> Integer - attr_reader y_resolution: Float? + attr_reader y_resolution: Integer? - def y_resolution=: (Float) -> Float + def y_resolution=: (Integer) -> Integer def initialize: ( - ?artist: String, - ?copyright: String, ?exif_offset: Integer, ?gps_info: Integer, - ?image_description: String, ?make: String, ?model: String, ?modify_date: String, ?orientation: Integer, ?resolution_unit: Integer, ?software: String, - ?x_resolution: Float, + ?x_resolution: Integer, ?y_cb_cr_positioning: Integer, - ?y_resolution: Float + ?y_resolution: Integer ) -> void def to_hash: -> { - artist: String, - copyright: String, exif_offset: Integer, gps_info: Integer, - image_description: String, make: String, model: String, modify_date: String, orientation: Integer, resolution_unit: Integer, software: String, - x_resolution: Float, + x_resolution: Integer, y_cb_cr_positioning: Integer, - y_resolution: Float + y_resolution: Integer } end @@ -647,8 +493,8 @@ module Imagekitio resolution_unit: Integer, thumbnail_length: Integer, thumbnail_offset: Integer, - x_resolution: Float, - y_resolution: Float + x_resolution: Integer, + y_resolution: Integer } class Thumbnail < Imagekitio::Internal::Type::BaseModel @@ -668,21 +514,21 @@ module Imagekitio def thumbnail_offset=: (Integer) -> Integer - attr_reader x_resolution: Float? + attr_reader x_resolution: Integer? - def x_resolution=: (Float) -> Float + def x_resolution=: (Integer) -> Integer - attr_reader y_resolution: Float? + attr_reader y_resolution: Integer? - def y_resolution=: (Float) -> Float + def y_resolution=: (Integer) -> Integer def initialize: ( ?compression: Integer, ?resolution_unit: Integer, ?thumbnail_length: Integer, ?thumbnail_offset: Integer, - ?x_resolution: Float, - ?y_resolution: Float + ?x_resolution: Integer, + ?y_resolution: Integer ) -> void def to_hash: -> { @@ -690,8 +536,8 @@ module Imagekitio resolution_unit: Integer, thumbnail_length: Integer, thumbnail_offset: Integer, - x_resolution: Float, - y_resolution: Float + x_resolution: Integer, + y_resolution: Integer } end end diff --git a/sig/imagekitio/models/named_transformation.rbs b/sig/imagekitio/models/named_transformation.rbs deleted file mode 100644 index edcb6747..00000000 --- a/sig/imagekitio/models/named_transformation.rbs +++ /dev/null @@ -1,40 +0,0 @@ -module Imagekitio - module Models - type named_transformation = - { - id: String, - created_at: Time, - enabled: bool, - name: String, - transformation: String - } - - class NamedTransformation < Imagekitio::Internal::Type::BaseModel - attr_accessor id: String - - attr_accessor created_at: Time - - attr_accessor enabled: bool - - attr_accessor name: String - - attr_accessor transformation: String - - def initialize: ( - id: String, - created_at: Time, - enabled: bool, - name: String, - transformation: String - ) -> void - - def to_hash: -> { - id: String, - created_at: Time, - enabled: bool, - name: String, - transformation: String - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_create_params.rbs b/sig/imagekitio/models/named_transformation_create_params.rbs deleted file mode 100644 index 7a534d11..00000000 --- a/sig/imagekitio/models/named_transformation_create_params.rbs +++ /dev/null @@ -1,34 +0,0 @@ -module Imagekitio - module Models - type named_transformation_create_params = - { name: String, transformation: String, enabled: bool } - & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationCreateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor name: String - - attr_accessor transformation: String - - attr_reader enabled: bool? - - def enabled=: (bool) -> bool - - def initialize: ( - name: String, - transformation: String, - ?enabled: bool, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - name: String, - transformation: String, - enabled: bool, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_delete_params.rbs b/sig/imagekitio/models/named_transformation_delete_params.rbs deleted file mode 100644 index 4aa8e42f..00000000 --- a/sig/imagekitio/models/named_transformation_delete_params.rbs +++ /dev/null @@ -1,23 +0,0 @@ -module Imagekitio - module Models - type named_transformation_delete_params = - { id: String } & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationDeleteParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor id: String - - def initialize: ( - id: String, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - id: String, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_get_params.rbs b/sig/imagekitio/models/named_transformation_get_params.rbs deleted file mode 100644 index bc8c27c1..00000000 --- a/sig/imagekitio/models/named_transformation_get_params.rbs +++ /dev/null @@ -1,23 +0,0 @@ -module Imagekitio - module Models - type named_transformation_get_params = - { id: String } & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationGetParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor id: String - - def initialize: ( - id: String, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - id: String, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_list_params.rbs b/sig/imagekitio/models/named_transformation_list_params.rbs deleted file mode 100644 index 91dc04e5..00000000 --- a/sig/imagekitio/models/named_transformation_list_params.rbs +++ /dev/null @@ -1,15 +0,0 @@ -module Imagekitio - module Models - type named_transformation_list_params = - { } & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationListParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - def initialize: (?request_options: Imagekitio::request_opts) -> void - - def to_hash: -> { request_options: Imagekitio::RequestOptions } - end - end -end diff --git a/sig/imagekitio/models/named_transformation_list_response.rbs b/sig/imagekitio/models/named_transformation_list_response.rbs deleted file mode 100644 index c800123e..00000000 --- a/sig/imagekitio/models/named_transformation_list_response.rbs +++ /dev/null @@ -1,8 +0,0 @@ -module Imagekitio - module Models - type named_transformation_list_response = - ::Array[Imagekitio::NamedTransformation] - - NamedTransformationListResponse: Imagekitio::Internal::Type::Converter - end -end diff --git a/sig/imagekitio/models/named_transformation_update_params.rbs b/sig/imagekitio/models/named_transformation_update_params.rbs deleted file mode 100644 index db06473b..00000000 --- a/sig/imagekitio/models/named_transformation_update_params.rbs +++ /dev/null @@ -1,42 +0,0 @@ -module Imagekitio - module Models - type named_transformation_update_params = - { id: String, enabled: bool, name: String, transformation: String } - & Imagekitio::Internal::Type::request_parameters - - class NamedTransformationUpdateParams < Imagekitio::Internal::Type::BaseModel - extend Imagekitio::Internal::Type::RequestParameters::Converter - include Imagekitio::Internal::Type::RequestParameters - - attr_accessor id: String - - attr_reader enabled: bool? - - def enabled=: (bool) -> bool - - attr_reader name: String? - - def name=: (String) -> String - - attr_reader transformation: String? - - def transformation=: (String) -> String - - def initialize: ( - id: String, - ?enabled: bool, - ?name: String, - ?transformation: String, - ?request_options: Imagekitio::request_opts - ) -> void - - def to_hash: -> { - id: String, - enabled: bool, - name: String, - transformation: String, - request_options: Imagekitio::RequestOptions - } - end - end -end diff --git a/sig/imagekitio/resources/accounts.rbs b/sig/imagekitio/resources/accounts.rbs index 5518b4d8..0e844846 100644 --- a/sig/imagekitio/resources/accounts.rbs +++ b/sig/imagekitio/resources/accounts.rbs @@ -3,8 +3,6 @@ module Imagekitio class Accounts attr_reader usage: Imagekitio::Resources::Accounts::Usage - attr_reader usage_analytics: Imagekitio::Resources::Accounts::UsageAnalytics - attr_reader origins: Imagekitio::Resources::Accounts::Origins attr_reader url_endpoints: Imagekitio::Resources::Accounts::URLEndpoints diff --git a/sig/imagekitio/resources/accounts/usage_analytics.rbs b/sig/imagekitio/resources/accounts/usage_analytics.rbs deleted file mode 100644 index 1df725e1..00000000 --- a/sig/imagekitio/resources/accounts/usage_analytics.rbs +++ /dev/null @@ -1,15 +0,0 @@ -module Imagekitio - module Resources - class Accounts - class UsageAnalytics - def get: ( - end_date: Date, - start_date: Date, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::Accounts::UsageAnalyticsResponse - - def initialize: (client: Imagekitio::Client) -> void - end - end - end -end diff --git a/sig/imagekitio/resources/custom_metadata_fields.rbs b/sig/imagekitio/resources/custom_metadata_fields.rbs index a7f4e41a..f4f8e326 100644 --- a/sig/imagekitio/resources/custom_metadata_fields.rbs +++ b/sig/imagekitio/resources/custom_metadata_fields.rbs @@ -5,13 +5,11 @@ module Imagekitio label: String, name: String, schema: Imagekitio::CustomMetadataFieldCreateParams::Schema, - ?description: String, ?request_options: Imagekitio::request_opts ) -> Imagekitio::CustomMetadataField def update: ( String id, - ?description: String, ?label: String, ?schema: Imagekitio::CustomMetadataFieldUpdateParams::Schema, ?request_options: Imagekitio::request_opts diff --git a/sig/imagekitio/resources/named_transformations.rbs b/sig/imagekitio/resources/named_transformations.rbs deleted file mode 100644 index ba6d0be6..00000000 --- a/sig/imagekitio/resources/named_transformations.rbs +++ /dev/null @@ -1,33 +0,0 @@ -module Imagekitio - module Resources - class NamedTransformations - def create: ( - name: String, - transformation: String, - ?enabled: bool, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::NamedTransformation - - def update: ( - String id, - ?enabled: bool, - ?name: String, - ?transformation: String, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::NamedTransformation - - def list: ( - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::Models::named_transformation_list_response - - def delete: (String id, ?request_options: Imagekitio::request_opts) -> nil - - def get: ( - String id, - ?request_options: Imagekitio::request_opts - ) -> Imagekitio::NamedTransformation - - def initialize: (client: Imagekitio::Client) -> void - end - end -end diff --git a/test/imagekitio/client_test.rb b/test/imagekitio/client_test.rb index aabeef38..caa3205f 100644 --- a/test/imagekitio/client_test.rb +++ b/test/imagekitio/client_test.rb @@ -278,7 +278,7 @@ def test_client_redirect_307 assert_requested(:any, "http://localhost/redirected", times: Imagekitio::Client::MAX_REDIRECTS) do assert_equal(recorded.method, _1.method) - # assert_equal(recorded.body, _1.body) skipping, since the request body is multipart encoded + assert_equal(recorded.body, _1.body) assert_equal( recorded.headers.transform_keys(&:downcase)["content-type"], _1.headers.transform_keys(&:downcase)["content-type"] diff --git a/test/imagekitio/custom-tests/helper_authentication_test.rb b/test/imagekitio/custom-tests/helper_authentication_test.rb deleted file mode 100644 index 7acb32fe..00000000 --- a/test/imagekitio/custom-tests/helper_authentication_test.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: true - -require_relative "../test_helper" - -class HelperAuthenticationTest < Minitest::Test - def test_should_return_correct_authentication_parameters_with_provided_token_and_expire - private_key = "private_key_test" - client = Imagekitio::Client.new(private_key: private_key) - - token = "your_token" - expire = 1_582_269_249 - - params = client.helper.get_authentication_parameters(token: token, expire: expire) - - # Expected exact match with Node.js output - expected_signature = "e71bcd6031016b060d349d212e23e85c791decdd" - - assert_equal(token, params[:token]) - assert_equal(expire, params[:expire]) - assert_equal(expected_signature, params[:signature]) - end - - def test_should_return_authentication_parameters_with_required_properties_when_no_params_provided - private_key = "private_key_test" - client = Imagekitio::Client.new(private_key: private_key) - - params = client.helper.get_authentication_parameters - - # Check that all required properties exist - assert(params.key?(:token), "Expected token parameter") - assert(params.key?(:expire), "Expected expire parameter") - assert(params.key?(:signature), "Expected signature parameter") - - # Token should be a 32-character hex string - token = params[:token] - assert_instance_of(String, token) - assert_match(/^[0-9a-f]{32}$/, token, "Expected token to be 32-character hex format") - - # Expire should be a number greater than current time - expire = params[:expire] - assert_instance_of(Integer, expire) - current_time = Time.now.to_i - assert(expire > current_time, "Expected expire #{expire} to be greater than current time #{current_time}") - - # Signature should be a hex string (40 characters for HMAC-SHA1) - signature = params[:signature] - assert_instance_of(String, signature) - assert_match(/^[a-f0-9]{40}$/, signature, "Expected signature to be 40 character hex string") - end - - def test_should_handle_edge_case_with_expire_time_0 - private_key = "private_key_test" - client = Imagekitio::Client.new(private_key: private_key) - - token = "test-token" - expire = 0 - - params = client.helper.get_authentication_parameters(token: token, expire: expire) - - assert_equal(token, params[:token]) - - # When expire is 0 (falsy), it should use default expire time (30 minutes from now) - expire_result = params[:expire] - assert_instance_of(Integer, expire_result) - expected_expire = Time.now.to_i + (60 * 30) - # Allow a 10 second tolerance for test execution time - assert( - expire_result.between?(expected_expire - 10, expected_expire + 10), - "Expected expire to be close to #{expected_expire} (30 minutes from now), got #{expire_result}" - ) - - # Signature should be a hex string (40 characters for HMAC-SHA1) - signature = params[:signature] - assert_instance_of(String, signature) - assert_match(/^[a-f0-9]{40}$/, signature, "Expected signature to be 40 character hex string") - end - - def test_should_handle_empty_string_token - private_key = "private_key_test" - client = Imagekitio::Client.new(private_key: private_key) - - token = "" # Empty string is falsy - expire = 1_582_269_249 - - params = client.helper.get_authentication_parameters(token: token, expire: expire) - - # Since empty string is falsy, it should generate a token - token_result = params[:token] - assert_instance_of(String, token_result) - refute_empty(token_result, "Expected token to be generated when empty string is provided") - assert_match(/^[0-9a-f]{32}$/, token_result, "Expected generated token to be 32-character hex format") - - assert_equal(expire, params[:expire]) - - # Signature should be a hex string (40 characters for HMAC-SHA1) - signature = params[:signature] - assert_instance_of(String, signature) - assert_match(/^[a-f0-9]{40}$/, signature, "Expected signature to be 40 character hex string") - end - - def test_should_raise_error_when_private_key_is_not_provided - # Test with empty private key - assert_raises(ArgumentError, "Expected error when private key is empty") do - client = Imagekitio::Client.new(private_key: "") - client.helper.get_authentication_parameters(token: "test", expire: 123) - end - end - - def test_should_raise_error_when_private_key_is_nil - # Test with nil private key - assert_raises(ArgumentError, "Expected error when private key is nil") do - client = Imagekitio::Client.new(private_key: nil) - client.helper.get_authentication_parameters(token: "test", expire: 123) - end - end -end diff --git a/test/imagekitio/custom-tests/responsive_image_attributes_test.rb b/test/imagekitio/custom-tests/responsive_image_attributes_test.rb deleted file mode 100644 index 48fb0599..00000000 --- a/test/imagekitio/custom-tests/responsive_image_attributes_test.rb +++ /dev/null @@ -1,306 +0,0 @@ -# frozen_string_literal: true - -require_relative "../test_helper" - -class ResponsiveImageAttributesTest < Minitest::Test - def setup - @client = Imagekitio::Client.new( - private_key: "private_key_test", - password: "test_password" - ) - end - - def test_bare_minimum_input - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo" - ) - - # Expected object based on default device_breakpoints and image_breakpoints - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=w-640,c-at_max 640w, https://ik.imagekit.io/demo/sample.jpg?tr=w-750,c-at_max 750w, https://ik.imagekit.io/demo/sample.jpg?tr=w-828,c-at_max 828w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1080,c-at_max 1080w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1200,c-at_max 1200w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1920,c-at_max 1920w, https://ik.imagekit.io/demo/sample.jpg?tr=w-2048,c-at_max 2048w, https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max 3840w", - sizes: "100vw", - width: nil - } - - assert_equal(expected, result.to_h) - end - - def test_sizes_provided_100vw - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - sizes: "100vw" - ) - - # With a sizes value of "100vw", the function should use the same breakpoints as in the bare minimum case - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=w-640,c-at_max 640w, https://ik.imagekit.io/demo/sample.jpg?tr=w-750,c-at_max 750w, https://ik.imagekit.io/demo/sample.jpg?tr=w-828,c-at_max 828w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1080,c-at_max 1080w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1200,c-at_max 1200w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1920,c-at_max 1920w, https://ik.imagekit.io/demo/sample.jpg?tr=w-2048,c-at_max 2048w, https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max 3840w", - sizes: "100vw", - width: nil - } - - assert_equal(expected, result.to_h) - end - - def test_width_only_dpr_strategy - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - width: 400 - ) - - # When width is provided without sizes attribute, the DPR strategy should be used - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=w-828,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=w-640,c-at_max 1x, https://ik.imagekit.io/demo/sample.jpg?tr=w-828,c-at_max 2x", - sizes: nil, - width: 400.0 - } - - assert_equal(expected, result.to_h) - end - - def test_custom_breakpoints - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - device_breakpoints: [200, 400, 800], - image_breakpoints: [100] - ) - - # For custom breakpoints, the breakpoints will be derived from the provided arrays - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=w-800,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=w-200,c-at_max 200w, https://ik.imagekit.io/demo/sample.jpg?tr=w-400,c-at_max 400w, https://ik.imagekit.io/demo/sample.jpg?tr=w-800,c-at_max 800w", - sizes: "100vw", - width: nil - } - - assert_equal(expected, result.to_h) - end - - def test_preserves_caller_transformations - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - width: 500, - transformation: [Imagekitio::Models::Transformation.new(height: 300.0)] - ) - - # The provided transformation should be preserved in the output - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=h-300:w-1080,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=h-300:w-640,c-at_max 1x, https://ik.imagekit.io/demo/sample.jpg?tr=h-300:w-1080,c-at_max 2x", - sizes: nil, - width: 500.0 - } - - assert_equal(expected, result.to_h) - end - - def test_both_sizes_and_width_passed - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - sizes: "50vw", - width: 600 - ) - - # Both sizes and width are provided, so the function should apply the sizes attribute while using width for DPR strategy - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=w-384,c-at_max 384w, https://ik.imagekit.io/demo/sample.jpg?tr=w-640,c-at_max 640w, https://ik.imagekit.io/demo/sample.jpg?tr=w-750,c-at_max 750w, https://ik.imagekit.io/demo/sample.jpg?tr=w-828,c-at_max 828w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1080,c-at_max 1080w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1200,c-at_max 1200w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1920,c-at_max 1920w, https://ik.imagekit.io/demo/sample.jpg?tr=w-2048,c-at_max 2048w, https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max 3840w", - sizes: "50vw", - width: 600.0 - } - - assert_equal(expected, result.to_h) - end - - def test_multiple_transformations - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - width: 450, - transformation: [ - Imagekitio::Models::Transformation.new(height: 300.0), - Imagekitio::Models::Transformation.new(ai_remove_background: true) - ] - ) - - # Multiple caller transformations should be combined appropriately - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=h-300:e-bgremove:w-1080,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=h-300:e-bgremove:w-640,c-at_max 1x, https://ik.imagekit.io/demo/sample.jpg?tr=h-300:e-bgremove:w-1080,c-at_max 2x", - sizes: nil, - width: 450.0 - } - - assert_equal(expected, result.to_h) - end - - def test_sizes_causes_breakpoint_pruning_33vw_path - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - sizes: "(min-width: 800px) 33vw, 100vw" - ) - - # When specified with a sizes attribute that prunes breakpoints, the output should reflect the pruned values - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=w-256,c-at_max 256w, https://ik.imagekit.io/demo/sample.jpg?tr=w-384,c-at_max 384w, https://ik.imagekit.io/demo/sample.jpg?tr=w-640,c-at_max 640w, https://ik.imagekit.io/demo/sample.jpg?tr=w-750,c-at_max 750w, https://ik.imagekit.io/demo/sample.jpg?tr=w-828,c-at_max 828w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1080,c-at_max 1080w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1200,c-at_max 1200w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1920,c-at_max 1920w, https://ik.imagekit.io/demo/sample.jpg?tr=w-2048,c-at_max 2048w, https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max 3840w", - sizes: "(min-width: 800px) 33vw, 100vw", - width: nil - } - - assert_equal(expected, result.to_h) - end - - def test_using_query_parameters_and_transformation_position - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - width: 450, - transformation: [ - Imagekitio::Models::Transformation.new(height: 300), - Imagekitio::Models::Transformation.new(ai_remove_background: true) - ], - query_parameters: {key: "value"}, - transformation_position: :path - ) - - # The function should respect the transformation position and query parameters - expected = { - src: "https://ik.imagekit.io/demo/tr:h-300:e-bgremove:w-1080,c-at_max/sample.jpg?key=value", - src_set: "https://ik.imagekit.io/demo/tr:h-300:e-bgremove:w-640,c-at_max/sample.jpg?key=value 1x, https://ik.imagekit.io/demo/tr:h-300:e-bgremove:w-1080,c-at_max/sample.jpg?key=value 2x", - sizes: nil, - width: 450.0 - } - - assert_equal(expected, result.to_h) - end - - # Hash-based API test - verify that plain hashes work for responsive image attributes - def test_should_work_with_plain_hashes_for_responsive_image_attributes - # Using plain hashes instead of model objects - result = @client.helper.get_responsive_image_attributes( - { - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - width: 450, - transformation: [ - { - height: 300 - }, - { - ai_remove_background: true - } - ] - } - ) - - # Multiple caller transformations should be combined appropriately - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=h-300:e-bgremove:w-1080,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=h-300:e-bgremove:w-640,c-at_max 1x, https://ik.imagekit.io/demo/sample.jpg?tr=h-300:e-bgremove:w-1080,c-at_max 2x", - sizes: nil, - width: 450 - } - - assert_equal(expected, result.to_h) - end - - # Test to verify that srcset uses integer descriptors (640w) not float (640.0w) - # This tests both model object and hash approaches - def test_should_use_integer_descriptors_in_srcset_with_model_object - # Using GetImageAttributesOptions model with Float array (as defined in schema) - result = @client.helper.get_responsive_image_attributes( - Imagekitio::Models::GetImageAttributesOptions.new( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - device_breakpoints: [320.0, 640.0, 1280.0], # SDK converts to floats - image_breakpoints: [] - ) - ) - - src_set = result.src_set - - # Should have integer descriptors like "320w", NOT "320.0w" - assert_includes(src_set, "320w") - assert_includes(src_set, "640w") - assert_includes(src_set, "1280w") - - # Should NOT have float descriptors - refute_includes(src_set, "320.0w") - refute_includes(src_set, "640.0w") - refute_includes(src_set, "1280.0w") - end - - def test_should_use_integer_descriptors_in_srcset_with_hash - # Using plain hash with integer breakpoints - result = @client.helper.get_responsive_image_attributes( - { - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - device_breakpoints: [320, 640, 1280], - image_breakpoints: [] - } - ) - - src_set = result.src_set - - # Should have integer descriptors like "320w", NOT "320.0w" - assert_includes(src_set, "320w") - assert_includes(src_set, "640w") - assert_includes(src_set, "1280w") - - # Should NOT have float descriptors - refute_includes(src_set, "320.0w") - refute_includes(src_set, "640.0w") - refute_includes(src_set, "1280.0w") - end - - def test_fallback_when_no_usable_vw_tokens - result = @client.helper.get_responsive_image_attributes( - src: "sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - sizes: "100%" - ) - - # When sizes has no vw tokens, all breakpoints should be used - expected = { - src: "https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max", - src_set: "https://ik.imagekit.io/demo/sample.jpg?tr=w-16,c-at_max 16w, https://ik.imagekit.io/demo/sample.jpg?tr=w-32,c-at_max 32w, https://ik.imagekit.io/demo/sample.jpg?tr=w-48,c-at_max 48w, https://ik.imagekit.io/demo/sample.jpg?tr=w-64,c-at_max 64w, https://ik.imagekit.io/demo/sample.jpg?tr=w-96,c-at_max 96w, https://ik.imagekit.io/demo/sample.jpg?tr=w-128,c-at_max 128w, https://ik.imagekit.io/demo/sample.jpg?tr=w-256,c-at_max 256w, https://ik.imagekit.io/demo/sample.jpg?tr=w-384,c-at_max 384w, https://ik.imagekit.io/demo/sample.jpg?tr=w-640,c-at_max 640w, https://ik.imagekit.io/demo/sample.jpg?tr=w-750,c-at_max 750w, https://ik.imagekit.io/demo/sample.jpg?tr=w-828,c-at_max 828w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1080,c-at_max 1080w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1200,c-at_max 1200w, https://ik.imagekit.io/demo/sample.jpg?tr=w-1920,c-at_max 1920w, https://ik.imagekit.io/demo/sample.jpg?tr=w-2048,c-at_max 2048w, https://ik.imagekit.io/demo/sample.jpg?tr=w-3840,c-at_max 3840w", - sizes: "100%", - width: nil - } - - assert_equal(expected, result.to_h) - end - - # Test to verify signed URLs work correctly in responsive image attributes - def test_should_generate_signed_urls_in_srcset - result = @client.helper.get_responsive_image_attributes( - { - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo", - device_breakpoints: [640, 1280], - image_breakpoints: [], - signed: true - } - ) - - expected = { - src: "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?tr=w-1280,c-at_max&ik-s=cce0258e8b27bee5d4b642bcee996c5fac11a907", - src_set: "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?tr=w-640,c-at_max&ik-s=d326eadc97c62b0896dc1bb872355a47c8b71943 640w, https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?tr=w-1280,c-at_max&ik-s=cce0258e8b27bee5d4b642bcee996c5fac11a907 1280w", - sizes: "100vw", - width: nil - } - - assert_equal(expected, result.to_h) - end -end diff --git a/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb b/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb deleted file mode 100644 index 2a2d8353..00000000 --- a/test/imagekitio/custom-tests/url-generation/advanced_url_generation_test.rb +++ /dev/null @@ -1,502 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" - -class AdvancedURLGenerationTest < Minitest::Test - def setup - @client = Imagekitio::Client.new( - private_key: "My Private API Key" - ) - end - - # AI Transformation Tests - def test_should_generate_the_correct_url_for_ai_background_removal_when_set_to_true - transformation = [ - Imagekitio::Models::Transformation.new( - ai_remove_background: true - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=e-bgremove" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_for_external_ai_background_removal_when_set_to_true - transformation = [ - Imagekitio::Models::Transformation.new( - ai_remove_background_external: true - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=e-removedotbg" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_when_ai_drop_shadow_transformation_is_set_to_true - transformation = [ - Imagekitio::Models::Transformation.new( - ai_drop_shadow: true - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=e-dropshadow" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_when_gradient_transformation_is_set_to_true - transformation = [ - Imagekitio::Models::Transformation.new( - gradient: true - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=e-gradient" - assert_equal(expected, url) - end - - def test_should_not_apply_ai_background_removal_when_value_is_not_true - transformation = [ - Imagekitio::Models::Transformation.new - # AIRemoveBackground: false, # This would be the case for false values - - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg" - assert_equal(expected, url) - end - - def test_should_not_apply_external_ai_background_removal_when_value_is_not_true - transformation = [ - Imagekitio::Models::Transformation.new - # AIRemoveBackgroundExternal: false, # This would be the case for false values - - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg" - assert_equal(expected, url) - end - - def test_should_handle_ai_transformations_with_parameters - transformation = [ - Imagekitio::Models::Transformation.new( - ai_drop_shadow: "custom-shadow-params" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=e-dropshadow-custom-shadow-params" - assert_equal(expected, url) - end - - def test_should_handle_gradient_with_parameters - transformation = [ - Imagekitio::Models::Transformation.new( - gradient: "ld-top_from-green_to-00FF0010_sp-1" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=e-gradient-ld-top_from-green_to-00FF0010_sp-1" - assert_equal(expected, url) - end - - def test_should_combine_ai_transformations_with_regular_transformations - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0, - height: 200.0, - ai_remove_background: true - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=w-300,h-200,e-bgremove" - assert_equal(expected, url) - end - - def test_should_handle_multiple_ai_transformations - transformation = [ - Imagekitio::Models::Transformation.new( - ai_remove_background: true, - ai_drop_shadow: true - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=e-bgremove,e-dropshadow" - assert_equal(expected, url) - end - - # Parameter-specific tests - def test_should_generate_the_correct_url_for_width_transformation_when_provided_with_a_number_value - transformation = [ - Imagekitio::Models::Transformation.new( - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=w-400" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_for_height_transformation_when_provided_with_a_string_value - transformation = [ - Imagekitio::Models::Transformation.new( - height: "300" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=h-300" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_for_aspect_ratio_transformation_when_provided_with_colon_format - transformation = [ - Imagekitio::Models::Transformation.new( - aspect_ratio: "4:3" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=ar-4:3" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_for_quality_transformation_when_provided_with_a_number_value - transformation = [ - Imagekitio::Models::Transformation.new( - quality: 80.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=q-80" - assert_equal(expected, url) - end - - # Additional parameter validation tests from Node.js SDK - def test_should_skip_transformation_parameters_that_are_undefined_or_empty - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0 - # Quality is not set - should be ignored - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=w-300" - assert_equal(expected, url) - end - - def test_should_handle_boolean_transformation_values - transformation = [ - Imagekitio::Models::Transformation.new( - trim: true - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=t-true" - assert_equal(expected, url) - end - - def test_should_handle_transformation_parameter_with_empty_string_value - transformation = [ - Imagekitio::Models::Transformation.new( - default_image: "" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg" - assert_equal(expected, url) - end - - def test_should_handle_complex_transformation_combinations - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0, - height: 200.0, - quality: 85.0, - border: "5_FF0000" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=w-300,h-200,q-85,b-5_FF0000" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_with_many_transformations_including_video_and_ai_transforms - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0, - aspect_ratio: "4-3", - quality: 40.0, - crop: :force, - crop_mode: :extract, - focus: "left", - format_: :jpeg, - radius: 50.0, - background: "A94D34", - border: "5-A94D34", - rotation: 90.0, - blur: 10.0, - named: "some_name", - progressive: true, - lossless: true, - trim: 5.0, - metadata: true, - color_profile: true, - default_image: "/folder/file.jpg/", - dpr: 3.0, - x: 10.0, - y_: 20.0, - x_center: 30.0, - y_center: 40.0, - flip: :h, - opacity: 0.8, - zoom: 2.0, - # Video transformations - video_codec: :h264, - audio_codec: :aac, - start_offset: 5.0, - end_offset: 15.0, - duration: 10.0, - streaming_resolutions: [:"1440", :"1080"], - # AI transformations - grayscale: true, - ai_upscale: true, - ai_retouch: true, - ai_variation: true, - ai_drop_shadow: true, - ai_change_background: "prompt-car", - ai_edit: "prompt-make it vintage", - ai_remove_background: true, - contrast_stretch: true, - shadow: "bl-15_st-40_x-10_y-N5", - sharpen: 10.0, - unsharp_mask: "2-2-0.8-0.024", - gradient: "from-red_to-white", - # New transformations - color_replace: "FF0000_50_0000FF", - distort: "p-100_50_200_150_300_250_400_350", - colorize: "co-FF0000_in-15", - original: true, - page: "2_4", - raw: "h-200,w-300,l-image,i-logo.png,l-end" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50,bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,x-10,y-20,xc-30,yc-40,fl-h,o-0.8,z-2,vc-h264,ac-aac,so-5,eo-15,du-10,sr-1440_1080,e-grayscale,e-upscale,e-retouch,e-genvar,e-dropshadow,e-changebg-prompt-car,e-edit-prompt-make it vintage,e-bgremove,e-contrast,e-shadow-bl-15_st-40_x-10_y-N5,e-sharpen-10,e-usm-2-2-0.8-0.024,e-gradient-from-red_to-white,cr-FF0000_50_0000FF,e-distort-p-100_50_200_150_300_250_400_350,e-colorize-co-FF0000_in-15,orig-true,pg-2_4,h-200,w-300,l-image,i-logo.png,l-end" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_for_radius_with_string_value - transformation = [ - Imagekitio::Models::Transformation.new( - radius: "10_20_30_40" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=r-10_20_30_40" - assert_equal(expected, url) - end - - # Hash-based API test - verify that plain hashes work for both transformations and options - # Developers can use hashes instead of model objects for a more concise, Ruby-idiomatic syntax - def test_should_work_with_plain_hashes_for_transformations_and_options - # Using plain hashes instead of Transformation.new and SrcOptions.new - url = @client.helper.build_url( - { - src: "/test_path1.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: [ - { - width: 300, - height: 200, - quality: 85, - border: "5_FF0000", - ai_remove_background: true, - ai_drop_shadow: true - } - ] - } - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path1.jpg?tr=w-300,h-200,q-85,b-5_FF0000,e-bgremove,e-dropshadow" - assert_equal(expected, url) - end -end diff --git a/test/imagekitio/custom-tests/url-generation/basic_url_generation_test.rb b/test/imagekitio/custom-tests/url-generation/basic_url_generation_test.rb deleted file mode 100644 index e414575e..00000000 --- a/test/imagekitio/custom-tests/url-generation/basic_url_generation_test.rb +++ /dev/null @@ -1,409 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" - -class BasicURLGenerationTest < Minitest::Test - def setup - @client = Imagekitio::Client.new( - private_key: "My Private API Key" - ) - end - - def test_should_return_an_empty_string_when_src_is_not_provided - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query - ) - ) - - assert_equal("", url) - end - - def test_should_generate_a_valid_url_when_src_is_slash - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint" - assert_equal(expected, url) - end - - def test_should_generate_a_valid_url_when_src_is_provided_with_transformation - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg" - assert_equal(expected, url) - end - - def test_should_generate_a_valid_url_when_a_src_is_provided_without_transformation - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg" - assert_equal(expected, url) - end - - def test_should_generate_a_valid_url_when_undefined_transformation_parameters_are_provided_with_path - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path_alt.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg" - assert_equal(expected, url) - end - - def test_by_default_transformation_position_should_be_query - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ), - Imagekitio::Models::Transformation.new( - rotation: 90.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400:rt-90" - assert_equal(expected, url) - end - - def test_should_generate_the_url_without_sdk_version - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation: transformation, - transformation_position: :path - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:h-300,w-400/test_path.jpg" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_with_a_valid_src_and_transformation - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_add_transformation_as_query_when_src_has_absolute_url_even_if_transformation_position_is_path - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "https://my.custom.domain.com/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://my.custom.domain.com/test_path.jpg?tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_generate_correct_url_when_src_has_query_params - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "https://ik.imagekit.io/imagekit_id/new-endpoint/test_path.jpg?t1=v1", - url_endpoint: "https://ik.imagekit.io/imagekit_id/new-endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/imagekit_id/new-endpoint/test_path.jpg?t1=v1&tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_when_the_provided_path_contains_multiple_leading_slashes - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "///test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_when_the_url_endpoint_is_overridden - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint_alt", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint_alt/test_path.jpg?tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_with_transformation_position_as_query_parameter_when_src_is_provided - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_with_a_valid_src_parameter_and_transformation - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg?tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_merge_query_parameters_correctly_in_the_generated_url - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ) - ] - - query_parameters = { - t2: "v2", - t3: "v3" - } - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg?t1=v1", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - query_parameters: query_parameters, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg?t1=v1&t2=v2&t3=v3&tr=h-300,w-400" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_with_chained_transformations - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ), - Imagekitio::Models::Transformation.new( - rotation: 90.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400:rt-90" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_with_chained_transformations_including_raw_transformation - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0 - ), - Imagekitio::Models::Transformation.new( - raw: "rndm_trnsf-abcd" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400:rndm_trnsf-abcd" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_when_border_transformation_is_applied - transformation = [ - Imagekitio::Models::Transformation.new( - height: 300.0, - width: 400.0, - border: "20_FF0000" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg?tr=h-300,w-400,b-20_FF0000" - assert_equal(expected, url) - end - - def test_should_generate_the_correct_url_when_transformation_has_empty_key_and_value - transformation = [ - Imagekitio::Models::Transformation.new( - raw: "" - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/test_path.jpg" - assert_equal(expected, url) - end - - def test_should_generate_a_valid_url_when_cname_is_used - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://custom.domain.com", - transformation_position: :query - ) - ) - - expected = "https://custom.domain.com/test_path.jpg" - assert_equal(expected, url) - end - - def test_should_generate_a_valid_url_when_cname_with_path_is_used - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/test_path.jpg", - url_endpoint: "https://custom.domain.com/url-pattern", - transformation_position: :query - ) - ) - - expected = "https://custom.domain.com/url-pattern/test_path.jpg" - assert_equal(expected, url) - end -end diff --git a/test/imagekitio/custom-tests/url-generation/build_transformation_string_test.rb b/test/imagekitio/custom-tests/url-generation/build_transformation_string_test.rb deleted file mode 100644 index d4726b4c..00000000 --- a/test/imagekitio/custom-tests/url-generation/build_transformation_string_test.rb +++ /dev/null @@ -1,132 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" - -class BuildTransformationStringTest < Minitest::Test - def setup - @client = Imagekitio::Client.new( - private_key: "test-key" - ) - end - - def test_should_return_empty_string_for_empty_transformation_array - result = @client.helper.build_transformation_string(nil) - assert_equal("", result) - - result = @client.helper.build_transformation_string([]) - assert_equal("", result) - end - - def test_should_generate_transformation_string_for_width_only - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0 - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "w-300" - assert_equal(expected, result) - end - - def test_should_generate_transformation_string_for_multiple_parameters - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0, - height: 200.0 - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "w-300,h-200" - assert_equal(expected, result) - end - - def test_should_generate_transformation_string_for_chained_transformations - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0 - ), - Imagekitio::Models::Transformation.new( - height: 200.0 - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "w-300:h-200" - assert_equal(expected, result) - end - - def test_should_handle_empty_transformation_object - transformation = [ - Imagekitio::Models::Transformation.new - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "" - assert_equal(expected, result) - end - - def test_should_handle_transformation_with_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "Hello" - ) - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "l-text,i-Hello,l-end" - assert_equal(expected, result) - end - - def test_should_handle_raw_transformation_parameter - transformation = [ - Imagekitio::Models::Transformation.new( - raw: "custom-transform-123" - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "custom-transform-123" - assert_equal(expected, result) - end - - def test_should_handle_mixed_parameters_with_raw - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0, - raw: "custom-param-123" - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "w-300,custom-param-123" - assert_equal(expected, result) - end - - def test_should_handle_quality_parameter - transformation = [ - Imagekitio::Models::Transformation.new( - quality: 80.0 - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "q-80" - assert_equal(expected, result) - end - - def test_should_handle_aspect_ratio_parameter - transformation = [ - Imagekitio::Models::Transformation.new( - aspect_ratio: "4:3" - ) - ] - - result = @client.helper.build_transformation_string(transformation) - expected = "ar-4:3" - assert_equal(expected, result) - end -end diff --git a/test/imagekitio/custom-tests/url-generation/overlay_test.rb b/test/imagekitio/custom-tests/url-generation/overlay_test.rb deleted file mode 100644 index 4afd7e70..00000000 --- a/test/imagekitio/custom-tests/url-generation/overlay_test.rb +++ /dev/null @@ -1,887 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" - -class OverlayTest < Minitest::Test - def setup - @client = Imagekitio::Client.new( - private_key: "My Private API Key" - ) - end - - # Basic overlay tests - def test_should_ignore_overlay_when_type_property_is_missing - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0 - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:w-300/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_ignore_text_overlay_when_text_property_is_missing - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_ignore_image_overlay_when_input_property_is_missing - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_ignore_video_overlay_when_input_property_is_missing - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::VideoOverlay.new( - input: "" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_ignore_subtitle_overlay_when_input_property_is_missing - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SubtitleOverlay.new( - input: "" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_ignore_solid_color_overlay_when_color_property_is_missing - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SolidColorOverlay.new( - color: "" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/base-image.jpg" - assert_equal(expected, url) - end - - # Basic overlay functionality tests - def test_should_generate_url_with_text_overlay_using_url_encoding - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "Minimal Text" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Minimal%20Text,l-end/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_generate_url_with_image_overlay_from_input_file - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "logo.png" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-logo.png,l-end/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_generate_url_with_video_overlay_from_input_file - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::VideoOverlay.new( - input: "play-pause-loop.mp4" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-video.mp4", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-video,i-play-pause-loop.mp4,l-end/base-video.mp4" - assert_equal(expected, url) - end - - def test_should_generate_url_with_subtitle_overlay_from_input_file - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SubtitleOverlay.new( - input: "subtitle.srt" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-video.mp4", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-subtitles,i-subtitle.srt,l-end/base-video.mp4" - assert_equal(expected, url) - end - - def test_should_generate_url_with_solid_color_overlay_using_background_color - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SolidColorOverlay.new( - color: "FF0000" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-ik_canvas,bg-FF0000,l-end/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_generate_url_with_multiple_complex_overlays_including_nested_transformations - transformation = [ - # Text overlay - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "Every thing", - position: Imagekitio::Models::OverlayPosition.new( - x: "10", - y_: "20", - focus: :center - ), - timing: Imagekitio::Models::OverlayTiming.new( - start: 5.0, - duration: "10", - end_: 15.0 - ), - transformation: [ - Imagekitio::Models::TextOverlayTransformation.new( - width: "bw_mul_0.5", - font_size: 20.0, - font_family: "Arial", - font_color: "0000ff", - inner_alignment: :left, - padding: 5.0, - alpha: 7.0, - typography: "b", - background: "red", - radius: 10.0, - rotation: "N45", - flip: :h, - line_height: 20.0 - ) - ] - ) - ), - # Image overlay - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "logo.png", - position: Imagekitio::Models::OverlayPosition.new( - x: "10", - y_: "20", - focus: :center - ), - timing: Imagekitio::Models::OverlayTiming.new( - start: 5.0, - duration: "10", - end_: 15.0 - ), - transformation: [ - Imagekitio::Models::Transformation.new( - width: "bw_mul_0.5", - height: "bh_mul_0.5", - rotation: "N45", - flip: :h, - overlay: Imagekitio::Models::TextOverlay.new( - text: "Nested text overlay" - ) - ) - ] - ) - ), - # Video overlay - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::VideoOverlay.new( - input: "play-pause-loop.mp4", - position: Imagekitio::Models::OverlayPosition.new( - x: "10", - y_: "20", - focus: :center - ), - timing: Imagekitio::Models::OverlayTiming.new( - start: 5.0, - duration: "10", - end_: 15.0 - ), - transformation: [ - Imagekitio::Models::Transformation.new( - width: "bw_mul_0.5", - height: "bh_mul_0.5", - rotation: "N45", - flip: :h - ) - ] - ) - ), - # Subtitle overlay - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SubtitleOverlay.new( - input: "subtitle.srt", - position: Imagekitio::Models::OverlayPosition.new( - x: "10", - y_: "20", - focus: :center - ), - timing: Imagekitio::Models::OverlayTiming.new( - start: 5.0, - duration: "10", - end_: 15.0 - ), - transformation: [ - Imagekitio::Models::SubtitleOverlayTransformation.new( - background: "red", - color: "0000ff", - font_family: "Arial", - font_outline: "2_A1CCDD50", - font_shadow: "A1CCDD_3" - ) - ] - ) - ), - # Solid color overlay - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SolidColorOverlay.new( - color: "FF0000", - position: Imagekitio::Models::OverlayPosition.new( - x: "10", - y_: "20", - focus: :center - ), - timing: Imagekitio::Models::OverlayTiming.new( - start: 5.0, - duration: "10", - end_: 15.0 - ), - transformation: [ - Imagekitio::Models::SolidColorOverlayTransformation.new( - width: "bw_mul_0.5", - height: "bh_mul_0.5", - alpha: 0.5, - background: "red", - gradient: true, - radius: :max - ) - ] - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-text,i-Every%20thing,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,fs-20,ff-Arial,co-0000ff,ia-left,pa-5,al-7,tg-b,bg-red,r-10,rt-N45,fl-h,lh-20,l-end:l-image,i-logo.png,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-text,i-Nested%20text%20overlay,l-end,l-end:l-video,i-play-pause-loop.mp4,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,rt-N45,fl-h,l-end:l-subtitles,i-subtitle.srt,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,bg-red,co-0000ff,ff-Arial,fol-2_A1CCDD50,fsh-A1CCDD_3,l-end:l-image,i-ik_canvas,bg-FF0000,lx-10,ly-20,lfo-center,lso-5,leo-15,ldu-10,w-bw_mul_0.5,h-bh_mul_0.5,al-0.5,bg-red,e-gradient,r-max,l-end/base-image.jpg" - assert_equal(expected, url) - end - - # Overlay encoding tests - def test_should_use_plain_encoding_for_simple_image_paths_with_slashes_converted_to_double_at - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "/customer_logo/nykaa.png" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/medium_cafe_B1iTdD0C.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-image,i-customer_logo@@nykaa.png,l-end/medium_cafe_B1iTdD0C.jpg" - assert_equal(expected, url) - end - - def test_should_use_base64_encoding_for_image_paths_containing_special_characters - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "/customer_logo/Ñykaa.png" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/medium_cafe_B1iTdD0C.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-image,ie-Y3VzdG9tZXJfbG9nby%2FDkXlrYWEucG5n,l-end/medium_cafe_B1iTdD0C.jpg" - assert_equal(expected, url) - end - - def test_should_use_plain_encoding_for_simple_text_overlays - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "Manu" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/medium_cafe_B1iTdD0C.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-text,i-Manu,l-end/medium_cafe_B1iTdD0C.jpg" - assert_equal(expected, url) - end - - def test_should_convert_slashes_to_double_at_in_font_family_paths_for_custom_fonts - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "Manu", - transformation: [ - Imagekitio::Models::TextOverlayTransformation.new( - font_family: "nested-path/Poppins-Regular_Q15GrYWmL.ttf" - ) - ] - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/medium_cafe_B1iTdD0C.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-text,i-Manu,ff-nested-path@@Poppins-Regular_Q15GrYWmL.ttf,l-end/medium_cafe_B1iTdD0C.jpg" - assert_equal(expected, url) - end - - def test_should_use_url_encoding_for_text_overlays_with_spaces_and_safe_characters - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "alnum123-._ " - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/medium_cafe_B1iTdD0C.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-text,i-alnum123-._%20,l-end/medium_cafe_B1iTdD0C.jpg" - assert_equal(expected, url) - end - - def test_should_use_base64_encoding_for_text_overlays_with_special_unicode_characters - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "Let's use ©, ®, ™, etc" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/medium_cafe_B1iTdD0C.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-text,ie-TGV0J3MgdXNlIMKpLCDCriwg4oSiLCBldGM%3D,l-end/medium_cafe_B1iTdD0C.jpg" - assert_equal(expected, url) - end - - def test_should_use_plain_encoding_when_explicitly_specified_for_text_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "HelloWorld", - encoding: :plain - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-text,i-HelloWorld,l-end/sample.jpg" - assert_equal(expected, url) - end - - def test_should_use_base64_encoding_when_explicitly_specified_for_text_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "HelloWorld", - encoding: :base64 - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-text,ie-SGVsbG9Xb3JsZA%3D%3D,l-end/sample.jpg" - assert_equal(expected, url) - end - - def test_should_use_plain_encoding_when_explicitly_specified_for_image_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "/customer/logo.png", - encoding: :plain - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-image,i-customer@@logo.png,l-end/sample.jpg" - assert_equal(expected, url) - end - - def test_should_use_base64_encoding_when_explicitly_specified_for_image_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "/customer/logo.png", - encoding: :base64 - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-image,ie-Y3VzdG9tZXIvbG9nby5wbmc%3D,l-end/sample.jpg" - assert_equal(expected, url) - end - - def test_should_use_base64_encoding_when_explicitly_specified_for_video_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::VideoOverlay.new( - input: "/path/to/video.mp4", - encoding: :base64 - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.mp4", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-video,ie-cGF0aC90by92aWRlby5tcDQ%3D,l-end/sample.mp4" - assert_equal(expected, url) - end - - def test_should_use_plain_encoding_when_explicitly_specified_for_subtitle_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SubtitleOverlay.new( - input: "/sub.srt", - encoding: :plain - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.mp4", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-subtitles,i-sub.srt,l-end/sample.mp4" - assert_equal(expected, url) - end - - def test_should_use_base64_encoding_when_explicitly_specified_for_subtitle_overlay - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::SubtitleOverlay.new( - input: "sub.srt", - encoding: :base64 - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.mp4", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-subtitles,ie-c3ViLnNydA%3D%3D,l-end/sample.mp4" - assert_equal(expected, url) - end - - def test_should_properly_encode_overlay_text_when_transformations_are_in_query_parameters - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "Minimal Text" - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/sample.jpg", - url_endpoint: "https://ik.imagekit.io/demo", - transformation_position: :query, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/demo/sample.jpg?tr=l-text,i-Minimal%20Text,l-end" - assert_equal(expected, url) - end - - # Layer mode tests - def test_should_generate_url_with_image_overlay_and_multiply_layer_mode - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "overlay.png", - layer_mode: :multiply - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-overlay.png,lm-multiply,l-end/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_generate_url_with_image_overlay_and_displace_layer_mode - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "displacement-map.png", - layer_mode: :displace, - position: Imagekitio::Models::OverlayPosition.new( - x: "10", - y_: "20" - ) - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-displacement-map.png,lm-displace,lx-10,ly-20,l-end/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_generate_url_with_image_overlay_and_cutout_layer_mode - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "mask.png", - layer_mode: :cutout - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-mask.png,lm-cutout,l-end/base-image.jpg" - assert_equal(expected, url) - end - - def test_should_generate_url_with_image_overlay_and_cutter_layer_mode - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::ImageOverlay.new( - input: "shape.png", - layer_mode: :cutter - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: transformation - ) - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-shape.png,lm-cutter,l-end/base-image.jpg" - assert_equal(expected, url) - end - - # Hash-based API test - verify that plain hashes work for overlays - def test_should_work_with_plain_hashes_for_text_overlay - # Using plain hashes for everything including overlay - url = @client.helper.build_url( - { - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: [ - { - width: 300, - height: 200, - overlay: { - type: :text, - text: "Hello World", - position: { - x: "10", - y_: "20", - focus: :center - }, - transformation: [ - { - font_size: 20, - font_color: "FF0000" - } - ] - } - } - ] - } - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:w-300,h-200,l-text,i-Hello%20World,lx-10,ly-20,lfo-center,fs-20,co-FF0000,l-end/base-image.jpg" - assert_equal(expected, url) - end - - # Test for x_center, y_center, and anchor_point - def test_should_generate_url_with_overlay_using_xcenter_ycenter_and_anchorpoint - # Using hash format to avoid type conversion issues with arithmetic expressions - url = @client.helper.build_url( - { - src: "/base-image.jpg", - url_endpoint: "https://ik.imagekit.io/test_url_endpoint", - transformation_position: :path, - transformation: [ - { - overlay: { - type: :image, - input: "logo.png", - position: { - x_center: "bw_mul_0.5", - y_center: "bh_mul_0.5", - anchor_point: :top_left - } - } - } - ] - } - ) - - expected = "https://ik.imagekit.io/test_url_endpoint/tr:l-image,i-logo.png,lxc-bw_mul_0.5,lyc-bh_mul_0.5,lap-top_left,l-end/base-image.jpg" - assert_equal(expected, url) - end -end diff --git a/test/imagekitio/custom-tests/url-generation/signing_test.rb b/test/imagekitio/custom-tests/url-generation/signing_test.rb deleted file mode 100644 index 70c4863a..00000000 --- a/test/imagekitio/custom-tests/url-generation/signing_test.rb +++ /dev/null @@ -1,235 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" - -class SigningTest < Minitest::Test - def setup - @client = Imagekitio::Client.new( - private_key: "dummy-key" - ) - end - - def test_should_generate_a_signed_url_when_signed_is_true_without_expires_in - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - signed: true - ) - ) - - expected = "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?ik-s=32dbbbfc5f945c0403c71b54c38e76896ef2d6b0" - assert_equal(expected, url) - end - - def test_should_generate_a_signed_url_when_signed_is_true_with_expires_in - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - signed: true, - expires_in: 3600.0 - ) - ) - - # Expect ik-t exist in the URL. We don't assert signature because it will keep changing. - assert_includes(url, "ik-t") - end - - def test_should_generate_a_signed_url_when_expires_in_is_above_0_and_even_if_signed_is_false - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - signed: false, - expires_in: 3600.0 - ) - ) - - # Expect ik-t exist in the URL. We don't assert signature because it will keep changing. - assert_includes(url, "ik-t") - end - - def test_should_generate_signed_url_with_special_characters_in_filename - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/हिन्दी.png", - url_endpoint: "https://ik.imagekit.io/demo/", - signed: true - ) - ) - - expected = "https://ik.imagekit.io/demo/sdk-testing-files/%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80.png?ik-s=3fff2f31da1f45e007adcdbe95f88c8c330e743c" - assert_equal(expected, url) - end - - def test_should_generate_signed_url_with_text_overlay_containing_special_characters - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "हिन्दी", - transformation: [ - Imagekitio::Models::TextOverlayTransformation.new( - font_color: "red", - font_size: "32", - font_family: "sdk-testing-files/Poppins-Regular_Q15GrYWmL.ttf" - ) - ] - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/हिन्दी.png", - url_endpoint: "https://ik.imagekit.io/demo/", - transformation: transformation, - signed: true - ) - ) - - expected = "https://ik.imagekit.io/demo/sdk-testing-files/%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80.png?tr=l-text,ie-4KS54KS%2F4KSo4KWN4KSm4KWA,co-red,fs-32,ff-sdk-testing-files@@Poppins-Regular_Q15GrYWmL.ttf,l-end&ik-s=ac9f24a03080102555e492185533c1ae6bd93fa7" - assert_equal(expected, url) - end - - def test_should_generate_signed_url_with_text_overlay_and_special_characters_using_path_transformation_position - transformation = [ - Imagekitio::Models::Transformation.new( - overlay: Imagekitio::Models::TextOverlay.new( - text: "हिन्दी", - transformation: [ - Imagekitio::Models::TextOverlayTransformation.new( - font_color: "red", - font_size: "32", - font_family: "sdk-testing-files/Poppins-Regular_Q15GrYWmL.ttf" - ) - ] - ) - ) - ] - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/हिन्दी.png", - url_endpoint: "https://ik.imagekit.io/demo/", - transformation_position: :path, - transformation: transformation, - signed: true - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:l-text,ie-4KS54KS%2F4KSo4KWN4KSm4KWA,co-red,fs-32,ff-sdk-testing-files@@Poppins-Regular_Q15GrYWmL.ttf,l-end/sdk-testing-files/%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80.png?ik-s=69f2ecbb7364bbbad24616e1f7f1bac5a560fc71" - assert_equal(expected, url) - end - - def test_should_generate_signed_url_with_query_parameters - query_params = { - "version" => "1.0", - "cache" => "false" - } - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - query_parameters: query_params, - signed: true - ) - ) - - expected = "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?version=1.0&cache=false&ik-s=f2e5a1b8b6a0b03fd63789dfc6413a94acef9fd8" - assert_equal(expected, url) - end - - def test_should_generate_signed_url_with_transformations_and_query_parameters - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0, - height: 200.0 - ) - ] - - query_params = { - "version" => "2.0" - } - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - transformation: transformation, - query_parameters: query_params, - signed: true - ) - ) - - expected = "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?version=2.0&tr=w-300,h-200&ik-s=601d97a7834b7554f4dabf0d3fc3a219ceeb6b31" - assert_equal(expected, url) - end - - def test_should_not_sign_url_when_signed_is_false - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - signed: false - ) - ) - - expected = "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png" - assert_equal(expected, url) - refute_includes(url, "ik-s=") - refute_includes(url, "ik-t=") - end - - def test_should_generate_signed_url_with_transformations_in_path_position_and_query_parameters - transformation = [ - Imagekitio::Models::Transformation.new( - width: 300.0, - height: 200.0 - ) - ] - - query_params = { - "version" => "2.0" - } - - url = @client.helper.build_url( - Imagekitio::Models::SrcOptions.new( - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - transformation: transformation, - transformation_position: :path, - query_parameters: query_params, - signed: true - ) - ) - - expected = "https://ik.imagekit.io/demo/tr:w-300,h-200/sdk-testing-files/future-search.png?version=2.0&ik-s=dd1ee8f83d019bc59fd57a5fc4674a11eb8a3496" - assert_equal(expected, url) - end - - # Hash-based API test - verify that plain hashes work for signed URLs - def test_should_work_with_plain_hashes_for_signed_url_with_transformations - # Using plain hashes instead of model objects - url = @client.helper.build_url( - { - src: "sdk-testing-files/future-search.png", - url_endpoint: "https://ik.imagekit.io/demo/", - transformation: [ - { - width: 300, - height: 200 - } - ], - query_parameters: { - "version" => "2.0" - }, - signed: true - } - ) - - expected = "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?version=2.0&tr=w-300,h-200&ik-s=601d97a7834b7554f4dabf0d3fc3a219ceeb6b31" - assert_equal(expected, url) - end -end diff --git a/test/imagekitio/resources/accounts/origins_test.rb b/test/imagekitio/resources/accounts/origins_test.rb index c71ca2c8..e8fbd73b 100644 --- a/test/imagekitio/resources/accounts/origins_test.rb +++ b/test/imagekitio/resources/accounts/origins_test.rb @@ -43,8 +43,7 @@ def test_create_required_params include_canonical_header: Imagekitio::Internal::Type::Boolean, name: String, prefix: String, - base_url_for_canonical_header: String | nil, - use_iam_role: Imagekitio::Internal::Type::Boolean | nil + base_url_for_canonical_header: String | nil } in { type: :S3_COMPATIBLE, @@ -64,8 +63,7 @@ def test_create_required_params include_canonical_header: Imagekitio::Internal::Type::Boolean, name: String, prefix: String, - base_url_for_canonical_header: String | nil, - use_iam_role: Imagekitio::Internal::Type::Boolean | nil + base_url_for_canonical_header: String | nil } in { type: :WEB_FOLDER, @@ -156,8 +154,7 @@ def test_update_required_params include_canonical_header: Imagekitio::Internal::Type::Boolean, name: String, prefix: String, - base_url_for_canonical_header: String | nil, - use_iam_role: Imagekitio::Internal::Type::Boolean | nil + base_url_for_canonical_header: String | nil } in { type: :S3_COMPATIBLE, @@ -177,8 +174,7 @@ def test_update_required_params include_canonical_header: Imagekitio::Internal::Type::Boolean, name: String, prefix: String, - base_url_for_canonical_header: String | nil, - use_iam_role: Imagekitio::Internal::Type::Boolean | nil + base_url_for_canonical_header: String | nil } in { type: :WEB_FOLDER, @@ -279,8 +275,7 @@ def test_get include_canonical_header: Imagekitio::Internal::Type::Boolean, name: String, prefix: String, - base_url_for_canonical_header: String | nil, - use_iam_role: Imagekitio::Internal::Type::Boolean | nil + base_url_for_canonical_header: String | nil } in { type: :S3_COMPATIBLE, @@ -300,8 +295,7 @@ def test_get include_canonical_header: Imagekitio::Internal::Type::Boolean, name: String, prefix: String, - base_url_for_canonical_header: String | nil, - use_iam_role: Imagekitio::Internal::Type::Boolean | nil + base_url_for_canonical_header: String | nil } in { type: :WEB_FOLDER, diff --git a/test/imagekitio/resources/accounts/usage_analytics_test.rb b/test/imagekitio/resources/accounts/usage_analytics_test.rb deleted file mode 100644 index 6f47556c..00000000 --- a/test/imagekitio/resources/accounts/usage_analytics_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require_relative "../../test_helper" - -class Imagekitio::Test::Resources::Accounts::UsageAnalyticsTest < Imagekitio::Test::ResourceTest - def test_get_required_params - skip("Mock server tests are disabled") - - response = @image_kit.accounts.usage_analytics.get(end_date: "2019-12-27", start_date: "2019-12-27") - - assert_pattern do - response => Imagekitio::Accounts::UsageAnalyticsResponse - end - - assert_pattern do - response => { - bandwidth_bytes: Float, - browser: Imagekitio::Accounts::UsageAnalyticsResponse::Browser, - cache: Imagekitio::Accounts::UsageAnalyticsResponse::Cache, - country: Imagekitio::Accounts::UsageAnalyticsResponse::Country, - device: Imagekitio::Accounts::UsageAnalyticsResponse::Device, - end_date: Date, - error_reasons: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::ErrorReason]), - extensions: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Extension]), - format_: Imagekitio::Accounts::UsageAnalyticsResponse::Format, - generated_at: Time, - request_count: Float, - start_date: Date, - status_codes: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::StatusCode]), - top404_assets: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::Top404Asset]), - top_images: Imagekitio::Accounts::UsageAnalyticsResponse::TopImages, - top_image_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopImageTransforms, - top_other_assets: Imagekitio::Accounts::UsageAnalyticsResponse::TopOtherAssets, - top_referrers: Imagekitio::Accounts::UsageAnalyticsResponse::TopReferrers, - top_user_agents: Imagekitio::Accounts::UsageAnalyticsResponse::TopUserAgents, - top_videos: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideos, - top_video_transforms: Imagekitio::Accounts::UsageAnalyticsResponse::TopVideoTransforms, - url_endpoints: Imagekitio::Accounts::UsageAnalyticsResponse::URLEndpoints, - video_processing: ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::Accounts::UsageAnalyticsResponse::VideoProcessing]) - } - end - end -end diff --git a/test/imagekitio/resources/custom_metadata_fields_test.rb b/test/imagekitio/resources/custom_metadata_fields_test.rb index b0023832..1d455ad6 100644 --- a/test/imagekitio/resources/custom_metadata_fields_test.rb +++ b/test/imagekitio/resources/custom_metadata_fields_test.rb @@ -18,8 +18,7 @@ def test_create_required_params id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema, - description: String | nil + schema: Imagekitio::CustomMetadataField::Schema } end end @@ -38,8 +37,7 @@ def test_update id: String, label: String, name: String, - schema: Imagekitio::CustomMetadataField::Schema, - description: String | nil + schema: Imagekitio::CustomMetadataField::Schema } end end diff --git a/test/imagekitio/resources/named_transformations_test.rb b/test/imagekitio/resources/named_transformations_test.rb deleted file mode 100644 index 0028f334..00000000 --- a/test/imagekitio/resources/named_transformations_test.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true - -require_relative "../test_helper" - -class Imagekitio::Test::Resources::NamedTransformationsTest < Imagekitio::Test::ResourceTest - def test_create_required_params - skip("Mock server tests are disabled") - - response = - @image_kit.named_transformations.create( - name: "small_thumbnail", - transformation: "w-150,h-150,fo-center,cm-pad_resize" - ) - - assert_pattern do - response => Imagekitio::NamedTransformation - end - - assert_pattern do - response => { - id: String, - created_at: Time, - enabled: Imagekitio::Internal::Type::Boolean, - name: String, - transformation: String - } - end - end - - def test_update - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.update("6bZ9x2ZUx") - - assert_pattern do - response => Imagekitio::NamedTransformation - end - - assert_pattern do - response => { - id: String, - created_at: Time, - enabled: Imagekitio::Internal::Type::Boolean, - name: String, - transformation: String - } - end - end - - def test_list - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.list - - assert_pattern do - response => ^(Imagekitio::Internal::Type::ArrayOf[Imagekitio::NamedTransformation]) - end - end - - def test_delete - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.delete("6bZ9x2ZUx") - - assert_pattern do - response => nil - end - end - - def test_get - skip("Mock server tests are disabled") - - response = @image_kit.named_transformations.get("6bZ9x2ZUx") - - assert_pattern do - response => Imagekitio::NamedTransformation - end - - assert_pattern do - response => { - id: String, - created_at: Time, - enabled: Imagekitio::Internal::Type::Boolean, - name: String, - transformation: String - } - end - end -end