diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 9ba0ad9..0000000 --- a/.coveragerc +++ /dev/null @@ -1,6 +0,0 @@ -[run] -omit = - */site-packages/* - */distutils/* - tests/* - .tox/* diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..ff261ba --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +ARG VARIANT="3.9" +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} + +USER vscode + +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash +ENV PATH=/home/vscode/.rye/shims:$PATH + +RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c17fdc1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,43 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/debian +{ + "name": "Debian", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + + "postStartCommand": "rye sync --all-features", + + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "python.pythonPath": ".venv/bin/python", + "python.defaultInterpreterPath": ".venv/bin/python", + "python.typeChecking": "basic", + "terminal.integrated.env.linux": { + "PATH": "/home/vscode/.rye/shims:${env:PATH}" + } + } + } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": {} + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index d265f23..0000000 --- a/.editorconfig +++ /dev/null @@ -1,17 +0,0 @@ -; https://editorconfig.org/ - -root = true - -[*] -indent_style = space -indent_size = 4 -insert_final_newline = true -trim_trailing_whitespace = true -end_of_line = lf -charset = utf-8 - -[*.{cfg, ini, json, toml, yml}] -indent_size = 2 - -[Makefile] -indent_style = tab diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7658728 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,98 @@ +name: CI +on: + push: + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' + +jobs: + lint: + timeout-minutes: 10 + name: lint + runs-on: ${{ github.repository == 'stainless-sdks/imagekit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Install dependencies + run: rye sync --all-features + + - name: Run lints + run: ./scripts/lint + + build: + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + timeout-minutes: 10 + name: build + permissions: + contents: read + id-token: write + runs-on: ${{ github.repository == 'stainless-sdks/imagekit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Install dependencies + run: rye sync --all-features + + - name: Run build + run: rye build + + - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/imagekit-python' + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + if: github.repository == 'stainless-sdks/imagekit-python' + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh + + test: + timeout-minutes: 10 + name: test + runs-on: ${{ github.repository == 'stainless-sdks/imagekit-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Run tests + run: ./scripts/test diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 0000000..08adafc --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,31 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to PyPI in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/imagekit-developer/imagekit-python/actions/workflows/publish-pypi.yml +name: Publish PyPI +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Publish to PyPI + run: | + bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.IMAGE_KIT_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index ce37efd..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Upload Python Package - -on: - release: - types: [published] - -jobs: - deploy: - runs-on: ubuntu-20.04 - strategy: - matrix: - python: [3.7, 3.8, 3.9, '3.10'] - steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python }} - - name: Install Tox and any other packages - run: | - python -m pip install --upgrade pip - pip install -r requirements/test.txt - - name: Run Tox - run: tox -e py - - name: Install build dependencies - run: | - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 0000000..c36a89d --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,21 @@ +name: Release Doctor +on: + pull_request: + branches: + - master + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'imagekit-developer/imagekit-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.IMAGE_KIT_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 17ce471..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Python CI - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-20.04 - strategy: - matrix: - python: [3.7, 3.8, 3.9, '3.10'] - steps: - - uses: actions/checkout@v1 - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python }} - - name: Install Tox and any other packages - run: pip install -r requirements/test.txt - - name: Run Tox - run: tox -e py - - name: Upload Coverage to codecov - run: bash <(curl -s https://codecov.io/bash) diff --git a/.gitignore b/.gitignore index 8992bc1..95ceb18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,58 +1,15 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class +.prism.log +_dev -# C extensions -*.so +__pycache__ +.mypy_cache -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -sample/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST +dist -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# pyenv -.python-version - -# Environments -.env .venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ +.idea -# Visual Studio Code -.vscode/ -htmlcov/ +.env +.envrc +codegen.log +Brewfile.lock.json diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..43077b2 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.9.18 diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..3d2ac0b --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml new file mode 100644 index 0000000..cfcbd7f --- /dev/null +++ b/.stats.yml @@ -0,0 +1,4 @@ +configured_endpoints: 42 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-667f7f4988b44bc587d6eb9960ff5c8326e9f7e9b072f3f724f9f54166eff8b1.yml +openapi_spec_hash: f2081864a4abee0480e5ff991b4c936a +config_hash: 70f9408b8d1dfbcf262a20d6eed50e1c diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5b01030 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.analysis.importFormat": "relative", +} diff --git a/Brewfile b/Brewfile new file mode 100644 index 0000000..492ca37 --- /dev/null +++ b/Brewfile @@ -0,0 +1,2 @@ +brew "rye" + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0d73a9d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,63 @@ +# Changelog + +## 0.1.0 (2025-09-03) + +Full Changelog: [v0.0.1...v0.1.0](https://github.com/imagekit-developer/imagekit-python/compare/v0.0.1...v0.1.0) + +### Features + +* add bulk delete options ([c1c4d32](https://github.com/imagekit-developer/imagekit-python/commit/c1c4d3206b06594ba77a8a1c4dab7d0c5b74de9a)) +* add file related functionalities ([681677b](https://github.com/imagekit-developer/imagekit-python/commit/681677bc60a207f433b4bc242c41e37f2d4c05a1)) +* add sdk version to url ([9c3e67d](https://github.com/imagekit-developer/imagekit-python/commit/9c3e67d20f78b799e974889420ead23f457b5cfa)) +* add url class for url genration ([5e615ed](https://github.com/imagekit-developer/imagekit-python/commit/5e615ed34386e3231c5c7963ff37ceb28ab7d2f1)) +* **api:** manual updates ([79f22e5](https://github.com/imagekit-developer/imagekit-python/commit/79f22e575f1e9644e34b388d16a7f25cd972eda2)) +* **api:** manual updates ([81882b7](https://github.com/imagekit-developer/imagekit-python/commit/81882b70cb70051bf102f360b5bfbfd284f3d1de)) +* **api:** manual updates ([b7f980c](https://github.com/imagekit-developer/imagekit-python/commit/b7f980c5a4532535e18e13d0d2333b572cfcae40)) +* **api:** manual updates ([1d0cd71](https://github.com/imagekit-developer/imagekit-python/commit/1d0cd717092f46c4024af867916c001be4e69edb)) +* **api:** manual updates ([cc31c09](https://github.com/imagekit-developer/imagekit-python/commit/cc31c0929c2c4c35b28214ce4ed40a0385054862)) +* **api:** manual updates ([23047c1](https://github.com/imagekit-developer/imagekit-python/commit/23047c1ce69a8f20c17dc41cb6679d1356b7d7a9)) +* **api:** manual updates ([e5c302f](https://github.com/imagekit-developer/imagekit-python/commit/e5c302ff99f0016a154731b806d9e48c4442b72b)) +* **api:** manual updates ([ef41522](https://github.com/imagekit-developer/imagekit-python/commit/ef4152255fdd6d8b8be2d9084f3cea6c43abf971)) +* implement client with all func. ([67dd4b2](https://github.com/imagekit-developer/imagekit-python/commit/67dd4b28822086009278e4ab3f85d52690e6e9b7)) +* implement get_remote_url_metadata ([1272740](https://github.com/imagekit-developer/imagekit-python/commit/12727400dc5bc6678f6769c5143c11962f58eea4)) +* **types:** replace List[str] with SequenceNotStr in params ([35f1e21](https://github.com/imagekit-developer/imagekit-python/commit/35f1e21860a391dc3a9434514e725b424cde5756)) + + +### Bug Fixes + +* binary file upload ([23c9c46](https://github.com/imagekit-developer/imagekit-python/commit/23c9c46f37a5b32144f86700227254e6f05bf491)) +* change ubuntu latest to ubuntu-20.04 in test.yml ([1e4b551](https://github.com/imagekit-developer/imagekit-python/commit/1e4b55192d08ebf1aa436fa56832322477605942)) +* Changes for CI/CD ([0bd2ac3](https://github.com/imagekit-developer/imagekit-python/commit/0bd2ac3e9b11e8269a2eacb2424d49ef58e37c5f)) +* fix issue [#35](https://github.com/imagekit-developer/imagekit-python/issues/35),[#37](https://github.com/imagekit-developer/imagekit-python/issues/37),[#41](https://github.com/imagekit-developer/imagekit-python/issues/41),[#44](https://github.com/imagekit-developer/imagekit-python/issues/44) ([1f913c8](https://github.com/imagekit-developer/imagekit-python/commit/1f913c8e34a06afbffa93adbbc79e8a174a02dac)) +* fix query params implementation ([2b7e6d4](https://github.com/imagekit-developer/imagekit-python/commit/2b7e6d4a148b6d94b52532846bd950d4eeeefac4)) +* make ik-attachment option handle True boolean value ([6eb9cd0](https://github.com/imagekit-developer/imagekit-python/commit/6eb9cd099021a1fd9bcc9dfeb080ec610d4bcfbd)) +* move the workflow to correct folder ([d9f933a](https://github.com/imagekit-developer/imagekit-python/commit/d9f933a8e78c61b8a61df1d74a28859f9e889378)) +* request toolbelt to 0.10.1 in requirements/test/txt ([c22ed89](https://github.com/imagekit-developer/imagekit-python/commit/c22ed89208f69f7d8fb21cc777049d72dad40093)) + + +### Chores + +* add func alias ([d7ce593](https://github.com/imagekit-developer/imagekit-python/commit/d7ce593318b24f33ba828b65042e16e892690b80)) +* add init file ([0cbbd27](https://github.com/imagekit-developer/imagekit-python/commit/0cbbd27f00ac3fe36d3fbc0bf6fa2b015308576c)) +* add publish github workflow script ([a275172](https://github.com/imagekit-developer/imagekit-python/commit/a275172c3e7096b7390665102bae4d95c718db9d)) +* add required constants ([48de1c0](https://github.com/imagekit-developer/imagekit-python/commit/48de1c02295fb42d522f8ee930c16ee763d7b93d)) +* add requirements files ([e8d3d9d](https://github.com/imagekit-developer/imagekit-python/commit/e8d3d9d60e946b036b3f8e37a9dbf1e68be5482d)) +* add sample file for devs ([65d1a3f](https://github.com/imagekit-developer/imagekit-python/commit/65d1a3f77eaa5a5c9dba5202a75dee3c70aa64a0)) +* add sample of get file metadata ([6d11584](https://github.com/imagekit-developer/imagekit-python/commit/6d115841c341df0f7a9d4d9bd0c33c1cf386d9c7)) +* change pacakge name & fix import ([2c1734a](https://github.com/imagekit-developer/imagekit-python/commit/2c1734a6e12c935bc80f72ec6b8cdd5a971e5a47)) +* fix package name ([c0c939d](https://github.com/imagekit-developer/imagekit-python/commit/c0c939d86fa5738855a0d6b606e33249ecd5a47a)) +* fix package name ([4bc8041](https://github.com/imagekit-developer/imagekit-python/commit/4bc8041e22c6333710645ddc95446c9c348eea5b)) +* fix sample ([2188038](https://github.com/imagekit-developer/imagekit-python/commit/2188038436aabfce68a3c1d7bb198ffda203dc72)) +* init ([febccef](https://github.com/imagekit-developer/imagekit-python/commit/febccef19d6ca6ae2b6c4272d44ae1625c9f3391)) +* remove unecessary workflow file ([97f19eb](https://github.com/imagekit-developer/imagekit-python/commit/97f19eb8284c5edfe164f98ad296ea1e69b21bf8)) +* sync repo ([c87cdf7](https://github.com/imagekit-developer/imagekit-python/commit/c87cdf7ccd3a490cc5dcc8b25e95044060d41d56)) +* unused import removed ([22774ff](https://github.com/imagekit-developer/imagekit-python/commit/22774fff1ac08c0573efc06ab10f3fe31e6d3f69)) +* update SDK settings ([15c93fb](https://github.com/imagekit-developer/imagekit-python/commit/15c93fb7cf181107901d9a2421dab95f1e7d091d)) +* update SDK settings ([f9c5565](https://github.com/imagekit-developer/imagekit-python/commit/f9c556528317e1d18c9ac077d8cb8650e41bc324)) + + +### Build System + +* add url and requirements ([211228e](https://github.com/imagekit-developer/imagekit-python/commit/211228ef91fe29b83507c89f3bf22cfb6b1c8184)) +* add url and requirements ([683ad01](https://github.com/imagekit-developer/imagekit-python/commit/683ad016099d4e4614b6f369bff69d9a7422029e)) +* add url and requirements ([#2](https://github.com/imagekit-developer/imagekit-python/issues/2)) ([211228e](https://github.com/imagekit-developer/imagekit-python/commit/211228ef91fe29b83507c89f3bf22cfb6b1c8184)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..cf4695d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,128 @@ +## Setting up the environment + +### With Rye + +We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run: + +```sh +$ ./scripts/bootstrap +``` + +Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run: + +```sh +$ rye sync --all-features +``` + +You can then run scripts using `rye run python script.py` or by activating the virtual environment: + +```sh +# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work +$ source .venv/bin/activate + +# now you can omit the `rye run` prefix +$ python script.py +``` + +### Without Rye + +Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command: + +```sh +$ pip install -r requirements-dev.lock +``` + +## Modifying/Adding code + +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may +result in merge conflicts between manual patches and changes from the generator. The generator will never +modify the contents of the `src/imagekit/lib/` and `examples/` directories. + +## Adding and running examples + +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. + +```py +# add an example to examples/.py + +#!/usr/bin/env -S rye run python +… +``` + +```sh +$ chmod +x examples/.py +# run the example against your api +$ ./examples/.py +``` + +## Using the repository from source + +If you’d like to use the repository from source, you can either install from git or link to a cloned repository: + +To install via git: + +```sh +$ pip install git+ssh://git@github.com/imagekit-developer/imagekit-python#master.git +``` + +Alternatively, you can build from source and install the wheel file: + +Building this package will create two files in the `dist/` directory, a `.tar.gz` containing the source files and a `.whl` that can be used to install the package efficiently. + +To create a distributable version of the library, all you have to do is run this command: + +```sh +$ rye build +# or +$ python -m build +``` + +Then to install: + +```sh +$ pip install ./path-to-wheel-file.whl +``` + +## Running tests + +Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. + +```sh +# you will need npm installed +$ npx prism mock path/to/your/openapi.yml +``` + +```sh +$ ./scripts/test +``` + +## Linting and formatting + +This repository uses [ruff](https://github.com/astral-sh/ruff) and +[black](https://github.com/psf/black) to format the code in the repository. + +To lint: + +```sh +$ ./scripts/lint +``` + +To format and fix all ruff issues automatically: + +```sh +$ ./scripts/format +``` + +## Publishing and releases + +Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If +the changes aren't made through the automated pipeline, you may want to make releases manually. + +### Publish with a GitHub workflow + +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/imagekit-developer/imagekit-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. + +### Publish manually + +If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on +the environment. diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md deleted file mode 100644 index 2f1ff7b..0000000 --- a/DEVELOPMENT.md +++ /dev/null @@ -1,22 +0,0 @@ -# Development Guide - -**1. Setup dependencies** - -```shell -pip install -r requirements/requirements.txt -``` - -**2. Run test cases** - -```shell -pip install -r requirements/test.txt -tox -e py -``` - -**3. Running the sample app** - -```shell -pip install -r sample/requirements.txt -cd sample -python sample.py -``` diff --git a/LICENSE b/LICENSE index ec2f41c..e7a4d16 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,201 @@ -MIT License - -Copyright (c) 2019 Imagekit - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2025 Image Kit + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 8e6acb5..19cc02b 100644 --- a/README.md +++ b/README.md @@ -1,1445 +1,448 @@ -[ImageKit.io](https://imagekit.io) +# Image Kit Python API library -# ImageKit.io Python SDK + +[![PyPI version](https://img.shields.io/pypi/v/imagekit.svg?label=pypi%20(stable))](https://pypi.org/project/imagekit/) -[![Python CI](https://github.com/imagekit-developer/imagekit-python/workflows/Python%20CI/badge.svg)](https://github.com/imagekit-developer/imagekit-python/) -[![imagekitio](https://img.shields.io/pypi/v/imagekitio.svg)](https://pypi.org/project/imagekitio) -[![codecov](https://codecov.io/gh/imagekit-developer/imagekit-python/branch/master/graph/badge.svg?token=CwKWqBIlCu)](https://codecov.io/gh/imagekit-developer/imagekit-python) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Twitter Follow](https://img.shields.io/twitter/follow/imagekitio?label=Follow&style=social)](https://twitter.com/ImagekitIo) +The Image Kit Python library provides convenient access to the Image Kit REST API from any Python 3.8+ +application. The library includes type definitions for all request params and response fields, +and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). -Python SDK for [ImageKit](https://imagekit.io/) implements the new APIs and interface for different file operations. +It is generated with [Stainless](https://www.stainless.com/). -ImageKit is complete media storage, optimization, and transformation solution that comes with an [image and video CDN](https://imagekit.io/features/imagekit-infrastructure). It can be integrated with your existing infrastructure - storage like AWS S3, web servers, your CDN, and custom domain names, allowing you to deliver optimized images in minutes with minimal code changes. +## Documentation -Supported Python Versions: >=3.6 - -Table of contents - - -- [Installation](#installation) -- [Initialization](#initialization) -- [Change Log](#change-log) -- [Usage](#usage) - - [URL Generation](#url-generation) - - [File Upload](#file-upload) - - [File Management](#file-management) - - [Utility Functions](#utility-functions) -- [Handling errors](#handling-errors) -- [Development](#development) - - [Tests](#tests) - - [Sample](#sample) -- [Support](#support) -- [Links](#links) +The REST API documentation can be found on [imagekit.io](https://imagekit.io/docs). The full API of this library can be found in [api.md](api.md). ## Installation -Go to your terminal and type the following command. - -```bash -pip install imagekitio -``` - -## Initialization - -```python -from imagekitio import ImageKit - -imagekit = ImageKit( - private_key='your_private_key', - public_key='your_public_key', - url_endpoint='your_url_endpoint' -) +```sh +# install from the production repo +pip install git+ssh://git@github.com/imagekit-developer/imagekit-python#master.git ``` -## Change log - -This document presents a list of changes that break the existing functionality of previous versions. We try to minimize these disruptions, but they are sometimes unavoidable, especially in significant updates. Therefore, versions are marked semantically and tagged as major upgrades whenever such breaking changes occur. - -### Breaking History: - -Changes from `3.2.0 -> 4.0.0` are listed below - -1. Overlay syntax update - -* In version 4.0.0, we've removed the old overlay syntax parameters for transformations, such as `oi`, `ot`, `obg`, and [more](https://docs.imagekit.io/features/image-transformations/overlay). These parameters are deprecated and will start returning errors when used in URLs. Please migrate to the new layers syntax that supports overlay nesting, provides better positional control, and allows more transformations at the layer level. You can start with [examples](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#examples) to learn quickly. -* You can migrate to the new layers syntax using the `raw` transformation parameter. - - -Changes from `2.2.8 -> 3.0.0` are listed below - -1. Throw an Error: - -**What changed** - -- Before the upgrade, an `error` dict was coming in the return object of any function call. Now, SDK throws an exception in case of an error. - -**Who is affected?** - -- This affects any development in your software that calls APIs from ImageKit IO and handles errors based on what's returned. - -**How should I update my code?** - -- To avoid failures in an application, you could handle errors as [documented here](#handling-errors) +> [!NOTE] +> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install imagekit` -# Usage +## Usage -You can use this Python SDK for three different kinds of methods: - -- [URL Generation](#url-generation) -- [File Upload](#file-upload) -- [File Management](#file-management) -- [Utility Functions](#utility-functions) - -## URL Generation - -**1. Using Image path and endpoint (hostname)** - -This method allows you to create a URL using the relative file path where the image exists and the URL -endpoint(url_endpoint) you want to use to access the image. You can refer to the documentation -[here](https://docs.imagekit.io/integration/url-endpoints) to read more about URL endpoints -in ImageKit and the section about [image origins](https://docs.imagekit.io/integration/configure-origin) to understand -about paths with different kinds of origins. - -The file can be an image, video, or any other static file supported by ImageKit. - -```python -imagekit_url = imagekit.url({ - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{ - "height": "300", - "width": "400", - "raw": "ar-4-3,q-40" - }], -}) -``` - -Sample Result URL - - -``` -https://ik.imagekit.io/your_imagekit_id/endpoint/tr:h-300,w-400,ar-4-3,q-40/default-image.jpg -``` - -**2. Using full image URL** - -This method allows you to add transformation parameters to an absolute URL using the `src` parameter. This method should be -used if you have the complete image URL stored in your database. +The full API of this library can be found in [api.md](api.md). ```python -image_url = imagekit.url({ - "src": "https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg", - "transformation": [{ - "height": "300", - "width": "400", - "raw": "ar-4-3,q-40" - }] -}) -``` +import os +from imagekit import ImageKit -Sample Result URL - +client = ImageKit( + private_api_key=os.environ.get( + "IMAGEKIT_PRIVATE_API_KEY" + ), # This is the default and can be omitted + password=os.environ.get( + "OPTIONAL_IMAGEKIT_IGNORES_THIS" + ), # This is the default and can be omitted +) +response = client.files.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", +) +print(response.video_codec) ``` -https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=h-300%2Cw-400%2Car-4-3%2Cq-40 -``` - -The `.url()` method accepts the following parameters. -| Option | Description | -| :---------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| url_endpoint | Optional. The prepended base URL before the path of the image. If not specified, the URL Endpoint specified during SDK initialization gets used. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/ | -| path | Conditional. A path at which the image exists. For example, `/path/to/image.jpg`. Specify a `path` or `src` parameter for URL generation. | -| src | Conditional. Complete URL of an image already mapped to ImageKit. For example, `https://ik.imagekit.io/your_imagekit_id/endpoint/path/to/image.jpg`. Specify a `path` or `src` parameter for URL generation. | -| transformation | Optional. Specify an array of objects with name and the value in key-value pair to apply transformation params in the URL. Append different steps of a [chained transformation](https://docs.imagekit.io/features/image-transformations/chained-transformations) as different objects of the array. This document includes a complete list of supported transformations in the SDK with some examples. If one uses an unspecified transformation name, it gets applied as it is in the URL. | -| transformation_position | Optional. The default value is `path`, which places the transformation string as a path parameter in the URL. One can also specify it as a query, which adds the transformation string as the query parameter `tr` in the URL. Suppose one uses the `src` parameter to create the URL. In that case, the transformation string is always a query parameter. | -| query_parameters | Optional. These are the other query parameters that one wants to add to the final URL. These can be any query parameters and are not necessarily related to ImageKit. Especially useful if one wants to add some versioning parameter to their URLs. | -| signed | Optional. Boolean. The default is `false`. If set to `true`, the SDK generates a signed image URL adding the image signature to the image URL. One can only use this if they create the URL with the `url_endpoint` and `path` parameters, not the `src` parameter. | -| expire_seconds | Optional. Integer. Used along with the `signed` parameter to specify the time in seconds from `now` when the URL should expire. If specified, the URL contains the expiry timestamp, and the image signature is modified accordingly. | +While you can provide a `private_api_key` keyword argument, +we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/) +to add `IMAGEKIT_PRIVATE_API_KEY="My Private API Key"` to your `.env` file +so that your Private API Key is not stored in source control. -## Examples of generating URLs +## Async usage -**1. Chained Transformations as a query parameter** +Simply import `AsyncImageKit` instead of `ImageKit` and use `await` with each API call: ```python -image_url = imagekit.url({ - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [ - { - "height": "300", - "width": "400" - }, - { - "rotation": 90 - } - ], - "transformation_position": "query" -}) -``` +import os +import asyncio +from imagekit import AsyncImageKit -Sample Result URL - - -``` -https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=h-300%2Cw-400%3Art-90 -``` - -**2. Sharpening, contrast transform and progressive JPG image** +client = AsyncImageKit( + private_api_key=os.environ.get( + "IMAGEKIT_PRIVATE_API_KEY" + ), # This is the default and can be omitted + password=os.environ.get( + "OPTIONAL_IMAGEKIT_IGNORES_THIS" + ), # This is the default and can be omitted +) -Add transformations like [Sharpening](https://docs.imagekit.io/features/image-transformations/image-enhancement-and-color-manipulation) to the URL with or without any other value. To use such transforms without specifying a value, set it as "-" in the transformation object. Otherwise, use the value that one wants to add to this transformation. -```python -image_url = imagekit.url({ - "src": "https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg", - "transformation": [{ - "format": "jpg", - "progressive": "true", - "effect_sharpen": "-", - "effect_contrast": "1" - }] -}) -``` +async def main() -> None: + response = await client.files.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", + ) + print(response.video_codec) -Sample Result URL - +asyncio.run(main()) ``` -# Note that because the `src` parameter is in effect, the transformation string gets added as a query parameter `tr` -https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=f-jpg%2Cpr-true%2Ce-sharpen%2Ce-contrast-1 -``` +Functionality between the synchronous and asynchronous clients is otherwise identical. -**3. Signed URL that expires in 300 seconds with the default URL endpoint and other query parameters** +### With aiohttp -```python -image_url = imagekit.url({ - "path": "/default-image.jpg", - "query_parameters": { - "p1": "123", - "p2": "345" - }, - "transformation": [{ - "height": "300", - "width": "400" - }], - "signed": True, - "expire_seconds": 300 -}) -``` +By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend. -Sample Result URL - +You can enable this by installing `aiohttp`: +```sh +# install from the production repo +pip install 'imagekit[aiohttp] @ git+ssh://git@github.com/imagekit-developer/imagekit-python#master.git' ``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400/default-image.jpg?p1=123&p2=345&ik-t=1658899345&ik-s=8f03aca28432d4e87f697a48143efb4497bbed9e -``` - -**4. Adding overlays** -ImageKit.io enables you to apply overlays to [images](https://docs.imagekit.io/features/image-transformations/overlay-using-layers) and [videos](https://docs.imagekit.io/features/video-transformation/overlay) using the raw parameter with the concept of [layers](https://docs.imagekit.io/features/image-transformations/overlay-using-layers#layers). The raw parameter facilitates incorporating transformations directly in the URL. A layer is a distinct type of transformation that allows you to define an asset to serve as an overlay, along with its positioning and additional transformations. - -**Text as overlays** - -You can add any text string over a base video or image using a text layer (l-text). - -For example: +Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: ```python -image_url = imagekit.url({ - "path": "/default-image", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{ - "height": "300", - "width": "400", - "raw": "l-text,i-Imagekit,fs-50,l-end" - }], -}) -``` -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-text,i-Imagekit,fs-50,l-end/default-image.jpg -``` +import asyncio +from imagekit import DefaultAioHttpClient +from imagekit import AsyncImageKit -**Image as overlays** -You can add an image over a base video or image using an image layer (l-image). +async def main() -> None: + async with AsyncImageKit( + private_api_key="My Private API Key", + password="My Password", + http_client=DefaultAioHttpClient(), + ) as client: + response = await client.files.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", + ) + print(response.video_codec) -For example: -```python -image_url = imagekit.url({ - "path": "/default-image", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{ - "height": "300", - "width": "400", - "raw": "l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end" - }], -}) -``` -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-default-image.jpg,w-100,b-10_CDDC39,l-end/default-image.jpg +asyncio.run(main()) ``` -**Solid color blocks as overlays** +## Using types -You can add solid color blocks over a base video or image using an image layer (l-image). +Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like: -For example: - -```python -image_url = imagekit.url({ - "path": "/img/sample-video", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{ - "height": "300", - "width": "400", - "raw": "l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end" - }], -}) -``` -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/tr:h-300,w-400,l-image,i-ik_canvas,bg-FF0000,w-300,h-100,l-end/img/sample-video.mp4 -``` +- Serializing back into JSON, `model.to_json()` +- Converting to a dictionary, `model.to_dict()` -**5. Arithmetic expressions in transformations** +Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. -ImageKit allows use of [arithmetic expressions](https://docs.imagekit.io/features/arithmetic-expressions-in-transformations) in certain dimension and position-related parameters, making media transformations more flexible and dynamic. +## Nested params -For example: +Nested parameters are dictionaries, typed using `TypedDict`, for example: ```python -image_url = imagekit.url({ - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{ - "height": "ih_div_2", - "width": "iw_div_4", - "border": "cw_mul_0.05_yellow" - }], -}) -``` +from imagekit import ImageKit -**Sample Result URL** -``` -https://ik.imagekit.io/your_imagekit_id/default-image.jpg?tr=w-iw_div_4,h-ih_div_2,b-cw_mul_0.05_yellow -``` +client = ImageKit() -**List of transformations** - -The complete list of transformations supported and their usage in ImageKit is available [here](https://docs.imagekit.io/features/image-transformations/resize-crop-and-other-transformations). -The SDK gives a name to each transformation parameter, making the code simpler, more straightforward, and readable. If a transformation is supported in ImageKit, though it cannot be found in the table below, then use the transformation code from ImageKit docs as the name when using the `URL` function. - -If you want to generate transformations in your application and add them to the URL as it is, use the raw parameter. - -| Supported Transformation Name | Translates to parameter | -| ----------------------------- | ------------------------------- | -| height | h | -| width | w | -| aspect_ratio | ar | -| quality | q | -| crop | c | -| crop_mode | cm | -| x | x | -| y | y | -| focus | fo | -| format | f | -| radius | r | -| background | bg | -| border | b | -| rotation | rt | -| blur | bl | -| named | n | -| progressive | pr | -| lossless | lo | -| trim | t | -| metadata | md | -| color_profile | cp | -| default_image | di | -| dpr | dpr | -| effect_sharpen | e-sharpen | -| effect_usm | e-usm | -| effect_contrast | e-contrast | -| effect_gray | e-grayscale | -| effect_shadow | e-shadow | -| effect_gradient | e-gradient | -| original | orig | -| raw | replaced by the parameter value | - -## File Upload - -The SDK provides a simple interface using the `.upload_file()` method to upload files to the ImageKit Media library. It -accepts all the parameters supported by -the [ImageKit Upload API](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload). - -The `upload_file()` method requires at least the `file` as (URL/Base64/Binary) and the `file_name` parameter to upload a -file. The method returns a dict data in case of success, or it will throw a custom exception in case of failure. -Use the `options` parameter to pass other parameters supported by -the [ImageKit Upload API](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload). Use the same -parameter name as specified in the upload API documentation. - -Simple usage - -```python -from imagekitio.models.UploadFileRequestOptions import UploadFileRequestOptions - -extensions = [ - { - 'name': 'remove-bg', - 'options': { - 'add_shadow': True, - 'bg_color': 'pink' - } +response = client.files.upload( + file=b"raw file contents", + file_name="fileName", + transformation={ + "post": [ + { + "type": "thumbnail", + "value": "w-150,h-150", + }, + { + "protocol": "dash", + "type": "abs", + "value": "sr-240_360_480_720_1080", + }, + ] }, - { - 'name': 'google-auto-tagging', - 'minConfidence': 80, - 'maxTags': 10 - } -] - -transformation = { - 'pre': 'l-text,i-Imagekit,fs-50,l-end', - 'post': [ - { - 'type': 'transformation', - 'value': 'w-100' - } - ] -} - -options = UploadFileRequestOptions( - use_unique_file_name=False, - tags=['abc', 'def'], - folder='/testing-python-folder/', - is_private_file=False, - custom_coordinates='10,10,20,20', - response_fields=['tags', 'custom_coordinates', 'is_private_file', - 'embedded_metadata', 'custom_metadata'], - extensions=extensions, - webhook_url='https://webhook.site/c78d617f-33bc-40d9-9e61-608999721e2e', - overwrite_file=True, - overwrite_ai_tags=False, - overwrite_tags=False, - overwrite_custom_metadata=True, - custom_metadata={'testss': 12}, - transformation=transformation, - checks="'request.folder' : '/testing-python-folder'", # To run server side checks before uploading files. Notice the quotes around request.folder and /testing-python-folder. - is_published=True ) - -result = imagekit.upload_file(file='', # required - file_name='my_file_name.jpg', # required - options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print that uploaded file's ID -print(result.file_id) +print(response.transformation) ``` -If the upload succeeds, the `result` will be the `UploadFileResult` class. - -If the upload fails, the custom exception will be thrown with: - -- `response_help` for any kind of help -- `response_metadata` with `raw`, `http_status_code` and `headers` -- `message` can be called to get the error message received from ImageKit's servers. - -## File Management - -The SDK provides a simple interface for all -the [media APIs mentioned here](https://docs.imagekit.io/api-reference/media-api) -to manage your files. This also returns `result`. - -**1. List & Search Files** - -Accepts an object specifying the parameters used to list and search files. All parameters specified -in -the [documentation here](https://docs.imagekit.io/api-reference/media-api/list-and-search-files#list-and-search-file-api) -can be passed with the correct values to get the results. - -#### Applying Filters -Filter out the files by specifying the parameters. - -```Python -from imagekitio.models.ListAndSearchFileRequestOptions import ListAndSearchFileRequestOptions - -options = ListAndSearchFileRequestOptions( - type='file', - sort='ASC_CREATED', - path='/', - file_type='all', - limit=5, - skip=0, - tags='Software, Developer, Engineer', -) +## File uploads -result = imagekit.list_files(options=options) +Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the first file's ID -print(result.list[0].file_id) -``` - -#### Advance Search -In addition, you can fine-tune your query by specifying various filters by generating a query string in a Lucene-like syntax and providing this generated string as the value of the `search_query`. +```python +from pathlib import Path +from imagekit import ImageKit -```Python -from imagekitio.models.ListAndSearchFileRequestOptions import ListAndSearchFileRequestOptions +client = ImageKit() -options = ListAndSearchFileRequestOptions( - search_query="createdAt >= '2d' OR size < '2mb' OR format='png'", +client.files.upload( + file=Path("/path/to/file"), + file_name="fileName", ) - -result = imagekit.list_files(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the first file's ID -print(result.list[0].file_id) ``` -Detailed documentation can be found here for [advance search queries](https://docs.imagekit.io/api-reference/media-api/list-and-search-files#advanced-search-queries). - -**2. Get File Details** - -Accepts the file ID and fetches the details as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-details) -```python -file_id = "your_file_id" -result = imagekit.get_file_details(file_id=file_id) # file_id required - -# Final Result -print(result) +The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically. -# Raw Response -print(result.response_metadata.raw) +## Handling errors -# print that file's id -print(result.file_id) -``` +When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `imagekit.APIConnectionError` is raised. -**3. Get File Versions** +When the API returns a non-success status code (that is, 4xx or 5xx +response), a subclass of `imagekit.APIStatusError` is raised, containing `status_code` and `response` properties. -Accepts the file ID and fetches the details as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-versions) +All errors inherit from `imagekit.APIError`. ```python -file_id = "your_file_id" -result = imagekit.get_file_versions(file_id=file_id) # file_id required - - -# Final Result -print(result) +import imagekit +from imagekit import ImageKit -# Raw Response -print(result.response_metadata.raw) +client = ImageKit() -# print that file's version id -print(result.list[0].version_info.id) -``` - -**4. Get File Version details** - -Accepts the `file_id` and `version_id` and fetches the details as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/get-file-version-details) - -```python -result = imagekit.get_file_version_details( - file_id='file_id', - version_id='version_id' +try: + client.files.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", + ) +except imagekit.APIConnectionError as e: + print("The server could not be reached") + print(e.__cause__) # an underlying Exception, likely raised within httpx. +except imagekit.RateLimitError as e: + print("A 429 status code was received; we should back off a bit.") +except imagekit.APIStatusError as e: + print("Another non-200-range status code was received") + print(e.status_code) + print(e.response) +``` + +Error codes are as follows: + +| Status Code | Error Type | +| ----------- | -------------------------- | +| 400 | `BadRequestError` | +| 401 | `AuthenticationError` | +| 403 | `PermissionDeniedError` | +| 404 | `NotFoundError` | +| 422 | `UnprocessableEntityError` | +| 429 | `RateLimitError` | +| >=500 | `InternalServerError` | +| N/A | `APIConnectionError` | + +### Retries + +Certain errors are automatically retried 2 times by default, with a short exponential backoff. +Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, +429 Rate Limit, and >=500 Internal errors are all retried by default. + +You can use the `max_retries` option to configure or disable retry settings: + +```python +from imagekit import ImageKit + +# Configure the default for all requests: +client = ImageKit( + # default is 2 + max_retries=0, ) -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print that file's id -print(result.file_id) - -# print that file's version id -print(result.version_info.id) -``` - -**5. Update File Details** - -Accepts all the parameters as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/update-file-details). -The first argument to the `update_file_details()` method is the file ID, and a second argument is an object with the -parameters to be -updated. - -```python -from imagekitio.models.UpdateFileRequestOptions import UpdateFileRequestOptions - -extensions = [ - { - 'name': 'remove-bg', - 'options': { - 'add_shadow': True, - 'bg_color': 'red' - } - }, - { - 'name': 'google-auto-tagging', - 'minConfidence': 80, - 'maxTags': 10 - } -] - -options = UpdateFileRequestOptions( - remove_ai_tags=['remove-ai-tag-1', 'remove-ai-tag-2'], - webhook_url='url', - extensions=extensions, - tags=['tag-1', 'tag-2'], - custom_coordinates='10,10,100,100', - custom_metadata={'test': 11}, +# Or, configure per-request: +client.with_options(max_retries=5).files.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", ) - -result = imagekit.update_file_details(file_id='62cfd39819ca454d82a07182' - , options=options) # required - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print that file's id -print(result.file_id) ``` -**Update publish status** +### Timeouts -If `publish` is included in the update options, no other parameters are allowed. If any are present, an error will be returned: `Your request cannot contain any other parameters when publish is present`. +By default requests time out after 1 minute. You can configure this with a `timeout` option, +which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python -from imagekitio.models.UpdateFileRequestOptions import UpdateFileRequestOptions +from imagekit import ImageKit -options = UpdateFileRequestOptions( - publish={ - "isPublished": True, - "includeFileVersions": True - } +# Configure the default for all requests: +client = ImageKit( + # 20 seconds (default is 1 minute) + timeout=20.0, ) -result = imagekit.update_file_details(file_id='62cfd39819ca454d82a07182' - , options=options) # required - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print that file's id -print(result.file_id) -``` - -**6. Add tags** - -Accepts a list of `file_ids` and `tags` as a parameter to be used to add tags. All parameters specified in -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/add-tags-bulk) can be passed to -the `.add_tags()` functions to get the results. - -```python -result = imagekit.add_tags(file_ids=['file-id-1', 'file-id-2'], tags=['add-tag-1', 'add-tag-2']) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# list successfully updated file ids -print(result.successfully_updated_file_ids) - -# print the first file's id -print(result.successfully_updated_file_ids[0]) -``` - -**7. Remove tags** - -Accepts a list of `file_ids` and `tags` as a parameter to be used to remove tags. All parameters specified in -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-tags-bulk) can be passed to -the `.remove_tags()` functions to get the results. - -```python -result = imagekit.remove_tags(file_ids=['file-id-1', 'file-id-2'], tags=['remove-tag-1', 'remove-tag-2']) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# list successfully updated file ids -print(result.successfully_updated_file_ids) - -# print the first file's id -print(result.successfully_updated_file_ids[0]) -``` - -**8. Remove AI tags** - -Accepts a list of `file_ids` and `ai_tags` as a parameter to remove AI tags. All parameters specified in -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/remove-aitags-bulk) can be passed to -the `.remove_ai_tags()` functions to get the results. - -```python -result = imagekit.remove_ai_tags(file_ids=['file-id-1', 'file-id-2'], ai_tags=['remove-ai-tag-1', 'remove-ai-tag-2']) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# list successfully updated file ids -print(result.successfully_updated_file_ids) - -# print the first file's id -print(result.successfully_updated_file_ids[0]) -``` - -**9. Delete File** - -Delete a file according to the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-file). It accepts the file ID of the File that has to be -deleted. - -```python -file_id = "file_id" -result = imagekit.delete_file(file_id=file_id) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) -``` - -**10. Delete FileVersion** - -Delete a file version as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-file-version). -The method accepts the `file_id` and particular version id of the file that has to be deleted. - -```python -result = imagekit.delete_file_version(file_id="file_id", version_id="version_id") - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) -``` - -**11. Bulk File Delete by IDs** - -Delete a file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-files-bulk). -The method accepts a list of file IDs that have to be deleted. - -```python -result = imagekit.bulk_file_delete(file_ids=["file_id1", "file_id2"]) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# list successfully deleted file ids -print(result.successfully_deleted_file_ids) - -# print the first file's id -print(result.successfully_deleted_file_ids[0]) -``` - -**12. Copy file** - -Copy a file according to the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-file). -The method accepts `source_file_path`, `destination_path`, and `include_file_versions` of the file that has to be copied. - -```python -from imagekitio.models.CopyFileRequestOptions import CopyFileRequestOptions - -options = \ - CopyFileRequestOptions(source_file_path='/source_file_path.jpg', - destination_path='/destination_path', - include_file_versions=True) -result = imagekit.copy_file(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) -``` - -**13. Move File** - -Move a file as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/move-file). -The method accepts `source_file_path` and `destination_path` of the file that has to be moved. - -```python -from imagekitio.models.MoveFileRequestOptions import MoveFileRequestOptions - -options = \ - MoveFileRequestOptions(source_file_path='/source_file_path.jpg', - destination_path='/destination_path') -result = imagekit.move_file(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) -``` - -**14. Rename File** - -Rename a file per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/rename-file). -The method accepts the `file_path`, `new_file_name`, and `purge_cache` boolean that has to be renamed. - -```python -from imagekitio.models.RenameFileRequestOptions import RenameFileRequestOptions - -options = RenameFileRequestOptions(file_path='/file_path.jpg', - new_file_name='new_file_name.jpg', - purge_cache=True) -result = imagekit.rename_file(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the purge request id -print(result.purge_request_id) -``` - -**15. Restore file Version** - -Restore a file as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/restore-file-version). -The method accepts the `file_id` and `version_id` of the file that has to be restored. - -```python -result = imagekit.restore_file_version(file_id="file_id", version_id="version_id") - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print that file's id -print(result.file_id) -``` - -**16. Create Folder** - -Create a folder per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/create-folder). -The method accepts `folder_name` and `parent_folder_path` as options that must be created. - -```Python -from imagekitio.models.CreateFolderRequestOptions import CreateFolderRequestOptions - -options = CreateFolderRequestOptions(folder_name='test', - parent_folder_path='/') -result = imagekit.create_folder(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) -``` - -**17. Delete Folder** - -Delete a folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/delete-folder). -The method accepts `folder_path` as an option that must be deleted. - -```python -from imagekitio.models.DeleteFolderRequestOptions import DeleteFolderRequestOptions - -options = DeleteFolderRequestOptions(folder_path='/test/demo') -result = imagekit.delete_folder(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) -``` - -**18. Copy Folder** - -Copy a folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-folder). -The method accepts the `source_folder_path`, `destination_path`, and `include_file_versions` boolean as options that -have to be copied. - -```python -from imagekitio.models.CopyFolderRequestOptions import CopyFolderRequestOptions -options = \ - CopyFolderRequestOptions(source_folder_path='/source_folder_path', - destination_path='/destination/path', - include_file_versions=True) -result = imagekit.copy_folder(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the job's id -print(result.job_id) -``` - -**19. Move Folder** - -Move a folder as per the [API documentation here](https://docs.imagekit.io/api-reference/media-api/move-folder). -The method accepts the `source_folder_path` and `destination_path` of a folder as options that must be moved. - -```python -from imagekitio.models.MoveFolderRequestOptions import MoveFolderRequestOptions -options = \ - MoveFolderRequestOptions(source_folder_path='/source_folder_path', - destination_path='/destination_path') -result = imagekit.move_folder(options=options) -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the job's id -print(result.job_id) -``` - -**20. Get Bulk Job Status** - -Accepts the `job_id` to get bulk job status as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/copy-move-folder-status). -The method takes only jobId. - -```python -result = imagekit.get_bulk_job_status(job_id="job_id") - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the job's id -print(result.job_id) - -# print the status -print(result.status) -``` - -**21. Purge Cache** - -Programmatically issue an explicit cache request as per -the [API documentation here](https://docs.imagekit.io/api-reference/media-api/purge-cache). -Accepts the full URL of the File for which the cache has to be cleared. - -```python -result = imagekit.purge_file_cache(file_url="full_url_of_file") - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) +# More granular control: +client = ImageKit( + timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0), +) -# print the purge file cache request id -print(result.request_id) +# Override per-request: +client.with_options(timeout=5.0).files.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", +) ``` -**22. Purge Cache Status** - -Get the purge cache request status using the `cache_request_id` returned when a purge cache request gets submitted as per the -[API documentation here](https://docs.imagekit.io/api-reference/media-api/purge-cache-status) - -```python -result = imagekit.get_purge_file_cache_status(purge_cache_id="cache_request_id") +On timeout, an `APITimeoutError` is thrown. -# Final Result -print(result) +Note that requests that time out are [retried twice by default](#retries). -# Raw Response -print(result.response_metadata.raw) +## Advanced -# print the purge file cache status -print(result.status) -``` - -**23. Get File Metadata** - -Accepts the `file_id` and fetches the metadata as per -the [API documentation here](https://docs.imagekit.io/api-reference/metadata-api/get-image-metadata-for-uploaded-media-files) - -```python -result = imagekit.get_file_metadata(file_id="file_id") +### Logging -# Final Result -print(result) +We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. -# Raw Response -print(result.response_metadata.raw) +You can enable logging by setting the environment variable `IMAGE_KIT_LOG` to `info`. -# print the file metadata fields -print(result.width) -print(result.exif.image.x_resolution) +```shell +$ export IMAGE_KIT_LOG=info ``` -**24. Get File Metadata from remote URL** - -Accepts the `remote_file_url` and fetches the metadata as per -the [API documentation here](https://docs.imagekit.io/api-reference/metadata-api/get-image-metadata-from-remote-url) - -```python -result = imagekit.get_remote_file_url_metadata(remote_file_url="remote_file_url") +Or to `debug` for more verbose logging. -# Final Result -print(result) +### How to tell whether `None` means `null` or missing -# Raw Response -print(result.response_metadata.raw) +In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`: -# print the file metadata fields -print(result.width) -print(result.exif.image.x_resolution) +```py +if response.my_field is None: + if 'my_field' not in response.model_fields_set: + print('Got json like {}, without a "my_field" key present at all.') + else: + print('Got json like {"my_field": null}.') ``` -**25. Create CustomMetaDataFields** - -Accepts an option specifying the parameters used to create custom metadata fields. All parameters specified in -the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/create-custom-metadata-field) -can be passed as it is with the correct values to get the results. - -Check for the [allowed values in the schema](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/create-custom-metadata-field#allowed-values-in-the-schema-object). - -**Example:** - -```python -# Example for the type number - -from imagekitio.models.CreateCustomMetadataFieldsRequestOptions import CreateCustomMetadataFieldsRequestOptions -from imagekitio.models.CustomMetadataFieldsSchema import CustomMetadataFieldsSchema -from imagekitio.models.CustomMetaDataTypeEnum import CustomMetaDataTypeEnum -schema = CustomMetadataFieldsSchema(type=CustomMetaDataTypeEnum.Number, - min_value=100, - max_value=200) -options = CreateCustomMetadataFieldsRequestOptions(name='test', - label='test', - schema=schema) -result = imagekit.create_custom_metadata_fields(options=options) - -# Final Result -print(result) +### Accessing raw response data (e.g. headers) -# Raw Response -print(result.response_metadata.raw) +The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g., -# print the id of created custom metadata fields -print(result.id) +```py +from imagekit import ImageKit -# print the schema's type of created custom metadata fields -print(result.schema.type) - -``` - -```python -# MultiSelect type Example - -from imagekitio.models.CreateCustomMetadataFieldsRequestOptions import CreateCustomMetadataFieldsRequestOptions -from imagekitio.models.CustomMetadataFieldsSchema import CustomMetadataFieldsSchema -from imagekitio.models.CustomMetaDataTypeEnum import CustomMetaDataTypeEnum - -schema = \ - CustomMetadataFieldsSchema(type=CustomMetaDataTypeEnum.MultiSelect, - is_value_required=True, - default_value=['small', 30, True], - select_options=[ - 'small', - 'medium', - 'large', - 30, - 40, - True, - ]) -options = \ - CreateCustomMetadataFieldsRequestOptions(name='test-MultiSelect', - label='test-MultiSelect', schema=schema) -result = imagekit.create_custom_metadata_fields(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the name of created custom metadata fields -print(result.name) - -# print the schema's select options of created custom metadata fields -print(result.schema.select_options) +client = ImageKit() +response = client.files.with_raw_response.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", +) +print(response.headers.get('X-My-Header')) +file = response.parse() # get the object that `files.upload()` would have returned +print(file.video_codec) ``` -```python -# Date type Example - -from imagekitio.models.CreateCustomMetadataFieldsRequestOptions import CreateCustomMetadataFieldsRequestOptions -from imagekitio.models.CustomMetadataFieldsSchema import CustomMetadataFieldsSchema -from imagekitio.models.CustomMetaDataTypeEnum import CustomMetaDataTypeEnum - -schema = CustomMetadataFieldsSchema(type=CustomMetaDataTypeEnum.Date, - min_value='2022-11-29T10:11:10+00:00', - max_value='2022-11-30T10:11:10+00:00') -options = CreateCustomMetadataFieldsRequestOptions(name='test-date', - label='test-date', - schema=schema) -result = imagekit.create_custom_metadata_fields(options=options) - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) - -# print the label of created custom metadata fields -print(result.label) +These methods return an [`APIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekit/_response.py) object. -# print the schema's min value of created custom metadata fields -print(result.schema.min_value) +The async client returns an [`AsyncAPIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekit/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. -``` +#### `.with_streaming_response` -**26. Get CustomMetaDataFields** +The above interface eagerly reads the full response body when you make the request, which may not always be what you want. -Accepts the `include_deleted` boolean as the initial parameter and fetches the metadata as per -the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/get-custom-metadata-field) -. +To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. ```python -result = imagekit.get_custom_metadata_fields() # in this case, it will consider includeDeleted as a False - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) +with client.files.with_streaming_response.upload( + file=b"https://www.example.com/public-url.jpg", + file_name="file-name.jpg", +) as response: + print(response.headers.get("X-My-Header")) -# print the first customMetadataField's id -print(result.list[0].id) - -# print the first customMetadataField schema's type -print(result.list[0].schema.type) + for line in response.iter_lines(): + print(line) ``` -```python -result = imagekit.get_custom_metadata_fields(include_deleted=True) +The context manager is required so that the response will reliably be closed. -# Final Result -print(result) +### Making custom/undocumented requests -# Raw Response -print(result.response_metadata.raw) +This library is typed for convenient access to the documented API. -# print the first customMetadataField's name -print(result.list[0].name) +If you need to access undocumented endpoints, params, or response properties, the library can still be used. -# print the first customMetadataField schema's default value -print(result.list[0].schema.default_value) -``` +#### Undocumented endpoints -**27. Update CustomMetaDataFields** +To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other +http verbs. Options on the client will be respected (such as retries) when making this request. -Accepts a `field_id` and options for specifying the parameters to be used to edit custom metadata fields -as per -the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/update-custom-metadata-field) -. +```py +import httpx -```python - -from imagekitio.models.CustomMetadataFieldsSchema import CustomMetadataFieldsSchema -from imagekitio.models.UpdateCustomMetadataFieldsRequestOptions import UpdateCustomMetadataFieldsRequestOptions - -schema = CustomMetadataFieldsSchema(min_value=100, max_value=200) -options = UpdateCustomMetadataFieldsRequestOptions( - label='test-update', - schema=schema +response = client.post( + "/foo", + cast_to=httpx.Response, + body={"my_param": True}, ) -result = imagekit.update_custom_metadata_fields( - field_id='id_of_custom_metadata_field', - options=options -) - -# Final Result -print(result) -# Raw Response -print(result.response_metadata.raw) - -# print the label of updated custom metadata fields -print(result.label) - -# print the schema's min value of updated custom metadata fields -print(result.schema.min_value) +print(response.headers.get("x-foo")) ``` -**28. Delete CustomMetaDataFields** - -Accepts the id to delete the custom metadata fields as per -the [API documentation here](https://docs.imagekit.io/api-reference/custom-metadata-fields-api/delete-custom-metadata-field) -. - -```python -result = imagekit.delete_custom_metadata_field(field_id="id_of_custom_metadata_field") - -# Final Result -print(result) - -# Raw Response -print(result.response_metadata.raw) -``` - -## Utility functions - -We have included the following commonly used utility functions in this package. - -**Authentication parameter generation** +#### Undocumented request params -Suppose one wants to implement client-side file upload. In that case, one will need a token, expiry timestamp, and a valid signature for that upload. The SDK provides a simple method that one can use in their code to generate these authentication parameters. +If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request +options. -Note: Any client-side code should never expose The Private API Key. One must always generate these authentications parameters on the server-side +#### Undocumented response properties -authentication +To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You +can also get all the extra fields on the Pydantic model as a dict with +[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra). -`authentication_parameters = imagekit.get_authentication_parameters(token, expire)` +### Configuring the HTTP client -Returns +You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including: -```python -{ - "token": "unique_token", - "expire": "valid_expiry_timestamp", - "signature": "generated_signature" -} -``` - -Both the `token` and `expire` parameters are optional. If not specified, the SDK uses the UUID to generate a random token and internally generates a valid expiry timestamp. The `token` and `expire` used to generate `signature` is part of a response returned by the server. - -**Distance calculation between two `pHash` values** - -Perceptual hashing allows you to construct a has value that uniquely identifies an input image based on the contents -of an image. [imagekit.io metadata API](https://docs.imagekit.io/api-reference/metadata-api) returns the `pHash` -value of an image in the response. You can use this value -to [find a duplicate or similar image](https://docs.imagekit.io/api-reference/metadata-api#using-phash-to-find-similar-or-duplicate-images) -by calculating the distance between the two images. - -This SDK exposes the `phash_distance` function to calculate the distance between two `pHash` values. It accepts two `pHash` -hexadecimal -strings and returns a numeric value indicative of the difference between the two images. +- Support for [proxies](https://www.python-httpx.org/advanced/proxies/) +- Custom [transports](https://www.python-httpx.org/advanced/transports/) +- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality ```python -def calculate_distance(): - # fetch metadata of two uploaded image files - ... - # extract pHash strings from both: say 'first_hash' and 'second_hash' - ... - # calculate the distance between them: - - distance = imagekit.phash_distance(first_hash, second_hash) - return distance - -``` - -**Distance calculation examples** - -```Python -imagekit.phash_distance('f06830ca9f1e3e90', 'f06830ca9f1e3e90') -# output: 0 (same image) +import httpx +from imagekit import ImageKit, DefaultHttpxClient -imagekit.phash_distance('2d5ad3936d2e015b', '2d6ed293db36a4fb') -# output: 17 (similar images) - -imagekit.phash_distance('a4a65595ac94518b', '7838873e791f8400') -# output: 37 (dissimilar images) -``` - -**HTTP response metadata of Internal API** - -HTTP response metadata of the internal API call can be accessed using the \_response_metadata on the Result object. -Example: - -```Python -result = imagekit.upload_file( - file="", - file_name="my_file_name.jpg", +client = ImageKit( + # Or use the `IMAGE_KIT_BASE_URL` env var + base_url="http://my.test.server.example.com:8083", + http_client=DefaultHttpxClient( + proxy="http://my.test.proxy.example.com", + transport=httpx.HTTPTransport(local_address="0.0.0.0"), + ), ) - -# Final Result -print(result) -print(result.response_metadata.raw) -print(result.response_metadata.http_status_code) -print(result.response_metadata.headers) -``` - -### Sample Code Instruction - -To run `sample` code go to the code samples here are hosted on GitHub - https://github.com/imagekit-samples/quickstart/tree/master/python and run. - -```shell -python sample.py ``` -## Handling errors - -Catch and respond to invalid data, internal problems, and more. - -ImageKit Python SDK raises exceptions for many reasons, such as not found, invalid parameters, authentication, and -internal server errors. Therefore, we recommend writing code that gracefully handles all possible API exceptions. +You can also customize the client on a per-request basis by using `with_options()`: -#### Example: - -```Python -from imagekitio.exceptions.BadRequestException import BadRequestException -from imagekitio.exceptions.UnauthorizedException import UnauthorizedException -from imagekitio.exceptions.ForbiddenException import ForbiddenException -from imagekitio.exceptions.TooManyRequestsException import TooManyRequestsException -from imagekitio.exceptions.InternalServerException import InternalServerException -from imagekitio.exceptions.PartialSuccessException import PartialSuccessException -from imagekitio.exceptions.NotFoundException import NotFoundException -from imagekitio.exceptions.UnknownException import UnknownException - -try: - - # Use ImageKit's SDK to make requests... - print('Run image kit api') -except BadRequestException, e: - # Missing or Invalid parameters were supplied to Imagekit.io's API - print('Status is: ' + e.response_metadata.http_status_code) - print('Message is: ' + e.message) - print('Headers are: ' + e.response_metadata.headers) - print('Raw body is: ' + e.response_metadata.raw) -except UnauthorizedException, e: - print(e) -except ForbiddenException, e: - # No valid API key was provided. - print(e) -except TooManyRequestsException, e: - # Can be for the following reasons: - # ImageKit could not authenticate your account with the keys provided. - # An expired key (public or private) was used with the request. - # The account is disabled. - # If you use the upload API, the total storage limit (or upload limit) is exceeded. - print(e) -except InternalServerException, e: - # Too many requests made to the API too quickly - print(e) -except PartialSuccessException, e: - # Something went wrong with ImageKit.io API. - print(e) -except NotFoundException, e: - # Error cases on partial success. - print(e) -except UnknownException, e: - # If any of the field or parameter is not found in the data - print(e) - -# Something else happened, which can be unrelated to ImageKit; the reason will be indicated in the message field +```python +client.with_options(http_client=DefaultHttpxClient(...)) ``` -## Development - -### Tests +### Managing HTTP resources -Tests are powered by [Tox](https://tox.wiki/en/latest/). - -```bash -$ git clone https://github.com/imagekit-developer/imagekit-python && cd imagekit-python -$ pip install tox -$ tox -``` +By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. -### Sample +```py +from imagekit import ImageKit -#### Get & Install local ImageKit Python SDK +with ImageKit() as client: + # make requests here + ... -```bash -$ git clone https://github.com/imagekit-developer/imagekit-python && cd imagekit-python -$ pip install -e . +# HTTP client is now closed ``` -#### Get samples +## Versioning -To integrate ImageKit Samples in the Python, the code samples covered here are hosted on GitHub - https://github.com/imagekit-samples/quickstart/tree/master/python. +This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: -Open the `python/sample.py` file and replace placeholder credentials with actual values. You can get the value of [URL-endpoint](https://imagekit.io/dashboard#url-endpoints) from your ImageKit dashboard. API keys can be obtained from the [developer](https://imagekit.io/dashboard/developer/api-keys) section in your ImageKit dashboard. +1. Changes that only affect static types, without breaking runtime behavior. +2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_ +3. Changes that we do not expect to impact the vast majority of users in practice. -In the `python/sample.py` file, set the following parameters for authentication: +We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -```python -from imagekitio import ImageKit -imagekit = ImageKit( - private_key='your private_key', - public_key='your public_key', - url_endpoint = 'your url_endpoint' -) -``` +We are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-python/issues) with questions, bugs, or suggestions. -To install dependencies that are in the `python/requirements.txt` file, can fire this command to install them: +### Determining the installed version -```shell -pip install -r python/requirements.txt -``` +If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version. -Now run `python/sample.py`. If you are using CLI Tool (Terminal/Command prompt), open the project in CLI and execute it. +You can determine the version that is being used at runtime with: -```shell -# if not installed already -pip install imagekitio - -# if installing local sdk -pip install -e - -# to run sample.py file -python3 python/sample.py +```py +import imagekit +print(imagekit.__version__) ``` -## Support - -For any feedback or to report any issues or general implementation support, please reach out -to [support@imagekit.io](https://github.com/imagekit-developer/imagekit-python) - -## Links - -- [Documentation](https://docs.imagekit.io/) +## Requirements -- [Main Website](https://imagekit.io/) +Python 3.8 or higher. -## License +## Contributing -Released under the MIT license. +See [the contributing documentation](./CONTRIBUTING.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8e64327 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainless.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +before making any information public. + +## Reporting Non-SDK Related Security Issues + +If you encounter security issues that are not directly related to SDKs but pertain to the services +or products provided by Image Kit, please follow the respective company's security reporting guidelines. + +### Image Kit Terms and Policies + +Please contact developer@imagekit.io for any questions or concerns regarding the security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/api.md b/api.md new file mode 100644 index 0000000..9b8bf83 --- /dev/null +++ b/api.md @@ -0,0 +1,252 @@ +# Shared Types + +```python +from imagekit.types import ( + BaseOverlay, + ImageOverlay, + Overlay, + OverlayPosition, + OverlayTiming, + SolidColorOverlay, + SolidColorOverlayTransformation, + SrcOptions, + StreamingResolution, + SubtitleOverlay, + SubtitleOverlayTransformation, + TextOverlay, + TextOverlayTransformation, + Transformation, + TransformationPosition, + VideoOverlay, +) +``` + +# CustomMetadataFields + +Types: + +```python +from imagekit.types import ( + CustomMetadataField, + CustomMetadataFieldListResponse, + CustomMetadataFieldDeleteResponse, +) +``` + +Methods: + +- client.custom_metadata_fields.create(\*\*params) -> CustomMetadataField +- client.custom_metadata_fields.update(id, \*\*params) -> CustomMetadataField +- client.custom_metadata_fields.list(\*\*params) -> CustomMetadataFieldListResponse +- client.custom_metadata_fields.delete(id) -> CustomMetadataFieldDeleteResponse + +# Files + +Types: + +```python +from imagekit.types import ( + File, + Folder, + Metadata, + FileUpdateResponse, + FileCopyResponse, + FileMoveResponse, + FileRenameResponse, + FileUploadResponse, +) +``` + +Methods: + +- client.files.update(file_id, \*\*params) -> FileUpdateResponse +- client.files.delete(file_id) -> None +- client.files.copy(\*\*params) -> FileCopyResponse +- client.files.get(file_id) -> File +- client.files.move(\*\*params) -> FileMoveResponse +- client.files.rename(\*\*params) -> FileRenameResponse +- client.files.upload(\*\*params) -> FileUploadResponse + +## Bulk + +Types: + +```python +from imagekit.types.files import ( + BulkDeleteResponse, + BulkAddTagsResponse, + BulkRemoveAITagsResponse, + BulkRemoveTagsResponse, +) +``` + +Methods: + +- client.files.bulk.delete(\*\*params) -> BulkDeleteResponse +- client.files.bulk.add_tags(\*\*params) -> BulkAddTagsResponse +- client.files.bulk.remove_ai_tags(\*\*params) -> BulkRemoveAITagsResponse +- client.files.bulk.remove_tags(\*\*params) -> BulkRemoveTagsResponse + +## Versions + +Types: + +```python +from imagekit.types.files import VersionListResponse, VersionDeleteResponse +``` + +Methods: + +- client.files.versions.list(file_id) -> VersionListResponse +- client.files.versions.delete(version_id, \*, file_id) -> VersionDeleteResponse +- client.files.versions.get(version_id, \*, file_id) -> File +- client.files.versions.restore(version_id, \*, file_id) -> File + +## Metadata + +Methods: + +- client.files.metadata.get(file_id) -> Metadata +- client.files.metadata.get_from_url(\*\*params) -> Metadata + +# Assets + +Types: + +```python +from imagekit.types import AssetListResponse +``` + +Methods: + +- client.assets.list(\*\*params) -> AssetListResponse + +# Cache + +## Invalidation + +Types: + +```python +from imagekit.types.cache import InvalidationCreateResponse, InvalidationGetResponse +``` + +Methods: + +- client.cache.invalidation.create(\*\*params) -> InvalidationCreateResponse +- client.cache.invalidation.get(request_id) -> InvalidationGetResponse + +# Folders + +Types: + +```python +from imagekit.types import ( + FolderCreateResponse, + FolderDeleteResponse, + FolderCopyResponse, + FolderMoveResponse, + FolderRenameResponse, +) +``` + +Methods: + +- client.folders.create(\*\*params) -> FolderCreateResponse +- client.folders.delete(\*\*params) -> FolderDeleteResponse +- client.folders.copy(\*\*params) -> FolderCopyResponse +- client.folders.move(\*\*params) -> FolderMoveResponse +- client.folders.rename(\*\*params) -> FolderRenameResponse + +## Job + +Types: + +```python +from imagekit.types.folders import JobGetResponse +``` + +Methods: + +- client.folders.job.get(job_id) -> JobGetResponse + +# Accounts + +## Usage + +Types: + +```python +from imagekit.types.accounts import UsageGetResponse +``` + +Methods: + +- client.accounts.usage.get(\*\*params) -> UsageGetResponse + +## Origins + +Types: + +```python +from imagekit.types.accounts import OriginRequest, OriginResponse, OriginListResponse +``` + +Methods: + +- client.accounts.origins.create(\*\*params) -> OriginResponse +- client.accounts.origins.update(id, \*\*params) -> OriginResponse +- client.accounts.origins.list() -> OriginListResponse +- client.accounts.origins.delete(id) -> None +- client.accounts.origins.get(id) -> OriginResponse + +## URLEndpoints + +Types: + +```python +from imagekit.types.accounts import URLEndpointRequest, URLEndpointResponse, URLEndpointListResponse +``` + +Methods: + +- client.accounts.url_endpoints.create(\*\*params) -> URLEndpointResponse +- client.accounts.url_endpoints.update(id, \*\*params) -> URLEndpointResponse +- client.accounts.url_endpoints.list() -> URLEndpointListResponse +- client.accounts.url_endpoints.delete(id) -> None +- client.accounts.url_endpoints.get(id) -> URLEndpointResponse + +# Beta + +## V2 + +### Files + +Types: + +```python +from imagekit.types.beta.v2 import FileUploadResponse +``` + +Methods: + +- client.beta.v2.files.upload(\*\*params) -> FileUploadResponse + +# Webhooks + +Types: + +```python +from imagekit.types import ( + BaseWebhookEvent, + UploadPostTransformErrorEvent, + UploadPostTransformSuccessEvent, + UploadPreTransformErrorEvent, + UploadPreTransformSuccessEvent, + VideoTransformationAcceptedEvent, + VideoTransformationErrorEvent, + VideoTransformationReadyEvent, + UnsafeUnwrapWebhookEvent, + UnwrapWebhookEvent, +) +``` diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 0000000..b845b0f --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${PYPI_TOKEN}" ]; then + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/bin/publish-pypi b/bin/publish-pypi new file mode 100644 index 0000000..826054e --- /dev/null +++ b/bin/publish-pypi @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -eux +mkdir -p dist +rye build --clean +rye publish --yes --token=$PYPI_TOKEN diff --git a/examples/.keep b/examples/.keep new file mode 100644 index 0000000..d8c73e9 --- /dev/null +++ b/examples/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store example files demonstrating usage of this SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/imagekitio/__init__.py b/imagekitio/__init__.py deleted file mode 100644 index ba7a502..0000000 --- a/imagekitio/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .client import ImageKit diff --git a/imagekitio/client.py b/imagekitio/client.py deleted file mode 100644 index c11a8df..0000000 --- a/imagekitio/client.py +++ /dev/null @@ -1,252 +0,0 @@ -from typing import Any, Dict - -from .constants.errors import ERRORS -from .file import File -from .models.CopyFileRequestOptions import CopyFileRequestOptions -from .models.CopyFolderRequestOptions import CopyFolderRequestOptions -from .models.CreateCustomMetadataFieldsRequestOptions import ( - CreateCustomMetadataFieldsRequestOptions, -) -from .models.CreateFolderRequestOptions import CreateFolderRequestOptions -from .models.DeleteFolderRequestOptions import DeleteFolderRequestOptions -from .models.ListAndSearchFileRequestOptions import ListAndSearchFileRequestOptions -from .models.MoveFileRequestOptions import MoveFileRequestOptions -from .models.MoveFolderRequestOptions import MoveFolderRequestOptions -from .models.RenameFileRequestOptions import RenameFileRequestOptions -from .models.UpdateCustomMetadataFieldsRequestOptions import ( - UpdateCustomMetadataFieldsRequestOptions, -) -from .models.UpdateFileRequestOptions import UpdateFileRequestOptions -from .models.UploadFileRequestOptions import UploadFileRequestOptions -from .models.results.BulkDeleteFileResult import BulkDeleteFileResult -from .models.results.CustomMetadataFieldsResultWithResponseMetadata import ( - CustomMetadataFieldsResultWithResponseMetadata, -) -from .models.results.FileResultWithResponseMetadata import ( - FileResultWithResponseMetadata, -) -from .models.results.FolderResult import FolderResult -from .models.results.GetBulkJobStatusResult import GetBulkJobStatusResult -from .models.results.GetMetadataResult import GetMetadataResult -from .models.results.ListCustomMetadataFieldsResult import ( - ListCustomMetadataFieldsResult, -) -from .models.results.ListFileResult import ListFileResult -from .models.results.PurgeCacheResult import PurgeCacheResult -from .models.results.PurgeCacheStatusResult import PurgeCacheStatusResult -from .models.results.RenameFileResult import RenameFileResult -from .models.results.ResponseMetadataResult import ResponseMetadataResult -from .models.results.TagsResult import TagsResult -from .models.results.UploadFileResult import UploadFileResult -from .resource import ImageKitRequest -from .url import Url -from .utils.calculation import get_authenticated_params, hamming_distance - - -class ImageKit(object): - """ - Main Class What user will use by creating - instance - """ - - def __init__( - self, - public_key=None, - private_key=None, - url_endpoint=None, - transformation_position=None, - options=None, - ): - self.ik_request = ImageKitRequest( - private_key, public_key, url_endpoint, transformation_position, options - ) - self.file = File(self.ik_request) - self.url_obj = Url(self.ik_request) - - def upload(self, file=None, file_name=None, options=None) -> UploadFileResult: - """Provides upload functionality""" - return self.file.upload(file, file_name, options) - - def upload_file( - self, file=None, file_name=None, options: UploadFileRequestOptions = None - ) -> UploadFileResult: - """Provides upload functionality""" - return self.file.upload( - file, file_name, options if options is not None else None - ) - - def list_files( - self, options: ListAndSearchFileRequestOptions = None - ) -> ListFileResult: - """Get list(filtered if given param) of images of client""" - return self.file.list(options) - - def get_file_details(self, file_id: str = None) -> FileResultWithResponseMetadata: - """Get file_detail by file_id or file_url""" - return self.file.details(file_id) - - def get_file_versions(self, file_id: str = None) -> ListFileResult: - """Get file_version by file_id or file_url""" - return self.file.get_file_versions(file_id) - - def get_file_version_details( - self, file_id: str = None, version_id: str = None - ) -> FileResultWithResponseMetadata: - """Get file_version details by file_id and version_id""" - return self.file.get_file_version_details(file_id, version_id) - - def update_file_details( - self, file_id: str, options: UpdateFileRequestOptions = None - ) -> FileResultWithResponseMetadata: - """Update file details by file id and options""" - return self.file.update_file_details(file_id, options) - - def add_tags(self, file_ids, tags) -> TagsResult: - """Add tags by file ids and tags""" - return self.file.manage_tags(file_ids, tags, "addTags") - - def remove_tags(self, file_ids, tags) -> TagsResult: - """Remove tags by file ids and tags""" - return self.file.manage_tags(file_ids, tags, "removeTags") - - def remove_ai_tags(self, file_ids, ai_tags) -> TagsResult: - """Remove AI tags by file ids and AI tags""" - return self.file.remove_ai_tags(file_ids, ai_tags) - - def delete_file(self, file_id: str = None) -> ResponseMetadataResult: - """Delete file by file_id""" - return self.file.delete(file_id) - - def delete_file_version(self, file_id, version_id) -> ResponseMetadataResult: - """Delete file version by provided file id and version id""" - return self.file.delete_file_version(file_id, version_id) - - def bulk_delete(self, file_ids: list = None) -> BulkDeleteFileResult: - """Delete files in bulk by provided list of file ids""" - return self.file.batch_delete(file_ids) - - def bulk_file_delete(self, file_ids: list = None) -> BulkDeleteFileResult: - """Delete files in bulk by provided list of file ids""" - return self.file.batch_delete(file_ids) - - def copy_file( - self, options: CopyFileRequestOptions = None - ) -> ResponseMetadataResult: - """Copy file by provided sourceFilePath, destinationPath and includeFileVersions as an options""" - return self.file.copy_file(options) - - def move_file( - self, options: MoveFileRequestOptions = None - ) -> ResponseMetadataResult: - """Move file by provided sourceFilePath and destinationPath as an options""" - return self.file.move_file(options) - - def rename_file(self, options: RenameFileRequestOptions = None) -> RenameFileResult: - """Rename file by provided filePath, newFileName and purgeCache as an options""" - return self.file.rename_file(options) - - def restore_file_version( - self, file_id, version_id - ) -> FileResultWithResponseMetadata: - """Restore file version by provided file id and version id""" - return self.file.restore_file_version(file_id, version_id) - - def create_folder( - self, options: CreateFolderRequestOptions = None - ) -> ResponseMetadataResult: - """Create folder by provided folderName and parentFolderPath as an options""" - return self.file.create_folder(options) - - def delete_folder( - self, options: DeleteFolderRequestOptions = None - ) -> ResponseMetadataResult: - """Delete folder by provided folderPath as an options""" - return self.file.delete_folder(options) - - def copy_folder(self, options: CopyFolderRequestOptions = None) -> FolderResult: - """Copy folder by provided sourceFolderPath, destinationPath and includeFileVersions as an options""" - return self.file.copy_folder(options) - - def move_folder(self, options: MoveFolderRequestOptions = None) -> FolderResult: - """Move folder by provided sourceFolderPath and destinationPath as an options""" - return self.file.move_folder(options) - - def get_bulk_job_status(self, job_id) -> GetBulkJobStatusResult: - """Get bulk job status by provided only jobId""" - return self.file.get_bulk_job_status(job_id) - - def purge_cache(self, file_url: str = None) -> PurgeCacheResult: - """Purge Cache from server by file url""" - return self.file.purge_cache(file_url) - - def purge_file_cache(self, file_url: str = None) -> PurgeCacheResult: - """Purge Cache from server by file url""" - return self.file.purge_cache(file_url) - - def get_purge_cache_status( - self, purge_cache_id: str = "" - ) -> PurgeCacheStatusResult: - """Get Purge Cache status by purge cache request_id""" - return self.file.get_purge_cache_status(str(purge_cache_id)) - - def get_purge_file_cache_status( - self, purge_cache_id: str = "" - ) -> PurgeCacheStatusResult: - """Get Purge Cache status by purge cache request_id""" - return self.file.get_purge_cache_status(str(purge_cache_id)) - - def get_metadata(self, file_id: str = None) -> GetMetadataResult: - """Get Meta Data of a file by file id""" - return self.file.get_metadata(str(file_id)) - - def get_file_metadata(self, file_id: str = None) -> GetMetadataResult: - """Get Meta Data of a file by file id""" - return self.file.get_metadata(str(file_id)) - - def get_remote_url_metadata(self, remote_file_url: str = "") -> GetMetadataResult: - return self.file.get_metadata_from_remote_url(remote_file_url) - - def get_remote_file_url_metadata( - self, remote_file_url: str = "" - ) -> GetMetadataResult: - """Get remote metadata by provided remote_file_url""" - return self.file.get_metadata_from_remote_url(remote_file_url) - - def create_custom_metadata_fields( - self, options: CreateCustomMetadataFieldsRequestOptions = None - ) -> CustomMetadataFieldsResultWithResponseMetadata: - """creates custom metadata fields by passing name, label and schema as an options""" - return self.file.create_custom_metadata_fields(options) - - def get_custom_metadata_fields( - self, include_deleted: bool = False - ) -> ListCustomMetadataFieldsResult: - """get custom metadata fields""" - return self.file.get_custom_metadata_fields(include_deleted) - - def update_custom_metadata_fields( - self, field_id, options: UpdateCustomMetadataFieldsRequestOptions = None - ) -> CustomMetadataFieldsResultWithResponseMetadata: - """updates custom metadata fields by passing id of custom metadata field and params as an options""" - return self.file.update_custom_metadata_fields(field_id, options) - - def delete_custom_metadata_field( - self, field_id: str = "" - ) -> ResponseMetadataResult: - """Deletes custom metadata fields by passing field_id""" - return self.file.delete_custom_metadata_field(field_id) - - def url(self, options: Dict[str, Any]) -> str: - """Get generated Url from options parameter""" - return self.url_obj.generate_url(options) - - @staticmethod - def phash_distance(first, second): - """Get hamming distance between two phash(to check similarity)""" - if not (first and second): - raise TypeError(ERRORS.MISSING_PHASH_VALUE.value) - return hamming_distance(first, second) - - def get_authentication_parameters(self, token="", expire=0): - """Get Authentication parameters""" - return get_authenticated_params(token, expire, self.ik_request.private_key) diff --git a/imagekitio/constants/defaults.py b/imagekitio/constants/defaults.py deleted file mode 100644 index b5c00b9..0000000 --- a/imagekitio/constants/defaults.py +++ /dev/null @@ -1,19 +0,0 @@ -import enum - - -class Default(enum.Enum): - DEFAULT_TRANSFORMATION_POSITION = "path" - QUERY_TRANSFORMATION_POSITION = "query" - VALID_TRANSFORMATION_POSITION = [ - DEFAULT_TRANSFORMATION_POSITION, - QUERY_TRANSFORMATION_POSITION, - ] - DEFAULT_TIMESTAMP = 9999999999 - SDK_VERSION = "python-3.2.0" - TRANSFORMATION_PARAMETER = "tr" - CHAIN_TRANSFORM_DELIMITER = ":" - TRANSFORM_DELIMITER = "," - TRANSFORM_KEY_VALUE_DELIMITER = "-" - SIGNATURE_PARAMETER = "ik-s" - TIMESTAMP_PARAMETER = "ik-t" - IGNORE_CHARACTERS = '~@#$&()*!+=:;,?/\'' diff --git a/imagekitio/constants/errors.py b/imagekitio/constants/errors.py deleted file mode 100644 index 35e9cd7..0000000 --- a/imagekitio/constants/errors.py +++ /dev/null @@ -1,93 +0,0 @@ -import enum - - -class ERRORS(enum.Enum): - MANDATORY_INITIALIZATION_MISSING = { - "message": "Missing public_key or private_key or url_endpoint during ImageKit initialization", - "help": "", - } - INVALID_TRANSFORMATION_POSITION = { - "message": "Invalid transformationPosition parameter", - "help": "", - } - MANDATORY_SRC_OR_PATH = { - "message": "Pass one of the mandatory parameter path or src" - } - INVALID_URL_GENERATION_PARAMETER = { - "message": "Invalid url parameter", - "help": "" - } - INVALID_TRANSFORMATION_OPTIONS = { - "message": "Invalid transformation parameter options", - "help": "", - } - CACHE_PURGE_URL_MISSING = { - "message": "Missing URL parameter for this request", - "help": "", - } - CACHE_PURGE_STATUS_ID_MISSING = { - "message": "Missing Request ID parameter for this request", - "help": "", - } - FILE_ID_MISSING = { - "message": "Missing File ID parameter for this request", - "help": "", - } - UPDATE_DATA_MISSING = { - "message": "Missing file update data for this request", - "help": "", - } - UPDATE_DATA_TAGS_INVALID = { - "message": "Invalid tags parameter for this request", - "help": "tags should be passed as null or an array like ['tag1', 'tag2']", - } - UPDATE_DATA_COORDS_INVALID = ( - { - "message": "Invalid custom_coordinates parameter for this request", - "help": "custom_coordinates should be passed as null or a string like 'x,y,width,height'", - }, - ) - - LIST_FILES_INPUT_MISSING = { - "message": "Missing options for list files", - "help": "If you do not want to pass any parameter for listing, pass an empty object", - } - MISSING_FILE_URL = { - "message": "Missing file_url for purge_cache", - "help": "" - } - MISSING_UPLOAD_DATA = { - "message": "Missing data for upload", - "help": "" - - } - MISSING_UPLOAD_FILE_PARAMETER = { - "message": "Missing file parameter for upload", - "help": "", - } - MISSING_UPLOAD_FILENAME_PARAMETER = { - "message": "Missing fileName parameter for upload", - "help": "", - } - INVALID_PHASH_VALUE = ( - { - "message": "Invalid pHash value", - "help": "Both pHash strings must be valid hexadecimal numbers", - }, - ) - MISSING_PHASH_VALUE = { - "message": "Missing pHash value", - "help": "Please pass two pHash values", - } - UNEQUAL_STRING_LENGTH = { - "message": "Unequal pHash string length", - "help": "For distance calculation, the two pHash strings must have equal length", - } - VERSION_ID_MISSING = { - "message": "Missing Version ID parameter for this request", - "help": "", - } - MISSING_CUSTOM_METADATA_FIELD_ID = { - "message": "Missing field_id for update_custom_metadata_fields", - "help": "", - } diff --git a/imagekitio/constants/files.py b/imagekitio/constants/files.py deleted file mode 100644 index 3fbf3e1..0000000 --- a/imagekitio/constants/files.py +++ /dev/null @@ -1,35 +0,0 @@ -VALID_FILE_OPTIONS = [ - "type", - "sort", - "path", - "searchQuery", - "fileType", - "limit", - "skip", - "tags", - "includeFolder", -] - -VALID_FILE_DETAIL_OPTIONS = ["fileID"] - -VALID_UPLOAD_OPTIONS = [ - "file", - "file_name", - "use_unique_file_name", - "tags", - "folder", - "is_private_file", - "custom_coordinates", - "response_fields", - "extensions", - "webhook_url", - "overwrite_file", - "overwrite_ai_tags", - "overwrite_tags", - "overwrite_custom_metadata", - "custom_metadata", - "embedded_metadata", - "transformation", - "checks", - "is_published", -] diff --git a/imagekitio/constants/supported_transform.py b/imagekitio/constants/supported_transform.py deleted file mode 100644 index d69c7dc..0000000 --- a/imagekitio/constants/supported_transform.py +++ /dev/null @@ -1,33 +0,0 @@ -SUPPORTED_TRANS = { - "height": "h", - "width": "w", - "aspect_ratio": "ar", - "quality": "q", - "crop": "c", - "crop_mode": "cm", - "x": "x", - "y": "y", - "focus": "fo", - "format": "f", - "radius": "r", - "background": "bg", - "border": "b", - "rotation": "rt", - "blur": "bl", - "named": "n", - "progressive": "pr", - "lossless": "lo", - "trim": "t", - "metadata": "md", - "color_profile": "cp", - "default_image": "di", - "dpr": "dpr", - "effect_sharpen": "e-sharpen", - "effect_usm": "e-usm", - "effect_contrast": "e-contrast", - "effect_gray": "e-grayscale", - 'effect_shadow': "e-shadow", - 'effect_gradient': "e-gradient", - "original": "orig", - "raw": "raw", -} diff --git a/imagekitio/constants/url.py b/imagekitio/constants/url.py deleted file mode 100644 index f1fe624..0000000 --- a/imagekitio/constants/url.py +++ /dev/null @@ -1,4 +0,0 @@ -class URL: - API_BASE_URL = "https://api.imagekit.io" - UPLOAD_BASE_URL = "https://upload.imagekit.io" - BULK_FILE_DELETE = "/batch/deleteByFileIds" diff --git a/imagekitio/exceptions/BadRequestException.py b/imagekitio/exceptions/BadRequestException.py deleted file mode 100644 index df61561..0000000 --- a/imagekitio/exceptions/BadRequestException.py +++ /dev/null @@ -1,16 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class BadRequestException(Exception): - def __init__( - self, - message, - response_help, - response_metadata: ResponseMetadata = ResponseMetadata(None, None, None), - ): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/ConflictException.py b/imagekitio/exceptions/ConflictException.py deleted file mode 100644 index 4d1fb93..0000000 --- a/imagekitio/exceptions/ConflictException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class ConflictException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/ForbiddenException.py b/imagekitio/exceptions/ForbiddenException.py deleted file mode 100644 index 6f8bc45..0000000 --- a/imagekitio/exceptions/ForbiddenException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class ForbiddenException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/InternalServerException.py b/imagekitio/exceptions/InternalServerException.py deleted file mode 100644 index e841083..0000000 --- a/imagekitio/exceptions/InternalServerException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class InternalServerException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/NotFoundException.py b/imagekitio/exceptions/NotFoundException.py deleted file mode 100644 index 0a37f52..0000000 --- a/imagekitio/exceptions/NotFoundException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class NotFoundException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/PartialSuccessException.py b/imagekitio/exceptions/PartialSuccessException.py deleted file mode 100644 index 7ecf4c5..0000000 --- a/imagekitio/exceptions/PartialSuccessException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class PartialSuccessException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/TooManyRequestsException.py b/imagekitio/exceptions/TooManyRequestsException.py deleted file mode 100644 index 3405a76..0000000 --- a/imagekitio/exceptions/TooManyRequestsException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class TooManyRequestsException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/UnauthorizedException.py b/imagekitio/exceptions/UnauthorizedException.py deleted file mode 100644 index 66fd8f5..0000000 --- a/imagekitio/exceptions/UnauthorizedException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class UnauthorizedException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/UnknownException.py b/imagekitio/exceptions/UnknownException.py deleted file mode 100644 index ff507a2..0000000 --- a/imagekitio/exceptions/UnknownException.py +++ /dev/null @@ -1,11 +0,0 @@ -from ..models.results.ResponseMetadata import ResponseMetadata - - -class UnknownException(Exception): - def __init__(self, message, response_help, response_metadata: ResponseMetadata): - self.message = message - self.response_help = response_help - self.response_metadata = response_metadata - - def __str__(self): - return str(self.message) diff --git a/imagekitio/exceptions/__init__.py b/imagekitio/exceptions/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/imagekitio/file.py b/imagekitio/file.py deleted file mode 100644 index ad29a78..0000000 --- a/imagekitio/file.py +++ /dev/null @@ -1,829 +0,0 @@ -import ast -from json import dumps -from typing import Any, Dict - -from requests_toolbelt import MultipartEncoder - -from .constants.errors import ERRORS -from .constants.files import VALID_FILE_OPTIONS, VALID_UPLOAD_OPTIONS -from .constants.url import URL -from .exceptions.BadRequestException import BadRequestException -from .exceptions.ConflictException import ConflictException -from .exceptions.NotFoundException import NotFoundException -from .exceptions.UnknownException import UnknownException -from .models.CopyFileRequestOptions import CopyFileRequestOptions -from .models.CopyFolderRequestOptions import CopyFolderRequestOptions -from .models.CreateCustomMetadataFieldsRequestOptions import ( - CreateCustomMetadataFieldsRequestOptions, -) -from .models.CreateFolderRequestOptions import CreateFolderRequestOptions -from .models.DeleteFolderRequestOptions import DeleteFolderRequestOptions -from .models.ListAndSearchFileRequestOptions import ListAndSearchFileRequestOptions -from .models.MoveFileRequestOptions import MoveFileRequestOptions -from .models.MoveFolderRequestOptions import MoveFolderRequestOptions -from .models.RenameFileRequestOptions import RenameFileRequestOptions -from .models.UpdateCustomMetadataFieldsRequestOptions import ( - UpdateCustomMetadataFieldsRequestOptions, -) -from .models.UpdateFileRequestOptions import UpdateFileRequestOptions -from .models.UploadFileRequestOptions import UploadFileRequestOptions -from .models.results.BulkDeleteFileResult import BulkDeleteFileResult -from .models.results.CustomMetadataFieldsResult import CustomMetadataFieldsResult -from .models.results.CustomMetadataFieldsResultWithResponseMetadata import ( - CustomMetadataFieldsResultWithResponseMetadata, -) -from .models.results.FileResult import FileResult -from .models.results.FileResultWithResponseMetadata import ( - FileResultWithResponseMetadata, -) -from .models.results.FolderResult import FolderResult -from .models.results.GetBulkJobStatusResult import GetBulkJobStatusResult -from .models.results.GetMetadataResult import GetMetadataResult -from .models.results.ListCustomMetadataFieldsResult import ( - ListCustomMetadataFieldsResult, -) -from .models.results.ListFileResult import ListFileResult -from .models.results.PurgeCacheResult import PurgeCacheResult -from .models.results.PurgeCacheStatusResult import PurgeCacheStatusResult -from .models.results.RenameFileResult import RenameFileResult -from .models.results.ResponseMetadataResult import ResponseMetadataResult -from .models.results.TagsResult import TagsResult -from .models.results.UploadFileResult import UploadFileResult -from .utils.formatter import ( - request_formatter, - snake_to_lower_camel, -) -from .utils.utils import ( - general_api_throw_exception, - get_response_json, - populate_response_metadata, - convert_to_response_object, - convert_to_list_response_object, - throw_other_exception, - convert_to_response_metadata_result_object, -) - -from io import BufferedReader - -class File(object): - def __init__(self, request_obj): - self.request = request_obj - - def upload( - self, file, file_name, options: UploadFileRequestOptions = None - ) -> UploadFileResult: - """Upload file to server using local image or url - :param file: either local file path or network file path - :param file_name: intended file name - :param options: intended options - :return: UploadFileResult - """ - if not file: - raise TypeError(ERRORS.MISSING_UPLOAD_FILE_PARAMETER.value) - if not file_name: - raise TypeError(ERRORS.MISSING_UPLOAD_FILENAME_PARAMETER.value) - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - headers = self.request.create_headers() - files = { - "file": file, - "fileName": file_name, - } - if not options: - options = dict() - else: - options = self.validate_upload(options.__dict__) - if options is False: - raise ValueError("Invalid upload options") - if isinstance(file,BufferedReader): - files.update({"file": (file_name,file,None)}) - elif isinstance(file, str) or isinstance(file, bytes): - files.update({"file": (None, file)}) - if "overwriteAiTags" in options: - options["overwriteAITags"] = options["overwriteAiTags"] - del options["overwriteAiTags"] - all_fields = {**files, **options} - multipart_data = MultipartEncoder( - fields=all_fields, boundary="--randomBoundary---------------------" - ) - headers.update({"Content-Type": multipart_data.content_type}) - resp = self.request.request( - "Post", url=url, data=multipart_data.read(), headers=headers - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, UploadFileResult) - return response - else: - general_api_throw_exception(resp) - - def list(self, options: ListAndSearchFileRequestOptions = None) -> ListFileResult: - """Returns list files on ImageKit Server - :param: options dictionary of options - :return: ListFileResult - """ - if options is not None: - if "tags" in options.__dict__ and isinstance(options.tags, list): - val = ", ".join(options.tags) - if val: - options.tags = val - formatted_options = request_formatter(options.__dict__) - if not self.is_valid_list_options(formatted_options): - raise ValueError("Invalid option for list_files") - else: - formatted_options = dict() - url = "{}/v1/files".format(URL.API_BASE_URL) - headers = self.request.create_headers() - resp = self.request.request( - method="GET", url=url, headers=headers, params=formatted_options - ) - if resp.status_code == 200: - response = convert_to_list_response_object(resp, FileResult, ListFileResult) - return response - else: - general_api_throw_exception(resp) - - def details(self, file_id: str = None) -> FileResultWithResponseMetadata: - """returns file detail""" - if not file_id: - raise TypeError(ERRORS.FILE_ID_MISSING.value) - url = "{}/v1/files/{}/details".format(URL.API_BASE_URL, file_id) - resp = self.request.request( - method="GET", - url=url, - headers=self.request.create_headers(), - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, FileResultWithResponseMetadata) - return response - else: - general_api_throw_exception(resp) - - def get_file_versions(self, file_id: str = None) -> ListFileResult: - """returns file versions""" - if not file_id: - raise TypeError(ERRORS.FILE_ID_MISSING.value) - url = "{}/v1/files/{}/versions".format(URL.API_BASE_URL, file_id) - resp = self.request.request( - method="GET", - url=url, - headers=self.request.create_headers(), - ) - if resp.status_code == 200: - response = convert_to_list_response_object(resp, FileResult, ListFileResult) - return response - elif resp.status_code == 404: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def get_file_version_details( - self, file_id: str = None, version_id: str = None - ) -> FileResultWithResponseMetadata: - """returns file version detail""" - if not file_id: - raise TypeError(ERRORS.FILE_ID_MISSING.value) - if not version_id: - raise TypeError(ERRORS.VERSION_ID_MISSING.value) - url = "{}/v1/files/{}/versions/{}".format(URL.API_BASE_URL, file_id, version_id) - resp = self.request.request( - method="GET", - url=url, - headers=self.request.create_headers(), - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, FileResultWithResponseMetadata) - return response - elif resp.status_code == 404: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def update_file_details( - self, file_id: str, options: UpdateFileRequestOptions = None - ) -> FileResultWithResponseMetadata: - """Update detail of a file(like tags, coordinates) - update details identified by file_id and options, - which is already uploaded - """ - if not file_id: - raise TypeError(ERRORS.FILE_ID_MISSING.value) - url = "{}/v1/files/{}/details/".format(URL.API_BASE_URL, file_id) - headers = {"Content-Type": "application/json"} - headers.update(self.request.get_auth_headers()) - formatted_options = request_formatter(options.__dict__) - if "removeAiTags" in formatted_options: - remove_ai_tags_dict = {"removeAITags": formatted_options["removeAiTags"]} - del formatted_options["removeAiTags"] - request_data = {**remove_ai_tags_dict, **formatted_options} - else: - request_data = formatted_options - data = dumps(request_data) if options is not None else dict() - resp = self.request.request(method="Patch", url=url, headers=headers, data=data) - if resp.status_code == 200: - response = convert_to_response_object(resp, FileResultWithResponseMetadata) - return response - else: - general_api_throw_exception(resp) - - def manage_tags(self, file_ids, tags, action) -> TagsResult: - """Add or Remove tags of files - :param file_ids: array of file ids - :param tags: array of tags - :param action: to identify call either for removeTags or addTags - """ - url = ( - "{}/v1/files/removeTags".format(URL.API_BASE_URL) - if action == "removeTags" - else "{}/v1/files/addTags".format(URL.API_BASE_URL) - ) - headers = {"Content-Type": "application/json"} - headers.update(self.request.get_auth_headers()) - data = dumps({"fileIds": file_ids, "tags": tags}) - resp = self.request.request(method="Post", url=url, headers=headers, data=data) - if resp.status_code == 200: - response = convert_to_response_object(resp, TagsResult) - return response - elif resp.status_code == 207 or resp.status_code == 404: - throw_other_exception(resp) - else: - general_api_throw_exception(resp) - - def remove_ai_tags(self, file_ids, ai_tags) -> TagsResult: - """Remove AI tags of files - :param file_ids: array of file ids - :param ai_tags: array of AI tags - """ - url = "{}/v1/files/removeAITags".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(self.request.get_auth_headers()) - data = dumps({"fileIds": file_ids, "AITags": ai_tags}) - resp = self.request.request(method="Post", url=url, headers=headers, data=data) - if resp.status_code == 200: - response = convert_to_response_object(resp, TagsResult) - return response - elif resp.status_code == 207 or resp.status_code == 404: - throw_other_exception(resp) - else: - general_api_throw_exception(resp) - - def delete(self, file_id: str = None) -> ResponseMetadataResult: - """Delete file by file_id - deletes file from imagekit server - """ - if not file_id: - raise TypeError(ERRORS.FILE_ID_MISSING.value) - url = "{}/v1/files/{}".format(URL.API_BASE_URL, file_id) - resp = self.request.request( - method="Delete", url=url, headers=self.request.create_headers() - ) - if resp.status_code == 204: - response = convert_to_response_metadata_result_object(resp) - return response - else: - general_api_throw_exception(resp) - - def delete_file_version(self, file_id, version_id) -> ResponseMetadataResult: - """Delete file version by file_id and version_id""" - url = "{}/v1/files/{}/versions/{}".format(URL.API_BASE_URL, file_id, version_id) - headers = {"Content-Type": "application/json"} - headers.update(self.request.create_headers()) - resp = self.request.request(method="Delete", url=url, headers=headers) - if resp.status_code == 204: - response = convert_to_response_metadata_result_object(resp) - return response - elif resp.status_code == 400 or resp.status_code == 404: - response = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response) == str: - response = ast.literal_eval(response) - error_message = response["message"] if type(response) == dict else "" - response_help = response["help"] if type(response) == dict else "" - if resp.status_code == 400: - raise BadRequestException( - error_message, response_help, response_meta_data - ) - elif resp.status_code == 404: - raise NotFoundException( - error_message, response_help, response_meta_data - ) - else: - general_api_throw_exception(resp) - - def batch_delete(self, file_ids: list = None) -> BulkDeleteFileResult: - """Delete bulk files - Delete files by batch ids - """ - if not file_ids: - raise ValueError("Need to pass ids in list") - url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE - headers = {"Content-Type": "application/json"} - headers.update(self.request.create_headers()) - data = dumps({"fileIds": file_ids}) - resp = self.request.request(method="POST", url=url, headers=headers, data=data) - if resp.status_code == 200: - response = convert_to_response_object(resp, BulkDeleteFileResult) - return response - elif resp.status_code == 207 or resp.status_code == 404: - throw_other_exception(resp) - else: - general_api_throw_exception(resp) - - def copy_file( - self, options: CopyFileRequestOptions = None - ) -> ResponseMetadataResult: - """Copy file by provided sourceFilePath, destinationPath and includeFileVersions as an options""" - url = "{}/v1/files/copy".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(self.request.create_headers()) - formatted_options = ( - dumps(request_formatter(options.__dict__)) - if options is not None - else dict() - ) - resp = self.request.request( - method="Post", url=url, headers=headers, data=formatted_options - ) - if resp.status_code == 204: - response = convert_to_response_metadata_result_object(resp) - return response - elif resp.status_code == 404: - response = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response) == str: - response = ast.literal_eval(response) - error_message = response["message"] if type(response) == dict else "" - response_help = response["help"] if type(response) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def move_file( - self, options: MoveFileRequestOptions = None - ) -> ResponseMetadataResult: - """Move file by provided sourceFilePath and destinationPath as an options""" - url = "{}/v1/files/move".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(self.request.create_headers()) - formatted_options = ( - dumps(request_formatter(options.__dict__)) - if options is not None - else dict() - ) - resp = self.request.request( - method="Post", url=url, headers=headers, data=formatted_options - ) - if resp.status_code == 204: - response = convert_to_response_metadata_result_object(resp) - return response - elif resp.status_code == 404: - response = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response) == str: - response = ast.literal_eval(response) - error_message = response["message"] if type(response) == dict else "" - response_help = response["help"] if type(response) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def rename_file(self, options: RenameFileRequestOptions = None) -> RenameFileResult: - """Rename file by provided filePath, newFileName and purgeCache as an options""" - url = "{}/v1/files/rename".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(self.request.create_headers()) - formatted_options = ( - dumps(request_formatter(options.__dict__)) - if options is not None - else dict() - ) - resp = self.request.request( - method="Put", url=url, headers=headers, data=formatted_options - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, RenameFileResult) - return response - elif resp.status_code == 207 or resp.status_code == 404: - throw_other_exception(resp) - elif resp.status_code == 409: - response = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response) == str: - response = ast.literal_eval(response) - error_message = response["message"] if type(response) == dict else "" - response_help = response["help"] if type(response) == dict else "" - raise ConflictException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def restore_file_version( - self, file_id, version_id - ) -> FileResultWithResponseMetadata: - """Restore file by provided fileId and versionId""" - url = "{}/v1/files/{}/versions/{}/restore".format( - URL.API_BASE_URL, file_id, version_id - ) - headers = self.request.create_headers() - resp = self.request.request( - method="Put", - url=url, - headers=headers, - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, FileResultWithResponseMetadata) - return response - elif resp.status_code == 404: - response = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response) == str: - response = ast.literal_eval(response) - error_message = response["message"] if type(response) == dict else "" - response_help = response["help"] if type(response) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def create_folder( - self, options: CreateFolderRequestOptions = None - ) -> ResponseMetadataResult: - """Create folder by provided folderName and parentFolderPath as an options""" - url = "{}/v1/folder".format(URL.API_BASE_URL) - headers = self.request.create_headers() - headers.update({"Content-Type": "application/json"}) - formatted_data = ( - dumps(request_formatter(options.__dict__)) if options is not None else dict() - ) - resp = self.request.request( - method="Post", url=url, headers=headers, data=formatted_data - ) - if resp.status_code == 201: - response = convert_to_response_metadata_result_object(resp) - return response - else: - response = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response) == str: - response = ast.literal_eval(response) - error_message = response["message"] if type(response) == dict else "" - response_help = response["help"] if type(response) == dict else "" - raise UnknownException(error_message, response_help, response_meta_data) - - def delete_folder( - self, options: DeleteFolderRequestOptions = None - ) -> ResponseMetadataResult: - """Delete folder by provided folderPath as an options""" - url = "{}/v1/folder".format(URL.API_BASE_URL) - headers = self.request.create_headers() - headers.update({"Content-Type": "application/json"}) - formatted_data = ( - dumps(request_formatter(options.__dict__)) if options is not None else dict() - ) - resp = self.request.request( - method="Delete", url=url, headers=headers, data=formatted_data - ) - if resp.status_code == 204: - response = convert_to_response_metadata_result_object(resp) - return response - elif resp.status_code == 404: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def copy_folder(self, options: CopyFolderRequestOptions = None) -> FolderResult: - """Copy folder by provided sourceFolderPath, destinationPath and includeFileVersions as an options""" - url = "{}/v1/bulkJobs/copyFolder".format(URL.API_BASE_URL) - headers = self.request.create_headers() - headers.update({"Content-Type": "application/json"}) - formatted_data = ( - dumps(request_formatter(options.__dict__)) - if options is not None - else dict() - ) - resp = self.request.request( - method="Post", url=url, headers=headers, data=formatted_data - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, FolderResult) - return response - elif resp.status_code == 404: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def move_folder(self, options: MoveFolderRequestOptions = None) -> FolderResult: - """Move folder by provided sourceFolderPath and destinationPath as an options""" - url = "{}/v1/bulkJobs/moveFolder".format(URL.API_BASE_URL) - headers = self.request.create_headers() - headers.update({"Content-Type": "application/json"}) - formatted_data = ( - dumps(request_formatter(options.__dict__)) - if options is not None - else dict() - ) - resp = self.request.request( - method="Post", url=url, headers=headers, data=formatted_data - ) - - if resp.status_code == 200: - response = convert_to_response_object(resp, FolderResult) - return response - elif resp.status_code == 404: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - raise NotFoundException(error_message, response_help, response_meta_data) - else: - general_api_throw_exception(resp) - - def get_bulk_job_status(self, job_id) -> GetBulkJobStatusResult: - """Get bulk job status by provided only jobId""" - url = "{}/v1/bulkJobs/{}".format(URL.API_BASE_URL, job_id) - headers = self.request.create_headers() - resp = self.request.request( - method="Get", - url=url, - headers=headers, - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, GetBulkJobStatusResult) - return response - else: - general_api_throw_exception(resp) - - def purge_cache(self, file_url: str = None) -> PurgeCacheResult: - """Use from child class to purge cache""" - if not file_url: - raise TypeError(ERRORS.MISSING_FILE_URL.value) - url = URL.API_BASE_URL + "/v1/files/purge" - headers = {"Content-Type": "application/json"} - headers.update(self.request.get_auth_headers()) - body = {"url": file_url} - resp = self.request.request("Post", headers=headers, url=url, data=dumps(body)) - if resp.status_code == 201: - response = convert_to_response_object(resp, PurgeCacheResult) - return response - else: - general_api_throw_exception(resp) - - def get_purge_cache_status( - self, cache_request_id: str = None - ) -> PurgeCacheStatusResult: - """Get purge cache status by cache_request_id - :return: PurgeCacheStatusResult - """ - if not cache_request_id: - raise TypeError(ERRORS.CACHE_PURGE_STATUS_ID_MISSING.value) - - url = "{}/v1/files/purge/{}".format(URL.API_BASE_URL, cache_request_id) - headers = self.request.create_headers() - resp = self.request.request("GET", url, headers=headers) - if resp.status_code == 200: - response = convert_to_response_object(resp, PurgeCacheStatusResult) - return response - else: - general_api_throw_exception(resp) - - def get_metadata(self, file_id: str = None) -> GetMetadataResult: - """Get metadata by file_id""" - if not file_id: - raise TypeError(ERRORS.FILE_ID_MISSING.value) - - url = "{}/v1/files/{}/metadata".format(URL.API_BASE_URL, file_id) - resp = self.request.request("GET", url, headers=self.request.create_headers()) - if resp.status_code == 200: - response = convert_to_response_object(resp, GetMetadataResult) - return response - else: - general_api_throw_exception(resp) - - def get_metadata_from_remote_url(self, remote_file_url: str) -> GetMetadataResult: - """Get remote metadata by provided remote_file_url""" - if not remote_file_url: - raise ValueError("You must provide remote url") - url = "{}/v1/metadata".format(URL.API_BASE_URL) - param = {"url": remote_file_url} - resp = self.request.request( - "GET", url, headers=self.request.create_headers(), params=param - ) - if resp.status_code == 200: - response = convert_to_response_object(resp, GetMetadataResult) - return response - else: - general_api_throw_exception(resp) - - def create_custom_metadata_fields( - self, options: CreateCustomMetadataFieldsRequestOptions = None - ) -> CustomMetadataFieldsResultWithResponseMetadata: - """creates custom metadata fields by passing name, label and schema as an options""" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - if options is not None: - if "schema" in options.__dict__: - options.schema.__dict__ = request_formatter(options.schema.__dict__) - options_dict = options.__dict__ - if "schema" in options_dict: - options_dict["schema"] = options.schema.__dict__ - formatted_options = dumps(options_dict) - else: - formatted_options = dict() - - headers = {"Content-Type": "application/json"} - headers.update(self.request.create_headers()) - resp = self.request.request( - method="Post", url=url, headers=headers, data=formatted_options - ) - if resp.status_code == 201: - response = convert_to_response_object( - resp, CustomMetadataFieldsResultWithResponseMetadata - ) - return response - else: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - if resp.status_code == 400: - raise BadRequestException( - error_message, response_help, response_meta_data - ) - else: - raise UnknownException(error_message, response_help, response_meta_data) - - def get_custom_metadata_fields( - self, include_deleted: bool = False - ) -> ListCustomMetadataFieldsResult: - """get custom metadata fields""" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - param = {"includeDeleted": str(include_deleted).lower()} - resp = self.request.request( - method="GET", url=url, headers=self.request.create_headers(), params=param - ) - if resp.status_code == 200: - response = convert_to_list_response_object( - resp, CustomMetadataFieldsResult, ListCustomMetadataFieldsResult - ) - return response - else: - response = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response) == str: - response = ast.literal_eval(response) - error_message = response["message"] if type(response) == dict else "" - response_help = response["help"] if type(response) == dict else "" - raise UnknownException(error_message, response_help, response_meta_data) - - def update_custom_metadata_fields( - self, field_id, options: UpdateCustomMetadataFieldsRequestOptions = None - ) -> CustomMetadataFieldsResultWithResponseMetadata: - """updates custom metadata fields by passing id of custom metadata field and params as an options""" - if not field_id: - raise ValueError(ERRORS.MISSING_CUSTOM_METADATA_FIELD_ID) - url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, field_id) - if "schema" in options.__dict__: - options.schema.__dict__ = request_formatter(options.schema.__dict__) - options_dict = options.__dict__ - if "schema" in options_dict: - options_dict["schema"] = options.schema.__dict__ - formatted_options = dumps(request_formatter(options_dict)) - headers = {"Content-Type": "application/json"} - headers.update(self.request.create_headers()) - resp = self.request.request( - method="Patch", url=url, headers=headers, data=formatted_options - ) - if resp.status_code == 200: - response = convert_to_response_object( - resp, CustomMetadataFieldsResultWithResponseMetadata - ) - return response - else: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - if resp.status_code == 400: - raise BadRequestException( - error_message, response_help, response_meta_data - ) - elif resp.status_code == 404: - raise NotFoundException( - error_message, response_help, response_meta_data - ) - else: - raise UnknownException(error_message, response_help, response_meta_data) - - def delete_custom_metadata_field(self, field_id: str) -> ResponseMetadataResult: - """Deletes custom metadata fields by passing field_id""" - url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, field_id) - resp = self.request.request( - "Delete", url, headers=self.request.create_headers() - ) - if resp.status_code == 204: - response = convert_to_response_metadata_result_object(resp) - return response - else: - response_json = get_response_json(resp) - response_meta_data = populate_response_metadata(resp) - if type(response_json) == str: - response_json = ast.literal_eval(response_json) - error_message = ( - response_json["message"] if type(response_json) == dict else "" - ) - response_help = response_json["help"] if type(response_json) == dict else "" - if resp.status_code == 404: - raise NotFoundException( - error_message, response_help, response_meta_data - ) - else: - raise UnknownException(error_message, response_help, response_meta_data) - - def is_valid_list_options(self, options: Dict[str, Any]) -> bool: - """Returns if options are valid""" - valid_values = self.get_valid_list_values() - for key in options: - if key not in valid_values: - return False - return True - - @staticmethod - def get_valid_list_values(): - """Returns valid options for list files""" - return VALID_FILE_OPTIONS - - @staticmethod - def validate_upload(options): - """ - Validates upload value, checks if params are valid, - changes snake to camel case - """ - response_list = [] - for key, val in options.items(): - if key not in VALID_UPLOAD_OPTIONS: - return False - if type(val) == dict or type(val) == tuple: - options[key] = dumps(val) - continue - if key == "extensions": - options[key] = dumps(val) - continue - if key == "response_fields": - for i, j in enumerate(options[key]): - if j not in VALID_UPLOAD_OPTIONS: - return False - response_list.append(snake_to_lower_camel(j)) - val = ",".join(response_list) - if val: - options[key] = ",".join(response_list) - continue - if isinstance(val, list): - val = ",".join([str(i) for i in val]) - if val: - options[key] = val - continue - # imagekit server accepts 'true/false' - elif isinstance(val, bool): - val = str(val).lower() - if val: - options[key] = val - return request_formatter(options) diff --git a/imagekitio/models/CopyFileRequestOptions.py b/imagekitio/models/CopyFileRequestOptions.py deleted file mode 100644 index 0a47b60..0000000 --- a/imagekitio/models/CopyFileRequestOptions.py +++ /dev/null @@ -1,13 +0,0 @@ -class CopyFileRequestOptions: - def __init__( - self, - source_file_path: str = None, - destination_path: str = None, - include_file_versions: bool = None, - ): - if source_file_path is not None: - self.source_file_path = source_file_path - if destination_path is not None: - self.destination_path = destination_path - if include_file_versions is not None: - self.include_file_versions = include_file_versions diff --git a/imagekitio/models/CopyFolderRequestOptions.py b/imagekitio/models/CopyFolderRequestOptions.py deleted file mode 100644 index d4e4c30..0000000 --- a/imagekitio/models/CopyFolderRequestOptions.py +++ /dev/null @@ -1,13 +0,0 @@ -class CopyFolderRequestOptions: - def __init__( - self, - source_folder_path: str = None, - destination_path: str = None, - include_file_versions: bool = None, - ): - if source_folder_path is not None: - self.source_folder_path = source_folder_path - if destination_path is not None: - self.destination_path = destination_path - if include_file_versions is not None: - self.include_file_versions = include_file_versions diff --git a/imagekitio/models/CreateCustomMetadataFieldsRequestOptions.py b/imagekitio/models/CreateCustomMetadataFieldsRequestOptions.py deleted file mode 100644 index ffcc3bf..0000000 --- a/imagekitio/models/CreateCustomMetadataFieldsRequestOptions.py +++ /dev/null @@ -1,36 +0,0 @@ -from ..models.CustomMetadataFieldsSchema import CustomMetadataFieldsSchema - - -class CreateCustomMetadataFieldsRequestOptions: - def __init__( - self, - name: str = None, - label: str = None, - schema: CustomMetadataFieldsSchema = None, - ): - self.name = name - self.label = label - if schema is None or schema == {}: - CustomMetadataFieldsSchema(None, None, None, None, None, None, None, None) - else: - if type(schema) == CustomMetadataFieldsSchema: - self.schema = schema - else: - self.schema = ( - CustomMetadataFieldsSchema( - schema["type"] if "type" in schema else None, - schema["select_options"] - if "select_options" in schema - else None, - schema["default_value"] if "default_value" in schema else None, - schema["is_value_required"] - if "is_value_required" in schema - else None, - schema["min_value"] if "min_value" in schema else None, - schema["max_value"] if "max_value" in schema else None, - schema["min_length"] if "min_length" in schema else None, - schema["max_length"], - ) - if "max_length" in schema - else None - ) diff --git a/imagekitio/models/CreateFolderRequestOptions.py b/imagekitio/models/CreateFolderRequestOptions.py deleted file mode 100644 index de3fcef..0000000 --- a/imagekitio/models/CreateFolderRequestOptions.py +++ /dev/null @@ -1,6 +0,0 @@ -class CreateFolderRequestOptions: - def __init__(self, folder_name: str = None, parent_folder_path: str = None): - if folder_name is not None: - self.folder_name = folder_name - if parent_folder_path is not None: - self.parent_folder_path = parent_folder_path diff --git a/imagekitio/models/CustomMetaDataTypeEnum.py b/imagekitio/models/CustomMetaDataTypeEnum.py deleted file mode 100644 index 9740e58..0000000 --- a/imagekitio/models/CustomMetaDataTypeEnum.py +++ /dev/null @@ -1,11 +0,0 @@ -from enum import Enum - - -class CustomMetaDataTypeEnum(Enum): - Text = 1 - Textarea = 2 - Number = 3 - Date = 4 - Boolean = 5 - SingleSelect = 6 - MultiSelect = 7 diff --git a/imagekitio/models/CustomMetadataFieldsSchema.py b/imagekitio/models/CustomMetadataFieldsSchema.py deleted file mode 100644 index 9f667a6..0000000 --- a/imagekitio/models/CustomMetadataFieldsSchema.py +++ /dev/null @@ -1,31 +0,0 @@ -from ..models.CustomMetaDataTypeEnum import CustomMetaDataTypeEnum - - -class CustomMetadataFieldsSchema: - def __init__( - self, - type: CustomMetaDataTypeEnum = None, - select_options=None, - default_value=None, - is_value_required: bool = None, - min_value=None, - max_value=None, - min_length: int = None, - max_length: int = None, - ): - if type is not None: - self.type = type.name - if select_options is not None: - self.select_options = select_options - if default_value is not None: - self.default_value = default_value - if is_value_required is not None: - self.is_value_required = is_value_required - if min_value is not None: - self.min_value = min_value - if max_value is not None: - self.max_value = max_value - if min_length is not None: - self.min_length = min_length - if max_length is not None: - self.max_length = max_length diff --git a/imagekitio/models/DeleteFolderRequestOptions.py b/imagekitio/models/DeleteFolderRequestOptions.py deleted file mode 100644 index dd1fcd6..0000000 --- a/imagekitio/models/DeleteFolderRequestOptions.py +++ /dev/null @@ -1,4 +0,0 @@ -class DeleteFolderRequestOptions: - def __init__(self, folder_path: str = None): - if folder_path is not None: - self.folder_path = folder_path diff --git a/imagekitio/models/ListAndSearchFileRequestOptions.py b/imagekitio/models/ListAndSearchFileRequestOptions.py deleted file mode 100644 index 3b834f2..0000000 --- a/imagekitio/models/ListAndSearchFileRequestOptions.py +++ /dev/null @@ -1,31 +0,0 @@ -import array - - -class ListAndSearchFileRequestOptions: - def __init__( - self, - type: str = None, - sort: str = None, - path: str = None, - search_query: str = None, - file_type: str = None, - limit: int = None, - skip: int = None, - tags=None, - ): - if type is not None: - self.type = type - if sort is not None: - self.sort = sort - if path is not None: - self.path = path - if search_query is not None: - self.search_query = search_query - if file_type is not None: - self.file_type = file_type - if limit is not None: - self.limit = limit - if skip is not None: - self.skip = skip - if tags is not None: - self.tags = tags diff --git a/imagekitio/models/MoveFileRequestOptions.py b/imagekitio/models/MoveFileRequestOptions.py deleted file mode 100644 index cf68f31..0000000 --- a/imagekitio/models/MoveFileRequestOptions.py +++ /dev/null @@ -1,6 +0,0 @@ -class MoveFileRequestOptions: - def __init__(self, source_file_path: str = None, destination_path: str = None): - if source_file_path is not None: - self.source_file_path = source_file_path - if destination_path is not None: - self.destination_path = destination_path diff --git a/imagekitio/models/MoveFolderRequestOptions.py b/imagekitio/models/MoveFolderRequestOptions.py deleted file mode 100644 index bfd9c58..0000000 --- a/imagekitio/models/MoveFolderRequestOptions.py +++ /dev/null @@ -1,6 +0,0 @@ -class MoveFolderRequestOptions: - def __init__(self, source_folder_path: str = None, destination_path: str = None): - if source_folder_path is not None: - self.source_folder_path = source_folder_path - if destination_path is not None: - self.destination_path = destination_path diff --git a/imagekitio/models/RenameFileRequestOptions.py b/imagekitio/models/RenameFileRequestOptions.py deleted file mode 100644 index 60d74b4..0000000 --- a/imagekitio/models/RenameFileRequestOptions.py +++ /dev/null @@ -1,10 +0,0 @@ -class RenameFileRequestOptions: - def __init__( - self, file_path: str = None, new_file_name: str = None, purge_cache: bool = None - ): - if file_path is not None: - self.file_path = file_path - if new_file_name is not None: - self.new_file_name = new_file_name - if purge_cache is not None: - self.purge_cache = purge_cache diff --git a/imagekitio/models/UpdateCustomMetadataFieldsRequestOptions.py b/imagekitio/models/UpdateCustomMetadataFieldsRequestOptions.py deleted file mode 100644 index 92294a1..0000000 --- a/imagekitio/models/UpdateCustomMetadataFieldsRequestOptions.py +++ /dev/null @@ -1,30 +0,0 @@ -from ..models.CustomMetadataFieldsSchema import CustomMetadataFieldsSchema - - -class UpdateCustomMetadataFieldsRequestOptions: - def __init__(self, label: str = None, schema: CustomMetadataFieldsSchema = None): - self.label = label - if schema is None or schema == {}: - CustomMetadataFieldsSchema(None, None, None, None, None, None, None, None) - else: - if type(schema) == CustomMetadataFieldsSchema: - self.schema = schema - else: - self.schema = ( - CustomMetadataFieldsSchema( - schema["type"] if "type" in schema else None, - schema["select_options"] - if "select_options" in schema - else None, - schema["default_value"] if "default_value" in schema else None, - schema["is_value_required"] - if "is_value_required" in schema - else None, - schema["min_value"] if "min_value" in schema else None, - schema["max_value"] if "max_value" in schema else None, - schema["min_length"] if "min_length" in schema else None, - schema["max_length"], - ) - if "max_length" in schema - else None - ) diff --git a/imagekitio/models/UpdateFileRequestOptions.py b/imagekitio/models/UpdateFileRequestOptions.py deleted file mode 100644 index c1f5f3d..0000000 --- a/imagekitio/models/UpdateFileRequestOptions.py +++ /dev/null @@ -1,29 +0,0 @@ -import json -from typing import List - - -class UpdateFileRequestOptions: - def __init__( - self, - remove_ai_tags: List[str] = None, - webhook_url: str = None, - extensions: json = None, - tags: List[str] = None, - custom_coordinates: str = None, - custom_metadata: json = None, - publish: json = None, - ): - if publish is not None: - self.publish = publish - if remove_ai_tags is not None: - self.remove_ai_tags = remove_ai_tags - if webhook_url is not None: - self.webhook_url = webhook_url - if extensions is not None: - self.extensions = extensions - if tags is not None: - self.tags = tags - if custom_coordinates is not None: - self.custom_coordinates = custom_coordinates - if custom_metadata is not None: - self.custom_metadata = custom_metadata diff --git a/imagekitio/models/UploadFileRequestOptions.py b/imagekitio/models/UploadFileRequestOptions.py deleted file mode 100644 index 98bd059..0000000 --- a/imagekitio/models/UploadFileRequestOptions.py +++ /dev/null @@ -1,56 +0,0 @@ -import json -from typing import List - - -class UploadFileRequestOptions: - def __init__( - self, - use_unique_file_name: bool = None, - tags: List[str] = None, - folder: str = None, - is_private_file: bool = None, - custom_coordinates: str = None, - response_fields: List[str] = None, - extensions: json = None, - webhook_url: str = None, - overwrite_file: bool = None, - overwrite_ai_tags: bool = None, - overwrite_tags: bool = None, - overwrite_custom_metadata: bool = None, - custom_metadata: json = None, - transformation: json = None, - checks: str = None, - is_published: bool = None, - ): - if use_unique_file_name is not None: - self.use_unique_file_name = use_unique_file_name - if tags is not None: - self.tags = tags - if folder is not None: - self.folder = folder - if is_private_file is not None: - self.is_private_file = is_private_file - if custom_coordinates is not None: - self.custom_coordinates = custom_coordinates - if response_fields is not None: - self.response_fields = response_fields - if extensions is not None: - self.extensions = extensions - if webhook_url is not None: - self.webhook_url = webhook_url - if overwrite_file is not None: - self.overwrite_file = overwrite_file - if overwrite_ai_tags is not None: - self.overwrite_ai_tags = overwrite_ai_tags - if overwrite_tags is not None: - self.overwrite_tags = overwrite_tags - if overwrite_custom_metadata is not None: - self.overwrite_custom_metadata = overwrite_custom_metadata - if custom_metadata is not None: - self.custom_metadata = custom_metadata - if transformation is not None: - self.transformation = transformation - if checks is not None: - self.checks = checks - if is_published is not None: - self.is_published = is_published diff --git a/imagekitio/models/__init__.py b/imagekitio/models/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/imagekitio/models/results/AITags.py b/imagekitio/models/results/AITags.py deleted file mode 100644 index 19aaad4..0000000 --- a/imagekitio/models/results/AITags.py +++ /dev/null @@ -1,10 +0,0 @@ -class AITags: - def __init__(self, name=None, confidence=None, source=None,**kwargs): - self.name = name - self.confidence = confidence - self.source = source - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - diff --git a/imagekitio/models/results/BulkDeleteFileResult.py b/imagekitio/models/results/BulkDeleteFileResult.py deleted file mode 100644 index c5aab30..0000000 --- a/imagekitio/models/results/BulkDeleteFileResult.py +++ /dev/null @@ -1,20 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class BulkDeleteFileResult: - def __init__(self, successfully_deleted_file_ids=None,**kwargs): - self.successfully_deleted_file_ids = successfully_deleted_file_ids - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/CustomMetadataFieldsResult.py b/imagekitio/models/results/CustomMetadataFieldsResult.py deleted file mode 100644 index c96a464..0000000 --- a/imagekitio/models/results/CustomMetadataFieldsResult.py +++ /dev/null @@ -1,23 +0,0 @@ -from .CustomMetadataSchema import CustomMetadataSchema -from ...utils.utils import camel_dict_to_snake_dict - -class CustomMetadataFieldsResult: - def __init__( - self, - id=None, - name=None, - label=None, - schema: dict = {}, - **kwargs - ): - self.id = id - self.name = name - self.label = label - self.schema = CustomMetadataSchema( - **camel_dict_to_snake_dict(schema) - ) - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - diff --git a/imagekitio/models/results/CustomMetadataFieldsResultWithResponseMetadata.py b/imagekitio/models/results/CustomMetadataFieldsResultWithResponseMetadata.py deleted file mode 100644 index d7d611b..0000000 --- a/imagekitio/models/results/CustomMetadataFieldsResultWithResponseMetadata.py +++ /dev/null @@ -1,18 +0,0 @@ -from .CustomMetadataFieldsResult import CustomMetadataFieldsResult -from .CustomMetadataSchema import CustomMetadataSchema -from .ResponseMetadata import ResponseMetadata - - -class CustomMetadataFieldsResultWithResponseMetadata(CustomMetadataFieldsResult): - def __init__( - self, - id=None, - name=None, - label=None, - schema:dict = {}, - **kwargs - ): - super(CustomMetadataFieldsResultWithResponseMetadata, self).__init__( - id, name, label, schema,**kwargs - ) - self.response_metadata: ResponseMetadata = ResponseMetadata("", "", "") diff --git a/imagekitio/models/results/CustomMetadataSchema.py b/imagekitio/models/results/CustomMetadataSchema.py deleted file mode 100644 index 76e42a5..0000000 --- a/imagekitio/models/results/CustomMetadataSchema.py +++ /dev/null @@ -1,27 +0,0 @@ -class CustomMetadataSchema: - def __init__( - self, - type=None, - select_options=None, - default_value=None, - is_value_required=None, - min_value=None, - max_value=None, - min_length=None, - max_length=None, - **kwargs - - ): - self.type = type - self.select_options = select_options - self.default_value = default_value - self.is_value_required = is_value_required - self.min_value = min_value - self.max_value = max_value - self.min_length = min_length - self.max_length = max_length - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - diff --git a/imagekitio/models/results/EmbeddedMetadata.py b/imagekitio/models/results/EmbeddedMetadata.py deleted file mode 100644 index d6828b6..0000000 --- a/imagekitio/models/results/EmbeddedMetadata.py +++ /dev/null @@ -1,15 +0,0 @@ -class EmbeddedMetadata: - - def __init__(self, x_resolution=None, y_resolution=None, date_created=None, date_time_created=None,**kwargs): - self.x_resolution = x_resolution - self.y_resolution = y_resolution - self.date_created = date_created - self.date_time_created = date_time_created - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - - def __getattr__(self,attr): - return None - - - diff --git a/imagekitio/models/results/FileResult.py b/imagekitio/models/results/FileResult.py deleted file mode 100644 index 6431eb1..0000000 --- a/imagekitio/models/results/FileResult.py +++ /dev/null @@ -1,66 +0,0 @@ -from typing import List -from .AITags import AITags -from .VersionInfo import VersionInfo -from ...utils.utils import camel_dict_to_snake_dict - -class FileResult: - def __init__( - self, - type=None, - name=None, - created_at=None, - updated_at=None, - file_id=None, - tags=None, - ai_tags: List[AITags] = [], - version_info: dict = {}, - embedded_metadata: dict = {}, - custom_coordinates: str = "", - custom_metadata: dict = {}, - is_private_file=False, - url: str = "", - thumbnail: str = "", - file_type: str = "", - file_path: str = "", - height: int = None, - width: int = None, - size: int = None, - has_alpha=False, - mime: str = None, - extension_status: dict = {}, - **kwargs - ): - self.type = type - self.name = name - self.created_at = created_at - self.updated_at = updated_at - self.file_id = file_id - self.tags = tags - self.ai_tags: List[AITags] = [] - if ai_tags is not None: - for i in ai_tags: - self.ai_tags.append( - AITags( - **camel_dict_to_snake_dict(i) - ) - ) - self.version_info = VersionInfo(**camel_dict_to_snake_dict(version_info)) - self.embedded_metadata = embedded_metadata - self.custom_coordinates = custom_coordinates - self.custom_metadata = custom_metadata - self.is_private_file = is_private_file - self.url = url - self.thumbnail = thumbnail - self.file_type = file_type - self.file_path = file_path - self.height = height - self.width = width - self.size = size - self.has_alpha = has_alpha - self.mime = mime - self.extension_status = extension_status - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - diff --git a/imagekitio/models/results/FileResultWithResponseMetadata.py b/imagekitio/models/results/FileResultWithResponseMetadata.py deleted file mode 100644 index f424299..0000000 --- a/imagekitio/models/results/FileResultWithResponseMetadata.py +++ /dev/null @@ -1,61 +0,0 @@ -from typing import List - -from .AITags import AITags -from .FileResult import FileResult -from .ResponseMetadata import ResponseMetadata -from .VersionInfo import VersionInfo - - -class FileResultWithResponseMetadata(FileResult): - def __init__( - self, - type=None, - name=None, - created_at=None, - updated_at=None, - file_id=None, - tags=None, - ai_tags: List[AITags] = [], - version_info: dict = {}, - embedded_metadata=None, - custom_coordinates: str = "", - custom_metadata=None, - is_private_file=False, - url: str = "", - thumbnail: str = "", - file_type: str = "", - file_path: str = "", - height: int = None, - width: int = None, - size: int = None, - has_alpha=False, - mime: str = None, - extension_status=None, - **kwargs - ): - super().__init__( - type, - name, - created_at, - updated_at, - file_id, - tags, - ai_tags, - version_info, - embedded_metadata, - custom_coordinates, - custom_metadata, - is_private_file, - url, - thumbnail, - file_type, - file_path, - height, - width, - size, - has_alpha, - mime, - extension_status, - **kwargs - ) - self.response_metadata: ResponseMetadata = ResponseMetadata("", "", "") diff --git a/imagekitio/models/results/FolderResult.py b/imagekitio/models/results/FolderResult.py deleted file mode 100644 index b720245..0000000 --- a/imagekitio/models/results/FolderResult.py +++ /dev/null @@ -1,20 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class FolderResult: - def __init__(self, job_id=None,**kwargs): - self.job_id = job_id - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/GetBulkJobStatusResult.py b/imagekitio/models/results/GetBulkJobStatusResult.py deleted file mode 100644 index 8df6e1e..0000000 --- a/imagekitio/models/results/GetBulkJobStatusResult.py +++ /dev/null @@ -1,22 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class GetBulkJobStatusResult: - def __init__(self, job_id=None, type=None, status=None,**kwargs): - self.job_id = job_id - self.type = type - self.status = status - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/GetMetadataResult.py b/imagekitio/models/results/GetMetadataResult.py deleted file mode 100644 index 82e282f..0000000 --- a/imagekitio/models/results/GetMetadataResult.py +++ /dev/null @@ -1,51 +0,0 @@ -from .MetadataExifExif import MetadataExifExif -from .MetadataExifGPS import MetadataExifGPS -from .MetadataExifInteroperability import MetadataExifInteroperability -from .MetadataExifThumbnail import MetadataExifThumbnail -from .MetadataExif import MetadataExif -from .MetadataExifImage import MetadataExifImage -from .ResponseMetadata import ResponseMetadata -from ...utils.utils import camel_dict_to_snake_dict - - -class GetMetadataResult: - def __init__( - self, - height=None, - width=None, - size=None, - format=None, - has_color_profile=None, - quality=None, - density=None, - has_transparency=None, - p_hash=None, - exif: dict = {}, - **kwargs - ): - self.height = height - self.width = width - self.size = size - self.format = format - self.has_color_profile = has_color_profile - self.quality = quality - self.density = density - self.has_transparency = has_transparency - self.p_hash = p_hash - self.exif: MetadataExif = MetadataExif( - ** camel_dict_to_snake_dict(exif) - ) - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/ListCustomMetadataFieldsResult.py b/imagekitio/models/results/ListCustomMetadataFieldsResult.py deleted file mode 100644 index 23ba45f..0000000 --- a/imagekitio/models/results/ListCustomMetadataFieldsResult.py +++ /dev/null @@ -1,18 +0,0 @@ -from typing import List - -from .CustomMetadataFieldsResult import CustomMetadataFieldsResult -from .ResponseMetadata import ResponseMetadata - - -class ListCustomMetadataFieldsResult: - def __init__(self, list: List[CustomMetadataFieldsResult]): - self.list = list - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/ListFileResult.py b/imagekitio/models/results/ListFileResult.py deleted file mode 100644 index 7db8cce..0000000 --- a/imagekitio/models/results/ListFileResult.py +++ /dev/null @@ -1,17 +0,0 @@ -from typing import List -from .FileResult import FileResult -from .ResponseMetadata import ResponseMetadata - - -class ListFileResult: - def __init__(self, list: List[FileResult] = None): - self.list = list - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/MetadataExif.py b/imagekitio/models/results/MetadataExif.py deleted file mode 100644 index d38add9..0000000 --- a/imagekitio/models/results/MetadataExif.py +++ /dev/null @@ -1,105 +0,0 @@ -from .MetadataExifExif import MetadataExifExif -from .MetadataExifGPS import MetadataExifGPS -from .MetadataExifInteroperability import MetadataExifInteroperability -from .MetadataExifThumbnail import MetadataExifThumbnail -from .MetadataExifImage import MetadataExifImage -from ...utils.utils import camel_dict_to_snake_dict - - -class MetadataExif: - def __init__( - self, - image: MetadataExifImage = None, - thumbnail: MetadataExifThumbnail = None, - exif: MetadataExifExif = None, - gps: MetadataExifGPS = None, - interoperability: MetadataExifInteroperability = None, - makernote=None, - ** kwargs - ): - if makernote is None: - makernote = {} - if image is None or image == {}: - self.image = MetadataExifImage( - None, None, None, None, None, None, None, None, None, None, None - ) - else: - if type(image) == MetadataExifImage: - self.image = image - else: - self.image = MetadataExifImage( - **camel_dict_to_snake_dict(image) - ) - - if thumbnail is None or thumbnail == {}: - self.thumbnail = MetadataExifThumbnail(None, None, None, None, None, None) - else: - if type(thumbnail) == MetadataExifThumbnail: - self.thumbnail = thumbnail - else: - self.thumbnail = MetadataExifThumbnail( - **camel_dict_to_snake_dict(thumbnail) - ) - if exif is None or exif == {}: - self.exif = MetadataExifExif( - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - None, - ) - else: - if type(exif) == MetadataExifExif: - self.exif = exif - else: - self.exif = MetadataExifExif( - **camel_dict_to_snake_dict(exif) - ) - if gps is None or gps == {}: - self.gps = MetadataExifGPS(None) - else: - if type(gps) == MetadataExifGPS: - self.gps = gps - else: - self.gps = MetadataExifGPS( - **camel_dict_to_snake_dict(gps) - ) - - if interoperability is None or interoperability == {}: - self.interoperability = MetadataExifInteroperability(None, None) - else: - if type(interoperability) == MetadataExifInteroperability: - self.interoperability = interoperability - else: - self.interoperability = MetadataExifInteroperability( - **camel_dict_to_snake_dict(interoperability) - ) - - self.makernote = makernote - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None diff --git a/imagekitio/models/results/MetadataExifExif.py b/imagekitio/models/results/MetadataExifExif.py deleted file mode 100644 index fef646a..0000000 --- a/imagekitio/models/results/MetadataExifExif.py +++ /dev/null @@ -1,65 +0,0 @@ -class MetadataExifExif: - def __init__( - self, - exposure_time=None, - f_number=None, - exposure_program=None, - iso=None, - exif_version=None, - date_time_original=None, - create_date=None, - shutter_speed_value=None, - aperture_value=None, - exposure_compensation=None, - metering_mode=None, - flash=None, - focal_length=None, - sub_sec_time=None, - sub_sec_time_original=None, - sub_sec_time_digitized=None, - flashpix_version=None, - color_space=None, - exif_image_width=None, - exif_image_height=None, - interop_offset=None, - focal_plane_x_resolution=None, - focal_plane_y_resolution=None, - focal_plane_resolution_unit=None, - custom_rendered=None, - exposure_mode=None, - white_balance=None, - scene_capture_type=None, - **kwargs - ): - self.exposure_time = exposure_time - self.f_number = f_number - self.exposure_program = exposure_program - self.iso = iso - self.exif_version = exif_version - self.date_time_original = date_time_original - self.create_date = create_date - self.shutter_speed_value = shutter_speed_value - self.aperture_value = aperture_value - self.exposure_compensation = exposure_compensation - self.metering_mode = metering_mode - self.flash = flash - self.focal_length = focal_length - self.sub_sec_time = sub_sec_time - self.sub_sec_time_original = sub_sec_time_original - self.sub_sec_time_digitized = sub_sec_time_digitized - self.flashpix_version = flashpix_version - self.color_space = color_space - self.exif_image_width = exif_image_width - self.exif_image_height = exif_image_height - self.interop_offset = interop_offset - self.focal_plane_x_resolution = focal_plane_x_resolution - self.focal_plane_y_resolution = focal_plane_y_resolution - self.focal_plane_resolution_unit = focal_plane_resolution_unit - self.custom_rendered = custom_rendered - self.exposure_mode = exposure_mode - self.white_balance = white_balance - self.scene_capture_type = scene_capture_type - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None diff --git a/imagekitio/models/results/MetadataExifGPS.py b/imagekitio/models/results/MetadataExifGPS.py deleted file mode 100644 index 452fa41..0000000 --- a/imagekitio/models/results/MetadataExifGPS.py +++ /dev/null @@ -1,14 +0,0 @@ -from typing import List - - -class MetadataExifGPS: - def __init__(self, gps_version_id=None,**kwargs): - if gps_version_id is None: - gps_version_id = [] - self.gps_version_id: List[int] = [] - for i in gps_version_id: - self.gps_version_id.append(i) - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None diff --git a/imagekitio/models/results/MetadataExifImage.py b/imagekitio/models/results/MetadataExifImage.py deleted file mode 100644 index 108aced..0000000 --- a/imagekitio/models/results/MetadataExifImage.py +++ /dev/null @@ -1,31 +0,0 @@ -class MetadataExifImage: - def __init__( - self, - make=None, - model=None, - orientation=None, - x_resolution=None, - y_resolution=None, - resolution_unit=None, - software=None, - modify_date=None, - y_cb_cr_positioning=None, - exif_offset=None, - gps_info=None, - **kwargs - ): - self.make = make - self.model = model - self.orientation = orientation - self.x_resolution = x_resolution - self.y_resolution = y_resolution - self.resolution_unit = resolution_unit - self.software = software - self.modify_date = modify_date - self.y_cb_cr_positioning = y_cb_cr_positioning - self.exif_offset = exif_offset - self.gps_info = gps_info - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None diff --git a/imagekitio/models/results/MetadataExifInteroperability.py b/imagekitio/models/results/MetadataExifInteroperability.py deleted file mode 100644 index a6a8a4f..0000000 --- a/imagekitio/models/results/MetadataExifInteroperability.py +++ /dev/null @@ -1,9 +0,0 @@ -class MetadataExifInteroperability: - def __init__(self, interop_index=None, interop_version=None,**kwargs): - self.interop_index = interop_index - self.interop_version = interop_version - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - diff --git a/imagekitio/models/results/MetadataExifThumbnail.py b/imagekitio/models/results/MetadataExifThumbnail.py deleted file mode 100644 index 9f22010..0000000 --- a/imagekitio/models/results/MetadataExifThumbnail.py +++ /dev/null @@ -1,21 +0,0 @@ -class MetadataExifThumbnail: - def __init__( - self, - compression=None, - x_resolution=None, - y_resolution=None, - resolution_unit=None, - thumbnail_offset=None, - thumbnail_length=None, - **kwargs - ): - self.compression = compression - self.x_resolution = x_resolution - self.y_resolution = y_resolution - self.resolution_unit = resolution_unit - self.thumbnail_offset = thumbnail_offset - self.thumbnail_length = thumbnail_length - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None diff --git a/imagekitio/models/results/PurgeCacheResult.py b/imagekitio/models/results/PurgeCacheResult.py deleted file mode 100644 index ca7cd3c..0000000 --- a/imagekitio/models/results/PurgeCacheResult.py +++ /dev/null @@ -1,15 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class PurgeCacheResult: - def __init__(self, request_id=None): - self.request_id = request_id - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/PurgeCacheStatusResult.py b/imagekitio/models/results/PurgeCacheStatusResult.py deleted file mode 100644 index bd2153f..0000000 --- a/imagekitio/models/results/PurgeCacheStatusResult.py +++ /dev/null @@ -1,15 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class PurgeCacheStatusResult: - def __init__(self, status=None): - self.status = status - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/RenameFileResult.py b/imagekitio/models/results/RenameFileResult.py deleted file mode 100644 index ab2a7f6..0000000 --- a/imagekitio/models/results/RenameFileResult.py +++ /dev/null @@ -1,15 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class RenameFileResult: - def __init__(self, purge_request_id: str = None): - self.purge_request_id = purge_request_id - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/ResponseMetadata.py b/imagekitio/models/results/ResponseMetadata.py deleted file mode 100644 index 21fcd12..0000000 --- a/imagekitio/models/results/ResponseMetadata.py +++ /dev/null @@ -1,9 +0,0 @@ -class ResponseMetadata: - def __init__(self, raw=None, http_status_code=None, headers=None,**kwargs): - self.raw = raw - self.http_status_code = http_status_code - self.headers = headers - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None diff --git a/imagekitio/models/results/ResponseMetadataResult.py b/imagekitio/models/results/ResponseMetadataResult.py deleted file mode 100644 index 92ce25e..0000000 --- a/imagekitio/models/results/ResponseMetadataResult.py +++ /dev/null @@ -1,14 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class ResponseMetadataResult: - def __init__(self): - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/TagsResult.py b/imagekitio/models/results/TagsResult.py deleted file mode 100644 index f8b23d1..0000000 --- a/imagekitio/models/results/TagsResult.py +++ /dev/null @@ -1,19 +0,0 @@ -from .ResponseMetadata import ResponseMetadata - - -class TagsResult: - def __init__(self, successfully_updated_file_ids=None,**kwargs): - self.successfully_updated_file_ids = successfully_updated_file_ids - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/UploadFileResult.py b/imagekitio/models/results/UploadFileResult.py deleted file mode 100644 index 6a027de..0000000 --- a/imagekitio/models/results/UploadFileResult.py +++ /dev/null @@ -1,76 +0,0 @@ -from typing import List - -from .AITags import AITags -from .EmbeddedMetadata import EmbeddedMetadata -from .ResponseMetadata import ResponseMetadata -from .VersionInfo import VersionInfo -from ...utils.utils import camel_dict_to_snake_dict - -class UploadFileResult: - def __init__( - self, - file_id=None, - name=None, - url=None, - thumbnail_url: str = None, - height: int = None, - width: int = None, - size: int = None, - file_path: str = None, - tags: dict = None, - ai_tags: List[AITags] = AITags(None, None, None), - version_info: VersionInfo = VersionInfo(None, None), - is_private_file=False, - custom_coordinates: dict = None, - custom_metadata: dict = None, - embedded_metadata: EmbeddedMetadata = EmbeddedMetadata(None, None, None, None), - extension_status: dict = None, - file_type: str = None, - orientation: int = None, - **kwargs - ): - self.file_id = file_id - self.name = name - self.url = url - self.thumbnail_url = thumbnail_url - self.height = height - self.width = width - self.size = size - self.file_path = file_path - self.tags = tags - self.ai_tags: List[AITags] = [] - if ai_tags is not None: - for i in ai_tags: - self.ai_tags.append(AITags(**camel_dict_to_snake_dict(i))) - else: - self.ai_tags.append(AITags(None, None, None)) - self.version_info = VersionInfo(**camel_dict_to_snake_dict(version_info)) - self.is_private_file = is_private_file - self.custom_coordinates = custom_coordinates - self.custom_metadata = custom_metadata - if embedded_metadata is None or embedded_metadata == {}: - self.embedded_metadata = EmbeddedMetadata(None, None, None, None) - else: - if type(embedded_metadata) == EmbeddedMetadata: - self.embedded_metadata = embedded_metadata - else: - self.embedded_metadata: EmbeddedMetadata = EmbeddedMetadata( - **camel_dict_to_snake_dict(embedded_metadata) - ) - self.extension_status = extension_status - self.file_type = file_type - self.orientation = orientation - self.__response_metadata: ResponseMetadata = ResponseMetadata("", "", "") - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - def __getattr__(self,key): - return None - - - @property - def response_metadata(self): - return self.__response_metadata - - @response_metadata.setter - def response_metadata(self, value): - self.__response_metadata = value diff --git a/imagekitio/models/results/VersionInfo.py b/imagekitio/models/results/VersionInfo.py deleted file mode 100644 index 07c4e44..0000000 --- a/imagekitio/models/results/VersionInfo.py +++ /dev/null @@ -1,13 +0,0 @@ -class VersionInfo: - def __init__(self, id=None, name=None,**kwargs): - self.id = id - self.name = name - for key in kwargs.keys(): - self.__setattr__(key,kwargs[key]) - - def __getattr__(self,attr): - return None - - - - diff --git a/imagekitio/models/results/__init__.py b/imagekitio/models/results/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/imagekitio/resource.py b/imagekitio/resource.py deleted file mode 100644 index 20855a7..0000000 --- a/imagekitio/resource.py +++ /dev/null @@ -1,90 +0,0 @@ -import base64 -from datetime import datetime as dt -from typing import Dict - -import requests -from requests import Response - -from .constants.defaults import Default -from .constants.errors import ERRORS - - -class ImageKitRequest(object): - """ - ImageKitRequest is holds the methods and attributes about server - communications and communicates to server, used by Internal classes - """ - - def __init__( - self, private_key, public_key, url_endpoint, transformation_position, options - ): - self.private_key = private_key - self.public_key = public_key - self.url_endpoint = url_endpoint - self.transformation_position = ( - transformation_position or Default.DEFAULT_TRANSFORMATION_POSITION.value - ) - self.options = options or {} - - if not (self.private_key and self.public_key and self.url_endpoint): - raise ValueError(ERRORS.MANDATORY_INITIALIZATION_MISSING.value) - - def create_headers(self): - """Create headers dict and sets Authorization header""" - headers = {"Accept-Encoding": "gzip, deflate"} - headers.update(self.get_auth_headers()) - return headers - - def get_auth_headers(self): - """Create dictionary with encoded private key - The out put is used in request header as authorization header - - :return: dictionary of encoded private key - """ - encoded_private_key = base64.b64encode( - (self.private_key + ":").encode() - ).decode("utf-8") - return {"Authorization": "Basic {}".format(encoded_private_key)} - - @staticmethod - def request(method, url, headers, params=None, files=None, data=None) -> Response: - """Requests from ImageKit server used,by internal methods""" - resp = requests.request( - method=method, - url=url, - params=params, - files=files, - data=data, - headers=headers, - ) - - return resp - - def extend_url_options(self, options: Dict) -> Dict: - """ - adds data to the options from the object, so that - required data can be used by url builder - """ - attr_dict = { - "public_key": self.public_key, - "private_key": self.private_key, - "url_endpoint": self.url_endpoint, - "transformation_position": self.transformation_position, - } - - extended_options = {**self.options, **attr_dict, **options} - return extended_options - - @staticmethod - def get_signature_timestamp(seconds: int = None) -> int: - """ - Returns either default time stamp - or current unix time and expiry seconds to get - signature time stamp - """ - - if not seconds: - return Default.DEFAULT_TIMESTAMP.value - current_timestamp = int(dt.now().timestamp()) - - return current_timestamp + seconds diff --git a/imagekitio/url.py b/imagekitio/url.py deleted file mode 100644 index 3930517..0000000 --- a/imagekitio/url.py +++ /dev/null @@ -1,231 +0,0 @@ -import hashlib -import hmac -import sys -from datetime import datetime as dt -from typing import Any, Dict, List -from urllib.parse import ParseResult, urlparse, urlunparse, parse_qsl, urlencode, quote, unquote - -from .constants.defaults import Default -from .constants.supported_transform import SUPPORTED_TRANS -from .utils.formatter import camel_dict_to_snake_dict, flatten_dict - -from .constants.errors import ERRORS - - -class Url: - """ - Url class holds the request and related methods - to generate url(signed and unsigned) - """ - - def __init__(self, request_obj): - self.request = request_obj - - def generate_url(self, options: Dict = None) -> str: - options = camel_dict_to_snake_dict(options) - attachment = options.get("query_parameters",{}).get("ik-attachment") - if attachment: - options["query_parameters"]["ik-attachment"] = str(attachment).lower() - extended_options = self.request.extend_url_options(options) - return self.build_url(extended_options) - - def build_url(self, options: dict) -> str: - """ - builds url for from all options, - """ - - # important to strip the trailing slashes. later logic assumes no trailing slashes. - path = options.get("path", "").strip("/") - src = options.get("src", "").strip("/") - url_endpoint = options.get("url_endpoint", "").strip("/") - transformation_str = self.transformation_to_str(options.get("transformation")) - transformation_position = options.get( - "transformation_position", Default.DEFAULT_TRANSFORMATION_POSITION.value - ) - - if transformation_position not in Default.VALID_TRANSFORMATION_POSITION.value: - raise ValueError(ERRORS.INVALID_TRANSFORMATION_POSITION.value) - - if path == "" and src == "": - return "" - - # if path is present then it is given priority over src parameter - if path: - if transformation_position == "path" and len(transformation_str) != 0: - temp_url = "{}/{}:{}/{}".format( - url_endpoint, - Default.TRANSFORMATION_PARAMETER.value, - transformation_str.strip("/"), - path, - ) - else: - temp_url = "{}/{}".format(url_endpoint, path) - else: - temp_url = src - # if src parameter is used, then we force transformation position in query - transformation_position = Default.QUERY_TRANSFORMATION_POSITION.value - - url_object = urlparse(temp_url) - - query_params = dict(parse_qsl(url_object.query)) - query_params.update(options.get("query_parameters", {})) - if ( - transformation_position == Default.QUERY_TRANSFORMATION_POSITION.value - and len(transformation_str) != 0 - ): - query_params.update( - {Default.TRANSFORMATION_PARAMETER.value: transformation_str} - ) - - # Update query params in the url - url_object = url_object._replace(query=urlencode(query_params)) - - if options.get("signed"): - expire_seconds = options.get("expire_seconds") - private_key = options.get("private_key") - expiry_timestamp = self.get_signature_timestamp(expire_seconds) - url_signature = self.get_signature( - private_key=private_key, - url=url_object.geturl(), - url_endpoint=url_endpoint, - expiry_timestamp=expiry_timestamp, - ) - - """ - If the expire_seconds parameter is specified then the output URL contains - ik-t parameter (unix timestamp seconds when the URL expires) and - the signature contains the timestamp for computation. - - If not present, then no ik-t parameter and the value 9999999999 is used. - """ - if expire_seconds: - query_params.update( - { - Default.TIMESTAMP_PARAMETER.value: expiry_timestamp, - Default.SIGNATURE_PARAMETER.value: url_signature, - } - ) - else: - query_params.update({Default.SIGNATURE_PARAMETER.value: url_signature}) - - # Update signature related query params - url_object = url_object._replace(query=urlencode(query_params)) - - return url_object.geturl() - - @staticmethod - def get_signature_timestamp(expiry_seconds: int = None) -> int: - """ - this function returns the signature timestamp to be used - with the generated url. - If expiry_seconds is provided, it returns expiry_seconds added - to the current unix time, otherwise the default time stamp - is returned. - """ - if not expiry_seconds: - return Default.DEFAULT_TIMESTAMP.value - current_timestamp = int(dt.now().timestamp()) - - return current_timestamp + expiry_seconds - - @staticmethod - def get_signature(private_key, url, url_endpoint, expiry_timestamp: int) -> str: - """ " - create signature(hashed hex key) from - private_key, url, url_endpoint and expiry_timestamp - """ - # ensure url_endpoint has a trailing slash - if url_endpoint[-1] != "/": - url_endpoint += "/" - - if expiry_timestamp < 1: - expiry_timestamp = Default.DEFAULT_TIMESTAMP.value - - replaced_url = url.replace(url_endpoint, "") + str(expiry_timestamp) - replaced_url = Url.encode_string_if_required(replaced_url) - signature = hmac.new( - key=private_key.encode(), msg=replaced_url.encode(), digestmod=hashlib.sha1 - ) - return signature.hexdigest() - - @staticmethod - def is_valid_trans_options(options: Dict[str, Any]) -> bool: - """ - check if transformation options parameter provided by user is valid - so that ValueError exception can be raised with appropriate error - message in the ImageKitRequest Class - """ - supported_trans_keys = SUPPORTED_TRANS.keys() - # flattening to dict from list of dict to check key validation - transformation_dict = flatten_dict(options.get("transformation", [])) - for key in transformation_dict: - if key not in supported_trans_keys: - return False - return True - - @staticmethod - def is_valid_transformation_pos(trans_pos: str) -> bool: - """ - Returns if transformation position is valid as per Server Documentation - """ - return trans_pos in Default.VALID_TRANSFORMATION_POSITION.value - - @staticmethod - def transformation_to_str(transformation): - """ - creates transformation_position string for url from - transformation_position dictionary - """ - if not isinstance(transformation, list): - return "" - parsed_transforms = [] - for i in range(len(transformation)): - parsed_transform_step = [] - for key in transformation[i]: - transform_key = SUPPORTED_TRANS.get(key, "") - if not transform_key: - transform_key = key - if transformation[i][key] == "-": - parsed_transform_step.append(transform_key) - else: - value = transformation[i][key] - if isinstance(value, bool): - value = str(value).lower() - if transform_key == "oi" or transform_key == "di": - value = value.strip("/") - value = value.replace("/", "@@") - if transform_key == "raw": - for j in value.split(","): - parsed_transform_step.append(j) - else: - parsed_transform_step.append( - "{}{}{}".format( - transform_key, - Default.TRANSFORM_KEY_VALUE_DELIMITER.value, - value, - ) - ) - - parsed_transforms.append( - Default.TRANSFORM_DELIMITER.value.join(parsed_transform_step) - ) - - return Default.CHAIN_TRANSFORM_DELIMITER.value.join(parsed_transforms) - - @staticmethod - def encodeURI(url_str): - # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI - if "?" in url_str: - # here we are not encoding query parameters as it is allready encoded - encoded_url = quote(url_str.split('?')[0], safe=Default.IGNORE_CHARACTERS.value)+"?"+url_str.split('?')[1] - else: - encoded_url = quote(url_str, safe=Default.IGNORE_CHARACTERS.value) - return encoded_url - - @staticmethod - def has_more_than_ascii(s): - return any(ord(char) > 127 for char in s) - - @staticmethod - def encode_string_if_required(s): - return Url.encodeURI(s) if Url.has_more_than_ascii(s) else s \ No newline at end of file diff --git a/imagekitio/utils/__init__.py b/imagekitio/utils/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/imagekitio/utils/calculation.py b/imagekitio/utils/calculation.py deleted file mode 100644 index 8bf495a..0000000 --- a/imagekitio/utils/calculation.py +++ /dev/null @@ -1,40 +0,0 @@ -import hashlib -import hmac -import uuid -from datetime import datetime as dt - -from ..constants.errors import ERRORS - -DEFAULT_TIME_DIFF = 60 * 30 - - -def hamming_distance(first: str, second: str) -> int: - """Calculate Hamming Distance between to hex string""" - try: - a = bin(int(first, 16))[2:].zfill(64) - b = bin(int(second, 16))[2:].zfill(64) - except TypeError: - raise TypeError(ERRORS.INVALID_PHASH_VALUE.value) - - return len(list(filter(lambda x: ord(x[0]) ^ ord(x[1]), zip(a, b)))) - - -def get_authenticated_params(token, expire, private_key): - default_expire = int(dt.now().timestamp()) + DEFAULT_TIME_DIFF - token = token or str(uuid.uuid4()) - expire = expire or default_expire - auth_params = {"token": token, "expire": expire, "signature": ""} - - if not private_key: - return - signature = hmac.new( - key=private_key.encode(), - msg=(token + str(expire)).encode(), - digestmod=hashlib.sha1, - ).hexdigest() - - auth_params["token"] = token - auth_params["expire"] = expire - auth_params["signature"] = signature - - return auth_params diff --git a/imagekitio/utils/formatter.py b/imagekitio/utils/formatter.py deleted file mode 100644 index 335956d..0000000 --- a/imagekitio/utils/formatter.py +++ /dev/null @@ -1,46 +0,0 @@ -import re -from collections import ChainMap, OrderedDict -from typing import Dict, List - - -def camel_to_snake(name): - """ - converts camelCase to snake_case for python - """ - s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name) - return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower() - - -def snake_to_lower_camel(word): - """ - changes word snake to lower camelCase example: my_plan -> MyPlan - :return camelCaseWord - """ - word_list = word.split("_") - if word_list: - return word_list[0] + "".join(x.title() for x in word_list[1:]) - return word - - -def request_formatter(data: dict) -> dict: - """Converts all keys to camelCase format required for ImageKit server - :param data: dict() - :return: converted_dict -> dict() - """ - return {snake_to_lower_camel(key): val for key, val in data.items()} - - -def camel_dict_to_snake_dict(data: dict) -> dict: - """Convert the keys of dictionary from camel case to snake case""" - return {camel_to_snake(key): val for key, val in data.items()} - - -def flatten_dict(dict_list: List[Dict]) -> OrderedDict: - """Convert list of dictionary to flatten dict - :param dict_list: list of dictionary - :return: flatten_dict - """ - flat_dict = OrderedDict() - for dict_var in dict_list: - flat_dict.update(dict_var) - return flat_dict diff --git a/imagekitio/utils/utils.py b/imagekitio/utils/utils.py deleted file mode 100644 index 2cfba0f..0000000 --- a/imagekitio/utils/utils.py +++ /dev/null @@ -1,104 +0,0 @@ -import ast -from json import loads, dumps -from requests.models import Response - -from ..exceptions.BadRequestException import BadRequestException -from ..exceptions.ForbiddenException import ForbiddenException -from ..exceptions.InternalServerException import InternalServerException -from ..exceptions.NotFoundException import NotFoundException -from ..exceptions.PartialSuccessException import PartialSuccessException -from ..exceptions.TooManyRequestsException import TooManyRequestsException -from ..exceptions.UnauthorizedException import UnauthorizedException -from ..exceptions.UnknownException import UnknownException -from ..models.results.ResponseMetadata import ResponseMetadata -from ..models.results.ResponseMetadataResult import ResponseMetadataResult -from ..utils.formatter import camel_dict_to_snake_dict - -try: - from simplejson.errors import JSONDecodeError -except ImportError: - from json import JSONDecodeError - - -def get_response_json(response: Response): - try: - resp = response.json() - except JSONDecodeError: - resp = response.text - return resp - - -def populate_response_metadata(response: Response): - resp = get_response_json(response) - response_metadata = ResponseMetadata(resp, response.status_code, response.headers) - return response_metadata - - -def general_api_throw_exception(response: Response): - resp = get_response_json(response) - response_meta_data = populate_response_metadata(response) - if type(resp) == str: - resp = ast.literal_eval(resp) - error_message = resp["message"] if type(resp) == dict else "" - response_help = resp["help"] if type(resp) == dict and "help" in resp else "" - if response.status_code == 400: - raise BadRequestException(error_message, response_help, response_meta_data) - elif response.status_code == 401: - raise UnauthorizedException(error_message, response_help, response_meta_data) - elif response.status_code == 403: - raise ForbiddenException(error_message, response_help, response_meta_data) - elif response.status_code == 429: - raise TooManyRequestsException(error_message, response_help, response_meta_data) - elif ( - response.status_code == 500 - or response.status_code == 502 - or response.status_code == 503 - or response.status_code == 504 - ): - raise InternalServerException(error_message, response_help, response_meta_data) - else: - raise UnknownException(error_message, response_help, response_meta_data) - - -def throw_other_exception(response: Response): - resp = get_response_json(response) - response_meta_data = populate_response_metadata(response) - if type(resp) == str: - resp = ast.literal_eval(resp) - error_message = resp["message"] if type(resp) == dict else "" - response_help = resp["help"] if type(resp) == dict else "" - if response.status_code == 207: - raise PartialSuccessException(error_message, response_help, response_meta_data) - elif response.status_code == 404: - raise NotFoundException(error_message, response_help, response_meta_data) - else: - raise UnknownException(error_message, response_help, response_meta_data) - - -def convert_to_response_object(resp: Response, response_object): - res_new = loads(dumps(camel_dict_to_snake_dict(resp.json()))) - u = response_object(**res_new) - u.response_metadata = ResponseMetadata(resp.json(), resp.status_code, resp.headers) - return u - - -def convert_to_response_metadata_result_object(resp: Response = None): - u = ResponseMetadataResult() - u.response_metadata = ResponseMetadata( - resp.json() if resp.status_code != 204 else None, resp.status_code, resp.headers - ) - return u - - -def convert_to_list_response_object( - resp: Response, response_object, list_response_object -): - response_list = [] - for item in resp.json(): - res_new = loads(dumps(camel_dict_to_snake_dict(item))) - u = response_object(**res_new) - response_list.append(u) - - u = list_response_object(response_list) - u.response_metadata = ResponseMetadata(resp.json(), resp.status_code, resp.headers) - return u diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..b2e3de8 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,50 @@ +[mypy] +pretty = True +show_error_codes = True + +# Exclude _files.py because mypy isn't smart enough to apply +# the correct type narrowing and as this is an internal module +# it's fine to just use Pyright. +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ^(src/imagekit/_files\.py|_dev/.*\.py|tests/.*)$ + +strict_equality = True +implicit_reexport = True +check_untyped_defs = True +no_implicit_optional = True + +warn_return_any = True +warn_unreachable = True +warn_unused_configs = True + +# Turn these options off as it could cause conflicts +# with the Pyright options. +warn_unused_ignores = False +warn_redundant_casts = False + +disallow_any_generics = True +disallow_untyped_defs = True +disallow_untyped_calls = True +disallow_subclassing_any = True +disallow_incomplete_defs = True +disallow_untyped_decorators = True +cache_fine_grained = True + +# By default, mypy reports an error if you assign a value to the result +# of a function call that doesn't return anything. We do this in our test +# cases: +# ``` +# result = ... +# assert result is None +# ``` +# Changing this codegen to make mypy happy would increase complexity +# and would not be worth it. +disable_error_code = func-returns-value,overload-cannot-match + +# https://github.com/python/mypy/issues/12162 +[mypy.overrides] +module = "black.files.*" +ignore_errors = true +ignore_missing_imports = true diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 0000000..53bca7f --- /dev/null +++ b/noxfile.py @@ -0,0 +1,9 @@ +import nox + + +@nox.session(reuse_venv=True, name="test-pydantic-v1") +def test_pydantic_v1(session: nox.Session) -> None: + session.install("-r", "requirements-dev.lock") + session.install("pydantic<2") + + session.run("pytest", "--showlocals", "--ignore=tests/functional", *session.posargs) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a5d32e2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,213 @@ +[project] +name = "imagekit" +version = "0.1.0" +description = "The official Python library for the ImageKit API" +dynamic = ["readme"] +license = "Apache-2.0" +authors = [ +{ name = "Image Kit", email = "developer@imagekit.io" }, +] +dependencies = [ + "httpx>=0.23.0, <1", + "pydantic>=1.9.0, <3", + "typing-extensions>=4.10, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", +] +requires-python = ">= 3.8" +classifiers = [ + "Typing :: Typed", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Operating System :: OS Independent", + "Operating System :: POSIX", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: Apache Software License" +] + +[project.urls] +Homepage = "https://github.com/imagekit-developer/imagekit-python" +Repository = "https://github.com/imagekit-developer/imagekit-python" + +[project.optional-dependencies] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"] +webhooks = ["standardwebhooks"] + +[tool.rye] +managed = true +# version pins are in requirements-dev.lock +dev-dependencies = [ + "pyright==1.1.399", + "mypy", + "respx", + "pytest", + "pytest-asyncio", + "ruff", + "time-machine", + "nox", + "dirty-equals>=0.6.0", + "importlib-metadata>=6.7.0", + "rich>=13.7.1", + "nest_asyncio==1.6.0", + "pytest-xdist>=3.6.1", +] + +[tool.rye.scripts] +format = { chain = [ + "format:ruff", + "format:docs", + "fix:ruff", + # run formatting again to fix any inconsistencies when imports are stripped + "format:ruff", +]} +"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" +"format:ruff" = "ruff format" + +"lint" = { chain = [ + "check:ruff", + "typecheck", + "check:importable", +]} +"check:ruff" = "ruff check ." +"fix:ruff" = "ruff check --fix ." + +"check:importable" = "python -c 'import imagekit'" + +typecheck = { chain = [ + "typecheck:pyright", + "typecheck:mypy" +]} +"typecheck:pyright" = "pyright" +"typecheck:verify-types" = "pyright --verifytypes imagekit --ignoreexternal" +"typecheck:mypy" = "mypy ." + +[build-system] +requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] +build-backend = "hatchling.build" + +[tool.hatch.build] +include = [ + "src/*" +] + +[tool.hatch.build.targets.wheel] +packages = ["src/imagekit"] + +[tool.hatch.build.targets.sdist] +# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) +include = [ + "/*.toml", + "/*.json", + "/*.lock", + "/*.md", + "/mypy.ini", + "/noxfile.py", + "bin/*", + "examples/*", + "src/*", + "tests/*", +] + +[tool.hatch.metadata.hooks.fancy-pypi-readme] +content-type = "text/markdown" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] +path = "README.md" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] +# replace relative links with absolute links +pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' +replacement = '[\1](https://github.com/imagekit-developer/imagekit-python/tree/master/\g<2>)' + +[tool.pytest.ini_options] +testpaths = ["tests"] +addopts = "--tb=short -n auto" +xfail_strict = true +asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" +filterwarnings = [ + "error" +] + +[tool.pyright] +# this enables practically every flag given by pyright. +# there are a couple of flags that are still disabled by +# default in strict mode as they are experimental and niche. +typeCheckingMode = "strict" +pythonVersion = "3.8" + +exclude = [ + "_dev", + ".venv", + ".nox", + ".git", +] + +reportImplicitOverride = true +reportOverlappingOverload = false + +reportImportCycles = false +reportPrivateUsage = false + +[tool.ruff] +line-length = 120 +output-format = "grouped" +target-version = "py38" + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] +select = [ + # isort + "I", + # bugbear rules + "B", + # remove unused imports + "F401", + # bare except statements + "E722", + # unused arguments + "ARG", + # print statements + "T201", + "T203", + # misuse of typing.TYPE_CHECKING + "TC004", + # import rules + "TID251", +] +ignore = [ + # mutable defaults + "B006", +] +unfixable = [ + # disable auto fix for print statements + "T201", + "T203", +] + +[tool.ruff.lint.flake8-tidy-imports.banned-api] +"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" + +[tool.ruff.lint.isort] +length-sort = true +length-sort-straight = true +combine-as-imports = true +extra-standard-library = ["typing_extensions"] +known-first-party = ["imagekit", "tests"] + +[tool.ruff.lint.per-file-ignores] +"bin/**.py" = ["T201", "T203"] +"scripts/**.py" = ["T201", "T203"] +"tests/**.py" = ["T201", "T203"] +"examples/**.py" = ["T201", "T203"] diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..48e2b41 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,66 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "python", + "extra-files": [ + "src/imagekit/_version.py" + ] +} \ No newline at end of file diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..396ac99 --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,148 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: true +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.12.8 + # via httpx-aiohttp + # via imagekit +aiosignal==1.3.2 + # via aiohttp +annotated-types==0.6.0 + # via pydantic +anyio==4.4.0 + # via httpx + # via imagekit +argcomplete==3.1.2 + # via nox +async-timeout==5.0.1 + # via aiohttp +attrs==25.3.0 + # via aiohttp + # via standardwebhooks +certifi==2023.7.22 + # via httpcore + # via httpx +colorlog==6.7.0 + # via nox +deprecated==1.2.18 + # via standardwebhooks +dirty-equals==0.6.0 +distlib==0.3.7 + # via virtualenv +distro==1.8.0 + # via imagekit +exceptiongroup==1.2.2 + # via anyio + # via pytest +execnet==2.1.1 + # via pytest-xdist +filelock==3.12.4 + # via virtualenv +frozenlist==1.6.2 + # via aiohttp + # via aiosignal +h11==0.16.0 + # via httpcore +httpcore==1.0.9 + # via httpx +httpx==0.28.1 + # via httpx-aiohttp + # via imagekit + # via respx + # via standardwebhooks +httpx-aiohttp==0.1.8 + # via imagekit +idna==3.4 + # via anyio + # via httpx + # via yarl +importlib-metadata==7.0.0 +iniconfig==2.0.0 + # via pytest +markdown-it-py==3.0.0 + # via rich +mdurl==0.1.2 + # via markdown-it-py +multidict==6.4.4 + # via aiohttp + # via yarl +mypy==1.14.1 +mypy-extensions==1.0.0 + # via mypy +nest-asyncio==1.6.0 +nodeenv==1.8.0 + # via pyright +nox==2023.4.22 +packaging==23.2 + # via nox + # via pytest +platformdirs==3.11.0 + # via virtualenv +pluggy==1.5.0 + # via pytest +propcache==0.3.1 + # via aiohttp + # via yarl +pydantic==2.10.3 + # via imagekit +pydantic-core==2.27.1 + # via pydantic +pygments==2.18.0 + # via rich +pyright==1.1.399 +pytest==8.3.3 + # via pytest-asyncio + # via pytest-xdist +pytest-asyncio==0.24.0 +pytest-xdist==3.7.0 +python-dateutil==2.8.2 + # via standardwebhooks + # via time-machine +pytz==2023.3.post1 + # via dirty-equals +respx==0.22.0 +rich==13.7.1 +ruff==0.9.4 +setuptools==68.2.2 + # via nodeenv +six==1.16.0 + # via python-dateutil +sniffio==1.3.0 + # via anyio + # via imagekit +standardwebhooks==1.0.0 + # via imagekit +time-machine==2.9.0 +tomli==2.0.2 + # via mypy + # via pytest +types-deprecated==1.2.15.20250304 + # via standardwebhooks +types-python-dateutil==2.9.0.20250822 + # via standardwebhooks +typing-extensions==4.12.2 + # via anyio + # via imagekit + # via multidict + # via mypy + # via pydantic + # via pydantic-core + # via pyright +virtualenv==20.24.5 + # via nox +wrapt==1.17.3 + # via deprecated +yarl==1.20.0 + # via aiohttp +zipp==3.17.0 + # via importlib-metadata diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..a922302 --- /dev/null +++ b/requirements.lock @@ -0,0 +1,88 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: true +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.12.8 + # via httpx-aiohttp + # via imagekit +aiosignal==1.3.2 + # via aiohttp +annotated-types==0.6.0 + # via pydantic +anyio==4.4.0 + # via httpx + # via imagekit +async-timeout==5.0.1 + # via aiohttp +attrs==25.3.0 + # via aiohttp + # via standardwebhooks +certifi==2023.7.22 + # via httpcore + # via httpx +deprecated==1.2.18 + # via standardwebhooks +distro==1.8.0 + # via imagekit +exceptiongroup==1.2.2 + # via anyio +frozenlist==1.6.2 + # via aiohttp + # via aiosignal +h11==0.16.0 + # via httpcore +httpcore==1.0.9 + # via httpx +httpx==0.28.1 + # via httpx-aiohttp + # via imagekit + # via standardwebhooks +httpx-aiohttp==0.1.8 + # via imagekit +idna==3.4 + # via anyio + # via httpx + # via yarl +multidict==6.4.4 + # via aiohttp + # via yarl +propcache==0.3.1 + # via aiohttp + # via yarl +pydantic==2.10.3 + # via imagekit +pydantic-core==2.27.1 + # via pydantic +python-dateutil==2.9.0.post0 + # via standardwebhooks +six==1.17.0 + # via python-dateutil +sniffio==1.3.0 + # via anyio + # via imagekit +standardwebhooks==1.0.0 + # via imagekit +types-deprecated==1.2.15.20250304 + # via standardwebhooks +types-python-dateutil==2.9.0.20250822 + # via standardwebhooks +typing-extensions==4.12.2 + # via anyio + # via imagekit + # via multidict + # via pydantic + # via pydantic-core +wrapt==1.17.3 + # via deprecated +yarl==1.20.0 + # via aiohttp diff --git a/requirements/requirements.txt b/requirements/requirements.txt deleted file mode 100644 index 7758d16..0000000 --- a/requirements/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -requests>=2.22.0 -requests_toolbelt==0.10.1 -urllib3==1.26.* \ No newline at end of file diff --git a/requirements/test.txt b/requirements/test.txt deleted file mode 100644 index 2d600d6..0000000 --- a/requirements/test.txt +++ /dev/null @@ -1,7 +0,0 @@ -requests>=2.22.0 -black==19.10b0 -coverage==4.5.4 -tox==3.14.2 -responses==0.17.0 -requests_toolbelt==0.10.1 -urllib3==1.26.* \ No newline at end of file diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 0000000..e84fe62 --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then + brew bundle check >/dev/null 2>&1 || { + echo "==> Installing Homebrew dependencies…" + brew bundle + } +fi + +echo "==> Installing Python dependencies…" + +# experimental uv support makes installations significantly faster +rye config --set-bool behavior.use-uv=true + +rye sync --all-features diff --git a/scripts/format b/scripts/format new file mode 100755 index 0000000..667ec2d --- /dev/null +++ b/scripts/format @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Running formatters" +rye run format diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 0000000..3a31c2a --- /dev/null +++ b/scripts/lint @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Running lints" +rye run lint + +echo "==> Making sure it imports" +rye run python -c 'import imagekit' diff --git a/scripts/mock b/scripts/mock new file mode 100755 index 0000000..0b28f6e --- /dev/null +++ b/scripts/mock @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [[ -n "$1" && "$1" != '--'* ]]; then + URL="$1" + shift +else + URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" +fi + +# Check if the URL is empty +if [ -z "$URL" ]; then + echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" + exit 1 +fi + +echo "==> Starting mock server with URL ${URL}" + +# Run prism mock on the given spec +if [ "$1" == "--daemon" ]; then + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + + # Wait for server to come online + echo -n "Waiting for server" + while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + echo -n "." + sleep 0.1 + done + + if grep -q "✖ fatal" ".prism.log"; then + cat .prism.log + exit 1 + fi + + echo +else + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" +fi diff --git a/scripts/test b/scripts/test new file mode 100755 index 0000000..dbeda2d --- /dev/null +++ b/scripts/test @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +function prism_is_running() { + curl --silent "http://localhost:4010" >/dev/null 2>&1 +} + +kill_server_on_port() { + pids=$(lsof -t -i tcp:"$1" || echo "") + if [ "$pids" != "" ]; then + kill "$pids" + echo "Stopped $pids." + fi +} + +function is_overriding_api_base_url() { + [ -n "$TEST_API_BASE_URL" ] +} + +if ! is_overriding_api_base_url && ! prism_is_running ; then + # When we exit this script, make sure to kill the background mock server process + trap 'kill_server_on_port 4010' EXIT + + # Start the dev server + ./scripts/mock --daemon +fi + +if is_overriding_api_base_url ; then + echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" + echo +elif ! prism_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" + echo -e "running against your OpenAPI spec." + echo + echo -e "To run the server, pass in the path or url of your OpenAPI" + echo -e "spec to the prism command:" + echo + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo + + exit 1 +else + echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo +fi + +export DEFER_PYDANTIC_BUILD=false + +echo "==> Running tests" +rye run pytest "$@" + +echo "==> Running Pydantic v1 tests" +rye run nox -s test-pydantic-v1 -- "$@" diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py new file mode 100644 index 0000000..0cf2bd2 --- /dev/null +++ b/scripts/utils/ruffen-docs.py @@ -0,0 +1,167 @@ +# fork of https://github.com/asottile/blacken-docs adapted for ruff +from __future__ import annotations + +import re +import sys +import argparse +import textwrap +import contextlib +import subprocess +from typing import Match, Optional, Sequence, Generator, NamedTuple, cast + +MD_RE = re.compile( + r"(?P^(?P *)```\s*python\n)" r"(?P.*?)" r"(?P^(?P=indent)```\s*$)", + re.DOTALL | re.MULTILINE, +) +MD_PYCON_RE = re.compile( + r"(?P^(?P *)```\s*pycon\n)" r"(?P.*?)" r"(?P^(?P=indent)```.*$)", + re.DOTALL | re.MULTILINE, +) +PYCON_PREFIX = ">>> " +PYCON_CONTINUATION_PREFIX = "..." +PYCON_CONTINUATION_RE = re.compile( + rf"^{re.escape(PYCON_CONTINUATION_PREFIX)}( |$)", +) +DEFAULT_LINE_LENGTH = 100 + + +class CodeBlockError(NamedTuple): + offset: int + exc: Exception + + +def format_str( + src: str, +) -> tuple[str, Sequence[CodeBlockError]]: + errors: list[CodeBlockError] = [] + + @contextlib.contextmanager + def _collect_error(match: Match[str]) -> Generator[None, None, None]: + try: + yield + except Exception as e: + errors.append(CodeBlockError(match.start(), e)) + + def _md_match(match: Match[str]) -> str: + code = textwrap.dedent(match["code"]) + with _collect_error(match): + code = format_code_block(code) + code = textwrap.indent(code, match["indent"]) + return f"{match['before']}{code}{match['after']}" + + def _pycon_match(match: Match[str]) -> str: + code = "" + fragment = cast(Optional[str], None) + + def finish_fragment() -> None: + nonlocal code + nonlocal fragment + + if fragment is not None: + with _collect_error(match): + fragment = format_code_block(fragment) + fragment_lines = fragment.splitlines() + code += f"{PYCON_PREFIX}{fragment_lines[0]}\n" + for line in fragment_lines[1:]: + # Skip blank lines to handle Black adding a blank above + # functions within blocks. A blank line would end the REPL + # continuation prompt. + # + # >>> if True: + # ... def f(): + # ... pass + # ... + if line: + code += f"{PYCON_CONTINUATION_PREFIX} {line}\n" + if fragment_lines[-1].startswith(" "): + code += f"{PYCON_CONTINUATION_PREFIX}\n" + fragment = None + + indentation = None + for line in match["code"].splitlines(): + orig_line, line = line, line.lstrip() + if indentation is None and line: + indentation = len(orig_line) - len(line) + continuation_match = PYCON_CONTINUATION_RE.match(line) + if continuation_match and fragment is not None: + fragment += line[continuation_match.end() :] + "\n" + else: + finish_fragment() + if line.startswith(PYCON_PREFIX): + fragment = line[len(PYCON_PREFIX) :] + "\n" + else: + code += orig_line[indentation:] + "\n" + finish_fragment() + return code + + def _md_pycon_match(match: Match[str]) -> str: + code = _pycon_match(match) + code = textwrap.indent(code, match["indent"]) + return f"{match['before']}{code}{match['after']}" + + src = MD_RE.sub(_md_match, src) + src = MD_PYCON_RE.sub(_md_pycon_match, src) + return src, errors + + +def format_code_block(code: str) -> str: + return subprocess.check_output( + [ + sys.executable, + "-m", + "ruff", + "format", + "--stdin-filename=script.py", + f"--line-length={DEFAULT_LINE_LENGTH}", + ], + encoding="utf-8", + input=code, + ) + + +def format_file( + filename: str, + skip_errors: bool, +) -> int: + with open(filename, encoding="UTF-8") as f: + contents = f.read() + new_contents, errors = format_str(contents) + for error in errors: + lineno = contents[: error.offset].count("\n") + 1 + print(f"{filename}:{lineno}: code block parse error {error.exc}") + if errors and not skip_errors: + return 1 + if contents != new_contents: + print(f"{filename}: Rewriting...") + with open(filename, "w", encoding="UTF-8") as f: + f.write(new_contents) + return 0 + else: + return 0 + + +def main(argv: Sequence[str] | None = None) -> int: + parser = argparse.ArgumentParser() + parser.add_argument( + "-l", + "--line-length", + type=int, + default=DEFAULT_LINE_LENGTH, + ) + parser.add_argument( + "-S", + "--skip-string-normalization", + action="store_true", + ) + parser.add_argument("-E", "--skip-errors", action="store_true") + parser.add_argument("filenames", nargs="*") + args = parser.parse_args(argv) + + retv = 0 + for filename in args.filenames: + retv |= format_file(filename, skip_errors=args.skip_errors) + return retv + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 0000000..ace7ffb --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -exuo pipefail + +FILENAME=$(basename dist/*.whl) + +RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(curl -v -X PUT \ + -H "Content-Type: binary/octet-stream" \ + --data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/imagekit-python/$SHA/$FILENAME'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi diff --git a/setup.py b/setup.py deleted file mode 100644 index 084fabe..0000000 --- a/setup.py +++ /dev/null @@ -1,24 +0,0 @@ -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - -with open("requirements/requirements.txt") as f: - install_requires = f.read().splitlines() - -setuptools.setup( - name="imagekitio", - version="4.1.0", - description="Python wrapper for the ImageKit API", - long_description=long_description, - long_description_content_type="text/markdown", - install_requires=install_requires, - url="https://github.com/imagekit-developer/imagekit-python", - packages=setuptools.find_packages(), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires=">=3.6", -) diff --git a/src/imagekit/__init__.py b/src/imagekit/__init__.py new file mode 100644 index 0000000..43d69f6 --- /dev/null +++ b/src/imagekit/__init__.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import typing as _t + +from . import types +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._utils import file_from_path +from ._client import ( + Client, + Stream, + Timeout, + ImageKit, + Transport, + AsyncClient, + AsyncStream, + AsyncImageKit, + RequestOptions, +) +from ._models import BaseModel +from ._version import __title__, __version__ +from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse +from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS +from ._exceptions import ( + APIError, + ConflictError, + ImageKitError, + NotFoundError, + APIStatusError, + RateLimitError, + APITimeoutError, + BadRequestError, + APIConnectionError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, + APIWebhookValidationError, + APIResponseValidationError, +) +from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient +from ._utils._logs import setup_logging as _setup_logging + +__all__ = [ + "types", + "__version__", + "__title__", + "NoneType", + "Transport", + "ProxiesTypes", + "NotGiven", + "NOT_GIVEN", + "Omit", + "ImageKitError", + "APIError", + "APIStatusError", + "APITimeoutError", + "APIConnectionError", + "APIResponseValidationError", + "APIWebhookValidationError", + "BadRequestError", + "AuthenticationError", + "PermissionDeniedError", + "NotFoundError", + "ConflictError", + "UnprocessableEntityError", + "RateLimitError", + "InternalServerError", + "Timeout", + "RequestOptions", + "Client", + "AsyncClient", + "Stream", + "AsyncStream", + "ImageKit", + "AsyncImageKit", + "file_from_path", + "BaseModel", + "DEFAULT_TIMEOUT", + "DEFAULT_MAX_RETRIES", + "DEFAULT_CONNECTION_LIMITS", + "DefaultHttpxClient", + "DefaultAsyncHttpxClient", + "DefaultAioHttpClient", +] + +if not _t.TYPE_CHECKING: + from ._utils._resources_proxy import resources as resources + +_setup_logging() + +# Update the __module__ attribute for exported symbols so that +# error messages point to this module instead of the module +# it was originally defined in, e.g. +# imagekit._exceptions.NotFoundError -> imagekit.NotFoundError +__locals = locals() +for __name in __all__: + if not __name.startswith("__"): + try: + __locals[__name].__module__ = "imagekit" + except (TypeError, AttributeError): + # Some of our exported symbols are builtins which we can't set attributes for. + pass diff --git a/src/imagekit/_base_client.py b/src/imagekit/_base_client.py new file mode 100644 index 0000000..9dcf022 --- /dev/null +++ b/src/imagekit/_base_client.py @@ -0,0 +1,1995 @@ +from __future__ import annotations + +import sys +import json +import time +import uuid +import email +import asyncio +import inspect +import logging +import platform +import email.utils +from types import TracebackType +from random import random +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Type, + Union, + Generic, + Mapping, + TypeVar, + Iterable, + Iterator, + Optional, + Generator, + AsyncIterator, + cast, + overload, +) +from typing_extensions import Literal, override, get_origin + +import anyio +import httpx +import distro +import pydantic +from httpx import URL +from pydantic import PrivateAttr + +from . import _exceptions +from ._qs import Querystring +from ._files import to_httpx_files, async_to_httpx_files +from ._types import ( + NOT_GIVEN, + Body, + Omit, + Query, + Headers, + Timeout, + NotGiven, + ResponseT, + AnyMapping, + PostParser, + RequestFiles, + HttpxSendArgs, + RequestOptions, + HttpxRequestFiles, + ModelBuilderProtocol, +) +from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping +from ._compat import PYDANTIC_V2, model_copy, model_dump +from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type +from ._response import ( + APIResponse, + BaseAPIResponse, + AsyncAPIResponse, + extract_response_type, +) +from ._constants import ( + DEFAULT_TIMEOUT, + MAX_RETRY_DELAY, + DEFAULT_MAX_RETRIES, + INITIAL_RETRY_DELAY, + RAW_RESPONSE_HEADER, + OVERRIDE_CAST_TO_HEADER, + DEFAULT_CONNECTION_LIMITS, +) +from ._streaming import Stream, SSEDecoder, AsyncStream, SSEBytesDecoder +from ._exceptions import ( + APIStatusError, + APITimeoutError, + APIConnectionError, + APIResponseValidationError, +) + +log: logging.Logger = logging.getLogger(__name__) + +# TODO: make base page type vars covariant +SyncPageT = TypeVar("SyncPageT", bound="BaseSyncPage[Any]") +AsyncPageT = TypeVar("AsyncPageT", bound="BaseAsyncPage[Any]") + + +_T = TypeVar("_T") +_T_co = TypeVar("_T_co", covariant=True) + +_StreamT = TypeVar("_StreamT", bound=Stream[Any]) +_AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) + +if TYPE_CHECKING: + from httpx._config import ( + DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage] + ) + + HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG +else: + try: + from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT + except ImportError: + # taken from https://github.com/encode/httpx/blob/3ba5fe0d7ac70222590e759c31442b1cab263791/httpx/_config.py#L366 + HTTPX_DEFAULT_TIMEOUT = Timeout(5.0) + + +class PageInfo: + """Stores the necessary information to build the request to retrieve the next page. + + Either `url` or `params` must be set. + """ + + url: URL | NotGiven + params: Query | NotGiven + json: Body | NotGiven + + @overload + def __init__( + self, + *, + url: URL, + ) -> None: ... + + @overload + def __init__( + self, + *, + params: Query, + ) -> None: ... + + @overload + def __init__( + self, + *, + json: Body, + ) -> None: ... + + def __init__( + self, + *, + url: URL | NotGiven = NOT_GIVEN, + json: Body | NotGiven = NOT_GIVEN, + params: Query | NotGiven = NOT_GIVEN, + ) -> None: + self.url = url + self.json = json + self.params = params + + @override + def __repr__(self) -> str: + if self.url: + return f"{self.__class__.__name__}(url={self.url})" + if self.json: + return f"{self.__class__.__name__}(json={self.json})" + return f"{self.__class__.__name__}(params={self.params})" + + +class BasePage(GenericModel, Generic[_T]): + """ + Defines the core interface for pagination. + + Type Args: + ModelT: The pydantic model that represents an item in the response. + + Methods: + has_next_page(): Check if there is another page available + next_page_info(): Get the necessary information to make a request for the next page + """ + + _options: FinalRequestOptions = PrivateAttr() + _model: Type[_T] = PrivateAttr() + + def has_next_page(self) -> bool: + items = self._get_page_items() + if not items: + return False + return self.next_page_info() is not None + + def next_page_info(self) -> Optional[PageInfo]: ... + + def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] + ... + + def _params_from_url(self, url: URL) -> httpx.QueryParams: + # TODO: do we have to preprocess params here? + return httpx.QueryParams(cast(Any, self._options.params)).merge(url.params) + + def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: + options = model_copy(self._options) + options._strip_raw_response_header() + + if not isinstance(info.params, NotGiven): + options.params = {**options.params, **info.params} + return options + + if not isinstance(info.url, NotGiven): + params = self._params_from_url(info.url) + url = info.url.copy_with(params=params) + options.params = dict(url.params) + options.url = str(url) + return options + + if not isinstance(info.json, NotGiven): + if not is_mapping(info.json): + raise TypeError("Pagination is only supported with mappings") + + if not options.json_data: + options.json_data = {**info.json} + else: + if not is_mapping(options.json_data): + raise TypeError("Pagination is only supported with mappings") + + options.json_data = {**options.json_data, **info.json} + return options + + raise ValueError("Unexpected PageInfo state") + + +class BaseSyncPage(BasePage[_T], Generic[_T]): + _client: SyncAPIClient = pydantic.PrivateAttr() + + def _set_private_attributes( + self, + client: SyncAPIClient, + model: Type[_T], + options: FinalRequestOptions, + ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + + self._model = model + self._client = client + self._options = options + + # Pydantic uses a custom `__iter__` method to support casting BaseModels + # to dictionaries. e.g. dict(model). + # As we want to support `for item in page`, this is inherently incompatible + # with the default pydantic behaviour. It is not possible to support both + # use cases at once. Fortunately, this is not a big deal as all other pydantic + # methods should continue to work as expected as there is an alternative method + # to cast a model to a dictionary, model.dict(), which is used internally + # by pydantic. + def __iter__(self) -> Iterator[_T]: # type: ignore + for page in self.iter_pages(): + for item in page._get_page_items(): + yield item + + def iter_pages(self: SyncPageT) -> Iterator[SyncPageT]: + page = self + while True: + yield page + if page.has_next_page(): + page = page.get_next_page() + else: + return + + def get_next_page(self: SyncPageT) -> SyncPageT: + info = self.next_page_info() + if not info: + raise RuntimeError( + "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`." + ) + + options = self._info_to_options(info) + return self._client._request_api_list(self._model, page=self.__class__, options=options) + + +class AsyncPaginator(Generic[_T, AsyncPageT]): + def __init__( + self, + client: AsyncAPIClient, + options: FinalRequestOptions, + page_cls: Type[AsyncPageT], + model: Type[_T], + ) -> None: + self._model = model + self._client = client + self._options = options + self._page_cls = page_cls + + def __await__(self) -> Generator[Any, None, AsyncPageT]: + return self._get_page().__await__() + + async def _get_page(self) -> AsyncPageT: + def _parser(resp: AsyncPageT) -> AsyncPageT: + resp._set_private_attributes( + model=self._model, + options=self._options, + client=self._client, + ) + return resp + + self._options.post_parser = _parser + + return await self._client.request(self._page_cls, self._options) + + async def __aiter__(self) -> AsyncIterator[_T]: + # https://github.com/microsoft/pyright/issues/3464 + page = cast( + AsyncPageT, + await self, # type: ignore + ) + async for item in page: + yield item + + +class BaseAsyncPage(BasePage[_T], Generic[_T]): + _client: AsyncAPIClient = pydantic.PrivateAttr() + + def _set_private_attributes( + self, + model: Type[_T], + client: AsyncAPIClient, + options: FinalRequestOptions, + ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + + self._model = model + self._client = client + self._options = options + + async def __aiter__(self) -> AsyncIterator[_T]: + async for page in self.iter_pages(): + for item in page._get_page_items(): + yield item + + async def iter_pages(self: AsyncPageT) -> AsyncIterator[AsyncPageT]: + page = self + while True: + yield page + if page.has_next_page(): + page = await page.get_next_page() + else: + return + + async def get_next_page(self: AsyncPageT) -> AsyncPageT: + info = self.next_page_info() + if not info: + raise RuntimeError( + "No next page expected; please check `.has_next_page()` before calling `.get_next_page()`." + ) + + options = self._info_to_options(info) + return await self._client._request_api_list(self._model, page=self.__class__, options=options) + + +_HttpxClientT = TypeVar("_HttpxClientT", bound=Union[httpx.Client, httpx.AsyncClient]) +_DefaultStreamT = TypeVar("_DefaultStreamT", bound=Union[Stream[Any], AsyncStream[Any]]) + + +class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): + _client: _HttpxClientT + _version: str + _base_url: URL + max_retries: int + timeout: Union[float, Timeout, None] + _strict_response_validation: bool + _idempotency_header: str | None + _default_stream_cls: type[_DefaultStreamT] | None = None + + def __init__( + self, + *, + version: str, + base_url: str | URL, + _strict_response_validation: bool, + max_retries: int = DEFAULT_MAX_RETRIES, + timeout: float | Timeout | None = DEFAULT_TIMEOUT, + custom_headers: Mapping[str, str] | None = None, + custom_query: Mapping[str, object] | None = None, + ) -> None: + self._version = version + self._base_url = self._enforce_trailing_slash(URL(base_url)) + self.max_retries = max_retries + self.timeout = timeout + self._custom_headers = custom_headers or {} + self._custom_query = custom_query or {} + self._strict_response_validation = _strict_response_validation + self._idempotency_header = None + self._platform: Platform | None = None + + if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] + raise TypeError( + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `imagekit.DEFAULT_MAX_RETRIES`" + ) + + def _enforce_trailing_slash(self, url: URL) -> URL: + if url.raw_path.endswith(b"/"): + return url + return url.copy_with(raw_path=url.raw_path + b"/") + + def _make_status_error_from_response( + self, + response: httpx.Response, + ) -> APIStatusError: + if response.is_closed and not response.is_stream_consumed: + # We can't read the response body as it has been closed + # before it was read. This can happen if an event hook + # raises a status error. + body = None + err_msg = f"Error code: {response.status_code}" + else: + err_text = response.text.strip() + body = err_text + + try: + body = json.loads(err_text) + err_msg = f"Error code: {response.status_code} - {body}" + except Exception: + err_msg = err_text or f"Error code: {response.status_code}" + + return self._make_status_error(err_msg, body=body, response=response) + + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> _exceptions.APIStatusError: + raise NotImplementedError() + + def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers: + custom_headers = options.headers or {} + headers_dict = _merge_mappings(self.default_headers, custom_headers) + self._validate_headers(headers_dict, custom_headers) + + # headers are case-insensitive while dictionaries are not. + headers = httpx.Headers(headers_dict) + + idempotency_header = self._idempotency_header + if idempotency_header and options.idempotency_key and idempotency_header not in headers: + headers[idempotency_header] = options.idempotency_key + + # Don't set these headers if they were already set or removed by the caller. We check + # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. + lower_custom_headers = [header.lower() for header in custom_headers] + if "x-stainless-retry-count" not in lower_custom_headers: + headers["x-stainless-retry-count"] = str(retries_taken) + if "x-stainless-read-timeout" not in lower_custom_headers: + timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout + if isinstance(timeout, Timeout): + timeout = timeout.read + if timeout is not None: + headers["x-stainless-read-timeout"] = str(timeout) + + return headers + + def _prepare_url(self, url: str) -> URL: + """ + Merge a URL argument together with any 'base_url' on the client, + to create the URL used for the outgoing request. + """ + # Copied from httpx's `_merge_url` method. + merge_url = URL(url) + if merge_url.is_relative_url: + merge_raw_path = self.base_url.raw_path + merge_url.raw_path.lstrip(b"/") + return self.base_url.copy_with(raw_path=merge_raw_path) + + return merge_url + + def _make_sse_decoder(self) -> SSEDecoder | SSEBytesDecoder: + return SSEDecoder() + + def _build_request( + self, + options: FinalRequestOptions, + *, + retries_taken: int = 0, + ) -> httpx.Request: + if log.isEnabledFor(logging.DEBUG): + log.debug("Request options: %s", model_dump(options, exclude_unset=True)) + + kwargs: dict[str, Any] = {} + + json_data = options.json_data + if options.extra_json is not None: + if json_data is None: + json_data = cast(Body, options.extra_json) + elif is_mapping(json_data): + json_data = _merge_mappings(json_data, options.extra_json) + else: + raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`") + + headers = self._build_headers(options, retries_taken=retries_taken) + params = _merge_mappings(self.default_query, options.params) + content_type = headers.get("Content-Type") + files = options.files + + # If the given Content-Type header is multipart/form-data then it + # has to be removed so that httpx can generate the header with + # additional information for us as it has to be in this form + # for the server to be able to correctly parse the request: + # multipart/form-data; boundary=---abc-- + if content_type is not None and content_type.startswith("multipart/form-data"): + if "boundary" not in content_type: + # only remove the header if the boundary hasn't been explicitly set + # as the caller doesn't want httpx to come up with their own boundary + headers.pop("Content-Type") + + # As we are now sending multipart/form-data instead of application/json + # we need to tell httpx to use it, https://www.python-httpx.org/advanced/clients/#multipart-file-encoding + if json_data: + if not is_dict(json_data): + raise TypeError( + f"Expected query input to be a dictionary for multipart requests but got {type(json_data)} instead." + ) + kwargs["data"] = self._serialize_multipartform(json_data) + + # httpx determines whether or not to send a "multipart/form-data" + # request based on the truthiness of the "files" argument. + # This gets around that issue by generating a dict value that + # evaluates to true. + # + # https://github.com/encode/httpx/discussions/2399#discussioncomment-3814186 + if not files: + files = cast(HttpxRequestFiles, ForceMultipartDict()) + + prepared_url = self._prepare_url(options.url) + if "_" in prepared_url.host: + # work around https://github.com/encode/httpx/discussions/2880 + kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} + + is_body_allowed = options.method.lower() != "get" + + if is_body_allowed: + if isinstance(json_data, bytes): + kwargs["content"] = json_data + else: + kwargs["json"] = json_data if is_given(json_data) else None + kwargs["files"] = files + else: + headers.pop("Content-Type", None) + kwargs.pop("data", None) + + # TODO: report this error to httpx + return self._client.build_request( # pyright: ignore[reportUnknownMemberType] + headers=headers, + timeout=self.timeout if isinstance(options.timeout, NotGiven) else options.timeout, + method=options.method, + url=prepared_url, + # the `Query` type that we use is incompatible with qs' + # `Params` type as it needs to be typed as `Mapping[str, object]` + # so that passing a `TypedDict` doesn't cause an error. + # https://github.com/microsoft/pyright/issues/3526#event-6715453066 + params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, + **kwargs, + ) + + def _serialize_multipartform(self, data: Mapping[object, object]) -> dict[str, object]: + items = self.qs.stringify_items( + # TODO: type ignore is required as stringify_items is well typed but we can't be + # well typed without heavy validation. + data, # type: ignore + array_format="brackets", + ) + serialized: dict[str, object] = {} + for key, value in items: + existing = serialized.get(key) + + if not existing: + serialized[key] = value + continue + + # If a value has already been set for this key then that + # means we're sending data like `array[]=[1, 2, 3]` and we + # need to tell httpx that we want to send multiple values with + # the same key which is done by using a list or a tuple. + # + # Note: 2d arrays should never result in the same key at both + # levels so it's safe to assume that if the value is a list, + # it was because we changed it to be a list. + if is_list(existing): + existing.append(value) + else: + serialized[key] = [existing, value] + + return serialized + + def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalRequestOptions) -> type[ResponseT]: + if not is_given(options.headers): + return cast_to + + # make a copy of the headers so we don't mutate user-input + headers = dict(options.headers) + + # we internally support defining a temporary header to override the + # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` + # see _response.py for implementation details + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + if is_given(override_cast_to): + options.headers = headers + return cast(Type[ResponseT], override_cast_to) + + return cast_to + + def _should_stream_response_body(self, request: httpx.Request) -> bool: + return request.headers.get(RAW_RESPONSE_HEADER) == "stream" # type: ignore[no-any-return] + + def _process_response_data( + self, + *, + data: object, + cast_to: type[ResponseT], + response: httpx.Response, + ) -> ResponseT: + if data is None: + return cast(ResponseT, None) + + if cast_to is object: + return cast(ResponseT, data) + + try: + if inspect.isclass(cast_to) and issubclass(cast_to, ModelBuilderProtocol): + return cast(ResponseT, cast_to.build(response=response, data=data)) + + if self._strict_response_validation: + return cast(ResponseT, validate_type(type_=cast_to, value=data)) + + return cast(ResponseT, construct_type(type_=cast_to, value=data)) + except pydantic.ValidationError as err: + raise APIResponseValidationError(response=response, body=data) from err + + @property + def qs(self) -> Querystring: + return Querystring() + + @property + def custom_auth(self) -> httpx.Auth | None: + return None + + @property + def auth_headers(self) -> dict[str, str]: + return {} + + @property + def default_headers(self) -> dict[str, str | Omit]: + return { + "Accept": "application/json", + "Content-Type": "application/json", + "User-Agent": self.user_agent, + **self.platform_headers(), + **self.auth_headers, + **self._custom_headers, + } + + @property + def default_query(self) -> dict[str, object]: + return { + **self._custom_query, + } + + def _validate_headers( + self, + headers: Headers, # noqa: ARG002 + custom_headers: Headers, # noqa: ARG002 + ) -> None: + """Validate the given default headers and custom headers. + + Does nothing by default. + """ + return + + @property + def user_agent(self) -> str: + return f"{self.__class__.__name__}/Python {self._version}" + + @property + def base_url(self) -> URL: + return self._base_url + + @base_url.setter + def base_url(self, url: URL | str) -> None: + self._base_url = self._enforce_trailing_slash(url if isinstance(url, URL) else URL(url)) + + def platform_headers(self) -> Dict[str, str]: + # the actual implementation is in a separate `lru_cache` decorated + # function because adding `lru_cache` to methods will leak memory + # https://github.com/python/cpython/issues/88476 + return platform_headers(self._version, platform=self._platform) + + def _parse_retry_after_header(self, response_headers: Optional[httpx.Headers] = None) -> float | None: + """Returns a float of the number of seconds (not milliseconds) to wait after retrying, or None if unspecified. + + About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After + See also https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After#syntax + """ + if response_headers is None: + return None + + # First, try the non-standard `retry-after-ms` header for milliseconds, + # which is more precise than integer-seconds `retry-after` + try: + retry_ms_header = response_headers.get("retry-after-ms", None) + return float(retry_ms_header) / 1000 + except (TypeError, ValueError): + pass + + # Next, try parsing `retry-after` header as seconds (allowing nonstandard floats). + retry_header = response_headers.get("retry-after") + try: + # note: the spec indicates that this should only ever be an integer + # but if someone sends a float there's no reason for us to not respect it + return float(retry_header) + except (TypeError, ValueError): + pass + + # Last, try parsing `retry-after` as a date. + retry_date_tuple = email.utils.parsedate_tz(retry_header) + if retry_date_tuple is None: + return None + + retry_date = email.utils.mktime_tz(retry_date_tuple) + return float(retry_date - time.time()) + + def _calculate_retry_timeout( + self, + remaining_retries: int, + options: FinalRequestOptions, + response_headers: Optional[httpx.Headers] = None, + ) -> float: + max_retries = options.get_max_retries(self.max_retries) + + # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + retry_after = self._parse_retry_after_header(response_headers) + if retry_after is not None and 0 < retry_after <= 60: + return retry_after + + # Also cap retry count to 1000 to avoid any potential overflows with `pow` + nb_retries = min(max_retries - remaining_retries, 1000) + + # Apply exponential backoff, but not more than the max. + sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY) + + # Apply some jitter, plus-or-minus half a second. + jitter = 1 - 0.25 * random() + timeout = sleep_seconds * jitter + return timeout if timeout >= 0 else 0 + + def _should_retry(self, response: httpx.Response) -> bool: + # Note: this is not a standard header + should_retry_header = response.headers.get("x-should-retry") + + # If the server explicitly says whether or not to retry, obey. + if should_retry_header == "true": + log.debug("Retrying as header `x-should-retry` is set to `true`") + return True + if should_retry_header == "false": + log.debug("Not retrying as header `x-should-retry` is set to `false`") + return False + + # Retry on request timeouts. + if response.status_code == 408: + log.debug("Retrying due to status code %i", response.status_code) + return True + + # Retry on lock timeouts. + if response.status_code == 409: + log.debug("Retrying due to status code %i", response.status_code) + return True + + # Retry on rate limits. + if response.status_code == 429: + log.debug("Retrying due to status code %i", response.status_code) + return True + + # Retry internal errors. + if response.status_code >= 500: + log.debug("Retrying due to status code %i", response.status_code) + return True + + log.debug("Not retrying") + return False + + def _idempotency_key(self) -> str: + return f"stainless-python-retry-{uuid.uuid4()}" + + +class _DefaultHttpxClient(httpx.Client): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultHttpxClient = httpx.Client + """An alias to `httpx.Client` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.Client` will result in httpx's defaults being used, not ours. + """ +else: + DefaultHttpxClient = _DefaultHttpxClient + + +class SyncHttpxClientWrapper(DefaultHttpxClient): + def __del__(self) -> None: + if self.is_closed: + return + + try: + self.close() + except Exception: + pass + + +class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]): + _client: httpx.Client + _default_stream_cls: type[Stream[Any]] | None = None + + def __init__( + self, + *, + version: str, + base_url: str | URL, + max_retries: int = DEFAULT_MAX_RETRIES, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.Client | None = None, + custom_headers: Mapping[str, str] | None = None, + custom_query: Mapping[str, object] | None = None, + _strict_response_validation: bool, + ) -> None: + if not is_given(timeout): + # if the user passed in a custom http client with a non-default + # timeout set then we use that timeout. + # + # note: there is an edge case here where the user passes in a client + # where they've explicitly set the timeout to match the default timeout + # as this check is structural, meaning that we'll think they didn't + # pass in a timeout and will ignore it + if http_client and http_client.timeout != HTTPX_DEFAULT_TIMEOUT: + timeout = http_client.timeout + else: + timeout = DEFAULT_TIMEOUT + + if http_client is not None and not isinstance(http_client, httpx.Client): # pyright: ignore[reportUnnecessaryIsInstance] + raise TypeError( + f"Invalid `http_client` argument; Expected an instance of `httpx.Client` but got {type(http_client)}" + ) + + super().__init__( + version=version, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + base_url=base_url, + max_retries=max_retries, + custom_query=custom_query, + custom_headers=custom_headers, + _strict_response_validation=_strict_response_validation, + ) + self._client = http_client or SyncHttpxClientWrapper( + base_url=base_url, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + ) + + def is_closed(self) -> bool: + return self._client.is_closed + + def close(self) -> None: + """Close the underlying HTTPX client. + + The client will *not* be usable after this. + """ + # If an error is thrown while constructing a client, self._client + # may not be present + if hasattr(self, "_client"): + self._client.close() + + def __enter__(self: _T) -> _T: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + self.close() + + def _prepare_options( + self, + options: FinalRequestOptions, # noqa: ARG002 + ) -> FinalRequestOptions: + """Hook for mutating the given options""" + return options + + def _prepare_request( + self, + request: httpx.Request, # noqa: ARG002 + ) -> None: + """This method is used as a callback for mutating the `Request` object + after it has been constructed. + This is useful for cases where you want to add certain headers based off of + the request properties, e.g. `url`, `method` etc. + """ + return None + + @overload + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: Literal[True], + stream_cls: Type[_StreamT], + ) -> _StreamT: ... + + @overload + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: bool = False, + stream_cls: Type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: ... + + def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: bool = False, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: + cast_to = self._maybe_override_cast_to(cast_to, options) + + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() + + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) + + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = self._prepare_options(options) + + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + self._prepare_request(request) + + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth + + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects + + log.debug("Sending HTTP Request: %s %s", request.method, request.url) + + response = None + try: + response = self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) + + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + err.response.close() + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue + + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + err.response.read() + + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None + + break + + assert response is not None, "could not resolve response (should never happen)" + return self._process_response( + cast_to=cast_to, + options=options, + response=response, + stream=stream, + stream_cls=stream_cls, + retries_taken=retries_taken, + ) + + def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken + if remaining_retries == 1: + log.debug("1 retry left") + else: + log.debug("%i retries left", remaining_retries) + + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) + log.info("Retrying request to %s in %f seconds", options.url, timeout) + + time.sleep(timeout) + + def _process_response( + self, + *, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + response: httpx.Response, + stream: bool, + stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, + ) -> ResponseT: + origin = get_origin(cast_to) or cast_to + + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): + if not issubclass(origin, APIResponse): + raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}") + + response_cls = cast("type[BaseAPIResponse[Any]]", cast_to) + return cast( + ResponseT, + response_cls( + raw=response, + client=self, + cast_to=extract_response_type(response_cls), + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ), + ) + + if cast_to == httpx.Response: + return cast(ResponseT, response) + + api_response = APIResponse( + raw=response, + client=self, + cast_to=cast("type[ResponseT]", cast_to), # pyright: ignore[reportUnnecessaryCast] + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ) + if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): + return cast(ResponseT, api_response) + + return api_response.parse() + + def _request_api_list( + self, + model: Type[object], + page: Type[SyncPageT], + options: FinalRequestOptions, + ) -> SyncPageT: + def _parser(resp: SyncPageT) -> SyncPageT: + resp._set_private_attributes( + client=self, + model=model, + options=options, + ) + return resp + + options.post_parser = _parser + + return self.request(page, options, stream=False) + + @overload + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[True], + stream_cls: type[_StreamT], + ) -> _StreamT: ... + + @overload + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: ... + + def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool = False, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: + opts = FinalRequestOptions.construct(method="get", url=path, **options) + # cast is required because mypy complains about returning Any even though + # it understands the type variables + return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) + + @overload + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: Literal[True], + stream_cls: type[_StreamT], + ) -> _StreamT: ... + + @overload + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: bool, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: ... + + def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + files: RequestFiles | None = None, + stream: bool = False, + stream_cls: type[_StreamT] | None = None, + ) -> ResponseT | _StreamT: + opts = FinalRequestOptions.construct( + method="post", url=path, json_data=body, files=to_httpx_files(files), **options + ) + return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) + + def patch( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + return self.request(cast_to, opts) + + def put( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct( + method="put", url=path, json_data=body, files=to_httpx_files(files), **options + ) + return self.request(cast_to, opts) + + def delete( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + return self.request(cast_to, opts) + + def get_api_list( + self, + path: str, + *, + model: Type[object], + page: Type[SyncPageT], + body: Body | None = None, + options: RequestOptions = {}, + method: str = "get", + ) -> SyncPageT: + opts = FinalRequestOptions.construct(method=method, url=path, json_data=body, **options) + return self._request_api_list(model, page, opts) + + +class _DefaultAsyncHttpxClient(httpx.AsyncClient): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +try: + import httpx_aiohttp +except ImportError: + + class _DefaultAioHttpClient(httpx.AsyncClient): + def __init__(self, **_kwargs: Any) -> None: + raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra") +else: + + class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultAsyncHttpxClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.AsyncClient` will result in httpx's defaults being used, not ours. + """ + + DefaultAioHttpClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`.""" +else: + DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient + DefaultAioHttpClient = _DefaultAioHttpClient + + +class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient): + def __del__(self) -> None: + if self.is_closed: + return + + try: + # TODO(someday): support non asyncio runtimes here + asyncio.get_running_loop().create_task(self.aclose()) + except Exception: + pass + + +class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]): + _client: httpx.AsyncClient + _default_stream_cls: type[AsyncStream[Any]] | None = None + + def __init__( + self, + *, + version: str, + base_url: str | URL, + _strict_response_validation: bool, + max_retries: int = DEFAULT_MAX_RETRIES, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.AsyncClient | None = None, + custom_headers: Mapping[str, str] | None = None, + custom_query: Mapping[str, object] | None = None, + ) -> None: + if not is_given(timeout): + # if the user passed in a custom http client with a non-default + # timeout set then we use that timeout. + # + # note: there is an edge case here where the user passes in a client + # where they've explicitly set the timeout to match the default timeout + # as this check is structural, meaning that we'll think they didn't + # pass in a timeout and will ignore it + if http_client and http_client.timeout != HTTPX_DEFAULT_TIMEOUT: + timeout = http_client.timeout + else: + timeout = DEFAULT_TIMEOUT + + if http_client is not None and not isinstance(http_client, httpx.AsyncClient): # pyright: ignore[reportUnnecessaryIsInstance] + raise TypeError( + f"Invalid `http_client` argument; Expected an instance of `httpx.AsyncClient` but got {type(http_client)}" + ) + + super().__init__( + version=version, + base_url=base_url, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + max_retries=max_retries, + custom_query=custom_query, + custom_headers=custom_headers, + _strict_response_validation=_strict_response_validation, + ) + self._client = http_client or AsyncHttpxClientWrapper( + base_url=base_url, + # cast to a valid type because mypy doesn't understand our type narrowing + timeout=cast(Timeout, timeout), + ) + + def is_closed(self) -> bool: + return self._client.is_closed + + async def close(self) -> None: + """Close the underlying HTTPX client. + + The client will *not* be usable after this. + """ + await self._client.aclose() + + async def __aenter__(self: _T) -> _T: + return self + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + await self.close() + + async def _prepare_options( + self, + options: FinalRequestOptions, # noqa: ARG002 + ) -> FinalRequestOptions: + """Hook for mutating the given options""" + return options + + async def _prepare_request( + self, + request: httpx.Request, # noqa: ARG002 + ) -> None: + """This method is used as a callback for mutating the `Request` object + after it has been constructed. + This is useful for cases where you want to add certain headers based off of + the request properties, e.g. `url`, `method` etc. + """ + return None + + @overload + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: Literal[True], + stream_cls: type[_AsyncStreamT], + ) -> _AsyncStreamT: ... + + @overload + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: bool, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: ... + + async def request( + self, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + *, + stream: bool = False, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: + if self._platform is None: + # `get_platform` can make blocking IO calls so we + # execute it earlier while we are in an async context + self._platform = await asyncify(get_platform)() + + cast_to = self._maybe_override_cast_to(cast_to, options) + + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() + + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) + + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = await self._prepare_options(options) + + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + await self._prepare_request(request) + + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth + + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects + + log.debug("Sending HTTP Request: %s %s", request.method, request.url) + + response = None + try: + response = await self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) + + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + await err.response.aclose() + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue + + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + await err.response.aread() + + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None + + break + + assert response is not None, "could not resolve response (should never happen)" + return await self._process_response( + cast_to=cast_to, + options=options, + response=response, + stream=stream, + stream_cls=stream_cls, + retries_taken=retries_taken, + ) + + async def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken + if remaining_retries == 1: + log.debug("1 retry left") + else: + log.debug("%i retries left", remaining_retries) + + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) + log.info("Retrying request to %s in %f seconds", options.url, timeout) + + await anyio.sleep(timeout) + + async def _process_response( + self, + *, + cast_to: Type[ResponseT], + options: FinalRequestOptions, + response: httpx.Response, + stream: bool, + stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, + ) -> ResponseT: + origin = get_origin(cast_to) or cast_to + + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): + if not issubclass(origin, AsyncAPIResponse): + raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}") + + response_cls = cast("type[BaseAPIResponse[Any]]", cast_to) + return cast( + "ResponseT", + response_cls( + raw=response, + client=self, + cast_to=extract_response_type(response_cls), + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ), + ) + + if cast_to == httpx.Response: + return cast(ResponseT, response) + + api_response = AsyncAPIResponse( + raw=response, + client=self, + cast_to=cast("type[ResponseT]", cast_to), # pyright: ignore[reportUnnecessaryCast] + stream=stream, + stream_cls=stream_cls, + options=options, + retries_taken=retries_taken, + ) + if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): + return cast(ResponseT, api_response) + + return await api_response.parse() + + def _request_api_list( + self, + model: Type[_T], + page: Type[AsyncPageT], + options: FinalRequestOptions, + ) -> AsyncPaginator[_T, AsyncPageT]: + return AsyncPaginator(client=self, options=options, page_cls=page, model=model) + + @overload + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: Literal[True], + stream_cls: type[_AsyncStreamT], + ) -> _AsyncStreamT: ... + + @overload + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: ... + + async def get( + self, + path: str, + *, + cast_to: Type[ResponseT], + options: RequestOptions = {}, + stream: bool = False, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: + opts = FinalRequestOptions.construct(method="get", url=path, **options) + return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) + + @overload + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: Literal[False] = False, + ) -> ResponseT: ... + + @overload + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: Literal[True], + stream_cls: type[_AsyncStreamT], + ) -> _AsyncStreamT: ... + + @overload + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: bool, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: ... + + async def post( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + stream: bool = False, + stream_cls: type[_AsyncStreamT] | None = None, + ) -> ResponseT | _AsyncStreamT: + opts = FinalRequestOptions.construct( + method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options + ) + return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) + + async def patch( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + return await self.request(cast_to, opts) + + async def put( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + files: RequestFiles | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct( + method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options + ) + return await self.request(cast_to, opts) + + async def delete( + self, + path: str, + *, + cast_to: Type[ResponseT], + body: Body | None = None, + options: RequestOptions = {}, + ) -> ResponseT: + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + return await self.request(cast_to, opts) + + def get_api_list( + self, + path: str, + *, + model: Type[_T], + page: Type[AsyncPageT], + body: Body | None = None, + options: RequestOptions = {}, + method: str = "get", + ) -> AsyncPaginator[_T, AsyncPageT]: + opts = FinalRequestOptions.construct(method=method, url=path, json_data=body, **options) + return self._request_api_list(model, page, opts) + + +def make_request_options( + *, + query: Query | None = None, + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + idempotency_key: str | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + post_parser: PostParser | NotGiven = NOT_GIVEN, +) -> RequestOptions: + """Create a dict of type RequestOptions without keys of NotGiven values.""" + options: RequestOptions = {} + if extra_headers is not None: + options["headers"] = extra_headers + + if extra_body is not None: + options["extra_json"] = cast(AnyMapping, extra_body) + + if query is not None: + options["params"] = query + + if extra_query is not None: + options["params"] = {**options.get("params", {}), **extra_query} + + if not isinstance(timeout, NotGiven): + options["timeout"] = timeout + + if idempotency_key is not None: + options["idempotency_key"] = idempotency_key + + if is_given(post_parser): + # internal + options["post_parser"] = post_parser # type: ignore + + return options + + +class ForceMultipartDict(Dict[str, None]): + def __bool__(self) -> bool: + return True + + +class OtherPlatform: + def __init__(self, name: str) -> None: + self.name = name + + @override + def __str__(self) -> str: + return f"Other:{self.name}" + + +Platform = Union[ + OtherPlatform, + Literal[ + "MacOS", + "Linux", + "Windows", + "FreeBSD", + "OpenBSD", + "iOS", + "Android", + "Unknown", + ], +] + + +def get_platform() -> Platform: + try: + system = platform.system().lower() + platform_name = platform.platform().lower() + except Exception: + return "Unknown" + + if "iphone" in platform_name or "ipad" in platform_name: + # Tested using Python3IDE on an iPhone 11 and Pythonista on an iPad 7 + # system is Darwin and platform_name is a string like: + # - Darwin-21.6.0-iPhone12,1-64bit + # - Darwin-21.6.0-iPad7,11-64bit + return "iOS" + + if system == "darwin": + return "MacOS" + + if system == "windows": + return "Windows" + + if "android" in platform_name: + # Tested using Pydroid 3 + # system is Linux and platform_name is a string like 'Linux-5.10.81-android12-9-00001-geba40aecb3b7-ab8534902-aarch64-with-libc' + return "Android" + + if system == "linux": + # https://distro.readthedocs.io/en/latest/#distro.id + distro_id = distro.id() + if distro_id == "freebsd": + return "FreeBSD" + + if distro_id == "openbsd": + return "OpenBSD" + + return "Linux" + + if platform_name: + return OtherPlatform(platform_name) + + return "Unknown" + + +@lru_cache(maxsize=None) +def platform_headers(version: str, *, platform: Platform | None) -> Dict[str, str]: + return { + "X-Stainless-Lang": "python", + "X-Stainless-Package-Version": version, + "X-Stainless-OS": str(platform or get_platform()), + "X-Stainless-Arch": str(get_architecture()), + "X-Stainless-Runtime": get_python_runtime(), + "X-Stainless-Runtime-Version": get_python_version(), + } + + +class OtherArch: + def __init__(self, name: str) -> None: + self.name = name + + @override + def __str__(self) -> str: + return f"other:{self.name}" + + +Arch = Union[OtherArch, Literal["x32", "x64", "arm", "arm64", "unknown"]] + + +def get_python_runtime() -> str: + try: + return platform.python_implementation() + except Exception: + return "unknown" + + +def get_python_version() -> str: + try: + return platform.python_version() + except Exception: + return "unknown" + + +def get_architecture() -> Arch: + try: + machine = platform.machine().lower() + except Exception: + return "unknown" + + if machine in ("arm64", "aarch64"): + return "arm64" + + # TODO: untested + if machine == "arm": + return "arm" + + if machine == "x86_64": + return "x64" + + # TODO: untested + if sys.maxsize <= 2**32: + return "x32" + + if machine: + return OtherArch(machine) + + return "unknown" + + +def _merge_mappings( + obj1: Mapping[_T_co, Union[_T, Omit]], + obj2: Mapping[_T_co, Union[_T, Omit]], +) -> Dict[_T_co, _T]: + """Merge two mappings of the same type, removing any values that are instances of `Omit`. + + In cases with duplicate keys the second mapping takes precedence. + """ + merged = {**obj1, **obj2} + return {key: value for key, value in merged.items() if not isinstance(value, Omit)} diff --git a/src/imagekit/_client.py b/src/imagekit/_client.py new file mode 100644 index 0000000..6166974 --- /dev/null +++ b/src/imagekit/_client.py @@ -0,0 +1,542 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +import base64 +from typing import Any, Union, Mapping +from typing_extensions import Self, override + +import httpx + +from . import _exceptions +from ._qs import Querystring +from ._types import ( + NOT_GIVEN, + Omit, + Headers, + Timeout, + NotGiven, + Transport, + ProxiesTypes, + RequestOptions, +) +from ._utils import is_given, get_async_library +from ._version import __version__ +from .resources import assets, webhooks, custom_metadata_fields +from ._streaming import Stream as Stream, AsyncStream as AsyncStream +from ._exceptions import ImageKitError, APIStatusError +from ._base_client import ( + DEFAULT_MAX_RETRIES, + SyncAPIClient, + AsyncAPIClient, +) +from .resources.beta import beta +from .resources.cache import cache +from .resources.files import files +from .resources.folders import folders +from .resources.accounts import accounts + +__all__ = [ + "Timeout", + "Transport", + "ProxiesTypes", + "RequestOptions", + "ImageKit", + "AsyncImageKit", + "Client", + "AsyncClient", +] + + +class ImageKit(SyncAPIClient): + custom_metadata_fields: custom_metadata_fields.CustomMetadataFieldsResource + files: files.FilesResource + assets: assets.AssetsResource + cache: cache.CacheResource + folders: folders.FoldersResource + accounts: accounts.AccountsResource + beta: beta.BetaResource + webhooks: webhooks.WebhooksResource + with_raw_response: ImageKitWithRawResponse + with_streaming_response: ImageKitWithStreamedResponse + + # client options + private_api_key: str + password: str | None + webhook_secret: str | None + + def __init__( + self, + *, + private_api_key: str | None = None, + password: str | None = None, + webhook_secret: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + max_retries: int = DEFAULT_MAX_RETRIES, + default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. + http_client: httpx.Client | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False, + ) -> None: + """Construct a new synchronous ImageKit client instance. + + This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `private_api_key` from `IMAGEKIT_PRIVATE_API_KEY` + - `password` from `OPTIONAL_IMAGEKIT_IGNORES_THIS` + - `webhook_secret` from `IMAGEKIT_WEBHOOK_SECRET` + """ + if private_api_key is None: + private_api_key = os.environ.get("IMAGEKIT_PRIVATE_API_KEY") + if private_api_key is None: + raise ImageKitError( + "The private_api_key client option must be set either by passing private_api_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable" + ) + self.private_api_key = private_api_key + + if password is None: + password = os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS") or "do_not_set" + self.password = password + + if webhook_secret is None: + webhook_secret = os.environ.get("IMAGEKIT_WEBHOOK_SECRET") + self.webhook_secret = webhook_secret + + if base_url is None: + base_url = os.environ.get("IMAGE_KIT_BASE_URL") + self._base_url_overridden = base_url is not None + if base_url is None: + base_url = f"https://api.imagekit.io" + + super().__init__( + version=__version__, + base_url=base_url, + max_retries=max_retries, + timeout=timeout, + http_client=http_client, + custom_headers=default_headers, + custom_query=default_query, + _strict_response_validation=_strict_response_validation, + ) + + self.custom_metadata_fields = custom_metadata_fields.CustomMetadataFieldsResource(self) + self.files = files.FilesResource(self) + self.assets = assets.AssetsResource(self) + self.cache = cache.CacheResource(self) + self.folders = folders.FoldersResource(self) + self.accounts = accounts.AccountsResource(self) + self.beta = beta.BetaResource(self) + self.webhooks = webhooks.WebhooksResource(self) + self.with_raw_response = ImageKitWithRawResponse(self) + self.with_streaming_response = ImageKitWithStreamedResponse(self) + + @property + @override + def qs(self) -> Querystring: + return Querystring(array_format="comma") + + @property + @override + def auth_headers(self) -> dict[str, str]: + if self.password is None: + return {} + credentials = f"{self.private_api_key}:{self.password}".encode("ascii") + header = f"Basic {base64.b64encode(credentials).decode('ascii')}" + return {"Authorization": header} + + @property + @override + def default_headers(self) -> dict[str, str | Omit]: + return { + **super().default_headers, + "X-Stainless-Async": "false", + **self._custom_headers, + } + + @override + def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: + if self.private_api_key and self.password and headers.get("Authorization"): + return + if isinstance(custom_headers.get("Authorization"), Omit): + return + + raise TypeError( + '"Could not resolve authentication method. Expected the private_api_key or password to be set. Or for the `Authorization` headers to be explicitly omitted"' + ) + + def copy( + self, + *, + private_api_key: str | None = None, + password: str | None = None, + webhook_secret: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.Client | None = None, + max_retries: int | NotGiven = NOT_GIVEN, + default_headers: Mapping[str, str] | None = None, + set_default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + set_default_query: Mapping[str, object] | None = None, + _extra_kwargs: Mapping[str, Any] = {}, + ) -> Self: + """ + Create a new client instance re-using the same options given to the current client with optional overriding. + """ + if default_headers is not None and set_default_headers is not None: + raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + + if default_query is not None and set_default_query is not None: + raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + + headers = self._custom_headers + if default_headers is not None: + headers = {**headers, **default_headers} + elif set_default_headers is not None: + headers = set_default_headers + + params = self._custom_query + if default_query is not None: + params = {**params, **default_query} + elif set_default_query is not None: + params = set_default_query + + http_client = http_client or self._client + client = self.__class__( + private_api_key=private_api_key or self.private_api_key, + password=password or self.password, + webhook_secret=webhook_secret or self.webhook_secret, + base_url=base_url or self.base_url, + timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, + http_client=http_client, + max_retries=max_retries if is_given(max_retries) else self.max_retries, + default_headers=headers, + default_query=params, + **_extra_kwargs, + ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client + + # Alias for `copy` for nicer inline usage, e.g. + # client.with_options(timeout=10).foo.create(...) + with_options = copy + + @override + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> APIStatusError: + if response.status_code == 400: + return _exceptions.BadRequestError(err_msg, response=response, body=body) + + if response.status_code == 401: + return _exceptions.AuthenticationError(err_msg, response=response, body=body) + + if response.status_code == 403: + return _exceptions.PermissionDeniedError(err_msg, response=response, body=body) + + if response.status_code == 404: + return _exceptions.NotFoundError(err_msg, response=response, body=body) + + if response.status_code == 409: + return _exceptions.ConflictError(err_msg, response=response, body=body) + + if response.status_code == 422: + return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body) + + if response.status_code == 429: + return _exceptions.RateLimitError(err_msg, response=response, body=body) + + if response.status_code >= 500: + return _exceptions.InternalServerError(err_msg, response=response, body=body) + return APIStatusError(err_msg, response=response, body=body) + + +class AsyncImageKit(AsyncAPIClient): + custom_metadata_fields: custom_metadata_fields.AsyncCustomMetadataFieldsResource + files: files.AsyncFilesResource + assets: assets.AsyncAssetsResource + cache: cache.AsyncCacheResource + folders: folders.AsyncFoldersResource + accounts: accounts.AsyncAccountsResource + beta: beta.AsyncBetaResource + webhooks: webhooks.AsyncWebhooksResource + with_raw_response: AsyncImageKitWithRawResponse + with_streaming_response: AsyncImageKitWithStreamedResponse + + # client options + private_api_key: str + password: str | None + webhook_secret: str | None + + def __init__( + self, + *, + private_api_key: str | None = None, + password: str | None = None, + webhook_secret: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + max_retries: int = DEFAULT_MAX_RETRIES, + default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + # Configure a custom httpx client. + # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. + http_client: httpx.AsyncClient | None = None, + # Enable or disable schema validation for data returned by the API. + # When enabled an error APIResponseValidationError is raised + # if the API responds with invalid data for the expected schema. + # + # This parameter may be removed or changed in the future. + # If you rely on this feature, please open a GitHub issue + # outlining your use-case to help us decide if it should be + # part of our public interface in the future. + _strict_response_validation: bool = False, + ) -> None: + """Construct a new async AsyncImageKit client instance. + + This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `private_api_key` from `IMAGEKIT_PRIVATE_API_KEY` + - `password` from `OPTIONAL_IMAGEKIT_IGNORES_THIS` + - `webhook_secret` from `IMAGEKIT_WEBHOOK_SECRET` + """ + if private_api_key is None: + private_api_key = os.environ.get("IMAGEKIT_PRIVATE_API_KEY") + if private_api_key is None: + raise ImageKitError( + "The private_api_key client option must be set either by passing private_api_key to the client or by setting the IMAGEKIT_PRIVATE_API_KEY environment variable" + ) + self.private_api_key = private_api_key + + if password is None: + password = os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS") or "do_not_set" + self.password = password + + if webhook_secret is None: + webhook_secret = os.environ.get("IMAGEKIT_WEBHOOK_SECRET") + self.webhook_secret = webhook_secret + + if base_url is None: + base_url = os.environ.get("IMAGE_KIT_BASE_URL") + self._base_url_overridden = base_url is not None + if base_url is None: + base_url = f"https://api.imagekit.io" + + super().__init__( + version=__version__, + base_url=base_url, + max_retries=max_retries, + timeout=timeout, + http_client=http_client, + custom_headers=default_headers, + custom_query=default_query, + _strict_response_validation=_strict_response_validation, + ) + + self.custom_metadata_fields = custom_metadata_fields.AsyncCustomMetadataFieldsResource(self) + self.files = files.AsyncFilesResource(self) + self.assets = assets.AsyncAssetsResource(self) + self.cache = cache.AsyncCacheResource(self) + self.folders = folders.AsyncFoldersResource(self) + self.accounts = accounts.AsyncAccountsResource(self) + self.beta = beta.AsyncBetaResource(self) + self.webhooks = webhooks.AsyncWebhooksResource(self) + self.with_raw_response = AsyncImageKitWithRawResponse(self) + self.with_streaming_response = AsyncImageKitWithStreamedResponse(self) + + @property + @override + def qs(self) -> Querystring: + return Querystring(array_format="comma") + + @property + @override + def auth_headers(self) -> dict[str, str]: + if self.password is None: + return {} + credentials = f"{self.private_api_key}:{self.password}".encode("ascii") + header = f"Basic {base64.b64encode(credentials).decode('ascii')}" + return {"Authorization": header} + + @property + @override + def default_headers(self) -> dict[str, str | Omit]: + return { + **super().default_headers, + "X-Stainless-Async": f"async:{get_async_library()}", + **self._custom_headers, + } + + @override + def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: + if self.private_api_key and self.password and headers.get("Authorization"): + return + if isinstance(custom_headers.get("Authorization"), Omit): + return + + raise TypeError( + '"Could not resolve authentication method. Expected the private_api_key or password to be set. Or for the `Authorization` headers to be explicitly omitted"' + ) + + def copy( + self, + *, + private_api_key: str | None = None, + password: str | None = None, + webhook_secret: str | None = None, + base_url: str | httpx.URL | None = None, + timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + http_client: httpx.AsyncClient | None = None, + max_retries: int | NotGiven = NOT_GIVEN, + default_headers: Mapping[str, str] | None = None, + set_default_headers: Mapping[str, str] | None = None, + default_query: Mapping[str, object] | None = None, + set_default_query: Mapping[str, object] | None = None, + _extra_kwargs: Mapping[str, Any] = {}, + ) -> Self: + """ + Create a new client instance re-using the same options given to the current client with optional overriding. + """ + if default_headers is not None and set_default_headers is not None: + raise ValueError("The `default_headers` and `set_default_headers` arguments are mutually exclusive") + + if default_query is not None and set_default_query is not None: + raise ValueError("The `default_query` and `set_default_query` arguments are mutually exclusive") + + headers = self._custom_headers + if default_headers is not None: + headers = {**headers, **default_headers} + elif set_default_headers is not None: + headers = set_default_headers + + params = self._custom_query + if default_query is not None: + params = {**params, **default_query} + elif set_default_query is not None: + params = set_default_query + + http_client = http_client or self._client + client = self.__class__( + private_api_key=private_api_key or self.private_api_key, + password=password or self.password, + webhook_secret=webhook_secret or self.webhook_secret, + base_url=base_url or self.base_url, + timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, + http_client=http_client, + max_retries=max_retries if is_given(max_retries) else self.max_retries, + default_headers=headers, + default_query=params, + **_extra_kwargs, + ) + client._base_url_overridden = self._base_url_overridden or base_url is not None + return client + + # Alias for `copy` for nicer inline usage, e.g. + # client.with_options(timeout=10).foo.create(...) + with_options = copy + + @override + def _make_status_error( + self, + err_msg: str, + *, + body: object, + response: httpx.Response, + ) -> APIStatusError: + if response.status_code == 400: + return _exceptions.BadRequestError(err_msg, response=response, body=body) + + if response.status_code == 401: + return _exceptions.AuthenticationError(err_msg, response=response, body=body) + + if response.status_code == 403: + return _exceptions.PermissionDeniedError(err_msg, response=response, body=body) + + if response.status_code == 404: + return _exceptions.NotFoundError(err_msg, response=response, body=body) + + if response.status_code == 409: + return _exceptions.ConflictError(err_msg, response=response, body=body) + + if response.status_code == 422: + return _exceptions.UnprocessableEntityError(err_msg, response=response, body=body) + + if response.status_code == 429: + return _exceptions.RateLimitError(err_msg, response=response, body=body) + + if response.status_code >= 500: + return _exceptions.InternalServerError(err_msg, response=response, body=body) + return APIStatusError(err_msg, response=response, body=body) + + +class ImageKitWithRawResponse: + def __init__(self, client: ImageKit) -> None: + self.custom_metadata_fields = custom_metadata_fields.CustomMetadataFieldsResourceWithRawResponse( + client.custom_metadata_fields + ) + self.files = files.FilesResourceWithRawResponse(client.files) + self.assets = assets.AssetsResourceWithRawResponse(client.assets) + self.cache = cache.CacheResourceWithRawResponse(client.cache) + self.folders = folders.FoldersResourceWithRawResponse(client.folders) + self.accounts = accounts.AccountsResourceWithRawResponse(client.accounts) + self.beta = beta.BetaResourceWithRawResponse(client.beta) + + +class AsyncImageKitWithRawResponse: + def __init__(self, client: AsyncImageKit) -> None: + self.custom_metadata_fields = custom_metadata_fields.AsyncCustomMetadataFieldsResourceWithRawResponse( + client.custom_metadata_fields + ) + self.files = files.AsyncFilesResourceWithRawResponse(client.files) + self.assets = assets.AsyncAssetsResourceWithRawResponse(client.assets) + self.cache = cache.AsyncCacheResourceWithRawResponse(client.cache) + self.folders = folders.AsyncFoldersResourceWithRawResponse(client.folders) + self.accounts = accounts.AsyncAccountsResourceWithRawResponse(client.accounts) + self.beta = beta.AsyncBetaResourceWithRawResponse(client.beta) + + +class ImageKitWithStreamedResponse: + def __init__(self, client: ImageKit) -> None: + self.custom_metadata_fields = custom_metadata_fields.CustomMetadataFieldsResourceWithStreamingResponse( + client.custom_metadata_fields + ) + self.files = files.FilesResourceWithStreamingResponse(client.files) + self.assets = assets.AssetsResourceWithStreamingResponse(client.assets) + self.cache = cache.CacheResourceWithStreamingResponse(client.cache) + self.folders = folders.FoldersResourceWithStreamingResponse(client.folders) + self.accounts = accounts.AccountsResourceWithStreamingResponse(client.accounts) + self.beta = beta.BetaResourceWithStreamingResponse(client.beta) + + +class AsyncImageKitWithStreamedResponse: + def __init__(self, client: AsyncImageKit) -> None: + self.custom_metadata_fields = custom_metadata_fields.AsyncCustomMetadataFieldsResourceWithStreamingResponse( + client.custom_metadata_fields + ) + self.files = files.AsyncFilesResourceWithStreamingResponse(client.files) + self.assets = assets.AsyncAssetsResourceWithStreamingResponse(client.assets) + self.cache = cache.AsyncCacheResourceWithStreamingResponse(client.cache) + self.folders = folders.AsyncFoldersResourceWithStreamingResponse(client.folders) + self.accounts = accounts.AsyncAccountsResourceWithStreamingResponse(client.accounts) + self.beta = beta.AsyncBetaResourceWithStreamingResponse(client.beta) + + +Client = ImageKit + +AsyncClient = AsyncImageKit diff --git a/src/imagekit/_compat.py b/src/imagekit/_compat.py new file mode 100644 index 0000000..92d9ee6 --- /dev/null +++ b/src/imagekit/_compat.py @@ -0,0 +1,219 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload +from datetime import date, datetime +from typing_extensions import Self, Literal + +import pydantic +from pydantic.fields import FieldInfo + +from ._types import IncEx, StrBytesIntFloat + +_T = TypeVar("_T") +_ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) + +# --------------- Pydantic v2 compatibility --------------- + +# Pyright incorrectly reports some of our functions as overriding a method when they don't +# pyright: reportIncompatibleMethodOverride=false + +PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + +# v1 re-exports +if TYPE_CHECKING: + + def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001 + ... + + def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: # noqa: ARG001 + ... + + def get_args(t: type[Any]) -> tuple[Any, ...]: # noqa: ARG001 + ... + + def is_union(tp: type[Any] | None) -> bool: # noqa: ARG001 + ... + + def get_origin(t: type[Any]) -> type[Any] | None: # noqa: ARG001 + ... + + def is_literal_type(type_: type[Any]) -> bool: # noqa: ARG001 + ... + + def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 + ... + +else: + if PYDANTIC_V2: + from pydantic.v1.typing import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, + ) + from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + else: + from pydantic.typing import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, + ) + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + + +# refactored config +if TYPE_CHECKING: + from pydantic import ConfigDict as ConfigDict +else: + if PYDANTIC_V2: + from pydantic import ConfigDict + else: + # TODO: provide an error message here? + ConfigDict = None + + +# renamed methods / properties +def parse_obj(model: type[_ModelT], value: object) -> _ModelT: + if PYDANTIC_V2: + return model.model_validate(value) + else: + return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + + +def field_is_required(field: FieldInfo) -> bool: + if PYDANTIC_V2: + return field.is_required() + return field.required # type: ignore + + +def field_get_default(field: FieldInfo) -> Any: + value = field.get_default() + if PYDANTIC_V2: + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None + return value + return value + + +def field_outer_type(field: FieldInfo) -> Any: + if PYDANTIC_V2: + return field.annotation + return field.outer_type_ # type: ignore + + +def get_model_config(model: type[pydantic.BaseModel]) -> Any: + if PYDANTIC_V2: + return model.model_config + return model.__config__ # type: ignore + + +def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: + if PYDANTIC_V2: + return model.model_fields + return model.__fields__ # type: ignore + + +def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: + if PYDANTIC_V2: + return model.model_copy(deep=deep) + return model.copy(deep=deep) # type: ignore + + +def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: + if PYDANTIC_V2: + return model.model_dump_json(indent=indent) + return model.json(indent=indent) # type: ignore + + +def model_dump( + model: pydantic.BaseModel, + *, + exclude: IncEx | None = None, + exclude_unset: bool = False, + exclude_defaults: bool = False, + warnings: bool = True, + mode: Literal["json", "python"] = "python", +) -> dict[str, Any]: + if PYDANTIC_V2 or hasattr(model, "model_dump"): + return model.model_dump( + mode=mode, + exclude=exclude, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + # warnings are not supported in Pydantic v1 + warnings=warnings if PYDANTIC_V2 else True, + ) + return cast( + "dict[str, Any]", + model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + exclude=exclude, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + ), + ) + + +def model_parse(model: type[_ModelT], data: Any) -> _ModelT: + if PYDANTIC_V2: + return model.model_validate(data) + return model.parse_obj(data) # pyright: ignore[reportDeprecated] + + +# generic models +if TYPE_CHECKING: + + class GenericModel(pydantic.BaseModel): ... + +else: + if PYDANTIC_V2: + # there no longer needs to be a distinction in v2 but + # we still have to create our own subclass to avoid + # inconsistent MRO ordering errors + class GenericModel(pydantic.BaseModel): ... + + else: + import pydantic.generics + + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + + +# cached properties +if TYPE_CHECKING: + cached_property = property + + # we define a separate type (copied from typeshed) + # that represents that `cached_property` is `set`able + # at runtime, which differs from `@property`. + # + # this is a separate type as editors likely special case + # `@property` and we don't want to cause issues just to have + # more helpful internal types. + + class typed_cached_property(Generic[_T]): + func: Callable[[Any], _T] + attrname: str | None + + def __init__(self, func: Callable[[Any], _T]) -> None: ... + + @overload + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... + + @overload + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... + + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: + raise NotImplementedError() + + def __set_name__(self, owner: type[Any], name: str) -> None: ... + + # __set__ is not defined at runtime, but @cached_property is designed to be settable + def __set__(self, instance: object, value: _T) -> None: ... +else: + from functools import cached_property as cached_property + + typed_cached_property = cached_property diff --git a/src/imagekit/_constants.py b/src/imagekit/_constants.py new file mode 100644 index 0000000..6ddf2c7 --- /dev/null +++ b/src/imagekit/_constants.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import httpx + +RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response" +OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" + +# default timeout is 1 minute +DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) +DEFAULT_MAX_RETRIES = 2 +DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) + +INITIAL_RETRY_DELAY = 0.5 +MAX_RETRY_DELAY = 8.0 diff --git a/src/imagekit/_exceptions.py b/src/imagekit/_exceptions.py new file mode 100644 index 0000000..364ab5a --- /dev/null +++ b/src/imagekit/_exceptions.py @@ -0,0 +1,112 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +__all__ = [ + "BadRequestError", + "AuthenticationError", + "PermissionDeniedError", + "NotFoundError", + "ConflictError", + "UnprocessableEntityError", + "RateLimitError", + "InternalServerError", +] + + +class ImageKitError(Exception): + pass + + +class APIError(ImageKitError): + message: str + request: httpx.Request + + body: object | None + """The API response body. + + If the API responded with a valid JSON structure then this property will be the + decoded result. + + If it isn't a valid JSON structure then this will be the raw response. + + If there was no response associated with this error then it will be `None`. + """ + + def __init__(self, message: str, request: httpx.Request, *, body: object | None) -> None: # noqa: ARG002 + super().__init__(message) + self.request = request + self.message = message + self.body = body + + +class APIResponseValidationError(APIError): + response: httpx.Response + status_code: int + + def __init__(self, response: httpx.Response, body: object | None, *, message: str | None = None) -> None: + super().__init__(message or "Data returned by API invalid for expected schema.", response.request, body=body) + self.response = response + self.status_code = response.status_code + + +class APIWebhookValidationError(APIError): + pass + + +class APIStatusError(APIError): + """Raised when an API response has a status code of 4xx or 5xx.""" + + response: httpx.Response + status_code: int + + def __init__(self, message: str, *, response: httpx.Response, body: object | None) -> None: + super().__init__(message, response.request, body=body) + self.response = response + self.status_code = response.status_code + + +class APIConnectionError(APIError): + def __init__(self, *, message: str = "Connection error.", request: httpx.Request) -> None: + super().__init__(message, request, body=None) + + +class APITimeoutError(APIConnectionError): + def __init__(self, request: httpx.Request) -> None: + super().__init__(message="Request timed out.", request=request) + + +class BadRequestError(APIStatusError): + status_code: Literal[400] = 400 # pyright: ignore[reportIncompatibleVariableOverride] + + +class AuthenticationError(APIStatusError): + status_code: Literal[401] = 401 # pyright: ignore[reportIncompatibleVariableOverride] + + +class PermissionDeniedError(APIStatusError): + status_code: Literal[403] = 403 # pyright: ignore[reportIncompatibleVariableOverride] + + +class NotFoundError(APIStatusError): + status_code: Literal[404] = 404 # pyright: ignore[reportIncompatibleVariableOverride] + + +class ConflictError(APIStatusError): + status_code: Literal[409] = 409 # pyright: ignore[reportIncompatibleVariableOverride] + + +class UnprocessableEntityError(APIStatusError): + status_code: Literal[422] = 422 # pyright: ignore[reportIncompatibleVariableOverride] + + +class RateLimitError(APIStatusError): + status_code: Literal[429] = 429 # pyright: ignore[reportIncompatibleVariableOverride] + + +class InternalServerError(APIStatusError): + pass diff --git a/src/imagekit/_files.py b/src/imagekit/_files.py new file mode 100644 index 0000000..331bc44 --- /dev/null +++ b/src/imagekit/_files.py @@ -0,0 +1,123 @@ +from __future__ import annotations + +import io +import os +import pathlib +from typing import overload +from typing_extensions import TypeGuard + +import anyio + +from ._types import ( + FileTypes, + FileContent, + RequestFiles, + HttpxFileTypes, + Base64FileInput, + HttpxFileContent, + HttpxRequestFiles, +) +from ._utils import is_tuple_t, is_mapping_t, is_sequence_t + + +def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]: + return isinstance(obj, io.IOBase) or isinstance(obj, os.PathLike) + + +def is_file_content(obj: object) -> TypeGuard[FileContent]: + return ( + isinstance(obj, bytes) or isinstance(obj, tuple) or isinstance(obj, io.IOBase) or isinstance(obj, os.PathLike) + ) + + +def assert_is_file_content(obj: object, *, key: str | None = None) -> None: + if not is_file_content(obj): + prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" + raise RuntimeError( + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/imagekit-developer/imagekit-python/tree/master#file-uploads" + ) from None + + +@overload +def to_httpx_files(files: None) -> None: ... + + +@overload +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... + + +def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: + if files is None: + return None + + if is_mapping_t(files): + files = {key: _transform_file(file) for key, file in files.items()} + elif is_sequence_t(files): + files = [(key, _transform_file(file)) for key, file in files] + else: + raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence") + + return files + + +def _transform_file(file: FileTypes) -> HttpxFileTypes: + if is_file_content(file): + if isinstance(file, os.PathLike): + path = pathlib.Path(file) + return (path.name, path.read_bytes()) + + return file + + if is_tuple_t(file): + return (file[0], read_file_content(file[1]), *file[2:]) + + raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") + + +def read_file_content(file: FileContent) -> HttpxFileContent: + if isinstance(file, os.PathLike): + return pathlib.Path(file).read_bytes() + return file + + +@overload +async def async_to_httpx_files(files: None) -> None: ... + + +@overload +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... + + +async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: + if files is None: + return None + + if is_mapping_t(files): + files = {key: await _async_transform_file(file) for key, file in files.items()} + elif is_sequence_t(files): + files = [(key, await _async_transform_file(file)) for key, file in files] + else: + raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence") + + return files + + +async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: + if is_file_content(file): + if isinstance(file, os.PathLike): + path = anyio.Path(file) + return (path.name, await path.read_bytes()) + + return file + + if is_tuple_t(file): + return (file[0], await async_read_file_content(file[1]), *file[2:]) + + raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") + + +async def async_read_file_content(file: FileContent) -> HttpxFileContent: + if isinstance(file, os.PathLike): + return await anyio.Path(file).read_bytes() + + return file diff --git a/src/imagekit/_models.py b/src/imagekit/_models.py new file mode 100644 index 0000000..92f7c10 --- /dev/null +++ b/src/imagekit/_models.py @@ -0,0 +1,829 @@ +from __future__ import annotations + +import os +import inspect +from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast +from datetime import date, datetime +from typing_extensions import ( + List, + Unpack, + Literal, + ClassVar, + Protocol, + Required, + ParamSpec, + TypedDict, + TypeGuard, + final, + override, + runtime_checkable, +) + +import pydantic +from pydantic.fields import FieldInfo + +from ._types import ( + Body, + IncEx, + Query, + ModelT, + Headers, + Timeout, + NotGiven, + AnyMapping, + HttpxRequestFiles, +) +from ._utils import ( + PropertyInfo, + is_list, + is_given, + json_safe, + lru_cache, + is_mapping, + parse_date, + coerce_boolean, + parse_datetime, + strip_not_given, + extract_type_arg, + is_annotated_type, + is_type_alias_type, + strip_annotated_type, +) +from ._compat import ( + PYDANTIC_V2, + ConfigDict, + GenericModel as BaseGenericModel, + get_args, + is_union, + parse_obj, + get_origin, + is_literal_type, + get_model_config, + get_model_fields, + field_get_default, +) +from ._constants import RAW_RESPONSE_HEADER + +if TYPE_CHECKING: + from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema + +__all__ = ["BaseModel", "GenericModel"] + +_T = TypeVar("_T") +_BaseModelT = TypeVar("_BaseModelT", bound="BaseModel") + +P = ParamSpec("P") + + +@runtime_checkable +class _ConfigProtocol(Protocol): + allow_population_by_field_name: bool + + +class BaseModel(pydantic.BaseModel): + if PYDANTIC_V2: + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) + else: + + @property + @override + def model_fields_set(self) -> set[str]: + # a forwards-compat shim for pydantic v2 + return self.__fields_set__ # type: ignore + + class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] + extra: Any = pydantic.Extra.allow # type: ignore + + def to_dict( + self, + *, + mode: Literal["json", "python"] = "python", + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> dict[str, object]: + """Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + mode: + If mode is 'json', the dictionary will only contain JSON serializable types. e.g. `datetime` will be turned into a string, `"2024-3-22T18:11:19.117000Z"`. + If mode is 'python', the dictionary may contain any Python objects. e.g. `datetime(2024, 3, 22)` + + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value from the output. + exclude_none: Whether to exclude fields that have a value of `None` from the output. + warnings: Whether to log warnings when invalid fields are encountered. This is only supported in Pydantic v2. + """ + return self.model_dump( + mode=mode, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) + + def to_json( + self, + *, + indent: int | None = 2, + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> str: + """Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation). + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + indent: Indentation to use in the JSON output. If `None` is passed, the output will be compact. Defaults to `2` + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that have the default value. + exclude_none: Whether to exclude fields that have a value of `None`. + warnings: Whether to show any warnings that occurred during serialization. This is only supported in Pydantic v2. + """ + return self.model_dump_json( + indent=indent, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) + + @override + def __str__(self) -> str: + # mypy complains about an invalid self arg + return f"{self.__repr_name__()}({self.__repr_str__(', ')})" # type: ignore[misc] + + # Override the 'construct' method in a way that supports recursive parsing without validation. + # Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. + @classmethod + @override + def construct( # pyright: ignore[reportIncompatibleMethodOverride] + __cls: Type[ModelT], + _fields_set: set[str] | None = None, + **values: object, + ) -> ModelT: + m = __cls.__new__(__cls) + fields_values: dict[str, object] = {} + + config = get_model_config(__cls) + populate_by_name = ( + config.allow_population_by_field_name + if isinstance(config, _ConfigProtocol) + else config.get("populate_by_name") + ) + + if _fields_set is None: + _fields_set = set() + + model_fields = get_model_fields(__cls) + for name, field in model_fields.items(): + key = field.alias + if key is None or (key not in values and populate_by_name): + key = name + + if key in values: + fields_values[name] = _construct_field(value=values[key], field=field, key=key) + _fields_set.add(name) + else: + fields_values[name] = field_get_default(field) + + extra_field_type = _get_extra_fields_type(__cls) + + _extra = {} + for key, value in values.items(): + if key not in model_fields: + parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value + + if PYDANTIC_V2: + _extra[key] = parsed + else: + _fields_set.add(key) + fields_values[key] = parsed + + object.__setattr__(m, "__dict__", fields_values) + + if PYDANTIC_V2: + # these properties are copied from Pydantic's `model_construct()` method + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", _extra) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) + else: + # init_private_attributes() does not exist in v2 + m._init_private_attributes() # type: ignore + + # copied from Pydantic v1's `construct()` method + object.__setattr__(m, "__fields_set__", _fields_set) + + return m + + if not TYPE_CHECKING: + # type checkers incorrectly complain about this assignment + # because the type signatures are technically different + # although not in practice + model_construct = construct + + if not PYDANTIC_V2: + # we define aliases for some of the new pydantic v2 methods so + # that we can just document these methods without having to specify + # a specific pydantic version as some users may not know which + # pydantic version they are currently using + + @override + def model_dump( + self, + *, + mode: Literal["json", "python"] | str = "python", + include: IncEx | None = None, + exclude: IncEx | None = None, + by_alias: bool = False, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + round_trip: bool = False, + warnings: bool | Literal["none", "warn", "error"] = True, + context: dict[str, Any] | None = None, + serialize_as_any: bool = False, + ) -> dict[str, Any]: + """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump + + Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + + Args: + mode: The mode in which `to_python` should run. + If mode is 'json', the dictionary will only contain JSON serializable types. + If mode is 'python', the dictionary may contain any Python objects. + include: A list of fields to include in the output. + exclude: A list of fields to exclude from the output. + by_alias: Whether to use the field's alias in the dictionary key if defined. + exclude_unset: Whether to exclude fields that are unset or None from the output. + exclude_defaults: Whether to exclude fields that are set to their default value from the output. + exclude_none: Whether to exclude fields that have a value of `None` from the output. + round_trip: Whether to enable serialization and deserialization round-trip support. + warnings: Whether to log warnings when invalid fields are encountered. + + Returns: + A dictionary representation of the model. + """ + if mode not in {"json", "python"}: + raise ValueError("mode must be either 'json' or 'python'") + if round_trip != False: + raise ValueError("round_trip is only supported in Pydantic v2") + if warnings != True: + raise ValueError("warnings is only supported in Pydantic v2") + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") + dumped = super().dict( # pyright: ignore[reportDeprecated] + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped + + @override + def model_dump_json( + self, + *, + indent: int | None = None, + include: IncEx | None = None, + exclude: IncEx | None = None, + by_alias: bool = False, + exclude_unset: bool = False, + exclude_defaults: bool = False, + exclude_none: bool = False, + round_trip: bool = False, + warnings: bool | Literal["none", "warn", "error"] = True, + context: dict[str, Any] | None = None, + serialize_as_any: bool = False, + ) -> str: + """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json + + Generates a JSON representation of the model using Pydantic's `to_json` method. + + Args: + indent: Indentation to use in the JSON output. If None is passed, the output will be compact. + include: Field(s) to include in the JSON output. Can take either a string or set of strings. + exclude: Field(s) to exclude from the JSON output. Can take either a string or set of strings. + by_alias: Whether to serialize using field aliases. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that have the default value. + exclude_none: Whether to exclude fields that have a value of `None`. + round_trip: Whether to use serialization/deserialization between JSON and class instance. + warnings: Whether to show any warnings that occurred during serialization. + + Returns: + A JSON string representation of the model. + """ + if round_trip != False: + raise ValueError("round_trip is only supported in Pydantic v2") + if warnings != True: + raise ValueError("warnings is only supported in Pydantic v2") + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") + return super().json( # type: ignore[reportDeprecated] + indent=indent, + include=include, + exclude=exclude, + by_alias=by_alias, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + ) + + +def _construct_field(value: object, field: FieldInfo, key: str) -> object: + if value is None: + return field_get_default(field) + + if PYDANTIC_V2: + type_ = field.annotation + else: + type_ = cast(type, field.outer_type_) # type: ignore + + if type_ is None: + raise RuntimeError(f"Unexpected field type is None for {key}") + + return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) + + +def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: + if not PYDANTIC_V2: + # TODO + return None + + schema = cls.__pydantic_core_schema__ + if schema["type"] == "model": + fields = schema["schema"] + if fields["type"] == "model-fields": + extras = fields.get("extras_schema") + if extras and "cls" in extras: + # mypy can't narrow the type + return extras["cls"] # type: ignore[no-any-return] + + return None + + +def is_basemodel(type_: type) -> bool: + """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`""" + if is_union(type_): + for variant in get_args(type_): + if is_basemodel(variant): + return True + + return False + + return is_basemodel_type(type_) + + +def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: + origin = get_origin(type_) or type_ + if not inspect.isclass(origin): + return False + return issubclass(origin, BaseModel) or issubclass(origin, GenericModel) + + +def build( + base_model_cls: Callable[P, _BaseModelT], + *args: P.args, + **kwargs: P.kwargs, +) -> _BaseModelT: + """Construct a BaseModel class without validation. + + This is useful for cases where you need to instantiate a `BaseModel` + from an API response as this provides type-safe params which isn't supported + by helpers like `construct_type()`. + + ```py + build(MyModel, my_field_a="foo", my_field_b=123) + ``` + """ + if args: + raise TypeError( + "Received positional arguments which are not supported; Keyword arguments must be used instead", + ) + + return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) + + +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + +def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object: + """Loose coercion to the expected type with construction of nested values. + + If the given value does not match the expected type then it is returned as-is. + """ + + # store a reference to the original type we were given before we extract any inner + # types so that we can properly resolve forward references in `TypeAliasType` annotations + original_type = None + + # we allow `object` as the input type because otherwise, passing things like + # `Literal['value']` will be reported as a type error by type checkers + type_ = cast("type[object]", type_) + if is_type_alias_type(type_): + original_type = type_ # type: ignore[unreachable] + type_ = type_.__value__ # type: ignore[unreachable] + + # unwrap `Annotated[T, ...]` -> `T` + if metadata is not None and len(metadata) > 0: + meta: tuple[Any, ...] = tuple(metadata) + elif is_annotated_type(type_): + meta = get_args(type_)[1:] + type_ = extract_type_arg(type_, 0) + else: + meta = tuple() + + # we need to use the origin class for any types that are subscripted generics + # e.g. Dict[str, object] + origin = get_origin(type_) or type_ + args = get_args(type_) + + if is_union(origin): + try: + return validate_type(type_=cast("type[object]", original_type or type_), value=value) + except Exception: + pass + + # if the type is a discriminated union then we want to construct the right variant + # in the union, even if the data doesn't match exactly, otherwise we'd break code + # that relies on the constructed class types, e.g. + # + # class FooType: + # kind: Literal['foo'] + # value: str + # + # class BarType: + # kind: Literal['bar'] + # value: int + # + # without this block, if the data we get is something like `{'kind': 'bar', 'value': 'foo'}` then + # we'd end up constructing `FooType` when it should be `BarType`. + discriminator = _build_discriminated_union_meta(union=type_, meta_annotations=meta) + if discriminator and is_mapping(value): + variant_value = value.get(discriminator.field_alias_from or discriminator.field_name) + if variant_value and isinstance(variant_value, str): + variant_type = discriminator.mapping.get(variant_value) + if variant_type: + return construct_type(type_=variant_type, value=value) + + # if the data is not valid, use the first variant that doesn't fail while deserializing + for variant in args: + try: + return construct_type(value=value, type_=variant) + except Exception: + continue + + raise RuntimeError(f"Could not convert data into a valid instance of {type_}") + + if origin == dict: + if not is_mapping(value): + return value + + _, items_type = get_args(type_) # Dict[_, items_type] + return {key: construct_type(value=item, type_=items_type) for key, item in value.items()} + + if ( + not is_literal_type(type_) + and inspect.isclass(origin) + and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel)) + ): + if is_list(value): + return [cast(Any, type_).construct(**entry) if is_mapping(entry) else entry for entry in value] + + if is_mapping(value): + if issubclass(type_, BaseModel): + return type_.construct(**value) # type: ignore[arg-type] + + return cast(Any, type_).construct(**value) + + if origin == list: + if not is_list(value): + return value + + inner_type = args[0] # List[inner_type] + return [construct_type(value=entry, type_=inner_type) for entry in value] + + if origin == float: + if isinstance(value, int): + coerced = float(value) + if coerced != value: + return value + return coerced + + return value + + if type_ == datetime: + try: + return parse_datetime(value) # type: ignore + except Exception: + return value + + if type_ == date: + try: + return parse_date(value) # type: ignore + except Exception: + return value + + return value + + +@runtime_checkable +class CachedDiscriminatorType(Protocol): + __discriminator__: DiscriminatorDetails + + +class DiscriminatorDetails: + field_name: str + """The name of the discriminator field in the variant class, e.g. + + ```py + class Foo(BaseModel): + type: Literal['foo'] + ``` + + Will result in field_name='type' + """ + + field_alias_from: str | None + """The name of the discriminator field in the API response, e.g. + + ```py + class Foo(BaseModel): + type: Literal['foo'] = Field(alias='type_from_api') + ``` + + Will result in field_alias_from='type_from_api' + """ + + mapping: dict[str, type] + """Mapping of discriminator value to variant type, e.g. + + {'foo': FooVariant, 'bar': BarVariant} + """ + + def __init__( + self, + *, + mapping: dict[str, type], + discriminator_field: str, + discriminator_alias: str | None, + ) -> None: + self.mapping = mapping + self.field_name = discriminator_field + self.field_alias_from = discriminator_alias + + +def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: + if isinstance(union, CachedDiscriminatorType): + return union.__discriminator__ + + discriminator_field_name: str | None = None + + for annotation in meta_annotations: + if isinstance(annotation, PropertyInfo) and annotation.discriminator is not None: + discriminator_field_name = annotation.discriminator + break + + if not discriminator_field_name: + return None + + mapping: dict[str, type] = {} + discriminator_alias: str | None = None + + for variant in get_args(union): + variant = strip_annotated_type(variant) + if is_basemodel_type(variant): + if PYDANTIC_V2: + field = _extract_field_schema_pv2(variant, discriminator_field_name) + if not field: + continue + + # Note: if one variant defines an alias then they all should + discriminator_alias = field.get("serialization_alias") + + field_schema = field["schema"] + + if field_schema["type"] == "literal": + for entry in cast("LiteralSchema", field_schema)["expected"]: + if isinstance(entry, str): + mapping[entry] = variant + else: + field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + if not field_info: + continue + + # Note: if one variant defines an alias then they all should + discriminator_alias = field_info.alias + + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): + if isinstance(entry, str): + mapping[entry] = variant + + if not mapping: + return None + + details = DiscriminatorDetails( + mapping=mapping, + discriminator_field=discriminator_field_name, + discriminator_alias=discriminator_alias, + ) + cast(CachedDiscriminatorType, union).__discriminator__ = details + return details + + +def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None: + schema = model.__pydantic_core_schema__ + if schema["type"] == "definitions": + schema = schema["schema"] + + if schema["type"] != "model": + return None + + schema = cast("ModelSchema", schema) + fields_schema = schema["schema"] + if fields_schema["type"] != "model-fields": + return None + + fields_schema = cast("ModelFieldsSchema", fields_schema) + field = fields_schema["fields"].get(field_name) + if not field: + return None + + return cast("ModelField", field) # pyright: ignore[reportUnnecessaryCast] + + +def validate_type(*, type_: type[_T], value: object) -> _T: + """Strict validation that the given value matches the expected type""" + if inspect.isclass(type_) and issubclass(type_, pydantic.BaseModel): + return cast(_T, parse_obj(type_, value)) + + return cast(_T, _validate_non_model_type(type_=type_, value=value)) + + +def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: + """Add a pydantic config for the given type. + + Note: this is a no-op on Pydantic v1. + """ + setattr(typ, "__pydantic_config__", config) # noqa: B010 + + +# our use of subclassing here causes weirdness for type checkers, +# so we just pretend that we don't subclass +if TYPE_CHECKING: + GenericModel = BaseModel +else: + + class GenericModel(BaseGenericModel, BaseModel): + pass + + +if PYDANTIC_V2: + from pydantic import TypeAdapter as _TypeAdapter + + _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) + + if TYPE_CHECKING: + from pydantic import TypeAdapter + else: + TypeAdapter = _CachedTypeAdapter + + def _validate_non_model_type(*, type_: type[_T], value: object) -> _T: + return TypeAdapter(type_).validate_python(value) + +elif not TYPE_CHECKING: # TODO: condition is weird + + class RootModel(GenericModel, Generic[_T]): + """Used as a placeholder to easily convert runtime types to a Pydantic format + to provide validation. + + For example: + ```py + validated = RootModel[int](__root__="5").__root__ + # validated: 5 + ``` + """ + + __root__: _T + + def _validate_non_model_type(*, type_: type[_T], value: object) -> _T: + model = _create_pydantic_model(type_).validate(value) + return cast(_T, model.__root__) + + def _create_pydantic_model(type_: _T) -> Type[RootModel[_T]]: + return RootModel[type_] # type: ignore + + +class FinalRequestOptionsInput(TypedDict, total=False): + method: Required[str] + url: Required[str] + params: Query + headers: Headers + max_retries: int + timeout: float | Timeout | None + files: HttpxRequestFiles | None + idempotency_key: str + json_data: Body + extra_json: AnyMapping + follow_redirects: bool + + +@final +class FinalRequestOptions(pydantic.BaseModel): + method: str + url: str + params: Query = {} + headers: Union[Headers, NotGiven] = NotGiven() + max_retries: Union[int, NotGiven] = NotGiven() + timeout: Union[float, Timeout, None, NotGiven] = NotGiven() + files: Union[HttpxRequestFiles, None] = None + idempotency_key: Union[str, None] = None + post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() + follow_redirects: Union[bool, None] = None + + # It should be noted that we cannot use `json` here as that would override + # a BaseModel method in an incompatible fashion. + json_data: Union[Body, None] = None + extra_json: Union[AnyMapping, None] = None + + if PYDANTIC_V2: + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) + else: + + class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] + arbitrary_types_allowed: bool = True + + def get_max_retries(self, max_retries: int) -> int: + if isinstance(self.max_retries, NotGiven): + return max_retries + return self.max_retries + + def _strip_raw_response_header(self) -> None: + if not is_given(self.headers): + return + + if self.headers.get(RAW_RESPONSE_HEADER): + self.headers = {**self.headers} + self.headers.pop(RAW_RESPONSE_HEADER) + + # override the `construct` method so that we can run custom transformations. + # this is necessary as we don't want to do any actual runtime type checking + # (which means we can't use validators) but we do want to ensure that `NotGiven` + # values are not present + # + # type ignore required because we're adding explicit types to `**values` + @classmethod + def construct( # type: ignore + cls, + _fields_set: set[str] | None = None, + **values: Unpack[FinalRequestOptionsInput], + ) -> FinalRequestOptions: + kwargs: dict[str, Any] = { + # we unconditionally call `strip_not_given` on any value + # as it will just ignore any non-mapping types + key: strip_not_given(value) + for key, value in values.items() + } + if PYDANTIC_V2: + return super().model_construct(_fields_set, **kwargs) + return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + + if not TYPE_CHECKING: + # type checkers incorrectly complain about this assignment + model_construct = construct diff --git a/src/imagekit/_qs.py b/src/imagekit/_qs.py new file mode 100644 index 0000000..274320c --- /dev/null +++ b/src/imagekit/_qs.py @@ -0,0 +1,150 @@ +from __future__ import annotations + +from typing import Any, List, Tuple, Union, Mapping, TypeVar +from urllib.parse import parse_qs, urlencode +from typing_extensions import Literal, get_args + +from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._utils import flatten + +_T = TypeVar("_T") + + +ArrayFormat = Literal["comma", "repeat", "indices", "brackets"] +NestedFormat = Literal["dots", "brackets"] + +PrimitiveData = Union[str, int, float, bool, None] +# this should be Data = Union[PrimitiveData, "List[Data]", "Tuple[Data]", "Mapping[str, Data]"] +# https://github.com/microsoft/pyright/issues/3555 +Data = Union[PrimitiveData, List[Any], Tuple[Any], "Mapping[str, Any]"] +Params = Mapping[str, Data] + + +class Querystring: + array_format: ArrayFormat + nested_format: NestedFormat + + def __init__( + self, + *, + array_format: ArrayFormat = "repeat", + nested_format: NestedFormat = "brackets", + ) -> None: + self.array_format = array_format + self.nested_format = nested_format + + def parse(self, query: str) -> Mapping[str, object]: + # Note: custom format syntax is not supported yet + return parse_qs(query) + + def stringify( + self, + params: Params, + *, + array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, + nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + ) -> str: + return urlencode( + self.stringify_items( + params, + array_format=array_format, + nested_format=nested_format, + ) + ) + + def stringify_items( + self, + params: Params, + *, + array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, + nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + ) -> list[tuple[str, str]]: + opts = Options( + qs=self, + array_format=array_format, + nested_format=nested_format, + ) + return flatten([self._stringify_item(key, value, opts) for key, value in params.items()]) + + def _stringify_item( + self, + key: str, + value: Data, + opts: Options, + ) -> list[tuple[str, str]]: + if isinstance(value, Mapping): + items: list[tuple[str, str]] = [] + nested_format = opts.nested_format + for subkey, subvalue in value.items(): + items.extend( + self._stringify_item( + # TODO: error if unknown format + f"{key}.{subkey}" if nested_format == "dots" else f"{key}[{subkey}]", + subvalue, + opts, + ) + ) + return items + + if isinstance(value, (list, tuple)): + array_format = opts.array_format + if array_format == "comma": + return [ + ( + key, + ",".join(self._primitive_value_to_str(item) for item in value if item is not None), + ), + ] + elif array_format == "repeat": + items = [] + for item in value: + items.extend(self._stringify_item(key, item, opts)) + return items + elif array_format == "indices": + raise NotImplementedError("The array indices format is not supported yet") + elif array_format == "brackets": + items = [] + key = key + "[]" + for item in value: + items.extend(self._stringify_item(key, item, opts)) + return items + else: + raise NotImplementedError( + f"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}" + ) + + serialised = self._primitive_value_to_str(value) + if not serialised: + return [] + return [(key, serialised)] + + def _primitive_value_to_str(self, value: PrimitiveData) -> str: + # copied from httpx + if value is True: + return "true" + elif value is False: + return "false" + elif value is None: + return "" + return str(value) + + +_qs = Querystring() +parse = _qs.parse +stringify = _qs.stringify +stringify_items = _qs.stringify_items + + +class Options: + array_format: ArrayFormat + nested_format: NestedFormat + + def __init__( + self, + qs: Querystring = _qs, + *, + array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, + nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + ) -> None: + self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format + self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/imagekit/_resource.py b/src/imagekit/_resource.py new file mode 100644 index 0000000..f830660 --- /dev/null +++ b/src/imagekit/_resource.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import time +from typing import TYPE_CHECKING + +import anyio + +if TYPE_CHECKING: + from ._client import ImageKit, AsyncImageKit + + +class SyncAPIResource: + _client: ImageKit + + def __init__(self, client: ImageKit) -> None: + self._client = client + self._get = client.get + self._post = client.post + self._patch = client.patch + self._put = client.put + self._delete = client.delete + self._get_api_list = client.get_api_list + + def _sleep(self, seconds: float) -> None: + time.sleep(seconds) + + +class AsyncAPIResource: + _client: AsyncImageKit + + def __init__(self, client: AsyncImageKit) -> None: + self._client = client + self._get = client.get + self._post = client.post + self._patch = client.patch + self._put = client.put + self._delete = client.delete + self._get_api_list = client.get_api_list + + async def _sleep(self, seconds: float) -> None: + await anyio.sleep(seconds) diff --git a/src/imagekit/_response.py b/src/imagekit/_response.py new file mode 100644 index 0000000..c7bcdb4 --- /dev/null +++ b/src/imagekit/_response.py @@ -0,0 +1,830 @@ +from __future__ import annotations + +import os +import inspect +import logging +import datetime +import functools +from types import TracebackType +from typing import ( + TYPE_CHECKING, + Any, + Union, + Generic, + TypeVar, + Callable, + Iterator, + AsyncIterator, + cast, + overload, +) +from typing_extensions import Awaitable, ParamSpec, override, get_origin + +import anyio +import httpx +import pydantic + +from ._types import NoneType +from ._utils import is_given, extract_type_arg, is_annotated_type, is_type_alias_type, extract_type_var_from_base +from ._models import BaseModel, is_basemodel +from ._constants import RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER +from ._streaming import Stream, AsyncStream, is_stream_class_type, extract_stream_chunk_type +from ._exceptions import ImageKitError, APIResponseValidationError + +if TYPE_CHECKING: + from ._models import FinalRequestOptions + from ._base_client import BaseClient + + +P = ParamSpec("P") +R = TypeVar("R") +_T = TypeVar("_T") +_APIResponseT = TypeVar("_APIResponseT", bound="APIResponse[Any]") +_AsyncAPIResponseT = TypeVar("_AsyncAPIResponseT", bound="AsyncAPIResponse[Any]") + +log: logging.Logger = logging.getLogger(__name__) + + +class BaseAPIResponse(Generic[R]): + _cast_to: type[R] + _client: BaseClient[Any, Any] + _parsed_by_type: dict[type[Any], Any] + _is_sse_stream: bool + _stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None + _options: FinalRequestOptions + + http_response: httpx.Response + + retries_taken: int + """The number of retries made. If no retries happened this will be `0`""" + + def __init__( + self, + *, + raw: httpx.Response, + cast_to: type[R], + client: BaseClient[Any, Any], + stream: bool, + stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + options: FinalRequestOptions, + retries_taken: int = 0, + ) -> None: + self._cast_to = cast_to + self._client = client + self._parsed_by_type = {} + self._is_sse_stream = stream + self._stream_cls = stream_cls + self._options = options + self.http_response = raw + self.retries_taken = retries_taken + + @property + def headers(self) -> httpx.Headers: + return self.http_response.headers + + @property + def http_request(self) -> httpx.Request: + """Returns the httpx Request instance associated with the current response.""" + return self.http_response.request + + @property + def status_code(self) -> int: + return self.http_response.status_code + + @property + def url(self) -> httpx.URL: + """Returns the URL for which the request was made.""" + return self.http_response.url + + @property + def method(self) -> str: + return self.http_request.method + + @property + def http_version(self) -> str: + return self.http_response.http_version + + @property + def elapsed(self) -> datetime.timedelta: + """The time taken for the complete request/response cycle to complete.""" + return self.http_response.elapsed + + @property + def is_closed(self) -> bool: + """Whether or not the response body has been closed. + + If this is False then there is response data that has not been read yet. + You must either fully consume the response body or call `.close()` + before discarding the response to prevent resource leaks. + """ + return self.http_response.is_closed + + @override + def __repr__(self) -> str: + return ( + f"<{self.__class__.__name__} [{self.status_code} {self.http_response.reason_phrase}] type={self._cast_to}>" + ) + + def _parse(self, *, to: type[_T] | None = None) -> R | _T: + cast_to = to if to is not None else self._cast_to + + # unwrap `TypeAlias('Name', T)` -> `T` + if is_type_alias_type(cast_to): + cast_to = cast_to.__value__ # type: ignore[unreachable] + + # unwrap `Annotated[T, ...]` -> `T` + if cast_to and is_annotated_type(cast_to): + cast_to = extract_type_arg(cast_to, 0) + + origin = get_origin(cast_to) or cast_to + + if self._is_sse_stream: + if to: + if not is_stream_class_type(to): + raise TypeError(f"Expected custom parse type to be a subclass of {Stream} or {AsyncStream}") + + return cast( + _T, + to( + cast_to=extract_stream_chunk_type( + to, + failure_message="Expected custom stream type to be passed with a type argument, e.g. Stream[ChunkType]", + ), + response=self.http_response, + client=cast(Any, self._client), + ), + ) + + if self._stream_cls: + return cast( + R, + self._stream_cls( + cast_to=extract_stream_chunk_type(self._stream_cls), + response=self.http_response, + client=cast(Any, self._client), + ), + ) + + stream_cls = cast("type[Stream[Any]] | type[AsyncStream[Any]] | None", self._client._default_stream_cls) + if stream_cls is None: + raise MissingStreamClassError() + + return cast( + R, + stream_cls( + cast_to=cast_to, + response=self.http_response, + client=cast(Any, self._client), + ), + ) + + if cast_to is NoneType: + return cast(R, None) + + response = self.http_response + if cast_to == str: + return cast(R, response.text) + + if cast_to == bytes: + return cast(R, response.content) + + if cast_to == int: + return cast(R, int(response.text)) + + if cast_to == float: + return cast(R, float(response.text)) + + if cast_to == bool: + return cast(R, response.text.lower() == "true") + + if origin == APIResponse: + raise RuntimeError("Unexpected state - cast_to is `APIResponse`") + + if inspect.isclass(origin) and issubclass(origin, httpx.Response): + # Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response + # and pass that class to our request functions. We cannot change the variance to be either + # covariant or contravariant as that makes our usage of ResponseT illegal. We could construct + # the response class ourselves but that is something that should be supported directly in httpx + # as it would be easy to incorrectly construct the Response object due to the multitude of arguments. + if cast_to != httpx.Response: + raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") + return cast(R, response) + + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): + raise TypeError("Pydantic models must subclass our base model type, e.g. `from imagekit import BaseModel`") + + if ( + cast_to is not object + and not origin is list + and not origin is dict + and not origin is Union + and not issubclass(origin, BaseModel) + ): + raise RuntimeError( + f"Unsupported type, expected {cast_to} to be a subclass of {BaseModel}, {dict}, {list}, {Union}, {NoneType}, {str} or {httpx.Response}." + ) + + # split is required to handle cases where additional information is included + # in the response, e.g. application/json; charset=utf-8 + content_type, *_ = response.headers.get("content-type", "*").split(";") + if not content_type.endswith("json"): + if is_basemodel(cast_to): + try: + data = response.json() + except Exception as exc: + log.debug("Could not read JSON from response data due to %s - %s", type(exc), exc) + else: + return self._client._process_response_data( + data=data, + cast_to=cast_to, # type: ignore + response=response, + ) + + if self._client._strict_response_validation: + raise APIResponseValidationError( + response=response, + message=f"Expected Content-Type response header to be `application/json` but received `{content_type}` instead.", + body=response.text, + ) + + # If the API responds with content that isn't JSON then we just return + # the (decoded) text without performing any parsing so that you can still + # handle the response however you need to. + return response.text # type: ignore + + data = response.json() + + return self._client._process_response_data( + data=data, + cast_to=cast_to, # type: ignore + response=response, + ) + + +class APIResponse(BaseAPIResponse[R]): + @overload + def parse(self, *, to: type[_T]) -> _T: ... + + @overload + def parse(self) -> R: ... + + def parse(self, *, to: type[_T] | None = None) -> R | _T: + """Returns the rich python representation of this response's data. + + For lower-level control, see `.read()`, `.json()`, `.iter_bytes()`. + + You can customise the type that the response is parsed into through + the `to` argument, e.g. + + ```py + from imagekit import BaseModel + + + class MyModel(BaseModel): + foo: str + + + obj = response.parse(to=MyModel) + print(obj.foo) + ``` + + We support parsing: + - `BaseModel` + - `dict` + - `list` + - `Union` + - `str` + - `int` + - `float` + - `httpx.Response` + """ + cache_key = to if to is not None else self._cast_to + cached = self._parsed_by_type.get(cache_key) + if cached is not None: + return cached # type: ignore[no-any-return] + + if not self._is_sse_stream: + self.read() + + parsed = self._parse(to=to) + if is_given(self._options.post_parser): + parsed = self._options.post_parser(parsed) + + self._parsed_by_type[cache_key] = parsed + return parsed + + def read(self) -> bytes: + """Read and return the binary response content.""" + try: + return self.http_response.read() + except httpx.StreamConsumed as exc: + # The default error raised by httpx isn't very + # helpful in our case so we re-raise it with + # a different error message. + raise StreamAlreadyConsumed() from exc + + def text(self) -> str: + """Read and decode the response content into a string.""" + self.read() + return self.http_response.text + + def json(self) -> object: + """Read and decode the JSON response content.""" + self.read() + return self.http_response.json() + + def close(self) -> None: + """Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + self.http_response.close() + + def iter_bytes(self, chunk_size: int | None = None) -> Iterator[bytes]: + """ + A byte-iterator over the decoded response content. + + This automatically handles gzip, deflate and brotli encoded responses. + """ + for chunk in self.http_response.iter_bytes(chunk_size): + yield chunk + + def iter_text(self, chunk_size: int | None = None) -> Iterator[str]: + """A str-iterator over the decoded response content + that handles both gzip, deflate, etc but also detects the content's + string encoding. + """ + for chunk in self.http_response.iter_text(chunk_size): + yield chunk + + def iter_lines(self) -> Iterator[str]: + """Like `iter_text()` but will only yield chunks for each line""" + for chunk in self.http_response.iter_lines(): + yield chunk + + +class AsyncAPIResponse(BaseAPIResponse[R]): + @overload + async def parse(self, *, to: type[_T]) -> _T: ... + + @overload + async def parse(self) -> R: ... + + async def parse(self, *, to: type[_T] | None = None) -> R | _T: + """Returns the rich python representation of this response's data. + + For lower-level control, see `.read()`, `.json()`, `.iter_bytes()`. + + You can customise the type that the response is parsed into through + the `to` argument, e.g. + + ```py + from imagekit import BaseModel + + + class MyModel(BaseModel): + foo: str + + + obj = response.parse(to=MyModel) + print(obj.foo) + ``` + + We support parsing: + - `BaseModel` + - `dict` + - `list` + - `Union` + - `str` + - `httpx.Response` + """ + cache_key = to if to is not None else self._cast_to + cached = self._parsed_by_type.get(cache_key) + if cached is not None: + return cached # type: ignore[no-any-return] + + if not self._is_sse_stream: + await self.read() + + parsed = self._parse(to=to) + if is_given(self._options.post_parser): + parsed = self._options.post_parser(parsed) + + self._parsed_by_type[cache_key] = parsed + return parsed + + async def read(self) -> bytes: + """Read and return the binary response content.""" + try: + return await self.http_response.aread() + except httpx.StreamConsumed as exc: + # the default error raised by httpx isn't very + # helpful in our case so we re-raise it with + # a different error message + raise StreamAlreadyConsumed() from exc + + async def text(self) -> str: + """Read and decode the response content into a string.""" + await self.read() + return self.http_response.text + + async def json(self) -> object: + """Read and decode the JSON response content.""" + await self.read() + return self.http_response.json() + + async def close(self) -> None: + """Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + await self.http_response.aclose() + + async def iter_bytes(self, chunk_size: int | None = None) -> AsyncIterator[bytes]: + """ + A byte-iterator over the decoded response content. + + This automatically handles gzip, deflate and brotli encoded responses. + """ + async for chunk in self.http_response.aiter_bytes(chunk_size): + yield chunk + + async def iter_text(self, chunk_size: int | None = None) -> AsyncIterator[str]: + """A str-iterator over the decoded response content + that handles both gzip, deflate, etc but also detects the content's + string encoding. + """ + async for chunk in self.http_response.aiter_text(chunk_size): + yield chunk + + async def iter_lines(self) -> AsyncIterator[str]: + """Like `iter_text()` but will only yield chunks for each line""" + async for chunk in self.http_response.aiter_lines(): + yield chunk + + +class BinaryAPIResponse(APIResponse[bytes]): + """Subclass of APIResponse providing helpers for dealing with binary data. + + Note: If you want to stream the response data instead of eagerly reading it + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + + def write_to_file( + self, + file: str | os.PathLike[str], + ) -> None: + """Write the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + + Note: if you want to stream the data to the file instead of writing + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + with open(file, mode="wb") as f: + for data in self.iter_bytes(): + f.write(data) + + +class AsyncBinaryAPIResponse(AsyncAPIResponse[bytes]): + """Subclass of APIResponse providing helpers for dealing with binary data. + + Note: If you want to stream the response data instead of eagerly reading it + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + + async def write_to_file( + self, + file: str | os.PathLike[str], + ) -> None: + """Write the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + + Note: if you want to stream the data to the file instead of writing + all at once then you should use `.with_streaming_response` when making + the API request, e.g. `.with_streaming_response.get_binary_response()` + """ + path = anyio.Path(file) + async with await path.open(mode="wb") as f: + async for data in self.iter_bytes(): + await f.write(data) + + +class StreamedBinaryAPIResponse(APIResponse[bytes]): + def stream_to_file( + self, + file: str | os.PathLike[str], + *, + chunk_size: int | None = None, + ) -> None: + """Streams the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + """ + with open(file, mode="wb") as f: + for data in self.iter_bytes(chunk_size): + f.write(data) + + +class AsyncStreamedBinaryAPIResponse(AsyncAPIResponse[bytes]): + async def stream_to_file( + self, + file: str | os.PathLike[str], + *, + chunk_size: int | None = None, + ) -> None: + """Streams the output to the given file. + + Accepts a filename or any path-like object, e.g. pathlib.Path + """ + path = anyio.Path(file) + async with await path.open(mode="wb") as f: + async for data in self.iter_bytes(chunk_size): + await f.write(data) + + +class MissingStreamClassError(TypeError): + def __init__(self) -> None: + super().__init__( + "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `imagekit._streaming` for reference", + ) + + +class StreamAlreadyConsumed(ImageKitError): + """ + Attempted to read or stream content, but the content has already + been streamed. + + This can happen if you use a method like `.iter_lines()` and then attempt + to read th entire response body afterwards, e.g. + + ```py + response = await client.post(...) + async for line in response.iter_lines(): + ... # do something with `line` + + content = await response.read() + # ^ error + ``` + + If you want this behaviour you'll need to either manually accumulate the response + content or call `await response.read()` before iterating over the stream. + """ + + def __init__(self) -> None: + message = ( + "Attempted to read or stream some content, but the content has " + "already been streamed. " + "This could be due to attempting to stream the response " + "content more than once." + "\n\n" + "You can fix this by manually accumulating the response content while streaming " + "or by calling `.read()` before starting to stream." + ) + super().__init__(message) + + +class ResponseContextManager(Generic[_APIResponseT]): + """Context manager for ensuring that a request is not made + until it is entered and that the response will always be closed + when the context manager exits + """ + + def __init__(self, request_func: Callable[[], _APIResponseT]) -> None: + self._request_func = request_func + self.__response: _APIResponseT | None = None + + def __enter__(self) -> _APIResponseT: + self.__response = self._request_func() + return self.__response + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + if self.__response is not None: + self.__response.close() + + +class AsyncResponseContextManager(Generic[_AsyncAPIResponseT]): + """Context manager for ensuring that a request is not made + until it is entered and that the response will always be closed + when the context manager exits + """ + + def __init__(self, api_request: Awaitable[_AsyncAPIResponseT]) -> None: + self._api_request = api_request + self.__response: _AsyncAPIResponseT | None = None + + async def __aenter__(self) -> _AsyncAPIResponseT: + self.__response = await self._api_request + return self.__response + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + if self.__response is not None: + await self.__response.close() + + +def to_streamed_response_wrapper(func: Callable[P, R]) -> Callable[P, ResponseContextManager[APIResponse[R]]]: + """Higher order function that takes one of our bound API methods and wraps it + to support streaming and returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> ResponseContextManager[APIResponse[R]]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + + kwargs["extra_headers"] = extra_headers + + make_request = functools.partial(func, *args, **kwargs) + + return ResponseContextManager(cast(Callable[[], APIResponse[R]], make_request)) + + return wrapped + + +def async_to_streamed_response_wrapper( + func: Callable[P, Awaitable[R]], +) -> Callable[P, AsyncResponseContextManager[AsyncAPIResponse[R]]]: + """Higher order function that takes one of our bound API methods and wraps it + to support streaming and returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncResponseContextManager[AsyncAPIResponse[R]]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + + kwargs["extra_headers"] = extra_headers + + make_request = func(*args, **kwargs) + + return AsyncResponseContextManager(cast(Awaitable[AsyncAPIResponse[R]], make_request)) + + return wrapped + + +def to_custom_streamed_response_wrapper( + func: Callable[P, object], + response_cls: type[_APIResponseT], +) -> Callable[P, ResponseContextManager[_APIResponseT]]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support streaming and returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> ResponseContextManager[_APIResponseT]: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + make_request = functools.partial(func, *args, **kwargs) + + return ResponseContextManager(cast(Callable[[], _APIResponseT], make_request)) + + return wrapped + + +def async_to_custom_streamed_response_wrapper( + func: Callable[P, Awaitable[object]], + response_cls: type[_AsyncAPIResponseT], +) -> Callable[P, AsyncResponseContextManager[_AsyncAPIResponseT]]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support streaming and returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncResponseContextManager[_AsyncAPIResponseT]: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "stream" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + make_request = func(*args, **kwargs) + + return AsyncResponseContextManager(cast(Awaitable[_AsyncAPIResponseT], make_request)) + + return wrapped + + +def to_raw_response_wrapper(func: Callable[P, R]) -> Callable[P, APIResponse[R]]: + """Higher order function that takes one of our bound API methods and wraps it + to support returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> APIResponse[R]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + + kwargs["extra_headers"] = extra_headers + + return cast(APIResponse[R], func(*args, **kwargs)) + + return wrapped + + +def async_to_raw_response_wrapper(func: Callable[P, Awaitable[R]]) -> Callable[P, Awaitable[AsyncAPIResponse[R]]]: + """Higher order function that takes one of our bound API methods and wraps it + to support returning the raw `APIResponse` object directly. + """ + + @functools.wraps(func) + async def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncAPIResponse[R]: + extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + + kwargs["extra_headers"] = extra_headers + + return cast(AsyncAPIResponse[R], await func(*args, **kwargs)) + + return wrapped + + +def to_custom_raw_response_wrapper( + func: Callable[P, object], + response_cls: type[_APIResponseT], +) -> Callable[P, _APIResponseT]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> _APIResponseT: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + return cast(_APIResponseT, func(*args, **kwargs)) + + return wrapped + + +def async_to_custom_raw_response_wrapper( + func: Callable[P, Awaitable[object]], + response_cls: type[_AsyncAPIResponseT], +) -> Callable[P, Awaitable[_AsyncAPIResponseT]]: + """Higher order function that takes one of our bound API methods and an `APIResponse` class + and wraps the method to support returning the given response class directly. + + Note: the given `response_cls` *must* be concrete, e.g. `class BinaryAPIResponse(APIResponse[bytes])` + """ + + @functools.wraps(func) + def wrapped(*args: P.args, **kwargs: P.kwargs) -> Awaitable[_AsyncAPIResponseT]: + extra_headers: dict[str, Any] = {**(cast(Any, kwargs.get("extra_headers")) or {})} + extra_headers[RAW_RESPONSE_HEADER] = "raw" + extra_headers[OVERRIDE_CAST_TO_HEADER] = response_cls + + kwargs["extra_headers"] = extra_headers + + return cast(Awaitable[_AsyncAPIResponseT], func(*args, **kwargs)) + + return wrapped + + +def extract_response_type(typ: type[BaseAPIResponse[Any]]) -> type: + """Given a type like `APIResponse[T]`, returns the generic type variable `T`. + + This also handles the case where a concrete subclass is given, e.g. + ```py + class MyResponse(APIResponse[bytes]): + ... + + extract_response_type(MyResponse) -> bytes + ``` + """ + return extract_type_var_from_base( + typ, + generic_bases=cast("tuple[type, ...]", (BaseAPIResponse, APIResponse, AsyncAPIResponse)), + index=0, + ) diff --git a/src/imagekit/_streaming.py b/src/imagekit/_streaming.py new file mode 100644 index 0000000..7fadf2a --- /dev/null +++ b/src/imagekit/_streaming.py @@ -0,0 +1,333 @@ +# Note: initially copied from https://github.com/florimondmanca/httpx-sse/blob/master/src/httpx_sse/_decoders.py +from __future__ import annotations + +import json +import inspect +from types import TracebackType +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast +from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable + +import httpx + +from ._utils import extract_type_var_from_base + +if TYPE_CHECKING: + from ._client import ImageKit, AsyncImageKit + + +_T = TypeVar("_T") + + +class Stream(Generic[_T]): + """Provides the core interface to iterate over a synchronous stream response.""" + + response: httpx.Response + + _decoder: SSEBytesDecoder + + def __init__( + self, + *, + cast_to: type[_T], + response: httpx.Response, + client: ImageKit, + ) -> None: + self.response = response + self._cast_to = cast_to + self._client = client + self._decoder = client._make_sse_decoder() + self._iterator = self.__stream__() + + def __next__(self) -> _T: + return self._iterator.__next__() + + def __iter__(self) -> Iterator[_T]: + for item in self._iterator: + yield item + + def _iter_events(self) -> Iterator[ServerSentEvent]: + yield from self._decoder.iter_bytes(self.response.iter_bytes()) + + def __stream__(self) -> Iterator[_T]: + cast_to = cast(Any, self._cast_to) + response = self.response + process_data = self._client._process_response_data + iterator = self._iter_events() + + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + + # Ensure the entire stream is consumed + for _sse in iterator: + ... + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + self.close() + + def close(self) -> None: + """ + Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + self.response.close() + + +class AsyncStream(Generic[_T]): + """Provides the core interface to iterate over an asynchronous stream response.""" + + response: httpx.Response + + _decoder: SSEDecoder | SSEBytesDecoder + + def __init__( + self, + *, + cast_to: type[_T], + response: httpx.Response, + client: AsyncImageKit, + ) -> None: + self.response = response + self._cast_to = cast_to + self._client = client + self._decoder = client._make_sse_decoder() + self._iterator = self.__stream__() + + async def __anext__(self) -> _T: + return await self._iterator.__anext__() + + async def __aiter__(self) -> AsyncIterator[_T]: + async for item in self._iterator: + yield item + + async def _iter_events(self) -> AsyncIterator[ServerSentEvent]: + async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()): + yield sse + + async def __stream__(self) -> AsyncIterator[_T]: + cast_to = cast(Any, self._cast_to) + response = self.response + process_data = self._client._process_response_data + iterator = self._iter_events() + + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + + # Ensure the entire stream is consumed + async for _sse in iterator: + ... + + async def __aenter__(self) -> Self: + return self + + async def __aexit__( + self, + exc_type: type[BaseException] | None, + exc: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + await self.close() + + async def close(self) -> None: + """ + Close the response and release the connection. + + Automatically called if the response body is read to completion. + """ + await self.response.aclose() + + +class ServerSentEvent: + def __init__( + self, + *, + event: str | None = None, + data: str | None = None, + id: str | None = None, + retry: int | None = None, + ) -> None: + if data is None: + data = "" + + self._id = id + self._data = data + self._event = event or None + self._retry = retry + + @property + def event(self) -> str | None: + return self._event + + @property + def id(self) -> str | None: + return self._id + + @property + def retry(self) -> int | None: + return self._retry + + @property + def data(self) -> str: + return self._data + + def json(self) -> Any: + return json.loads(self.data) + + @override + def __repr__(self) -> str: + return f"ServerSentEvent(event={self.event}, data={self.data}, id={self.id}, retry={self.retry})" + + +class SSEDecoder: + _data: list[str] + _event: str | None + _retry: int | None + _last_event_id: str | None + + def __init__(self) -> None: + self._event = None + self._data = [] + self._last_event_id = None + self._retry = None + + def iter_bytes(self, iterator: Iterator[bytes]) -> Iterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + for chunk in self._iter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + def _iter_chunks(self, iterator: Iterator[bytes]) -> Iterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data + + async def aiter_bytes(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + async for chunk in self._aiter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + async def _aiter_chunks(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + async for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data + + def decode(self, line: str) -> ServerSentEvent | None: + # See: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation # noqa: E501 + + if not line: + if not self._event and not self._data and not self._last_event_id and self._retry is None: + return None + + sse = ServerSentEvent( + event=self._event, + data="\n".join(self._data), + id=self._last_event_id, + retry=self._retry, + ) + + # NOTE: as per the SSE spec, do not reset last_event_id. + self._event = None + self._data = [] + self._retry = None + + return sse + + if line.startswith(":"): + return None + + fieldname, _, value = line.partition(":") + + if value.startswith(" "): + value = value[1:] + + if fieldname == "event": + self._event = value + elif fieldname == "data": + self._data.append(value) + elif fieldname == "id": + if "\0" in value: + pass + else: + self._last_event_id = value + elif fieldname == "retry": + try: + self._retry = int(value) + except (TypeError, ValueError): + pass + else: + pass # Field is ignored. + + return None + + +@runtime_checkable +class SSEBytesDecoder(Protocol): + def iter_bytes(self, iterator: Iterator[bytes]) -> Iterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + ... + + def aiter_bytes(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[ServerSentEvent]: + """Given an async iterator that yields raw binary data, iterate over it & yield every event encountered""" + ... + + +def is_stream_class_type(typ: type) -> TypeGuard[type[Stream[object]] | type[AsyncStream[object]]]: + """TypeGuard for determining whether or not the given type is a subclass of `Stream` / `AsyncStream`""" + origin = get_origin(typ) or typ + return inspect.isclass(origin) and issubclass(origin, (Stream, AsyncStream)) + + +def extract_stream_chunk_type( + stream_cls: type, + *, + failure_message: str | None = None, +) -> type: + """Given a type like `Stream[T]`, returns the generic type variable `T`. + + This also handles the case where a concrete subclass is given, e.g. + ```py + class MyStream(Stream[bytes]): + ... + + extract_stream_chunk_type(MyStream) -> bytes + ``` + """ + from ._base_client import Stream, AsyncStream + + return extract_type_var_from_base( + stream_cls, + index=0, + generic_bases=cast("tuple[type, ...]", (Stream, AsyncStream)), + failure_message=failure_message, + ) diff --git a/src/imagekit/_types.py b/src/imagekit/_types.py new file mode 100644 index 0000000..62059ad --- /dev/null +++ b/src/imagekit/_types.py @@ -0,0 +1,253 @@ +from __future__ import annotations + +from os import PathLike +from typing import ( + IO, + TYPE_CHECKING, + Any, + Dict, + List, + Type, + Tuple, + Union, + Mapping, + TypeVar, + Callable, + Iterator, + Optional, + Sequence, +) +from typing_extensions import ( + Set, + Literal, + Protocol, + TypeAlias, + TypedDict, + SupportsIndex, + overload, + override, + runtime_checkable, +) + +import httpx +import pydantic +from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport + +if TYPE_CHECKING: + from ._models import BaseModel + from ._response import APIResponse, AsyncAPIResponse + +Transport = BaseTransport +AsyncTransport = AsyncBaseTransport +Query = Mapping[str, object] +Body = object +AnyMapping = Mapping[str, object] +ModelT = TypeVar("ModelT", bound=pydantic.BaseModel) +_T = TypeVar("_T") + + +# Approximates httpx internal ProxiesTypes and RequestFiles types +# while adding support for `PathLike` instances +ProxiesDict = Dict["str | URL", Union[None, str, URL, Proxy]] +ProxiesTypes = Union[str, Proxy, ProxiesDict] +if TYPE_CHECKING: + Base64FileInput = Union[IO[bytes], PathLike[str]] + FileContent = Union[IO[bytes], bytes, PathLike[str]] +else: + Base64FileInput = Union[IO[bytes], PathLike] + FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8. +FileTypes = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + Tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + Tuple[Optional[str], FileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], +] +RequestFiles = Union[Mapping[str, FileTypes], Sequence[Tuple[str, FileTypes]]] + +# duplicate of the above but without our custom file support +HttpxFileContent = Union[IO[bytes], bytes] +HttpxFileTypes = Union[ + # file (or bytes) + HttpxFileContent, + # (filename, file (or bytes)) + Tuple[Optional[str], HttpxFileContent], + # (filename, file (or bytes), content_type) + Tuple[Optional[str], HttpxFileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + Tuple[Optional[str], HttpxFileContent, Optional[str], Mapping[str, str]], +] +HttpxRequestFiles = Union[Mapping[str, HttpxFileTypes], Sequence[Tuple[str, HttpxFileTypes]]] + +# Workaround to support (cast_to: Type[ResponseT]) -> ResponseT +# where ResponseT includes `None`. In order to support directly +# passing `None`, overloads would have to be defined for every +# method that uses `ResponseT` which would lead to an unacceptable +# amount of code duplication and make it unreadable. See _base_client.py +# for example usage. +# +# This unfortunately means that you will either have +# to import this type and pass it explicitly: +# +# from imagekit import NoneType +# client.get('/foo', cast_to=NoneType) +# +# or build it yourself: +# +# client.get('/foo', cast_to=type(None)) +if TYPE_CHECKING: + NoneType: Type[None] +else: + NoneType = type(None) + + +class RequestOptions(TypedDict, total=False): + headers: Headers + max_retries: int + timeout: float | Timeout | None + params: Query + extra_json: AnyMapping + idempotency_key: str + follow_redirects: bool + + +# Sentinel class used until PEP 0661 is accepted +class NotGiven: + """ + A sentinel singleton class used to distinguish omitted keyword arguments + from those passed in with the value None (which may have different behavior). + + For example: + + ```py + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + + + get(timeout=1) # 1s timeout + get(timeout=None) # No timeout + get() # Default timeout behavior, which may not be statically known at the method definition. + ``` + """ + + def __bool__(self) -> Literal[False]: + return False + + @override + def __repr__(self) -> str: + return "NOT_GIVEN" + + +NotGivenOr = Union[_T, NotGiven] +NOT_GIVEN = NotGiven() + + +class Omit: + """In certain situations you need to be able to represent a case where a default value has + to be explicitly removed and `None` is not an appropriate substitute, for example: + + ```py + # as the default `Content-Type` header is `application/json` that will be sent + client.post("/upload/files", files={"file": b"my raw file content"}) + + # you can't explicitly override the header as it has to be dynamically generated + # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' + client.post(..., headers={"Content-Type": "multipart/form-data"}) + + # instead you can remove the default `application/json` header by passing Omit + client.post(..., headers={"Content-Type": Omit()}) + ``` + """ + + def __bool__(self) -> Literal[False]: + return False + + +@runtime_checkable +class ModelBuilderProtocol(Protocol): + @classmethod + def build( + cls: type[_T], + *, + response: Response, + data: object, + ) -> _T: ... + + +Headers = Mapping[str, Union[str, Omit]] + + +class HeadersLikeProtocol(Protocol): + def get(self, __key: str) -> str | None: ... + + +HeadersLike = Union[Headers, HeadersLikeProtocol] + +ResponseT = TypeVar( + "ResponseT", + bound=Union[ + object, + str, + None, + "BaseModel", + List[Any], + Dict[str, Any], + Response, + ModelBuilderProtocol, + "APIResponse[Any]", + "AsyncAPIResponse[Any]", + ], +) + +StrBytesIntFloat = Union[str, bytes, int, float] + +# Note: copied from Pydantic +# https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79 +IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]] + +PostParser = Callable[[Any], Any] + + +@runtime_checkable +class InheritsGeneric(Protocol): + """Represents a type that has inherited from `Generic` + + The `__orig_bases__` property can be used to determine the resolved + type variable for a given base class. + """ + + __orig_bases__: tuple[_GenericAlias] + + +class _GenericAlias(Protocol): + __origin__: type[object] + + +class HttpxSendArgs(TypedDict, total=False): + auth: httpx.Auth + follow_redirects: bool + + +_T_co = TypeVar("_T_co", covariant=True) + + +if TYPE_CHECKING: + # This works because str.__contains__ does not accept object (either in typeshed or at runtime) + # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + class SequenceNotStr(Protocol[_T_co]): + @overload + def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... + @overload + def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... + def __contains__(self, value: object, /) -> bool: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_T_co]: ... + def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... + def count(self, value: Any, /) -> int: ... + def __reversed__(self) -> Iterator[_T_co]: ... +else: + # just point this to a normal `Sequence` at runtime to avoid having to special case + # deserializing our custom sequence type + SequenceNotStr = Sequence diff --git a/src/imagekit/_utils/__init__.py b/src/imagekit/_utils/__init__.py new file mode 100644 index 0000000..ca547ce --- /dev/null +++ b/src/imagekit/_utils/__init__.py @@ -0,0 +1,58 @@ +from ._sync import asyncify as asyncify +from ._proxy import LazyProxy as LazyProxy +from ._utils import ( + flatten as flatten, + is_dict as is_dict, + is_list as is_list, + is_given as is_given, + is_tuple as is_tuple, + json_safe as json_safe, + lru_cache as lru_cache, + is_mapping as is_mapping, + is_tuple_t as is_tuple_t, + parse_date as parse_date, + is_iterable as is_iterable, + is_sequence as is_sequence, + coerce_float as coerce_float, + is_mapping_t as is_mapping_t, + removeprefix as removeprefix, + removesuffix as removesuffix, + extract_files as extract_files, + is_sequence_t as is_sequence_t, + required_args as required_args, + coerce_boolean as coerce_boolean, + coerce_integer as coerce_integer, + file_from_path as file_from_path, + parse_datetime as parse_datetime, + strip_not_given as strip_not_given, + deepcopy_minimal as deepcopy_minimal, + get_async_library as get_async_library, + maybe_coerce_float as maybe_coerce_float, + get_required_header as get_required_header, + maybe_coerce_boolean as maybe_coerce_boolean, + maybe_coerce_integer as maybe_coerce_integer, +) +from ._typing import ( + is_list_type as is_list_type, + is_union_type as is_union_type, + extract_type_arg as extract_type_arg, + is_iterable_type as is_iterable_type, + is_required_type as is_required_type, + is_sequence_type as is_sequence_type, + is_annotated_type as is_annotated_type, + is_type_alias_type as is_type_alias_type, + strip_annotated_type as strip_annotated_type, + extract_type_var_from_base as extract_type_var_from_base, +) +from ._streams import consume_sync_iterator as consume_sync_iterator, consume_async_iterator as consume_async_iterator +from ._transform import ( + PropertyInfo as PropertyInfo, + transform as transform, + async_transform as async_transform, + maybe_transform as maybe_transform, + async_maybe_transform as async_maybe_transform, +) +from ._reflection import ( + function_has_argument as function_has_argument, + assert_signatures_in_sync as assert_signatures_in_sync, +) diff --git a/src/imagekit/_utils/_logs.py b/src/imagekit/_utils/_logs.py new file mode 100644 index 0000000..f896bb6 --- /dev/null +++ b/src/imagekit/_utils/_logs.py @@ -0,0 +1,25 @@ +import os +import logging + +logger: logging.Logger = logging.getLogger("imagekit") +httpx_logger: logging.Logger = logging.getLogger("httpx") + + +def _basic_config() -> None: + # e.g. [2023-10-05 14:12:26 - imagekit._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" + logging.basicConfig( + format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s", + datefmt="%Y-%m-%d %H:%M:%S", + ) + + +def setup_logging() -> None: + env = os.environ.get("IMAGE_KIT_LOG") + if env == "debug": + _basic_config() + logger.setLevel(logging.DEBUG) + httpx_logger.setLevel(logging.DEBUG) + elif env == "info": + _basic_config() + logger.setLevel(logging.INFO) + httpx_logger.setLevel(logging.INFO) diff --git a/src/imagekit/_utils/_proxy.py b/src/imagekit/_utils/_proxy.py new file mode 100644 index 0000000..0f239a3 --- /dev/null +++ b/src/imagekit/_utils/_proxy.py @@ -0,0 +1,65 @@ +from __future__ import annotations + +from abc import ABC, abstractmethod +from typing import Generic, TypeVar, Iterable, cast +from typing_extensions import override + +T = TypeVar("T") + + +class LazyProxy(Generic[T], ABC): + """Implements data methods to pretend that an instance is another instance. + + This includes forwarding attribute access and other methods. + """ + + # Note: we have to special case proxies that themselves return proxies + # to support using a proxy as a catch-all for any random access, e.g. `proxy.foo.bar.baz` + + def __getattr__(self, attr: str) -> object: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return proxied # pyright: ignore + return getattr(proxied, attr) + + @override + def __repr__(self) -> str: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return proxied.__class__.__name__ + return repr(self.__get_proxied__()) + + @override + def __str__(self) -> str: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return proxied.__class__.__name__ + return str(proxied) + + @override + def __dir__(self) -> Iterable[str]: + proxied = self.__get_proxied__() + if isinstance(proxied, LazyProxy): + return [] + return proxied.__dir__() + + @property # type: ignore + @override + def __class__(self) -> type: # pyright: ignore + try: + proxied = self.__get_proxied__() + except Exception: + return type(self) + if issubclass(type(proxied), LazyProxy): + return type(proxied) + return proxied.__class__ + + def __get_proxied__(self) -> T: + return self.__load__() + + def __as_proxied__(self) -> T: + """Helper method that returns the current proxy, typed as the loaded object""" + return cast(T, self) + + @abstractmethod + def __load__(self) -> T: ... diff --git a/src/imagekit/_utils/_reflection.py b/src/imagekit/_utils/_reflection.py new file mode 100644 index 0000000..89aa712 --- /dev/null +++ b/src/imagekit/_utils/_reflection.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +import inspect +from typing import Any, Callable + + +def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool: + """Returns whether or not the given function has a specific parameter""" + sig = inspect.signature(func) + return arg_name in sig.parameters + + +def assert_signatures_in_sync( + source_func: Callable[..., Any], + check_func: Callable[..., Any], + *, + exclude_params: set[str] = set(), +) -> None: + """Ensure that the signature of the second function matches the first.""" + + check_sig = inspect.signature(check_func) + source_sig = inspect.signature(source_func) + + errors: list[str] = [] + + for name, source_param in source_sig.parameters.items(): + if name in exclude_params: + continue + + custom_param = check_sig.parameters.get(name) + if not custom_param: + errors.append(f"the `{name}` param is missing") + continue + + if custom_param.annotation != source_param.annotation: + errors.append( + f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}" + ) + continue + + if errors: + raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors)) diff --git a/src/imagekit/_utils/_resources_proxy.py b/src/imagekit/_utils/_resources_proxy.py new file mode 100644 index 0000000..6421783 --- /dev/null +++ b/src/imagekit/_utils/_resources_proxy.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from typing import Any +from typing_extensions import override + +from ._proxy import LazyProxy + + +class ResourcesProxy(LazyProxy[Any]): + """A proxy for the `imagekit.resources` module. + + This is used so that we can lazily import `imagekit.resources` only when + needed *and* so that users can just import `imagekit` and reference `imagekit.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("imagekit.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() diff --git a/src/imagekit/_utils/_streams.py b/src/imagekit/_utils/_streams.py new file mode 100644 index 0000000..f4a0208 --- /dev/null +++ b/src/imagekit/_utils/_streams.py @@ -0,0 +1,12 @@ +from typing import Any +from typing_extensions import Iterator, AsyncIterator + + +def consume_sync_iterator(iterator: Iterator[Any]) -> None: + for _ in iterator: + ... + + +async def consume_async_iterator(iterator: AsyncIterator[Any]) -> None: + async for _ in iterator: + ... diff --git a/src/imagekit/_utils/_sync.py b/src/imagekit/_utils/_sync.py new file mode 100644 index 0000000..ad7ec71 --- /dev/null +++ b/src/imagekit/_utils/_sync.py @@ -0,0 +1,86 @@ +from __future__ import annotations + +import sys +import asyncio +import functools +import contextvars +from typing import Any, TypeVar, Callable, Awaitable +from typing_extensions import ParamSpec + +import anyio +import sniffio +import anyio.to_thread + +T_Retval = TypeVar("T_Retval") +T_ParamSpec = ParamSpec("T_ParamSpec") + + +if sys.version_info >= (3, 9): + _asyncio_to_thread = asyncio.to_thread +else: + # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread + # for Python 3.8 support + async def _asyncio_to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs + ) -> Any: + """Asynchronously run function *func* in a separate thread. + + Any *args and **kwargs supplied for this function are directly passed + to *func*. Also, the current :class:`contextvars.Context` is propagated, + allowing context variables from the main thread to be accessed in the + separate thread. + + Returns a coroutine that can be awaited to get the eventual result of *func*. + """ + loop = asyncio.events.get_running_loop() + ctx = contextvars.copy_context() + func_call = functools.partial(ctx.run, func, *args, **kwargs) + return await loop.run_in_executor(None, func_call) + + +async def to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs +) -> T_Retval: + if sniffio.current_async_library() == "asyncio": + return await _asyncio_to_thread(func, *args, **kwargs) + + return await anyio.to_thread.run_sync( + functools.partial(func, *args, **kwargs), + ) + + +# inspired by `asyncer`, https://github.com/tiangolo/asyncer +def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: + """ + Take a blocking function and create an async one that receives the same + positional and keyword arguments. For python version 3.9 and above, it uses + asyncio.to_thread to run the function in a separate thread. For python version + 3.8, it uses locally defined copy of the asyncio.to_thread function which was + introduced in python 3.9. + + Usage: + + ```python + def blocking_func(arg1, arg2, kwarg1=None): + # blocking code + return result + + + result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1) + ``` + + ## Arguments + + `function`: a blocking regular callable (e.g. a function) + + ## Return + + An async function that takes the same positional and keyword arguments as the + original one, that when called runs the same original function in a thread worker + and returns the result. + """ + + async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval: + return await to_thread(function, *args, **kwargs) + + return wrapper diff --git a/src/imagekit/_utils/_transform.py b/src/imagekit/_utils/_transform.py new file mode 100644 index 0000000..f0bcefd --- /dev/null +++ b/src/imagekit/_utils/_transform.py @@ -0,0 +1,453 @@ +from __future__ import annotations + +import io +import base64 +import pathlib +from typing import Any, Mapping, TypeVar, cast +from datetime import date, datetime +from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints + +import anyio +import pydantic + +from ._utils import ( + is_list, + is_given, + lru_cache, + is_mapping, + is_iterable, + is_sequence, +) +from .._files import is_base64_file_input +from ._typing import ( + is_list_type, + is_union_type, + extract_type_arg, + is_iterable_type, + is_required_type, + is_sequence_type, + is_annotated_type, + strip_annotated_type, +) +from .._compat import get_origin, model_dump, is_typeddict + +_T = TypeVar("_T") + + +# TODO: support for drilling globals() and locals() +# TODO: ensure works correctly with forward references in all cases + + +PropertyFormat = Literal["iso8601", "base64", "custom"] + + +class PropertyInfo: + """Metadata class to be used in Annotated types to provide information about a given type. + + For example: + + class MyParams(TypedDict): + account_holder_name: Annotated[str, PropertyInfo(alias='accountHolderName')] + + This means that {'account_holder_name': 'Robert'} will be transformed to {'accountHolderName': 'Robert'} before being sent to the API. + """ + + alias: str | None + format: PropertyFormat | None + format_template: str | None + discriminator: str | None + + def __init__( + self, + *, + alias: str | None = None, + format: PropertyFormat | None = None, + format_template: str | None = None, + discriminator: str | None = None, + ) -> None: + self.alias = alias + self.format = format + self.format_template = format_template + self.discriminator = discriminator + + @override + def __repr__(self) -> str: + return f"{self.__class__.__name__}(alias='{self.alias}', format={self.format}, format_template='{self.format_template}', discriminator='{self.discriminator}')" + + +def maybe_transform( + data: object, + expected_type: object, +) -> Any | None: + """Wrapper over `transform()` that allows `None` to be passed. + + See `transform()` for more details. + """ + if data is None: + return None + return transform(data, expected_type) + + +# Wrapper over _transform_recursive providing fake types +def transform( + data: _T, + expected_type: object, +) -> _T: + """Transform dictionaries based off of type information from the given type, for example: + + ```py + class Params(TypedDict, total=False): + card_id: Required[Annotated[str, PropertyInfo(alias="cardID")]] + + + transformed = transform({"card_id": ""}, Params) + # {'cardID': ''} + ``` + + Any keys / data that does not have type information given will be included as is. + + It should be noted that the transformations that this function does are not represented in the type system. + """ + transformed = _transform_recursive(data, annotation=cast(type, expected_type)) + return cast(_T, transformed) + + +@lru_cache(maxsize=8096) +def _get_annotated_type(type_: type) -> type | None: + """If the given type is an `Annotated` type then it is returned, if not `None` is returned. + + This also unwraps the type when applicable, e.g. `Required[Annotated[T, ...]]` + """ + if is_required_type(type_): + # Unwrap `Required[Annotated[T, ...]]` to `Annotated[T, ...]` + type_ = get_args(type_)[0] + + if is_annotated_type(type_): + return type_ + + return None + + +def _maybe_transform_key(key: str, type_: type) -> str: + """Transform the given `data` based on the annotations provided in `type_`. + + Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata. + """ + annotated_type = _get_annotated_type(type_) + if annotated_type is None: + # no `Annotated` definition for this type, no transformation needed + return key + + # ignore the first argument as it is the actual type + annotations = get_args(annotated_type)[1:] + for annotation in annotations: + if isinstance(annotation, PropertyInfo) and annotation.alias is not None: + return annotation.alias + + return key + + +def _no_transform_needed(annotation: type) -> bool: + return annotation == float or annotation == int + + +def _transform_recursive( + data: object, + *, + annotation: type, + inner_type: type | None = None, +) -> object: + """Transform the given data against the expected type. + + Args: + annotation: The direct type annotation given to the particular piece of data. + This may or may not be wrapped in metadata types, e.g. `Required[T]`, `Annotated[T, ...]` etc + + inner_type: If applicable, this is the "inside" type. This is useful in certain cases where the outside type + is a container type such as `List[T]`. In that case `inner_type` should be set to `T` so that each entry in + the list can be transformed using the metadata from the container type. + + Defaults to the same value as the `annotation` argument. + """ + if inner_type is None: + inner_type = annotation + + stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type + if is_typeddict(stripped_type) and is_mapping(data): + return _transform_typeddict(data, stripped_type) + + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + + if ( + # List[T] + (is_list_type(stripped_type) and is_list(data)) + # Iterable[T] + or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) + ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + + inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] + + if is_union_type(stripped_type): + # For union types we run the transformation against all subtypes to ensure that everything is transformed. + # + # TODO: there may be edge cases where the same normalized field name will transform to two different names + # in different subtypes. + for subtype in get_args(stripped_type): + data = _transform_recursive(data, annotation=annotation, inner_type=subtype) + return data + + if isinstance(data, pydantic.BaseModel): + return model_dump(data, exclude_unset=True, mode="json") + + annotated_type = _get_annotated_type(annotation) + if annotated_type is None: + return data + + # ignore the first argument as it is the actual type + annotations = get_args(annotated_type)[1:] + for annotation in annotations: + if isinstance(annotation, PropertyInfo) and annotation.format is not None: + return _format_data(data, annotation.format, annotation.format_template) + + return data + + +def _format_data(data: object, format_: PropertyFormat, format_template: str | None) -> object: + if isinstance(data, (date, datetime)): + if format_ == "iso8601": + return data.isoformat() + + if format_ == "custom" and format_template is not None: + return data.strftime(format_template) + + if format_ == "base64" and is_base64_file_input(data): + binary: str | bytes | None = None + + if isinstance(data, pathlib.Path): + binary = data.read_bytes() + elif isinstance(data, io.IOBase): + binary = data.read() + + if isinstance(binary, str): # type: ignore[unreachable] + binary = binary.encode() + + if not isinstance(binary, bytes): + raise RuntimeError(f"Could not read bytes from {data}; Received {type(binary)}") + + return base64.b64encode(binary).decode("ascii") + + return data + + +def _transform_typeddict( + data: Mapping[str, object], + expected_type: type, +) -> Mapping[str, object]: + result: dict[str, object] = {} + annotations = get_type_hints(expected_type, include_extras=True) + for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + + type_ = annotations.get(key) + if type_ is None: + # we do not have a type annotation for this field, leave it as is + result[key] = value + else: + result[_maybe_transform_key(key, type_)] = _transform_recursive(value, annotation=type_) + return result + + +async def async_maybe_transform( + data: object, + expected_type: object, +) -> Any | None: + """Wrapper over `async_transform()` that allows `None` to be passed. + + See `async_transform()` for more details. + """ + if data is None: + return None + return await async_transform(data, expected_type) + + +async def async_transform( + data: _T, + expected_type: object, +) -> _T: + """Transform dictionaries based off of type information from the given type, for example: + + ```py + class Params(TypedDict, total=False): + card_id: Required[Annotated[str, PropertyInfo(alias="cardID")]] + + + transformed = transform({"card_id": ""}, Params) + # {'cardID': ''} + ``` + + Any keys / data that does not have type information given will be included as is. + + It should be noted that the transformations that this function does are not represented in the type system. + """ + transformed = await _async_transform_recursive(data, annotation=cast(type, expected_type)) + return cast(_T, transformed) + + +async def _async_transform_recursive( + data: object, + *, + annotation: type, + inner_type: type | None = None, +) -> object: + """Transform the given data against the expected type. + + Args: + annotation: The direct type annotation given to the particular piece of data. + This may or may not be wrapped in metadata types, e.g. `Required[T]`, `Annotated[T, ...]` etc + + inner_type: If applicable, this is the "inside" type. This is useful in certain cases where the outside type + is a container type such as `List[T]`. In that case `inner_type` should be set to `T` so that each entry in + the list can be transformed using the metadata from the container type. + + Defaults to the same value as the `annotation` argument. + """ + if inner_type is None: + inner_type = annotation + + stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type + if is_typeddict(stripped_type) and is_mapping(data): + return await _async_transform_typeddict(data, stripped_type) + + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + + if ( + # List[T] + (is_list_type(stripped_type) and is_list(data)) + # Iterable[T] + or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) + ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + + inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] + + if is_union_type(stripped_type): + # For union types we run the transformation against all subtypes to ensure that everything is transformed. + # + # TODO: there may be edge cases where the same normalized field name will transform to two different names + # in different subtypes. + for subtype in get_args(stripped_type): + data = await _async_transform_recursive(data, annotation=annotation, inner_type=subtype) + return data + + if isinstance(data, pydantic.BaseModel): + return model_dump(data, exclude_unset=True, mode="json") + + annotated_type = _get_annotated_type(annotation) + if annotated_type is None: + return data + + # ignore the first argument as it is the actual type + annotations = get_args(annotated_type)[1:] + for annotation in annotations: + if isinstance(annotation, PropertyInfo) and annotation.format is not None: + return await _async_format_data(data, annotation.format, annotation.format_template) + + return data + + +async def _async_format_data(data: object, format_: PropertyFormat, format_template: str | None) -> object: + if isinstance(data, (date, datetime)): + if format_ == "iso8601": + return data.isoformat() + + if format_ == "custom" and format_template is not None: + return data.strftime(format_template) + + if format_ == "base64" and is_base64_file_input(data): + binary: str | bytes | None = None + + if isinstance(data, pathlib.Path): + binary = await anyio.Path(data).read_bytes() + elif isinstance(data, io.IOBase): + binary = data.read() + + if isinstance(binary, str): # type: ignore[unreachable] + binary = binary.encode() + + if not isinstance(binary, bytes): + raise RuntimeError(f"Could not read bytes from {data}; Received {type(binary)}") + + return base64.b64encode(binary).decode("ascii") + + return data + + +async def _async_transform_typeddict( + data: Mapping[str, object], + expected_type: type, +) -> Mapping[str, object]: + result: dict[str, object] = {} + annotations = get_type_hints(expected_type, include_extras=True) + for key, value in data.items(): + if not is_given(value): + # we don't need to include `NotGiven` values here as they'll + # be stripped out before the request is sent anyway + continue + + type_ = annotations.get(key) + if type_ is None: + # we do not have a type annotation for this field, leave it as is + result[key] = value + else: + result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) + return result + + +@lru_cache(maxsize=8096) +def get_type_hints( + obj: Any, + globalns: dict[str, Any] | None = None, + localns: Mapping[str, Any] | None = None, + include_extras: bool = False, +) -> dict[str, Any]: + return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras) diff --git a/src/imagekit/_utils/_typing.py b/src/imagekit/_utils/_typing.py new file mode 100644 index 0000000..845cd6b --- /dev/null +++ b/src/imagekit/_utils/_typing.py @@ -0,0 +1,156 @@ +from __future__ import annotations + +import sys +import typing +import typing_extensions +from typing import Any, TypeVar, Iterable, cast +from collections import abc as _c_abc +from typing_extensions import ( + TypeIs, + Required, + Annotated, + get_args, + get_origin, +) + +from ._utils import lru_cache +from .._types import InheritsGeneric +from .._compat import is_union as _is_union + + +def is_annotated_type(typ: type) -> bool: + return get_origin(typ) == Annotated + + +def is_list_type(typ: type) -> bool: + return (get_origin(typ) or typ) == list + + +def is_sequence_type(typ: type) -> bool: + origin = get_origin(typ) or typ + return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence + + +def is_iterable_type(typ: type) -> bool: + """If the given type is `typing.Iterable[T]`""" + origin = get_origin(typ) or typ + return origin == Iterable or origin == _c_abc.Iterable + + +def is_union_type(typ: type) -> bool: + return _is_union(get_origin(typ)) + + +def is_required_type(typ: type) -> bool: + return get_origin(typ) == Required + + +def is_typevar(typ: type) -> bool: + # type ignore is required because type checkers + # think this expression will always return False + return type(typ) == TypeVar # type: ignore + + +_TYPE_ALIAS_TYPES: tuple[type[typing_extensions.TypeAliasType], ...] = (typing_extensions.TypeAliasType,) +if sys.version_info >= (3, 12): + _TYPE_ALIAS_TYPES = (*_TYPE_ALIAS_TYPES, typing.TypeAliasType) + + +def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]: + """Return whether the provided argument is an instance of `TypeAliasType`. + + ```python + type Int = int + is_type_alias_type(Int) + # > True + Str = TypeAliasType("Str", str) + is_type_alias_type(Str) + # > True + ``` + """ + return isinstance(tp, _TYPE_ALIAS_TYPES) + + +# Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]] +@lru_cache(maxsize=8096) +def strip_annotated_type(typ: type) -> type: + if is_required_type(typ) or is_annotated_type(typ): + return strip_annotated_type(cast(type, get_args(typ)[0])) + + return typ + + +def extract_type_arg(typ: type, index: int) -> type: + args = get_args(typ) + try: + return cast(type, args[index]) + except IndexError as err: + raise RuntimeError(f"Expected type {typ} to have a type argument at index {index} but it did not") from err + + +def extract_type_var_from_base( + typ: type, + *, + generic_bases: tuple[type, ...], + index: int, + failure_message: str | None = None, +) -> type: + """Given a type like `Foo[T]`, returns the generic type variable `T`. + + This also handles the case where a concrete subclass is given, e.g. + ```py + class MyResponse(Foo[bytes]): + ... + + extract_type_var(MyResponse, bases=(Foo,), index=0) -> bytes + ``` + + And where a generic subclass is given: + ```py + _T = TypeVar('_T') + class MyResponse(Foo[_T]): + ... + + extract_type_var(MyResponse[bytes], bases=(Foo,), index=0) -> bytes + ``` + """ + cls = cast(object, get_origin(typ) or typ) + if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains] + # we're given the class directly + return extract_type_arg(typ, index) + + # if a subclass is given + # --- + # this is needed as __orig_bases__ is not present in the typeshed stubs + # because it is intended to be for internal use only, however there does + # not seem to be a way to resolve generic TypeVars for inherited subclasses + # without using it. + if isinstance(cls, InheritsGeneric): + target_base_class: Any | None = None + for base in cls.__orig_bases__: + if base.__origin__ in generic_bases: + target_base_class = base + break + + if target_base_class is None: + raise RuntimeError( + "Could not find the generic base class;\n" + "This should never happen;\n" + f"Does {cls} inherit from one of {generic_bases} ?" + ) + + extracted = extract_type_arg(target_base_class, index) + if is_typevar(extracted): + # If the extracted type argument is itself a type variable + # then that means the subclass itself is generic, so we have + # to resolve the type argument from the class itself, not + # the base class. + # + # Note: if there is more than 1 type argument, the subclass could + # change the ordering of the type arguments, this is not currently + # supported. + return extract_type_arg(typ, index) + + return extracted + + raise RuntimeError(failure_message or f"Could not resolve inner type variable at index {index} for {typ}") diff --git a/src/imagekit/_utils/_utils.py b/src/imagekit/_utils/_utils.py new file mode 100644 index 0000000..ea3cf3f --- /dev/null +++ b/src/imagekit/_utils/_utils.py @@ -0,0 +1,422 @@ +from __future__ import annotations + +import os +import re +import inspect +import functools +from typing import ( + Any, + Tuple, + Mapping, + TypeVar, + Callable, + Iterable, + Sequence, + cast, + overload, +) +from pathlib import Path +from datetime import date, datetime +from typing_extensions import TypeGuard + +import sniffio + +from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._compat import parse_date as parse_date, parse_datetime as parse_datetime + +_T = TypeVar("_T") +_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) +_MappingT = TypeVar("_MappingT", bound=Mapping[str, object]) +_SequenceT = TypeVar("_SequenceT", bound=Sequence[object]) +CallableT = TypeVar("CallableT", bound=Callable[..., Any]) + + +def flatten(t: Iterable[Iterable[_T]]) -> list[_T]: + return [item for sublist in t for item in sublist] + + +def extract_files( + # TODO: this needs to take Dict but variance issues..... + # create protocol type ? + query: Mapping[str, object], + *, + paths: Sequence[Sequence[str]], +) -> list[tuple[str, FileTypes]]: + """Recursively extract files from the given dictionary based on specified paths. + + A path may look like this ['foo', 'files', '', 'data']. + + Note: this mutates the given dictionary. + """ + files: list[tuple[str, FileTypes]] = [] + for path in paths: + files.extend(_extract_items(query, path, index=0, flattened_key=None)) + return files + + +def _extract_items( + obj: object, + path: Sequence[str], + *, + index: int, + flattened_key: str | None, +) -> list[tuple[str, FileTypes]]: + try: + key = path[index] + except IndexError: + if isinstance(obj, NotGiven): + # no value was provided - we can safely ignore + return [] + + # cyclical import + from .._files import assert_is_file_content + + # We have exhausted the path, return the entry we found. + assert flattened_key is not None + + if is_list(obj): + files: list[tuple[str, FileTypes]] = [] + for entry in obj: + assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "") + files.append((flattened_key + "[]", cast(FileTypes, entry))) + return files + + assert_is_file_content(obj, key=flattened_key) + return [(flattened_key, cast(FileTypes, obj))] + + index += 1 + if is_dict(obj): + try: + # We are at the last entry in the path so we must remove the field + if (len(path)) == index: + item = obj.pop(key) + else: + item = obj[key] + except KeyError: + # Key was not present in the dictionary, this is not indicative of an error + # as the given path may not point to a required field. We also do not want + # to enforce required fields as the API may differ from the spec in some cases. + return [] + if flattened_key is None: + flattened_key = key + else: + flattened_key += f"[{key}]" + return _extract_items( + item, + path, + index=index, + flattened_key=flattened_key, + ) + elif is_list(obj): + if key != "": + return [] + + return flatten( + [ + _extract_items( + item, + path, + index=index, + flattened_key=flattened_key + "[]" if flattened_key is not None else "[]", + ) + for item in obj + ] + ) + + # Something unexpected was passed, just ignore it. + return [] + + +def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) + + +# Type safe methods for narrowing types with TypeVars. +# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], +# however this cause Pyright to rightfully report errors. As we know we don't +# care about the contained types we can safely use `object` in it's place. +# +# There are two separate functions defined, `is_*` and `is_*_t` for different use cases. +# `is_*` is for when you're dealing with an unknown input +# `is_*_t` is for when you're narrowing a known union type to a specific subset + + +def is_tuple(obj: object) -> TypeGuard[tuple[object, ...]]: + return isinstance(obj, tuple) + + +def is_tuple_t(obj: _TupleT | object) -> TypeGuard[_TupleT]: + return isinstance(obj, tuple) + + +def is_sequence(obj: object) -> TypeGuard[Sequence[object]]: + return isinstance(obj, Sequence) + + +def is_sequence_t(obj: _SequenceT | object) -> TypeGuard[_SequenceT]: + return isinstance(obj, Sequence) + + +def is_mapping(obj: object) -> TypeGuard[Mapping[str, object]]: + return isinstance(obj, Mapping) + + +def is_mapping_t(obj: _MappingT | object) -> TypeGuard[_MappingT]: + return isinstance(obj, Mapping) + + +def is_dict(obj: object) -> TypeGuard[dict[object, object]]: + return isinstance(obj, dict) + + +def is_list(obj: object) -> TypeGuard[list[object]]: + return isinstance(obj, list) + + +def is_iterable(obj: object) -> TypeGuard[Iterable[object]]: + return isinstance(obj, Iterable) + + +def deepcopy_minimal(item: _T) -> _T: + """Minimal reimplementation of copy.deepcopy() that will only copy certain object types: + + - mappings, e.g. `dict` + - list + + This is done for performance reasons. + """ + if is_mapping(item): + return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()}) + if is_list(item): + return cast(_T, [deepcopy_minimal(entry) for entry in item]) + return item + + +# copied from https://github.com/Rapptz/RoboDanny +def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str: + size = len(seq) + if size == 0: + return "" + + if size == 1: + return seq[0] + + if size == 2: + return f"{seq[0]} {final} {seq[1]}" + + return delim.join(seq[:-1]) + f" {final} {seq[-1]}" + + +def quote(string: str) -> str: + """Add single quotation marks around the given string. Does *not* do any escaping.""" + return f"'{string}'" + + +def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: + """Decorator to enforce a given set of arguments or variants of arguments are passed to the decorated function. + + Useful for enforcing runtime validation of overloaded functions. + + Example usage: + ```py + @overload + def foo(*, a: str) -> str: ... + + + @overload + def foo(*, b: bool) -> str: ... + + + # This enforces the same constraints that a static type checker would + # i.e. that either a or b must be passed to the function + @required_args(["a"], ["b"]) + def foo(*, a: str | None = None, b: bool | None = None) -> str: ... + ``` + """ + + def inner(func: CallableT) -> CallableT: + params = inspect.signature(func).parameters + positional = [ + name + for name, param in params.items() + if param.kind + in { + param.POSITIONAL_ONLY, + param.POSITIONAL_OR_KEYWORD, + } + ] + + @functools.wraps(func) + def wrapper(*args: object, **kwargs: object) -> object: + given_params: set[str] = set() + for i, _ in enumerate(args): + try: + given_params.add(positional[i]) + except IndexError: + raise TypeError( + f"{func.__name__}() takes {len(positional)} argument(s) but {len(args)} were given" + ) from None + + for key in kwargs.keys(): + given_params.add(key) + + for variant in variants: + matches = all((param in given_params for param in variant)) + if matches: + break + else: # no break + if len(variants) > 1: + variations = human_join( + ["(" + human_join([quote(arg) for arg in variant], final="and") + ")" for variant in variants] + ) + msg = f"Missing required arguments; Expected either {variations} arguments to be given" + else: + assert len(variants) > 0 + + # TODO: this error message is not deterministic + missing = list(set(variants[0]) - given_params) + if len(missing) > 1: + msg = f"Missing required arguments: {human_join([quote(arg) for arg in missing])}" + else: + msg = f"Missing required argument: {quote(missing[0])}" + raise TypeError(msg) + return func(*args, **kwargs) + + return wrapper # type: ignore + + return inner + + +_K = TypeVar("_K") +_V = TypeVar("_V") + + +@overload +def strip_not_given(obj: None) -> None: ... + + +@overload +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... + + +@overload +def strip_not_given(obj: object) -> object: ... + + +def strip_not_given(obj: object | None) -> object: + """Remove all top-level keys where their values are instances of `NotGiven`""" + if obj is None: + return None + + if not is_mapping(obj): + return obj + + return {key: value for key, value in obj.items() if not isinstance(value, NotGiven)} + + +def coerce_integer(val: str) -> int: + return int(val, base=10) + + +def coerce_float(val: str) -> float: + return float(val) + + +def coerce_boolean(val: str) -> bool: + return val == "true" or val == "1" or val == "on" + + +def maybe_coerce_integer(val: str | None) -> int | None: + if val is None: + return None + return coerce_integer(val) + + +def maybe_coerce_float(val: str | None) -> float | None: + if val is None: + return None + return coerce_float(val) + + +def maybe_coerce_boolean(val: str | None) -> bool | None: + if val is None: + return None + return coerce_boolean(val) + + +def removeprefix(string: str, prefix: str) -> str: + """Remove a prefix from a string. + + Backport of `str.removeprefix` for Python < 3.9 + """ + if string.startswith(prefix): + return string[len(prefix) :] + return string + + +def removesuffix(string: str, suffix: str) -> str: + """Remove a suffix from a string. + + Backport of `str.removesuffix` for Python < 3.9 + """ + if string.endswith(suffix): + return string[: -len(suffix)] + return string + + +def file_from_path(path: str) -> FileTypes: + contents = Path(path).read_bytes() + file_name = os.path.basename(path) + return (file_name, contents) + + +def get_required_header(headers: HeadersLike, header: str) -> str: + lower_header = header.lower() + if is_mapping_t(headers): + # mypy doesn't understand the type narrowing here + for k, v in headers.items(): # type: ignore + if k.lower() == lower_header and isinstance(v, str): + return v + + # to deal with the case where the header looks like Stainless-Event-Id + intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize()) + + for normalized_header in [header, lower_header, header.upper(), intercaps_header]: + value = headers.get(normalized_header) + if value: + return value + + raise ValueError(f"Could not find {header} header") + + +def get_async_library() -> str: + try: + return sniffio.current_async_library() + except Exception: + return "false" + + +def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]: + """A version of functools.lru_cache that retains the type signature + for the wrapped function arguments. + """ + wrapper = functools.lru_cache( # noqa: TID251 + maxsize=maxsize, + ) + return cast(Any, wrapper) # type: ignore[no-any-return] + + +def json_safe(data: object) -> object: + """Translates a mapping / sequence recursively in the same fashion + as `pydantic` v2's `model_dump(mode="json")`. + """ + if is_mapping(data): + return {json_safe(key): json_safe(value) for key, value in data.items()} + + if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)): + return [json_safe(item) for item in data] + + if isinstance(data, (datetime, date)): + return data.isoformat() + + return data diff --git a/src/imagekit/_version.py b/src/imagekit/_version.py new file mode 100644 index 0000000..adf42c3 --- /dev/null +++ b/src/imagekit/_version.py @@ -0,0 +1,4 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +__title__ = "imagekit" +__version__ = "0.1.0" # x-release-please-version diff --git a/src/imagekit/lib/.keep b/src/imagekit/lib/.keep new file mode 100644 index 0000000..5e2c99f --- /dev/null +++ b/src/imagekit/lib/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store custom files to expand the SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/imagekitio/constants/__init__.py b/src/imagekit/py.typed similarity index 100% rename from imagekitio/constants/__init__.py rename to src/imagekit/py.typed diff --git a/src/imagekit/resources/__init__.py b/src/imagekit/resources/__init__.py new file mode 100644 index 0000000..39999ec --- /dev/null +++ b/src/imagekit/resources/__init__.py @@ -0,0 +1,106 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .beta import ( + BetaResource, + AsyncBetaResource, + BetaResourceWithRawResponse, + AsyncBetaResourceWithRawResponse, + BetaResourceWithStreamingResponse, + AsyncBetaResourceWithStreamingResponse, +) +from .cache import ( + CacheResource, + AsyncCacheResource, + CacheResourceWithRawResponse, + AsyncCacheResourceWithRawResponse, + CacheResourceWithStreamingResponse, + AsyncCacheResourceWithStreamingResponse, +) +from .files import ( + FilesResource, + AsyncFilesResource, + FilesResourceWithRawResponse, + AsyncFilesResourceWithRawResponse, + FilesResourceWithStreamingResponse, + AsyncFilesResourceWithStreamingResponse, +) +from .assets import ( + AssetsResource, + AsyncAssetsResource, + AssetsResourceWithRawResponse, + AsyncAssetsResourceWithRawResponse, + AssetsResourceWithStreamingResponse, + AsyncAssetsResourceWithStreamingResponse, +) +from .folders import ( + FoldersResource, + AsyncFoldersResource, + FoldersResourceWithRawResponse, + AsyncFoldersResourceWithRawResponse, + FoldersResourceWithStreamingResponse, + AsyncFoldersResourceWithStreamingResponse, +) +from .accounts import ( + AccountsResource, + AsyncAccountsResource, + AccountsResourceWithRawResponse, + AsyncAccountsResourceWithRawResponse, + AccountsResourceWithStreamingResponse, + AsyncAccountsResourceWithStreamingResponse, +) +from .webhooks import WebhooksResource, AsyncWebhooksResource +from .custom_metadata_fields import ( + CustomMetadataFieldsResource, + AsyncCustomMetadataFieldsResource, + CustomMetadataFieldsResourceWithRawResponse, + AsyncCustomMetadataFieldsResourceWithRawResponse, + CustomMetadataFieldsResourceWithStreamingResponse, + AsyncCustomMetadataFieldsResourceWithStreamingResponse, +) + +__all__ = [ + "CustomMetadataFieldsResource", + "AsyncCustomMetadataFieldsResource", + "CustomMetadataFieldsResourceWithRawResponse", + "AsyncCustomMetadataFieldsResourceWithRawResponse", + "CustomMetadataFieldsResourceWithStreamingResponse", + "AsyncCustomMetadataFieldsResourceWithStreamingResponse", + "FilesResource", + "AsyncFilesResource", + "FilesResourceWithRawResponse", + "AsyncFilesResourceWithRawResponse", + "FilesResourceWithStreamingResponse", + "AsyncFilesResourceWithStreamingResponse", + "AssetsResource", + "AsyncAssetsResource", + "AssetsResourceWithRawResponse", + "AsyncAssetsResourceWithRawResponse", + "AssetsResourceWithStreamingResponse", + "AsyncAssetsResourceWithStreamingResponse", + "CacheResource", + "AsyncCacheResource", + "CacheResourceWithRawResponse", + "AsyncCacheResourceWithRawResponse", + "CacheResourceWithStreamingResponse", + "AsyncCacheResourceWithStreamingResponse", + "FoldersResource", + "AsyncFoldersResource", + "FoldersResourceWithRawResponse", + "AsyncFoldersResourceWithRawResponse", + "FoldersResourceWithStreamingResponse", + "AsyncFoldersResourceWithStreamingResponse", + "AccountsResource", + "AsyncAccountsResource", + "AccountsResourceWithRawResponse", + "AsyncAccountsResourceWithRawResponse", + "AccountsResourceWithStreamingResponse", + "AsyncAccountsResourceWithStreamingResponse", + "BetaResource", + "AsyncBetaResource", + "BetaResourceWithRawResponse", + "AsyncBetaResourceWithRawResponse", + "BetaResourceWithStreamingResponse", + "AsyncBetaResourceWithStreamingResponse", + "WebhooksResource", + "AsyncWebhooksResource", +] diff --git a/src/imagekit/resources/accounts/__init__.py b/src/imagekit/resources/accounts/__init__.py new file mode 100644 index 0000000..fc56413 --- /dev/null +++ b/src/imagekit/resources/accounts/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .usage import ( + UsageResource, + AsyncUsageResource, + UsageResourceWithRawResponse, + AsyncUsageResourceWithRawResponse, + UsageResourceWithStreamingResponse, + AsyncUsageResourceWithStreamingResponse, +) +from .origins import ( + OriginsResource, + AsyncOriginsResource, + OriginsResourceWithRawResponse, + AsyncOriginsResourceWithRawResponse, + OriginsResourceWithStreamingResponse, + AsyncOriginsResourceWithStreamingResponse, +) +from .accounts import ( + AccountsResource, + AsyncAccountsResource, + AccountsResourceWithRawResponse, + AsyncAccountsResourceWithRawResponse, + AccountsResourceWithStreamingResponse, + AsyncAccountsResourceWithStreamingResponse, +) +from .url_endpoints import ( + URLEndpointsResource, + AsyncURLEndpointsResource, + URLEndpointsResourceWithRawResponse, + AsyncURLEndpointsResourceWithRawResponse, + URLEndpointsResourceWithStreamingResponse, + AsyncURLEndpointsResourceWithStreamingResponse, +) + +__all__ = [ + "UsageResource", + "AsyncUsageResource", + "UsageResourceWithRawResponse", + "AsyncUsageResourceWithRawResponse", + "UsageResourceWithStreamingResponse", + "AsyncUsageResourceWithStreamingResponse", + "OriginsResource", + "AsyncOriginsResource", + "OriginsResourceWithRawResponse", + "AsyncOriginsResourceWithRawResponse", + "OriginsResourceWithStreamingResponse", + "AsyncOriginsResourceWithStreamingResponse", + "URLEndpointsResource", + "AsyncURLEndpointsResource", + "URLEndpointsResourceWithRawResponse", + "AsyncURLEndpointsResourceWithRawResponse", + "URLEndpointsResourceWithStreamingResponse", + "AsyncURLEndpointsResourceWithStreamingResponse", + "AccountsResource", + "AsyncAccountsResource", + "AccountsResourceWithRawResponse", + "AsyncAccountsResourceWithRawResponse", + "AccountsResourceWithStreamingResponse", + "AsyncAccountsResourceWithStreamingResponse", +] diff --git a/src/imagekit/resources/accounts/accounts.py b/src/imagekit/resources/accounts/accounts.py new file mode 100644 index 0000000..461e8cf --- /dev/null +++ b/src/imagekit/resources/accounts/accounts.py @@ -0,0 +1,166 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .usage import ( + UsageResource, + AsyncUsageResource, + UsageResourceWithRawResponse, + AsyncUsageResourceWithRawResponse, + UsageResourceWithStreamingResponse, + AsyncUsageResourceWithStreamingResponse, +) +from .origins import ( + OriginsResource, + AsyncOriginsResource, + OriginsResourceWithRawResponse, + AsyncOriginsResourceWithRawResponse, + OriginsResourceWithStreamingResponse, + AsyncOriginsResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from .url_endpoints import ( + URLEndpointsResource, + AsyncURLEndpointsResource, + URLEndpointsResourceWithRawResponse, + AsyncURLEndpointsResourceWithRawResponse, + URLEndpointsResourceWithStreamingResponse, + AsyncURLEndpointsResourceWithStreamingResponse, +) + +__all__ = ["AccountsResource", "AsyncAccountsResource"] + + +class AccountsResource(SyncAPIResource): + @cached_property + def usage(self) -> UsageResource: + return UsageResource(self._client) + + @cached_property + def origins(self) -> OriginsResource: + return OriginsResource(self._client) + + @cached_property + def url_endpoints(self) -> URLEndpointsResource: + return URLEndpointsResource(self._client) + + @cached_property + def with_raw_response(self) -> AccountsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AccountsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AccountsResourceWithStreamingResponse(self) + + +class AsyncAccountsResource(AsyncAPIResource): + @cached_property + def usage(self) -> AsyncUsageResource: + return AsyncUsageResource(self._client) + + @cached_property + def origins(self) -> AsyncOriginsResource: + return AsyncOriginsResource(self._client) + + @cached_property + def url_endpoints(self) -> AsyncURLEndpointsResource: + return AsyncURLEndpointsResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncAccountsResourceWithStreamingResponse(self) + + +class AccountsResourceWithRawResponse: + def __init__(self, accounts: AccountsResource) -> None: + self._accounts = accounts + + @cached_property + def usage(self) -> UsageResourceWithRawResponse: + return UsageResourceWithRawResponse(self._accounts.usage) + + @cached_property + def origins(self) -> OriginsResourceWithRawResponse: + return OriginsResourceWithRawResponse(self._accounts.origins) + + @cached_property + def url_endpoints(self) -> URLEndpointsResourceWithRawResponse: + return URLEndpointsResourceWithRawResponse(self._accounts.url_endpoints) + + +class AsyncAccountsResourceWithRawResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: + self._accounts = accounts + + @cached_property + def usage(self) -> AsyncUsageResourceWithRawResponse: + return AsyncUsageResourceWithRawResponse(self._accounts.usage) + + @cached_property + def origins(self) -> AsyncOriginsResourceWithRawResponse: + return AsyncOriginsResourceWithRawResponse(self._accounts.origins) + + @cached_property + def url_endpoints(self) -> AsyncURLEndpointsResourceWithRawResponse: + return AsyncURLEndpointsResourceWithRawResponse(self._accounts.url_endpoints) + + +class AccountsResourceWithStreamingResponse: + def __init__(self, accounts: AccountsResource) -> None: + self._accounts = accounts + + @cached_property + def usage(self) -> UsageResourceWithStreamingResponse: + return UsageResourceWithStreamingResponse(self._accounts.usage) + + @cached_property + def origins(self) -> OriginsResourceWithStreamingResponse: + return OriginsResourceWithStreamingResponse(self._accounts.origins) + + @cached_property + def url_endpoints(self) -> URLEndpointsResourceWithStreamingResponse: + return URLEndpointsResourceWithStreamingResponse(self._accounts.url_endpoints) + + +class AsyncAccountsResourceWithStreamingResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: + self._accounts = accounts + + @cached_property + def usage(self) -> AsyncUsageResourceWithStreamingResponse: + return AsyncUsageResourceWithStreamingResponse(self._accounts.usage) + + @cached_property + def origins(self) -> AsyncOriginsResourceWithStreamingResponse: + return AsyncOriginsResourceWithStreamingResponse(self._accounts.origins) + + @cached_property + def url_endpoints(self) -> AsyncURLEndpointsResourceWithStreamingResponse: + return AsyncURLEndpointsResourceWithStreamingResponse(self._accounts.url_endpoints) diff --git a/src/imagekit/resources/accounts/origins.py b/src/imagekit/resources/accounts/origins.py new file mode 100644 index 0000000..c036f03 --- /dev/null +++ b/src/imagekit/resources/accounts/origins.py @@ -0,0 +1,527 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Any, cast + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.accounts import origin_create_params, origin_update_params +from ...types.accounts.origin_response import OriginResponse +from ...types.accounts.origin_list_response import OriginListResponse +from ...types.accounts.origin_request_param import OriginRequestParam + +__all__ = ["OriginsResource", "AsyncOriginsResource"] + + +class OriginsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OriginsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return OriginsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OriginsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return OriginsResourceWithStreamingResponse(self) + + def create( + self, + *, + origin: OriginRequestParam, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginResponse: + """**Note:** This API is currently in beta. + + + Creates a new origin and returns the origin object. + + Args: + origin: Schema for origin request resources. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + OriginResponse, + self._post( + "/v1/accounts/origins", + body=maybe_transform(origin, origin_create_params.OriginCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginResponse), # Union types cannot be passed in as arguments in the type system + ), + ) + + def update( + self, + id: str, + *, + origin: OriginRequestParam, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginResponse: + """**Note:** This API is currently in beta. + + + Updates the origin identified by `id` and returns the updated origin object. + + Args: + id: Unique identifier for the origin. This is generated by ImageKit when you create + a new origin. + + origin: Schema for origin request resources. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return cast( + OriginResponse, + self._put( + f"/v1/accounts/origins/{id}", + body=maybe_transform(origin, origin_update_params.OriginUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginResponse), # Union types cannot be passed in as arguments in the type system + ), + ) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginListResponse: + """**Note:** This API is currently in beta. + + + Returns an array of all configured origins for the current account. + """ + return self._get( + "/v1/accounts/origins", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OriginListResponse, + ) + + def delete( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """**Note:** This API is currently in beta. + + + Permanently removes the origin identified by `id`. If the origin is in use by + any URL‑endpoints, the API will return an error. + + Args: + id: Unique identifier for the origin. This is generated by ImageKit when you create + a new origin. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/v1/accounts/origins/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginResponse: + """**Note:** This API is currently in beta. + + + Retrieves the origin identified by `id`. + + Args: + id: Unique identifier for the origin. This is generated by ImageKit when you create + a new origin. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return cast( + OriginResponse, + self._get( + f"/v1/accounts/origins/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginResponse), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class AsyncOriginsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOriginsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncOriginsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOriginsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncOriginsResourceWithStreamingResponse(self) + + async def create( + self, + *, + origin: OriginRequestParam, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginResponse: + """**Note:** This API is currently in beta. + + + Creates a new origin and returns the origin object. + + Args: + origin: Schema for origin request resources. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return cast( + OriginResponse, + await self._post( + "/v1/accounts/origins", + body=await async_maybe_transform(origin, origin_create_params.OriginCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginResponse), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def update( + self, + id: str, + *, + origin: OriginRequestParam, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginResponse: + """**Note:** This API is currently in beta. + + + Updates the origin identified by `id` and returns the updated origin object. + + Args: + id: Unique identifier for the origin. This is generated by ImageKit when you create + a new origin. + + origin: Schema for origin request resources. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return cast( + OriginResponse, + await self._put( + f"/v1/accounts/origins/{id}", + body=await async_maybe_transform(origin, origin_update_params.OriginUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginResponse), # Union types cannot be passed in as arguments in the type system + ), + ) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginListResponse: + """**Note:** This API is currently in beta. + + + Returns an array of all configured origins for the current account. + """ + return await self._get( + "/v1/accounts/origins", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OriginListResponse, + ) + + async def delete( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """**Note:** This API is currently in beta. + + + Permanently removes the origin identified by `id`. If the origin is in use by + any URL‑endpoints, the API will return an error. + + Args: + id: Unique identifier for the origin. This is generated by ImageKit when you create + a new origin. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/v1/accounts/origins/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> OriginResponse: + """**Note:** This API is currently in beta. + + + Retrieves the origin identified by `id`. + + Args: + id: Unique identifier for the origin. This is generated by ImageKit when you create + a new origin. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return cast( + OriginResponse, + await self._get( + f"/v1/accounts/origins/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=cast(Any, OriginResponse), # Union types cannot be passed in as arguments in the type system + ), + ) + + +class OriginsResourceWithRawResponse: + def __init__(self, origins: OriginsResource) -> None: + self._origins = origins + + self.create = to_raw_response_wrapper( + origins.create, + ) + self.update = to_raw_response_wrapper( + origins.update, + ) + self.list = to_raw_response_wrapper( + origins.list, + ) + self.delete = to_raw_response_wrapper( + origins.delete, + ) + self.get = to_raw_response_wrapper( + origins.get, + ) + + +class AsyncOriginsResourceWithRawResponse: + def __init__(self, origins: AsyncOriginsResource) -> None: + self._origins = origins + + self.create = async_to_raw_response_wrapper( + origins.create, + ) + self.update = async_to_raw_response_wrapper( + origins.update, + ) + self.list = async_to_raw_response_wrapper( + origins.list, + ) + self.delete = async_to_raw_response_wrapper( + origins.delete, + ) + self.get = async_to_raw_response_wrapper( + origins.get, + ) + + +class OriginsResourceWithStreamingResponse: + def __init__(self, origins: OriginsResource) -> None: + self._origins = origins + + self.create = to_streamed_response_wrapper( + origins.create, + ) + self.update = to_streamed_response_wrapper( + origins.update, + ) + self.list = to_streamed_response_wrapper( + origins.list, + ) + self.delete = to_streamed_response_wrapper( + origins.delete, + ) + self.get = to_streamed_response_wrapper( + origins.get, + ) + + +class AsyncOriginsResourceWithStreamingResponse: + def __init__(self, origins: AsyncOriginsResource) -> None: + self._origins = origins + + self.create = async_to_streamed_response_wrapper( + origins.create, + ) + self.update = async_to_streamed_response_wrapper( + origins.update, + ) + self.list = async_to_streamed_response_wrapper( + origins.list, + ) + self.delete = async_to_streamed_response_wrapper( + origins.delete, + ) + self.get = async_to_streamed_response_wrapper( + origins.get, + ) diff --git a/src/imagekit/resources/accounts/url_endpoints.py b/src/imagekit/resources/accounts/url_endpoints.py new file mode 100644 index 0000000..cd8e6f7 --- /dev/null +++ b/src/imagekit/resources/accounts/url_endpoints.py @@ -0,0 +1,594 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.accounts import url_endpoint_create_params, url_endpoint_update_params +from ...types.accounts.url_endpoint_response import URLEndpointResponse +from ...types.accounts.url_endpoint_list_response import URLEndpointListResponse + +__all__ = ["URLEndpointsResource", "AsyncURLEndpointsResource"] + + +class URLEndpointsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> URLEndpointsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return URLEndpointsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> URLEndpointsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return URLEndpointsResourceWithStreamingResponse(self) + + def create( + self, + *, + description: str, + origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + url_prefix: str | NotGiven = NOT_GIVEN, + url_rewriter: url_endpoint_create_params.URLRewriter | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointResponse: + """**Note:** This API is currently in beta. + + + Creates a new URL‑endpoint and returns the resulting object. + + Args: + description: Description of the URL endpoint. + + origins: Ordered list of origin IDs to try when the file isn’t in the Media Library; + ImageKit checks them in the sequence provided. Origin must be created before it + can be used in a URL endpoint. + + url_prefix: Path segment appended to your base URL to form the endpoint (letters, digits, + and hyphens only — or empty for the default endpoint). + + url_rewriter: Configuration for third-party URL rewriting. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/accounts/url-endpoints", + body=maybe_transform( + { + "description": description, + "origins": origins, + "url_prefix": url_prefix, + "url_rewriter": url_rewriter, + }, + url_endpoint_create_params.URLEndpointCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointResponse, + ) + + def update( + self, + id: str, + *, + description: str, + origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + url_prefix: str | NotGiven = NOT_GIVEN, + url_rewriter: url_endpoint_update_params.URLRewriter | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointResponse: + """**Note:** This API is currently in beta. + + + Updates the URL‑endpoint identified by `id` and returns the updated object. + + Args: + id: Unique identifier for the URL-endpoint. This is generated by ImageKit when you + create a new URL-endpoint. For the default URL-endpoint, this is always + `default`. + + description: Description of the URL endpoint. + + origins: Ordered list of origin IDs to try when the file isn’t in the Media Library; + ImageKit checks them in the sequence provided. Origin must be created before it + can be used in a URL endpoint. + + url_prefix: Path segment appended to your base URL to form the endpoint (letters, digits, + and hyphens only — or empty for the default endpoint). + + url_rewriter: Configuration for third-party URL rewriting. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._put( + f"/v1/accounts/url-endpoints/{id}", + body=maybe_transform( + { + "description": description, + "origins": origins, + "url_prefix": url_prefix, + "url_rewriter": url_rewriter, + }, + url_endpoint_update_params.URLEndpointUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointResponse, + ) + + def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointListResponse: + """**Note:** This API is currently in beta. + + + Returns an array of all URL‑endpoints configured including the default + URL-endpoint generated by ImageKit during account creation. + """ + return self._get( + "/v1/accounts/url-endpoints", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointListResponse, + ) + + def delete( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """**Note:** This API is currently in beta. + + + Deletes the URL‑endpoint identified by `id`. You cannot delete the default + URL‑endpoint created by ImageKit during account creation. + + Args: + id: Unique identifier for the URL-endpoint. This is generated by ImageKit when you + create a new URL-endpoint. For the default URL-endpoint, this is always + `default`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/v1/accounts/url-endpoints/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def get( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointResponse: + """**Note:** This API is currently in beta. + + + Retrieves the URL‑endpoint identified by `id`. + + Args: + id: Unique identifier for the URL-endpoint. This is generated by ImageKit when you + create a new URL-endpoint. For the default URL-endpoint, this is always + `default`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._get( + f"/v1/accounts/url-endpoints/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointResponse, + ) + + +class AsyncURLEndpointsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncURLEndpointsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncURLEndpointsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncURLEndpointsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncURLEndpointsResourceWithStreamingResponse(self) + + async def create( + self, + *, + description: str, + origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + url_prefix: str | NotGiven = NOT_GIVEN, + url_rewriter: url_endpoint_create_params.URLRewriter | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointResponse: + """**Note:** This API is currently in beta. + + + Creates a new URL‑endpoint and returns the resulting object. + + Args: + description: Description of the URL endpoint. + + origins: Ordered list of origin IDs to try when the file isn’t in the Media Library; + ImageKit checks them in the sequence provided. Origin must be created before it + can be used in a URL endpoint. + + url_prefix: Path segment appended to your base URL to form the endpoint (letters, digits, + and hyphens only — or empty for the default endpoint). + + url_rewriter: Configuration for third-party URL rewriting. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/accounts/url-endpoints", + body=await async_maybe_transform( + { + "description": description, + "origins": origins, + "url_prefix": url_prefix, + "url_rewriter": url_rewriter, + }, + url_endpoint_create_params.URLEndpointCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointResponse, + ) + + async def update( + self, + id: str, + *, + description: str, + origins: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + url_prefix: str | NotGiven = NOT_GIVEN, + url_rewriter: url_endpoint_update_params.URLRewriter | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointResponse: + """**Note:** This API is currently in beta. + + + Updates the URL‑endpoint identified by `id` and returns the updated object. + + Args: + id: Unique identifier for the URL-endpoint. This is generated by ImageKit when you + create a new URL-endpoint. For the default URL-endpoint, this is always + `default`. + + description: Description of the URL endpoint. + + origins: Ordered list of origin IDs to try when the file isn’t in the Media Library; + ImageKit checks them in the sequence provided. Origin must be created before it + can be used in a URL endpoint. + + url_prefix: Path segment appended to your base URL to form the endpoint (letters, digits, + and hyphens only — or empty for the default endpoint). + + url_rewriter: Configuration for third-party URL rewriting. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._put( + f"/v1/accounts/url-endpoints/{id}", + body=await async_maybe_transform( + { + "description": description, + "origins": origins, + "url_prefix": url_prefix, + "url_rewriter": url_rewriter, + }, + url_endpoint_update_params.URLEndpointUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointResponse, + ) + + async def list( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointListResponse: + """**Note:** This API is currently in beta. + + + Returns an array of all URL‑endpoints configured including the default + URL-endpoint generated by ImageKit during account creation. + """ + return await self._get( + "/v1/accounts/url-endpoints", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointListResponse, + ) + + async def delete( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """**Note:** This API is currently in beta. + + + Deletes the URL‑endpoint identified by `id`. You cannot delete the default + URL‑endpoint created by ImageKit during account creation. + + Args: + id: Unique identifier for the URL-endpoint. This is generated by ImageKit when you + create a new URL-endpoint. For the default URL-endpoint, this is always + `default`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/v1/accounts/url-endpoints/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def get( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> URLEndpointResponse: + """**Note:** This API is currently in beta. + + + Retrieves the URL‑endpoint identified by `id`. + + Args: + id: Unique identifier for the URL-endpoint. This is generated by ImageKit when you + create a new URL-endpoint. For the default URL-endpoint, this is always + `default`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._get( + f"/v1/accounts/url-endpoints/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=URLEndpointResponse, + ) + + +class URLEndpointsResourceWithRawResponse: + def __init__(self, url_endpoints: URLEndpointsResource) -> None: + self._url_endpoints = url_endpoints + + self.create = to_raw_response_wrapper( + url_endpoints.create, + ) + self.update = to_raw_response_wrapper( + url_endpoints.update, + ) + self.list = to_raw_response_wrapper( + url_endpoints.list, + ) + self.delete = to_raw_response_wrapper( + url_endpoints.delete, + ) + self.get = to_raw_response_wrapper( + url_endpoints.get, + ) + + +class AsyncURLEndpointsResourceWithRawResponse: + def __init__(self, url_endpoints: AsyncURLEndpointsResource) -> None: + self._url_endpoints = url_endpoints + + self.create = async_to_raw_response_wrapper( + url_endpoints.create, + ) + self.update = async_to_raw_response_wrapper( + url_endpoints.update, + ) + self.list = async_to_raw_response_wrapper( + url_endpoints.list, + ) + self.delete = async_to_raw_response_wrapper( + url_endpoints.delete, + ) + self.get = async_to_raw_response_wrapper( + url_endpoints.get, + ) + + +class URLEndpointsResourceWithStreamingResponse: + def __init__(self, url_endpoints: URLEndpointsResource) -> None: + self._url_endpoints = url_endpoints + + self.create = to_streamed_response_wrapper( + url_endpoints.create, + ) + self.update = to_streamed_response_wrapper( + url_endpoints.update, + ) + self.list = to_streamed_response_wrapper( + url_endpoints.list, + ) + self.delete = to_streamed_response_wrapper( + url_endpoints.delete, + ) + self.get = to_streamed_response_wrapper( + url_endpoints.get, + ) + + +class AsyncURLEndpointsResourceWithStreamingResponse: + def __init__(self, url_endpoints: AsyncURLEndpointsResource) -> None: + self._url_endpoints = url_endpoints + + self.create = async_to_streamed_response_wrapper( + url_endpoints.create, + ) + self.update = async_to_streamed_response_wrapper( + url_endpoints.update, + ) + self.list = async_to_streamed_response_wrapper( + url_endpoints.list, + ) + self.delete = async_to_streamed_response_wrapper( + url_endpoints.delete, + ) + self.get = async_to_streamed_response_wrapper( + url_endpoints.get, + ) diff --git a/src/imagekit/resources/accounts/usage.py b/src/imagekit/resources/accounts/usage.py new file mode 100644 index 0000000..3e0fd41 --- /dev/null +++ b/src/imagekit/resources/accounts/usage.py @@ -0,0 +1,206 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import date + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.accounts import usage_get_params +from ...types.accounts.usage_get_response import UsageGetResponse + +__all__ = ["UsageResource", "AsyncUsageResource"] + + +class UsageResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UsageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return UsageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return UsageResourceWithStreamingResponse(self) + + def get( + self, + *, + end_date: Union[str, date], + start_date: Union[str, date], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UsageGetResponse: + """Get the account usage information between two dates. + + Note that the API response + includes data from the start date while excluding data from the end date. In + other words, the data covers the period starting from the specified start date + up to, but not including, the end date. + + Args: + end_date: Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + The difference between `startDate` and `endDate` should be less than 90 days. + + start_date: Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + The difference between `startDate` and `endDate` should be less than 90 days. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/v1/accounts/usage", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "end_date": end_date, + "start_date": start_date, + }, + usage_get_params.UsageGetParams, + ), + ), + cast_to=UsageGetResponse, + ) + + +class AsyncUsageResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUsageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncUsageResourceWithStreamingResponse(self) + + async def get( + self, + *, + end_date: Union[str, date], + start_date: Union[str, date], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UsageGetResponse: + """Get the account usage information between two dates. + + Note that the API response + includes data from the start date while excluding data from the end date. In + other words, the data covers the period starting from the specified start date + up to, but not including, the end date. + + Args: + end_date: Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. + The difference between `startDate` and `endDate` should be less than 90 days. + + start_date: Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. + The difference between `startDate` and `endDate` should be less than 90 days. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/v1/accounts/usage", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "end_date": end_date, + "start_date": start_date, + }, + usage_get_params.UsageGetParams, + ), + ), + cast_to=UsageGetResponse, + ) + + +class UsageResourceWithRawResponse: + def __init__(self, usage: UsageResource) -> None: + self._usage = usage + + self.get = to_raw_response_wrapper( + usage.get, + ) + + +class AsyncUsageResourceWithRawResponse: + def __init__(self, usage: AsyncUsageResource) -> None: + self._usage = usage + + self.get = async_to_raw_response_wrapper( + usage.get, + ) + + +class UsageResourceWithStreamingResponse: + def __init__(self, usage: UsageResource) -> None: + self._usage = usage + + self.get = to_streamed_response_wrapper( + usage.get, + ) + + +class AsyncUsageResourceWithStreamingResponse: + def __init__(self, usage: AsyncUsageResource) -> None: + self._usage = usage + + self.get = async_to_streamed_response_wrapper( + usage.get, + ) diff --git a/src/imagekit/resources/assets.py b/src/imagekit/resources/assets.py new file mode 100644 index 0000000..51173fa --- /dev/null +++ b/src/imagekit/resources/assets.py @@ -0,0 +1,325 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..types import asset_list_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.asset_list_response import AssetListResponse + +__all__ = ["AssetsResource", "AsyncAssetsResource"] + + +class AssetsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> AssetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AssetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AssetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AssetsResourceWithStreamingResponse(self) + + def list( + self, + *, + file_type: Literal["all", "image", "non-image"] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + path: str | NotGiven = NOT_GIVEN, + search_query: str | NotGiven = NOT_GIVEN, + skip: int | NotGiven = NOT_GIVEN, + sort: Literal[ + "ASC_NAME", + "DESC_NAME", + "ASC_CREATED", + "DESC_CREATED", + "ASC_UPDATED", + "DESC_UPDATED", + "ASC_HEIGHT", + "DESC_HEIGHT", + "ASC_WIDTH", + "DESC_WIDTH", + "ASC_SIZE", + "DESC_SIZE", + "ASC_RELEVANCE", + "DESC_RELEVANCE", + ] + | NotGiven = NOT_GIVEN, + type: Literal["file", "file-version", "folder", "all"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AssetListResponse: + """ + This API can list all the uploaded files and folders in your ImageKit.io media + library. In addition, you can fine-tune your query by specifying various filters + by generating a query string in a Lucene-like syntax and provide this generated + string as the value of the `searchQuery`. + + Args: + file_type: Filter results by file type. + + - `all` — include all file types + - `image` — include only image files + - `non-image` — include only non-image files (e.g., JS, CSS, video) + + limit: The maximum number of results to return in response. + + path: Folder path if you want to limit the search within a specific folder. For + example, `/sales-banner/` will only search in folder sales-banner. + + Note : If your use case involves searching within a folder as well as its + subfolders, you can use `path` parameter in `searchQuery` with appropriate + operator. Checkout + [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) + for more information. + + search_query: Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + + Note : When the searchQuery parameter is present, the following query parameters + will have no effect on the result: + + 1. `tags` + 2. `type` + 3. `name` + + [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) + from examples. + + skip: The number of results to skip before returning results. + + sort: Sort the results by one of the supported fields in ascending or descending + order. + + type: Filter results by asset type. + + - `file` — returns only files + - `file-version` — returns specific file versions + - `folder` — returns only folders + - `all` — returns both files and folders (excludes `file-version`) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/v1/files", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "file_type": file_type, + "limit": limit, + "path": path, + "search_query": search_query, + "skip": skip, + "sort": sort, + "type": type, + }, + asset_list_params.AssetListParams, + ), + ), + cast_to=AssetListResponse, + ) + + +class AsyncAssetsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncAssetsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncAssetsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAssetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncAssetsResourceWithStreamingResponse(self) + + async def list( + self, + *, + file_type: Literal["all", "image", "non-image"] | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + path: str | NotGiven = NOT_GIVEN, + search_query: str | NotGiven = NOT_GIVEN, + skip: int | NotGiven = NOT_GIVEN, + sort: Literal[ + "ASC_NAME", + "DESC_NAME", + "ASC_CREATED", + "DESC_CREATED", + "ASC_UPDATED", + "DESC_UPDATED", + "ASC_HEIGHT", + "DESC_HEIGHT", + "ASC_WIDTH", + "DESC_WIDTH", + "ASC_SIZE", + "DESC_SIZE", + "ASC_RELEVANCE", + "DESC_RELEVANCE", + ] + | NotGiven = NOT_GIVEN, + type: Literal["file", "file-version", "folder", "all"] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AssetListResponse: + """ + This API can list all the uploaded files and folders in your ImageKit.io media + library. In addition, you can fine-tune your query by specifying various filters + by generating a query string in a Lucene-like syntax and provide this generated + string as the value of the `searchQuery`. + + Args: + file_type: Filter results by file type. + + - `all` — include all file types + - `image` — include only image files + - `non-image` — include only non-image files (e.g., JS, CSS, video) + + limit: The maximum number of results to return in response. + + path: Folder path if you want to limit the search within a specific folder. For + example, `/sales-banner/` will only search in folder sales-banner. + + Note : If your use case involves searching within a folder as well as its + subfolders, you can use `path` parameter in `searchQuery` with appropriate + operator. Checkout + [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) + for more information. + + search_query: Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + + Note : When the searchQuery parameter is present, the following query parameters + will have no effect on the result: + + 1. `tags` + 2. `type` + 3. `name` + + [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) + from examples. + + skip: The number of results to skip before returning results. + + sort: Sort the results by one of the supported fields in ascending or descending + order. + + type: Filter results by asset type. + + - `file` — returns only files + - `file-version` — returns specific file versions + - `folder` — returns only folders + - `all` — returns both files and folders (excludes `file-version`) + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/v1/files", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "file_type": file_type, + "limit": limit, + "path": path, + "search_query": search_query, + "skip": skip, + "sort": sort, + "type": type, + }, + asset_list_params.AssetListParams, + ), + ), + cast_to=AssetListResponse, + ) + + +class AssetsResourceWithRawResponse: + def __init__(self, assets: AssetsResource) -> None: + self._assets = assets + + self.list = to_raw_response_wrapper( + assets.list, + ) + + +class AsyncAssetsResourceWithRawResponse: + def __init__(self, assets: AsyncAssetsResource) -> None: + self._assets = assets + + self.list = async_to_raw_response_wrapper( + assets.list, + ) + + +class AssetsResourceWithStreamingResponse: + def __init__(self, assets: AssetsResource) -> None: + self._assets = assets + + self.list = to_streamed_response_wrapper( + assets.list, + ) + + +class AsyncAssetsResourceWithStreamingResponse: + def __init__(self, assets: AsyncAssetsResource) -> None: + self._assets = assets + + self.list = async_to_streamed_response_wrapper( + assets.list, + ) diff --git a/src/imagekit/resources/beta/__init__.py b/src/imagekit/resources/beta/__init__.py new file mode 100644 index 0000000..08cb3fb --- /dev/null +++ b/src/imagekit/resources/beta/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .v2 import ( + V2Resource, + AsyncV2Resource, + V2ResourceWithRawResponse, + AsyncV2ResourceWithRawResponse, + V2ResourceWithStreamingResponse, + AsyncV2ResourceWithStreamingResponse, +) +from .beta import ( + BetaResource, + AsyncBetaResource, + BetaResourceWithRawResponse, + AsyncBetaResourceWithRawResponse, + BetaResourceWithStreamingResponse, + AsyncBetaResourceWithStreamingResponse, +) + +__all__ = [ + "V2Resource", + "AsyncV2Resource", + "V2ResourceWithRawResponse", + "AsyncV2ResourceWithRawResponse", + "V2ResourceWithStreamingResponse", + "AsyncV2ResourceWithStreamingResponse", + "BetaResource", + "AsyncBetaResource", + "BetaResourceWithRawResponse", + "AsyncBetaResourceWithRawResponse", + "BetaResourceWithStreamingResponse", + "AsyncBetaResourceWithStreamingResponse", +] diff --git a/src/imagekit/resources/beta/beta.py b/src/imagekit/resources/beta/beta.py new file mode 100644 index 0000000..01e43aa --- /dev/null +++ b/src/imagekit/resources/beta/beta.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .v2.v2 import ( + V2Resource, + AsyncV2Resource, + V2ResourceWithRawResponse, + AsyncV2ResourceWithRawResponse, + V2ResourceWithStreamingResponse, + AsyncV2ResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["BetaResource", "AsyncBetaResource"] + + +class BetaResource(SyncAPIResource): + @cached_property + def v2(self) -> V2Resource: + return V2Resource(self._client) + + @cached_property + def with_raw_response(self) -> BetaResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return BetaResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BetaResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return BetaResourceWithStreamingResponse(self) + + +class AsyncBetaResource(AsyncAPIResource): + @cached_property + def v2(self) -> AsyncV2Resource: + return AsyncV2Resource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncBetaResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncBetaResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBetaResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncBetaResourceWithStreamingResponse(self) + + +class BetaResourceWithRawResponse: + def __init__(self, beta: BetaResource) -> None: + self._beta = beta + + @cached_property + def v2(self) -> V2ResourceWithRawResponse: + return V2ResourceWithRawResponse(self._beta.v2) + + +class AsyncBetaResourceWithRawResponse: + def __init__(self, beta: AsyncBetaResource) -> None: + self._beta = beta + + @cached_property + def v2(self) -> AsyncV2ResourceWithRawResponse: + return AsyncV2ResourceWithRawResponse(self._beta.v2) + + +class BetaResourceWithStreamingResponse: + def __init__(self, beta: BetaResource) -> None: + self._beta = beta + + @cached_property + def v2(self) -> V2ResourceWithStreamingResponse: + return V2ResourceWithStreamingResponse(self._beta.v2) + + +class AsyncBetaResourceWithStreamingResponse: + def __init__(self, beta: AsyncBetaResource) -> None: + self._beta = beta + + @cached_property + def v2(self) -> AsyncV2ResourceWithStreamingResponse: + return AsyncV2ResourceWithStreamingResponse(self._beta.v2) diff --git a/src/imagekit/resources/beta/v2/__init__.py b/src/imagekit/resources/beta/v2/__init__.py new file mode 100644 index 0000000..6f4e8f3 --- /dev/null +++ b/src/imagekit/resources/beta/v2/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .v2 import ( + V2Resource, + AsyncV2Resource, + V2ResourceWithRawResponse, + AsyncV2ResourceWithRawResponse, + V2ResourceWithStreamingResponse, + AsyncV2ResourceWithStreamingResponse, +) +from .files import ( + FilesResource, + AsyncFilesResource, + FilesResourceWithRawResponse, + AsyncFilesResourceWithRawResponse, + FilesResourceWithStreamingResponse, + AsyncFilesResourceWithStreamingResponse, +) + +__all__ = [ + "FilesResource", + "AsyncFilesResource", + "FilesResourceWithRawResponse", + "AsyncFilesResourceWithRawResponse", + "FilesResourceWithStreamingResponse", + "AsyncFilesResourceWithStreamingResponse", + "V2Resource", + "AsyncV2Resource", + "V2ResourceWithRawResponse", + "AsyncV2ResourceWithRawResponse", + "V2ResourceWithStreamingResponse", + "AsyncV2ResourceWithStreamingResponse", +] diff --git a/src/imagekit/resources/beta/v2/files.py b/src/imagekit/resources/beta/v2/files.py new file mode 100644 index 0000000..a09604d --- /dev/null +++ b/src/imagekit/resources/beta/v2/files.py @@ -0,0 +1,564 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Mapping, Iterable, cast +from typing_extensions import Literal + +import httpx + +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes, SequenceNotStr +from ...._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource +from ...._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...._base_client import make_request_options +from ....types.beta.v2 import file_upload_params +from ....types.beta.v2.file_upload_response import FileUploadResponse + +__all__ = ["FilesResource", "AsyncFilesResource"] + + +class FilesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FilesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return FilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return FilesResourceWithStreamingResponse(self) + + def upload( + self, + *, + file: FileTypes, + file_name: str, + token: str | NotGiven = NOT_GIVEN, + checks: str | NotGiven = NOT_GIVEN, + custom_coordinates: str | NotGiven = NOT_GIVEN, + custom_metadata: Dict[str, object] | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + extensions: Iterable[file_upload_params.Extension] | NotGiven = NOT_GIVEN, + folder: str | NotGiven = NOT_GIVEN, + is_private_file: bool | NotGiven = NOT_GIVEN, + is_published: bool | NotGiven = NOT_GIVEN, + overwrite_ai_tags: bool | NotGiven = NOT_GIVEN, + overwrite_custom_metadata: bool | NotGiven = NOT_GIVEN, + overwrite_file: bool | NotGiven = NOT_GIVEN, + overwrite_tags: bool | NotGiven = NOT_GIVEN, + response_fields: List[ + Literal[ + "tags", + "customCoordinates", + "isPrivateFile", + "embeddedMetadata", + "isPublished", + "customMetadata", + "metadata", + ] + ] + | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + transformation: file_upload_params.Transformation | NotGiven = NOT_GIVEN, + use_unique_file_name: bool | NotGiven = NOT_GIVEN, + webhook_url: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileUploadResponse: + """The V2 API enhances security by verifying the entire payload using JWT. + + This API + is in beta. + + ImageKit.io allows you to upload files directly from both the server and client + sides. For server-side uploads, private API key authentication is used. For + client-side uploads, generate a one-time `token` from your secure backend using + private API. + [Learn more](/docs/api-reference/upload-file/upload-file-v2#how-to-implement-secure-client-side-file-upload) + about how to implement secure client-side file upload. + + **File size limit** \\ + On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + files, and 100MB for videos. On the paid plan, these limits increase to 40MB for + images, audio, and raw files, and 2GB for videos. These limits can be further increased + with higher-tier plans. + + **Version limit** \\ + A file can have a maximum of 100 versions. + + **Demo applications** + + - A full-fledged + [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + supporting file selections from local storage, URL, Dropbox, Google Drive, + Instagram, and more. + - [Quick start guides](/docs/quick-start-guides) for various frameworks and + technologies. + + Args: + file: + The API accepts any of the following: + + - **Binary data** – send the raw bytes as `multipart/form-data`. + - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + fetch. + - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + + When supplying a URL, the server must receive the response headers within 8 + seconds; otherwise the request fails with 400 Bad Request. + + file_name: The name with which the file has to be uploaded. + + token: This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses + it to authenticate and check that the upload request parameters have not been + tampered with after the token has been generated. Learn how to create the token + on the page below. This field is only required for authentication when uploading + a file from the client side. + + **Note**: Sending a JWT that has been used in the past will result in a + validation error. Even if your previous request resulted in an error, you should + always send a new token. + + **⚠️Warning**: JWT must be generated on the server-side because it is generated + using your account's private API key. This field is required for authentication + when uploading a file from the client-side. + + checks: Server-side checks to run on the asset. Read more about + [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks). + + custom_coordinates: Define an important area in the image. This is only relevant for image type + files. + + - To be passed as a string with the x and y coordinates of the top-left corner, + and width and height of the area of interest in the format `x,y,width,height`. + For example - `10,10,100,100` + - Can be used with fo-customtransformation. + - If this field is not specified and the file is overwritten, then + customCoordinates will be removed. + + custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata + fields before setting these values. + + description: Optional text to describe the contents of the file. + + extensions: Array of extensions to be applied to the image. Each extension can be configured + with specific parameters based on the extension type. + + folder: The folder path in which the image has to be uploaded. If the folder(s) didn't + exist before, a new folder(s) is created. Using multiple `/` creates a nested + folder. + + is_private_file: Whether to mark the file as private or not. + + If `true`, the file is marked as private and is accessible only using named + transformation or signed URL. + + is_published: Whether to upload file as published or not. + + If `false`, the file is marked as unpublished, which restricts access to the + file only via the media library. Files in draft or unpublished state can only be + publicly accessed after being published. + + The option to upload in draft state is only available in custom enterprise + pricing plans. + + overwrite_ai_tags: If set to `true` and a file already exists at the exact location, its AITags + will be removed. Set `overwriteAITags` to `false` to preserve AITags. + + overwrite_custom_metadata: If the request does not have `customMetadata`, and a file already exists at the + exact location, existing customMetadata will be removed. + + overwrite_file: If `false` and `useUniqueFileName` is also `false`, and a file already exists at + the exact location, upload API will return an error immediately. + + overwrite_tags: If the request does not have `tags`, and a file already exists at the exact + location, existing tags will be removed. + + response_fields: Array of response field keys to include in the API response body. + + tags: Set the tags while uploading the file. Provide an array of tag strings (e.g. + `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + exceed 500, and the `%` character is not allowed. If this field is not specified + and the file is overwritten, the existing tags will be removed. + + transformation: Configure pre-processing (`pre`) and post-processing (`post`) transformations. + + - `pre` — applied before the file is uploaded to the Media Library. + Useful for reducing file size or applying basic optimizations upfront (e.g., + resize, compress). + + - `post` — applied immediately after upload. + Ideal for generating transformed versions (like video encodes or thumbnails) + in advance, so they're ready for delivery without delay. + + You can mix and match any combination of post-processing types. + + use_unique_file_name: Whether to use a unique filename for this file or not. + + If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + a unique filename. + + If `false`, then the image is uploaded with the provided filename parameter, and + any existing file with the same name is replaced. + + webhook_url: The final status of extensions after they have completed execution will be + delivered to this endpoint as a POST request. + [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + about the webhook payload structure. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + body = deepcopy_minimal( + { + "file": file, + "file_name": file_name, + "token": token, + "checks": checks, + "custom_coordinates": custom_coordinates, + "custom_metadata": custom_metadata, + "description": description, + "extensions": extensions, + "folder": folder, + "is_private_file": is_private_file, + "is_published": is_published, + "overwrite_ai_tags": overwrite_ai_tags, + "overwrite_custom_metadata": overwrite_custom_metadata, + "overwrite_file": overwrite_file, + "overwrite_tags": overwrite_tags, + "response_fields": response_fields, + "tags": tags, + "transformation": transformation, + "use_unique_file_name": use_unique_file_name, + "webhook_url": webhook_url, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + return self._post( + "/api/v2/files/upload" + if self._client._base_url_overridden + else "https://upload.imagekit.io/api/v2/files/upload", + body=maybe_transform(body, file_upload_params.FileUploadParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileUploadResponse, + ) + + +class AsyncFilesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncFilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncFilesResourceWithStreamingResponse(self) + + async def upload( + self, + *, + file: FileTypes, + file_name: str, + token: str | NotGiven = NOT_GIVEN, + checks: str | NotGiven = NOT_GIVEN, + custom_coordinates: str | NotGiven = NOT_GIVEN, + custom_metadata: Dict[str, object] | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + extensions: Iterable[file_upload_params.Extension] | NotGiven = NOT_GIVEN, + folder: str | NotGiven = NOT_GIVEN, + is_private_file: bool | NotGiven = NOT_GIVEN, + is_published: bool | NotGiven = NOT_GIVEN, + overwrite_ai_tags: bool | NotGiven = NOT_GIVEN, + overwrite_custom_metadata: bool | NotGiven = NOT_GIVEN, + overwrite_file: bool | NotGiven = NOT_GIVEN, + overwrite_tags: bool | NotGiven = NOT_GIVEN, + response_fields: List[ + Literal[ + "tags", + "customCoordinates", + "isPrivateFile", + "embeddedMetadata", + "isPublished", + "customMetadata", + "metadata", + ] + ] + | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + transformation: file_upload_params.Transformation | NotGiven = NOT_GIVEN, + use_unique_file_name: bool | NotGiven = NOT_GIVEN, + webhook_url: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileUploadResponse: + """The V2 API enhances security by verifying the entire payload using JWT. + + This API + is in beta. + + ImageKit.io allows you to upload files directly from both the server and client + sides. For server-side uploads, private API key authentication is used. For + client-side uploads, generate a one-time `token` from your secure backend using + private API. + [Learn more](/docs/api-reference/upload-file/upload-file-v2#how-to-implement-secure-client-side-file-upload) + about how to implement secure client-side file upload. + + **File size limit** \\ + On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + files, and 100MB for videos. On the paid plan, these limits increase to 40MB for + images, audio, and raw files, and 2GB for videos. These limits can be further increased + with higher-tier plans. + + **Version limit** \\ + A file can have a maximum of 100 versions. + + **Demo applications** + + - A full-fledged + [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + supporting file selections from local storage, URL, Dropbox, Google Drive, + Instagram, and more. + - [Quick start guides](/docs/quick-start-guides) for various frameworks and + technologies. + + Args: + file: + The API accepts any of the following: + + - **Binary data** – send the raw bytes as `multipart/form-data`. + - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + fetch. + - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + + When supplying a URL, the server must receive the response headers within 8 + seconds; otherwise the request fails with 400 Bad Request. + + file_name: The name with which the file has to be uploaded. + + token: This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses + it to authenticate and check that the upload request parameters have not been + tampered with after the token has been generated. Learn how to create the token + on the page below. This field is only required for authentication when uploading + a file from the client side. + + **Note**: Sending a JWT that has been used in the past will result in a + validation error. Even if your previous request resulted in an error, you should + always send a new token. + + **⚠️Warning**: JWT must be generated on the server-side because it is generated + using your account's private API key. This field is required for authentication + when uploading a file from the client-side. + + checks: Server-side checks to run on the asset. Read more about + [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks). + + custom_coordinates: Define an important area in the image. This is only relevant for image type + files. + + - To be passed as a string with the x and y coordinates of the top-left corner, + and width and height of the area of interest in the format `x,y,width,height`. + For example - `10,10,100,100` + - Can be used with fo-customtransformation. + - If this field is not specified and the file is overwritten, then + customCoordinates will be removed. + + custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata + fields before setting these values. + + description: Optional text to describe the contents of the file. + + extensions: Array of extensions to be applied to the image. Each extension can be configured + with specific parameters based on the extension type. + + folder: The folder path in which the image has to be uploaded. If the folder(s) didn't + exist before, a new folder(s) is created. Using multiple `/` creates a nested + folder. + + is_private_file: Whether to mark the file as private or not. + + If `true`, the file is marked as private and is accessible only using named + transformation or signed URL. + + is_published: Whether to upload file as published or not. + + If `false`, the file is marked as unpublished, which restricts access to the + file only via the media library. Files in draft or unpublished state can only be + publicly accessed after being published. + + The option to upload in draft state is only available in custom enterprise + pricing plans. + + overwrite_ai_tags: If set to `true` and a file already exists at the exact location, its AITags + will be removed. Set `overwriteAITags` to `false` to preserve AITags. + + overwrite_custom_metadata: If the request does not have `customMetadata`, and a file already exists at the + exact location, existing customMetadata will be removed. + + overwrite_file: If `false` and `useUniqueFileName` is also `false`, and a file already exists at + the exact location, upload API will return an error immediately. + + overwrite_tags: If the request does not have `tags`, and a file already exists at the exact + location, existing tags will be removed. + + response_fields: Array of response field keys to include in the API response body. + + tags: Set the tags while uploading the file. Provide an array of tag strings (e.g. + `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + exceed 500, and the `%` character is not allowed. If this field is not specified + and the file is overwritten, the existing tags will be removed. + + transformation: Configure pre-processing (`pre`) and post-processing (`post`) transformations. + + - `pre` — applied before the file is uploaded to the Media Library. + Useful for reducing file size or applying basic optimizations upfront (e.g., + resize, compress). + + - `post` — applied immediately after upload. + Ideal for generating transformed versions (like video encodes or thumbnails) + in advance, so they're ready for delivery without delay. + + You can mix and match any combination of post-processing types. + + use_unique_file_name: Whether to use a unique filename for this file or not. + + If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + a unique filename. + + If `false`, then the image is uploaded with the provided filename parameter, and + any existing file with the same name is replaced. + + webhook_url: The final status of extensions after they have completed execution will be + delivered to this endpoint as a POST request. + [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + about the webhook payload structure. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + body = deepcopy_minimal( + { + "file": file, + "file_name": file_name, + "token": token, + "checks": checks, + "custom_coordinates": custom_coordinates, + "custom_metadata": custom_metadata, + "description": description, + "extensions": extensions, + "folder": folder, + "is_private_file": is_private_file, + "is_published": is_published, + "overwrite_ai_tags": overwrite_ai_tags, + "overwrite_custom_metadata": overwrite_custom_metadata, + "overwrite_file": overwrite_file, + "overwrite_tags": overwrite_tags, + "response_fields": response_fields, + "tags": tags, + "transformation": transformation, + "use_unique_file_name": use_unique_file_name, + "webhook_url": webhook_url, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + return await self._post( + "/api/v2/files/upload" + if self._client._base_url_overridden + else "https://upload.imagekit.io/api/v2/files/upload", + body=await async_maybe_transform(body, file_upload_params.FileUploadParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileUploadResponse, + ) + + +class FilesResourceWithRawResponse: + def __init__(self, files: FilesResource) -> None: + self._files = files + + self.upload = to_raw_response_wrapper( + files.upload, + ) + + +class AsyncFilesResourceWithRawResponse: + def __init__(self, files: AsyncFilesResource) -> None: + self._files = files + + self.upload = async_to_raw_response_wrapper( + files.upload, + ) + + +class FilesResourceWithStreamingResponse: + def __init__(self, files: FilesResource) -> None: + self._files = files + + self.upload = to_streamed_response_wrapper( + files.upload, + ) + + +class AsyncFilesResourceWithStreamingResponse: + def __init__(self, files: AsyncFilesResource) -> None: + self._files = files + + self.upload = async_to_streamed_response_wrapper( + files.upload, + ) diff --git a/src/imagekit/resources/beta/v2/v2.py b/src/imagekit/resources/beta/v2/v2.py new file mode 100644 index 0000000..2fb9830 --- /dev/null +++ b/src/imagekit/resources/beta/v2/v2.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .files import ( + FilesResource, + AsyncFilesResource, + FilesResourceWithRawResponse, + AsyncFilesResourceWithRawResponse, + FilesResourceWithStreamingResponse, + AsyncFilesResourceWithStreamingResponse, +) +from ...._compat import cached_property +from ...._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["V2Resource", "AsyncV2Resource"] + + +class V2Resource(SyncAPIResource): + @cached_property + def files(self) -> FilesResource: + return FilesResource(self._client) + + @cached_property + def with_raw_response(self) -> V2ResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return V2ResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> V2ResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return V2ResourceWithStreamingResponse(self) + + +class AsyncV2Resource(AsyncAPIResource): + @cached_property + def files(self) -> AsyncFilesResource: + return AsyncFilesResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncV2ResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncV2ResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncV2ResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncV2ResourceWithStreamingResponse(self) + + +class V2ResourceWithRawResponse: + def __init__(self, v2: V2Resource) -> None: + self._v2 = v2 + + @cached_property + def files(self) -> FilesResourceWithRawResponse: + return FilesResourceWithRawResponse(self._v2.files) + + +class AsyncV2ResourceWithRawResponse: + def __init__(self, v2: AsyncV2Resource) -> None: + self._v2 = v2 + + @cached_property + def files(self) -> AsyncFilesResourceWithRawResponse: + return AsyncFilesResourceWithRawResponse(self._v2.files) + + +class V2ResourceWithStreamingResponse: + def __init__(self, v2: V2Resource) -> None: + self._v2 = v2 + + @cached_property + def files(self) -> FilesResourceWithStreamingResponse: + return FilesResourceWithStreamingResponse(self._v2.files) + + +class AsyncV2ResourceWithStreamingResponse: + def __init__(self, v2: AsyncV2Resource) -> None: + self._v2 = v2 + + @cached_property + def files(self) -> AsyncFilesResourceWithStreamingResponse: + return AsyncFilesResourceWithStreamingResponse(self._v2.files) diff --git a/src/imagekit/resources/cache/__init__.py b/src/imagekit/resources/cache/__init__.py new file mode 100644 index 0000000..f7e5a70 --- /dev/null +++ b/src/imagekit/resources/cache/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .cache import ( + CacheResource, + AsyncCacheResource, + CacheResourceWithRawResponse, + AsyncCacheResourceWithRawResponse, + CacheResourceWithStreamingResponse, + AsyncCacheResourceWithStreamingResponse, +) +from .invalidation import ( + InvalidationResource, + AsyncInvalidationResource, + InvalidationResourceWithRawResponse, + AsyncInvalidationResourceWithRawResponse, + InvalidationResourceWithStreamingResponse, + AsyncInvalidationResourceWithStreamingResponse, +) + +__all__ = [ + "InvalidationResource", + "AsyncInvalidationResource", + "InvalidationResourceWithRawResponse", + "AsyncInvalidationResourceWithRawResponse", + "InvalidationResourceWithStreamingResponse", + "AsyncInvalidationResourceWithStreamingResponse", + "CacheResource", + "AsyncCacheResource", + "CacheResourceWithRawResponse", + "AsyncCacheResourceWithRawResponse", + "CacheResourceWithStreamingResponse", + "AsyncCacheResourceWithStreamingResponse", +] diff --git a/src/imagekit/resources/cache/cache.py b/src/imagekit/resources/cache/cache.py new file mode 100644 index 0000000..936b39f --- /dev/null +++ b/src/imagekit/resources/cache/cache.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from .invalidation import ( + InvalidationResource, + AsyncInvalidationResource, + InvalidationResourceWithRawResponse, + AsyncInvalidationResourceWithRawResponse, + InvalidationResourceWithStreamingResponse, + AsyncInvalidationResourceWithStreamingResponse, +) + +__all__ = ["CacheResource", "AsyncCacheResource"] + + +class CacheResource(SyncAPIResource): + @cached_property + def invalidation(self) -> InvalidationResource: + return InvalidationResource(self._client) + + @cached_property + def with_raw_response(self) -> CacheResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return CacheResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CacheResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return CacheResourceWithStreamingResponse(self) + + +class AsyncCacheResource(AsyncAPIResource): + @cached_property + def invalidation(self) -> AsyncInvalidationResource: + return AsyncInvalidationResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncCacheResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncCacheResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCacheResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncCacheResourceWithStreamingResponse(self) + + +class CacheResourceWithRawResponse: + def __init__(self, cache: CacheResource) -> None: + self._cache = cache + + @cached_property + def invalidation(self) -> InvalidationResourceWithRawResponse: + return InvalidationResourceWithRawResponse(self._cache.invalidation) + + +class AsyncCacheResourceWithRawResponse: + def __init__(self, cache: AsyncCacheResource) -> None: + self._cache = cache + + @cached_property + def invalidation(self) -> AsyncInvalidationResourceWithRawResponse: + return AsyncInvalidationResourceWithRawResponse(self._cache.invalidation) + + +class CacheResourceWithStreamingResponse: + def __init__(self, cache: CacheResource) -> None: + self._cache = cache + + @cached_property + def invalidation(self) -> InvalidationResourceWithStreamingResponse: + return InvalidationResourceWithStreamingResponse(self._cache.invalidation) + + +class AsyncCacheResourceWithStreamingResponse: + def __init__(self, cache: AsyncCacheResource) -> None: + self._cache = cache + + @cached_property + def invalidation(self) -> AsyncInvalidationResourceWithStreamingResponse: + return AsyncInvalidationResourceWithStreamingResponse(self._cache.invalidation) diff --git a/src/imagekit/resources/cache/invalidation.py b/src/imagekit/resources/cache/invalidation.py new file mode 100644 index 0000000..a1c83d7 --- /dev/null +++ b/src/imagekit/resources/cache/invalidation.py @@ -0,0 +1,252 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.cache import invalidation_create_params +from ..._base_client import make_request_options +from ...types.cache.invalidation_get_response import InvalidationGetResponse +from ...types.cache.invalidation_create_response import InvalidationCreateResponse + +__all__ = ["InvalidationResource", "AsyncInvalidationResource"] + + +class InvalidationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InvalidationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return InvalidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InvalidationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return InvalidationResourceWithStreamingResponse(self) + + def create( + self, + *, + url: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InvalidationCreateResponse: + """This API will purge CDN cache and ImageKit.io's internal cache for a file. + + Note: + Purge cache is an asynchronous process and it may take some time to reflect the + changes. + + Args: + url: The full URL of the file to be purged. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/files/purge", + body=maybe_transform({"url": url}, invalidation_create_params.InvalidationCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InvalidationCreateResponse, + ) + + def get( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InvalidationGetResponse: + """ + This API returns the status of a purge cache request. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return self._get( + f"/v1/files/purge/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InvalidationGetResponse, + ) + + +class AsyncInvalidationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInvalidationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncInvalidationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInvalidationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncInvalidationResourceWithStreamingResponse(self) + + async def create( + self, + *, + url: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InvalidationCreateResponse: + """This API will purge CDN cache and ImageKit.io's internal cache for a file. + + Note: + Purge cache is an asynchronous process and it may take some time to reflect the + changes. + + Args: + url: The full URL of the file to be purged. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/files/purge", + body=await async_maybe_transform({"url": url}, invalidation_create_params.InvalidationCreateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InvalidationCreateResponse, + ) + + async def get( + self, + request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> InvalidationGetResponse: + """ + This API returns the status of a purge cache request. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not request_id: + raise ValueError(f"Expected a non-empty value for `request_id` but received {request_id!r}") + return await self._get( + f"/v1/files/purge/{request_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InvalidationGetResponse, + ) + + +class InvalidationResourceWithRawResponse: + def __init__(self, invalidation: InvalidationResource) -> None: + self._invalidation = invalidation + + self.create = to_raw_response_wrapper( + invalidation.create, + ) + self.get = to_raw_response_wrapper( + invalidation.get, + ) + + +class AsyncInvalidationResourceWithRawResponse: + def __init__(self, invalidation: AsyncInvalidationResource) -> None: + self._invalidation = invalidation + + self.create = async_to_raw_response_wrapper( + invalidation.create, + ) + self.get = async_to_raw_response_wrapper( + invalidation.get, + ) + + +class InvalidationResourceWithStreamingResponse: + def __init__(self, invalidation: InvalidationResource) -> None: + self._invalidation = invalidation + + self.create = to_streamed_response_wrapper( + invalidation.create, + ) + self.get = to_streamed_response_wrapper( + invalidation.get, + ) + + +class AsyncInvalidationResourceWithStreamingResponse: + def __init__(self, invalidation: AsyncInvalidationResource) -> None: + self._invalidation = invalidation + + self.create = async_to_streamed_response_wrapper( + invalidation.create, + ) + self.get = async_to_streamed_response_wrapper( + invalidation.get, + ) diff --git a/src/imagekit/resources/custom_metadata_fields.py b/src/imagekit/resources/custom_metadata_fields.py new file mode 100644 index 0000000..94f4eb5 --- /dev/null +++ b/src/imagekit/resources/custom_metadata_fields.py @@ -0,0 +1,507 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import ( + custom_metadata_field_list_params, + custom_metadata_field_create_params, + custom_metadata_field_update_params, +) +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.custom_metadata_field import CustomMetadataField +from ..types.custom_metadata_field_list_response import CustomMetadataFieldListResponse +from ..types.custom_metadata_field_delete_response import CustomMetadataFieldDeleteResponse + +__all__ = ["CustomMetadataFieldsResource", "AsyncCustomMetadataFieldsResource"] + + +class CustomMetadataFieldsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CustomMetadataFieldsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return CustomMetadataFieldsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CustomMetadataFieldsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return CustomMetadataFieldsResourceWithStreamingResponse(self) + + def create( + self, + *, + label: str, + name: str, + schema: custom_metadata_field_create_params.Schema, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataField: + """This API creates a new custom metadata field. + + Once a custom metadata field is + created either through this API or using the dashboard UI, its value can be set + on the assets. The value of a field for an asset can be set using the media + library UI or programmatically through upload or update assets API. + + Args: + label: Human readable name of the custom metadata field. This should be unique across + all non deleted custom metadata fields. This name is displayed as form field + label to the users while setting field value on an asset in the media library + UI. + + name: API name of the custom metadata field. This should be unique across all + (including deleted) custom metadata fields. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/customMetadataFields", + body=maybe_transform( + { + "label": label, + "name": name, + "schema": schema, + }, + custom_metadata_field_create_params.CustomMetadataFieldCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomMetadataField, + ) + + def update( + self, + id: str, + *, + label: str | NotGiven = NOT_GIVEN, + schema: custom_metadata_field_update_params.Schema | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataField: + """ + This API updates the label or schema of an existing custom metadata field. + + Args: + label: Human readable name of the custom metadata field. This should be unique across + all non deleted custom metadata fields. This name is displayed as form field + label to the users while setting field value on an asset in the media library + UI. This parameter is required if `schema` is not provided. + + schema: An object that describes the rules for the custom metadata key. This parameter + is required if `label` is not provided. Note: `type` cannot be updated and will + be ignored if sent with the `schema`. The schema will be validated as per the + existing `type`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._patch( + f"/v1/customMetadataFields/{id}", + body=maybe_transform( + { + "label": label, + "schema": schema, + }, + custom_metadata_field_update_params.CustomMetadataFieldUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomMetadataField, + ) + + def list( + self, + *, + include_deleted: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataFieldListResponse: + """This API returns the array of created custom metadata field objects. + + By default + the API returns only non deleted field objects, but you can include deleted + fields in the API response. + + Args: + include_deleted: Set it to `true` to include deleted field objects in the API response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/v1/customMetadataFields", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + {"include_deleted": include_deleted}, + custom_metadata_field_list_params.CustomMetadataFieldListParams, + ), + ), + cast_to=CustomMetadataFieldListResponse, + ) + + def delete( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataFieldDeleteResponse: + """This API deletes a custom metadata field. + + Even after deleting a custom metadata + field, you cannot create any new custom metadata field with the same name. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._delete( + f"/v1/customMetadataFields/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomMetadataFieldDeleteResponse, + ) + + +class AsyncCustomMetadataFieldsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCustomMetadataFieldsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncCustomMetadataFieldsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCustomMetadataFieldsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncCustomMetadataFieldsResourceWithStreamingResponse(self) + + async def create( + self, + *, + label: str, + name: str, + schema: custom_metadata_field_create_params.Schema, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataField: + """This API creates a new custom metadata field. + + Once a custom metadata field is + created either through this API or using the dashboard UI, its value can be set + on the assets. The value of a field for an asset can be set using the media + library UI or programmatically through upload or update assets API. + + Args: + label: Human readable name of the custom metadata field. This should be unique across + all non deleted custom metadata fields. This name is displayed as form field + label to the users while setting field value on an asset in the media library + UI. + + name: API name of the custom metadata field. This should be unique across all + (including deleted) custom metadata fields. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/customMetadataFields", + body=await async_maybe_transform( + { + "label": label, + "name": name, + "schema": schema, + }, + custom_metadata_field_create_params.CustomMetadataFieldCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomMetadataField, + ) + + async def update( + self, + id: str, + *, + label: str | NotGiven = NOT_GIVEN, + schema: custom_metadata_field_update_params.Schema | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataField: + """ + This API updates the label or schema of an existing custom metadata field. + + Args: + label: Human readable name of the custom metadata field. This should be unique across + all non deleted custom metadata fields. This name is displayed as form field + label to the users while setting field value on an asset in the media library + UI. This parameter is required if `schema` is not provided. + + schema: An object that describes the rules for the custom metadata key. This parameter + is required if `label` is not provided. Note: `type` cannot be updated and will + be ignored if sent with the `schema`. The schema will be validated as per the + existing `type`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._patch( + f"/v1/customMetadataFields/{id}", + body=await async_maybe_transform( + { + "label": label, + "schema": schema, + }, + custom_metadata_field_update_params.CustomMetadataFieldUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomMetadataField, + ) + + async def list( + self, + *, + include_deleted: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataFieldListResponse: + """This API returns the array of created custom metadata field objects. + + By default + the API returns only non deleted field objects, but you can include deleted + fields in the API response. + + Args: + include_deleted: Set it to `true` to include deleted field objects in the API response. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/v1/customMetadataFields", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"include_deleted": include_deleted}, + custom_metadata_field_list_params.CustomMetadataFieldListParams, + ), + ), + cast_to=CustomMetadataFieldListResponse, + ) + + async def delete( + self, + id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> CustomMetadataFieldDeleteResponse: + """This API deletes a custom metadata field. + + Even after deleting a custom metadata + field, you cannot create any new custom metadata field with the same name. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._delete( + f"/v1/customMetadataFields/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CustomMetadataFieldDeleteResponse, + ) + + +class CustomMetadataFieldsResourceWithRawResponse: + def __init__(self, custom_metadata_fields: CustomMetadataFieldsResource) -> None: + self._custom_metadata_fields = custom_metadata_fields + + self.create = to_raw_response_wrapper( + custom_metadata_fields.create, + ) + self.update = to_raw_response_wrapper( + custom_metadata_fields.update, + ) + self.list = to_raw_response_wrapper( + custom_metadata_fields.list, + ) + self.delete = to_raw_response_wrapper( + custom_metadata_fields.delete, + ) + + +class AsyncCustomMetadataFieldsResourceWithRawResponse: + def __init__(self, custom_metadata_fields: AsyncCustomMetadataFieldsResource) -> None: + self._custom_metadata_fields = custom_metadata_fields + + self.create = async_to_raw_response_wrapper( + custom_metadata_fields.create, + ) + self.update = async_to_raw_response_wrapper( + custom_metadata_fields.update, + ) + self.list = async_to_raw_response_wrapper( + custom_metadata_fields.list, + ) + self.delete = async_to_raw_response_wrapper( + custom_metadata_fields.delete, + ) + + +class CustomMetadataFieldsResourceWithStreamingResponse: + def __init__(self, custom_metadata_fields: CustomMetadataFieldsResource) -> None: + self._custom_metadata_fields = custom_metadata_fields + + self.create = to_streamed_response_wrapper( + custom_metadata_fields.create, + ) + self.update = to_streamed_response_wrapper( + custom_metadata_fields.update, + ) + self.list = to_streamed_response_wrapper( + custom_metadata_fields.list, + ) + self.delete = to_streamed_response_wrapper( + custom_metadata_fields.delete, + ) + + +class AsyncCustomMetadataFieldsResourceWithStreamingResponse: + def __init__(self, custom_metadata_fields: AsyncCustomMetadataFieldsResource) -> None: + self._custom_metadata_fields = custom_metadata_fields + + self.create = async_to_streamed_response_wrapper( + custom_metadata_fields.create, + ) + self.update = async_to_streamed_response_wrapper( + custom_metadata_fields.update, + ) + self.list = async_to_streamed_response_wrapper( + custom_metadata_fields.list, + ) + self.delete = async_to_streamed_response_wrapper( + custom_metadata_fields.delete, + ) diff --git a/src/imagekit/resources/files/__init__.py b/src/imagekit/resources/files/__init__.py new file mode 100644 index 0000000..7fdf519 --- /dev/null +++ b/src/imagekit/resources/files/__init__.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .bulk import ( + BulkResource, + AsyncBulkResource, + BulkResourceWithRawResponse, + AsyncBulkResourceWithRawResponse, + BulkResourceWithStreamingResponse, + AsyncBulkResourceWithStreamingResponse, +) +from .files import ( + FilesResource, + AsyncFilesResource, + FilesResourceWithRawResponse, + AsyncFilesResourceWithRawResponse, + FilesResourceWithStreamingResponse, + AsyncFilesResourceWithStreamingResponse, +) +from .metadata import ( + MetadataResource, + AsyncMetadataResource, + MetadataResourceWithRawResponse, + AsyncMetadataResourceWithRawResponse, + MetadataResourceWithStreamingResponse, + AsyncMetadataResourceWithStreamingResponse, +) +from .versions import ( + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, +) + +__all__ = [ + "BulkResource", + "AsyncBulkResource", + "BulkResourceWithRawResponse", + "AsyncBulkResourceWithRawResponse", + "BulkResourceWithStreamingResponse", + "AsyncBulkResourceWithStreamingResponse", + "VersionsResource", + "AsyncVersionsResource", + "VersionsResourceWithRawResponse", + "AsyncVersionsResourceWithRawResponse", + "VersionsResourceWithStreamingResponse", + "AsyncVersionsResourceWithStreamingResponse", + "MetadataResource", + "AsyncMetadataResource", + "MetadataResourceWithRawResponse", + "AsyncMetadataResourceWithRawResponse", + "MetadataResourceWithStreamingResponse", + "AsyncMetadataResourceWithStreamingResponse", + "FilesResource", + "AsyncFilesResource", + "FilesResourceWithRawResponse", + "AsyncFilesResourceWithRawResponse", + "FilesResourceWithStreamingResponse", + "AsyncFilesResourceWithStreamingResponse", +] diff --git a/src/imagekit/resources/files/bulk.py b/src/imagekit/resources/files/bulk.py new file mode 100644 index 0000000..8b7a216 --- /dev/null +++ b/src/imagekit/resources/files/bulk.py @@ -0,0 +1,488 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.files import bulk_delete_params, bulk_add_tags_params, bulk_remove_tags_params, bulk_remove_ai_tags_params +from ..._base_client import make_request_options +from ...types.files.bulk_delete_response import BulkDeleteResponse +from ...types.files.bulk_add_tags_response import BulkAddTagsResponse +from ...types.files.bulk_remove_tags_response import BulkRemoveTagsResponse +from ...types.files.bulk_remove_ai_tags_response import BulkRemoveAITagsResponse + +__all__ = ["BulkResource", "AsyncBulkResource"] + + +class BulkResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BulkResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return BulkResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BulkResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return BulkResourceWithStreamingResponse(self) + + def delete( + self, + *, + file_ids: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkDeleteResponse: + """ + This API deletes multiple files and all their file versions permanently. + + Note: If a file or specific transformation has been requested in the past, then + the response is cached. Deleting a file does not purge the cache. You can purge + the cache using purge cache API. + + A maximum of 100 files can be deleted at a time. + + Args: + file_ids: An array of fileIds which you want to delete. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/files/batch/deleteByFileIds", + body=maybe_transform({"file_ids": file_ids}, bulk_delete_params.BulkDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkDeleteResponse, + ) + + def add_tags( + self, + *, + file_ids: SequenceNotStr[str], + tags: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkAddTagsResponse: + """This API adds tags to multiple files in bulk. + + A maximum of 50 files can be + specified at a time. + + Args: + file_ids: An array of fileIds to which you want to add tags. + + tags: An array of tags that you want to add to the files. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/files/addTags", + body=maybe_transform( + { + "file_ids": file_ids, + "tags": tags, + }, + bulk_add_tags_params.BulkAddTagsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkAddTagsResponse, + ) + + def remove_ai_tags( + self, + *, + ai_tags: SequenceNotStr[str], + file_ids: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkRemoveAITagsResponse: + """This API removes AITags from multiple files in bulk. + + A maximum of 50 files can + be specified at a time. + + Args: + ai_tags: An array of AITags that you want to remove from the files. + + file_ids: An array of fileIds from which you want to remove AITags. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/files/removeAITags", + body=maybe_transform( + { + "ai_tags": ai_tags, + "file_ids": file_ids, + }, + bulk_remove_ai_tags_params.BulkRemoveAITagsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkRemoveAITagsResponse, + ) + + def remove_tags( + self, + *, + file_ids: SequenceNotStr[str], + tags: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkRemoveTagsResponse: + """This API removes tags from multiple files in bulk. + + A maximum of 50 files can be + specified at a time. + + Args: + file_ids: An array of fileIds from which you want to remove tags. + + tags: An array of tags that you want to remove from the files. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/files/removeTags", + body=maybe_transform( + { + "file_ids": file_ids, + "tags": tags, + }, + bulk_remove_tags_params.BulkRemoveTagsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkRemoveTagsResponse, + ) + + +class AsyncBulkResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBulkResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncBulkResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBulkResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncBulkResourceWithStreamingResponse(self) + + async def delete( + self, + *, + file_ids: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkDeleteResponse: + """ + This API deletes multiple files and all their file versions permanently. + + Note: If a file or specific transformation has been requested in the past, then + the response is cached. Deleting a file does not purge the cache. You can purge + the cache using purge cache API. + + A maximum of 100 files can be deleted at a time. + + Args: + file_ids: An array of fileIds which you want to delete. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/files/batch/deleteByFileIds", + body=await async_maybe_transform({"file_ids": file_ids}, bulk_delete_params.BulkDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkDeleteResponse, + ) + + async def add_tags( + self, + *, + file_ids: SequenceNotStr[str], + tags: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkAddTagsResponse: + """This API adds tags to multiple files in bulk. + + A maximum of 50 files can be + specified at a time. + + Args: + file_ids: An array of fileIds to which you want to add tags. + + tags: An array of tags that you want to add to the files. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/files/addTags", + body=await async_maybe_transform( + { + "file_ids": file_ids, + "tags": tags, + }, + bulk_add_tags_params.BulkAddTagsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkAddTagsResponse, + ) + + async def remove_ai_tags( + self, + *, + ai_tags: SequenceNotStr[str], + file_ids: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkRemoveAITagsResponse: + """This API removes AITags from multiple files in bulk. + + A maximum of 50 files can + be specified at a time. + + Args: + ai_tags: An array of AITags that you want to remove from the files. + + file_ids: An array of fileIds from which you want to remove AITags. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/files/removeAITags", + body=await async_maybe_transform( + { + "ai_tags": ai_tags, + "file_ids": file_ids, + }, + bulk_remove_ai_tags_params.BulkRemoveAITagsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkRemoveAITagsResponse, + ) + + async def remove_tags( + self, + *, + file_ids: SequenceNotStr[str], + tags: SequenceNotStr[str], + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> BulkRemoveTagsResponse: + """This API removes tags from multiple files in bulk. + + A maximum of 50 files can be + specified at a time. + + Args: + file_ids: An array of fileIds from which you want to remove tags. + + tags: An array of tags that you want to remove from the files. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/files/removeTags", + body=await async_maybe_transform( + { + "file_ids": file_ids, + "tags": tags, + }, + bulk_remove_tags_params.BulkRemoveTagsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BulkRemoveTagsResponse, + ) + + +class BulkResourceWithRawResponse: + def __init__(self, bulk: BulkResource) -> None: + self._bulk = bulk + + self.delete = to_raw_response_wrapper( + bulk.delete, + ) + self.add_tags = to_raw_response_wrapper( + bulk.add_tags, + ) + self.remove_ai_tags = to_raw_response_wrapper( + bulk.remove_ai_tags, + ) + self.remove_tags = to_raw_response_wrapper( + bulk.remove_tags, + ) + + +class AsyncBulkResourceWithRawResponse: + def __init__(self, bulk: AsyncBulkResource) -> None: + self._bulk = bulk + + self.delete = async_to_raw_response_wrapper( + bulk.delete, + ) + self.add_tags = async_to_raw_response_wrapper( + bulk.add_tags, + ) + self.remove_ai_tags = async_to_raw_response_wrapper( + bulk.remove_ai_tags, + ) + self.remove_tags = async_to_raw_response_wrapper( + bulk.remove_tags, + ) + + +class BulkResourceWithStreamingResponse: + def __init__(self, bulk: BulkResource) -> None: + self._bulk = bulk + + self.delete = to_streamed_response_wrapper( + bulk.delete, + ) + self.add_tags = to_streamed_response_wrapper( + bulk.add_tags, + ) + self.remove_ai_tags = to_streamed_response_wrapper( + bulk.remove_ai_tags, + ) + self.remove_tags = to_streamed_response_wrapper( + bulk.remove_tags, + ) + + +class AsyncBulkResourceWithStreamingResponse: + def __init__(self, bulk: AsyncBulkResource) -> None: + self._bulk = bulk + + self.delete = async_to_streamed_response_wrapper( + bulk.delete, + ) + self.add_tags = async_to_streamed_response_wrapper( + bulk.add_tags, + ) + self.remove_ai_tags = async_to_streamed_response_wrapper( + bulk.remove_ai_tags, + ) + self.remove_tags = async_to_streamed_response_wrapper( + bulk.remove_tags, + ) diff --git a/src/imagekit/resources/files/files.py b/src/imagekit/resources/files/files.py new file mode 100644 index 0000000..66bbefe --- /dev/null +++ b/src/imagekit/resources/files/files.py @@ -0,0 +1,1351 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Mapping, Iterable, cast +from typing_extensions import Literal + +import httpx + +from .bulk import ( + BulkResource, + AsyncBulkResource, + BulkResourceWithRawResponse, + AsyncBulkResourceWithRawResponse, + BulkResourceWithStreamingResponse, + AsyncBulkResourceWithStreamingResponse, +) +from ...types import file_copy_params, file_move_params, file_rename_params, file_update_params, file_upload_params +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, FileTypes, SequenceNotStr +from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform +from .metadata import ( + MetadataResource, + AsyncMetadataResource, + MetadataResourceWithRawResponse, + AsyncMetadataResourceWithRawResponse, + MetadataResourceWithStreamingResponse, + AsyncMetadataResourceWithStreamingResponse, +) +from .versions import ( + VersionsResource, + AsyncVersionsResource, + VersionsResourceWithRawResponse, + AsyncVersionsResourceWithRawResponse, + VersionsResourceWithStreamingResponse, + AsyncVersionsResourceWithStreamingResponse, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.file import File +from ..._base_client import make_request_options +from ...types.file_copy_response import FileCopyResponse +from ...types.file_move_response import FileMoveResponse +from ...types.file_rename_response import FileRenameResponse +from ...types.file_update_response import FileUpdateResponse +from ...types.file_upload_response import FileUploadResponse + +__all__ = ["FilesResource", "AsyncFilesResource"] + + +class FilesResource(SyncAPIResource): + @cached_property + def bulk(self) -> BulkResource: + return BulkResource(self._client) + + @cached_property + def versions(self) -> VersionsResource: + return VersionsResource(self._client) + + @cached_property + def metadata(self) -> MetadataResource: + return MetadataResource(self._client) + + @cached_property + def with_raw_response(self) -> FilesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return FilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return FilesResourceWithStreamingResponse(self) + + def update( + self, + file_id: str, + *, + update: file_update_params.Update | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileUpdateResponse: + """ + This API updates the details or attributes of the current version of the file. + You can update `tags`, `customCoordinates`, `customMetadata`, publication + status, remove existing `AITags` and apply extensions using this API. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return self._patch( + f"/v1/files/{file_id}/details", + body=maybe_transform(update, file_update_params.FileUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileUpdateResponse, + ) + + def delete( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + This API deletes the file and all its file versions permanently. + + Note: If a file or specific transformation has been requested in the past, then + the response is cached. Deleting a file does not purge the cache. You can purge + the cache using purge cache API. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/v1/files/{file_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + def copy( + self, + *, + destination_path: str, + source_file_path: str, + include_file_versions: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileCopyResponse: + """ + This will copy a file from one folder to another. + + Note: If any file at the destination has the same name as the source file, then + the source file and its versions (if `includeFileVersions` is set to true) will + be appended to the destination file version history. + + Args: + destination_path: Full path to the folder you want to copy the above file into. + + source_file_path: The full path of the file you want to copy. + + include_file_versions: Option to copy all versions of a file. By default, only the current version of + the file is copied. When set to true, all versions of the file will be copied. + Default value - `false`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/files/copy", + body=maybe_transform( + { + "destination_path": destination_path, + "source_file_path": source_file_path, + "include_file_versions": include_file_versions, + }, + file_copy_params.FileCopyParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileCopyResponse, + ) + + def get( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> File: + """ + This API returns an object with details or attributes about the current version + of the file. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return self._get( + f"/v1/files/{file_id}/details", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=File, + ) + + def move( + self, + *, + destination_path: str, + source_file_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileMoveResponse: + """ + This will move a file and all its versions from one folder to another. + + Note: If any file at the destination has the same name as the source file, then + the source file and its versions will be appended to the destination file. + + Args: + destination_path: Full path to the folder you want to move the above file into. + + source_file_path: The full path of the file you want to move. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/files/move", + body=maybe_transform( + { + "destination_path": destination_path, + "source_file_path": source_file_path, + }, + file_move_params.FileMoveParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileMoveResponse, + ) + + def rename( + self, + *, + file_path: str, + new_file_name: str, + purge_cache: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileRenameResponse: + """ + You can rename an already existing file in the media library using rename file + API. This operation would rename all file versions of the file. + + Note: The old URLs will stop working. The file/file version URLs cached on CDN + will continue to work unless a purge is requested. + + Args: + file_path: The full path of the file you want to rename. + + new_file_name: + The new name of the file. A filename can contain: + + Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, + and numerals in other languages). Special Characters: `.`, `_`, and `-`. + + Any other character, including space, will be replaced by `_`. + + purge_cache: Option to purge cache for the old file and its versions' URLs. + + When set to true, it will internally issue a purge cache request on CDN to + remove cached content of old file and its versions. This purge request is + counted against your monthly purge quota. + + Note: If the old file were accessible at + `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be + issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard + at the end). It will remove the file and its versions' URLs and any + transformations made using query parameters on this file or its versions. + However, the cache for file transformations made using path parameters will + persist. You can purge them using the purge API. For more details, refer to the + purge API documentation. + + Default value - `false` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._put( + "/v1/files/rename", + body=maybe_transform( + { + "file_path": file_path, + "new_file_name": new_file_name, + "purge_cache": purge_cache, + }, + file_rename_params.FileRenameParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileRenameResponse, + ) + + def upload( + self, + *, + file: FileTypes, + file_name: str, + token: str | NotGiven = NOT_GIVEN, + checks: str | NotGiven = NOT_GIVEN, + custom_coordinates: str | NotGiven = NOT_GIVEN, + custom_metadata: Dict[str, object] | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + expire: int | NotGiven = NOT_GIVEN, + extensions: Iterable[file_upload_params.Extension] | NotGiven = NOT_GIVEN, + folder: str | NotGiven = NOT_GIVEN, + is_private_file: bool | NotGiven = NOT_GIVEN, + is_published: bool | NotGiven = NOT_GIVEN, + overwrite_ai_tags: bool | NotGiven = NOT_GIVEN, + overwrite_custom_metadata: bool | NotGiven = NOT_GIVEN, + overwrite_file: bool | NotGiven = NOT_GIVEN, + overwrite_tags: bool | NotGiven = NOT_GIVEN, + public_key: str | NotGiven = NOT_GIVEN, + response_fields: List[ + Literal[ + "tags", + "customCoordinates", + "isPrivateFile", + "embeddedMetadata", + "isPublished", + "customMetadata", + "metadata", + ] + ] + | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + transformation: file_upload_params.Transformation | NotGiven = NOT_GIVEN, + use_unique_file_name: bool | NotGiven = NOT_GIVEN, + webhook_url: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileUploadResponse: + """ + ImageKit.io allows you to upload files directly from both the server and client + sides. For server-side uploads, private API key authentication is used. For + client-side uploads, generate a one-time `token`, `signature`, and `expire` from + your secure backend using private API. + [Learn more](/docs/api-reference/upload-file/upload-file#how-to-implement-client-side-file-upload) + about how to implement client-side file upload. + + The [V2 API](/docs/api-reference/upload-file/upload-file-v2) enhances security + by verifying the entire payload using JWT. + + **File size limit** \\ + On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + files and 100MB for videos. On the paid plan, these limits increase to 40MB for images, + audio, and raw files and 2GB for videos. These limits can be further increased with + higher-tier plans. + + **Version limit** \\ + A file can have a maximum of 100 versions. + + **Demo applications** + + - A full-fledged + [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + supporting file selections from local storage, URL, Dropbox, Google Drive, + Instagram, and more. + - [Quick start guides](/docs/quick-start-guides) for various frameworks and + technologies. + + Args: + file: + The API accepts any of the following: + + - **Binary data** – send the raw bytes as `multipart/form-data`. + - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + fetch. + - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + + When supplying a URL, the server must receive the response headers within 8 + seconds; otherwise the request fails with 400 Bad Request. + + file_name: + The name with which the file has to be uploaded. The file name can contain: + + - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`. + - Special Characters: `.`, `-` + + Any other character including space will be replaced by `_` + + token: A unique value that the ImageKit.io server will use to recognize and prevent + subsequent retries for the same request. We suggest using V4 UUIDs, or another + random string with enough entropy to avoid collisions. This field is only + required for authentication when uploading a file from the client side. + + **Note**: Sending a value that has been used in the past will result in a + validation error. Even if your previous request resulted in an error, you should + always send a new value for this field. + + checks: Server-side checks to run on the asset. Read more about + [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks). + + custom_coordinates: Define an important area in the image. This is only relevant for image type + files. + + - To be passed as a string with the x and y coordinates of the top-left corner, + and width and height of the area of interest in the format `x,y,width,height`. + For example - `10,10,100,100` + - Can be used with fo-customtransformation. + - If this field is not specified and the file is overwritten, then + customCoordinates will be removed. + + custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata + fields before setting these values. + + description: Optional text to describe the contents of the file. + + expire: The time until your signature is valid. It must be a + [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into + the future. It should be in seconds. This field is only required for + authentication when uploading a file from the client side. + + extensions: Array of extensions to be applied to the image. Each extension can be configured + with specific parameters based on the extension type. + + folder: The folder path in which the image has to be uploaded. If the folder(s) didn't + exist before, a new folder(s) is created. + + The folder name can contain: + + - Alphanumeric Characters: `a-z` , `A-Z` , `0-9` + - Special Characters: `/` , `_` , `-` + + Using multiple `/` creates a nested folder. + + is_private_file: Whether to mark the file as private or not. + + If `true`, the file is marked as private and is accessible only using named + transformation or signed URL. + + is_published: Whether to upload file as published or not. + + If `false`, the file is marked as unpublished, which restricts access to the + file only via the media library. Files in draft or unpublished state can only be + publicly accessed after being published. + + The option to upload in draft state is only available in custom enterprise + pricing plans. + + overwrite_ai_tags: If set to `true` and a file already exists at the exact location, its AITags + will be removed. Set `overwriteAITags` to `false` to preserve AITags. + + overwrite_custom_metadata: If the request does not have `customMetadata`, and a file already exists at the + exact location, existing customMetadata will be removed. + + overwrite_file: If `false` and `useUniqueFileName` is also `false`, and a file already exists at + the exact location, upload API will return an error immediately. + + overwrite_tags: If the request does not have `tags`, and a file already exists at the exact + location, existing tags will be removed. + + public_key: Your ImageKit.io public key. This field is only required for authentication when + uploading a file from the client side. + + response_fields: Array of response field keys to include in the API response body. + + signature: HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + key. Learn how to create a signature on the page below. This should be in + lowercase. + + Signature must be calculated on the server-side. This field is only required for + authentication when uploading a file from the client side. + + tags: Set the tags while uploading the file. Provide an array of tag strings (e.g. + `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + exceed 500, and the `%` character is not allowed. If this field is not specified + and the file is overwritten, the existing tags will be removed. + + transformation: Configure pre-processing (`pre`) and post-processing (`post`) transformations. + + - `pre` — applied before the file is uploaded to the Media Library. + Useful for reducing file size or applying basic optimizations upfront (e.g., + resize, compress). + + - `post` — applied immediately after upload. + Ideal for generating transformed versions (like video encodes or thumbnails) + in advance, so they're ready for delivery without delay. + + You can mix and match any combination of post-processing types. + + use_unique_file_name: Whether to use a unique filename for this file or not. + + If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + a unique filename. + + If `false`, then the image is uploaded with the provided filename parameter, and + any existing file with the same name is replaced. + + webhook_url: The final status of extensions after they have completed execution will be + delivered to this endpoint as a POST request. + [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + about the webhook payload structure. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + body = deepcopy_minimal( + { + "file": file, + "file_name": file_name, + "token": token, + "checks": checks, + "custom_coordinates": custom_coordinates, + "custom_metadata": custom_metadata, + "description": description, + "expire": expire, + "extensions": extensions, + "folder": folder, + "is_private_file": is_private_file, + "is_published": is_published, + "overwrite_ai_tags": overwrite_ai_tags, + "overwrite_custom_metadata": overwrite_custom_metadata, + "overwrite_file": overwrite_file, + "overwrite_tags": overwrite_tags, + "public_key": public_key, + "response_fields": response_fields, + "signature": signature, + "tags": tags, + "transformation": transformation, + "use_unique_file_name": use_unique_file_name, + "webhook_url": webhook_url, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + return self._post( + "/api/v1/files/upload" + if self._client._base_url_overridden + else "https://upload.imagekit.io/api/v1/files/upload", + body=maybe_transform(body, file_upload_params.FileUploadParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileUploadResponse, + ) + + +class AsyncFilesResource(AsyncAPIResource): + @cached_property + def bulk(self) -> AsyncBulkResource: + return AsyncBulkResource(self._client) + + @cached_property + def versions(self) -> AsyncVersionsResource: + return AsyncVersionsResource(self._client) + + @cached_property + def metadata(self) -> AsyncMetadataResource: + return AsyncMetadataResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncFilesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncFilesResourceWithStreamingResponse(self) + + async def update( + self, + file_id: str, + *, + update: file_update_params.Update | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileUpdateResponse: + """ + This API updates the details or attributes of the current version of the file. + You can update `tags`, `customCoordinates`, `customMetadata`, publication + status, remove existing `AITags` and apply extensions using this API. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return await self._patch( + f"/v1/files/{file_id}/details", + body=await async_maybe_transform(update, file_update_params.FileUpdateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileUpdateResponse, + ) + + async def delete( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + This API deletes the file and all its file versions permanently. + + Note: If a file or specific transformation has been requested in the past, then + the response is cached. Deleting a file does not purge the cache. You can purge + the cache using purge cache API. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/v1/files/{file_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + + async def copy( + self, + *, + destination_path: str, + source_file_path: str, + include_file_versions: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileCopyResponse: + """ + This will copy a file from one folder to another. + + Note: If any file at the destination has the same name as the source file, then + the source file and its versions (if `includeFileVersions` is set to true) will + be appended to the destination file version history. + + Args: + destination_path: Full path to the folder you want to copy the above file into. + + source_file_path: The full path of the file you want to copy. + + include_file_versions: Option to copy all versions of a file. By default, only the current version of + the file is copied. When set to true, all versions of the file will be copied. + Default value - `false`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/files/copy", + body=await async_maybe_transform( + { + "destination_path": destination_path, + "source_file_path": source_file_path, + "include_file_versions": include_file_versions, + }, + file_copy_params.FileCopyParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileCopyResponse, + ) + + async def get( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> File: + """ + This API returns an object with details or attributes about the current version + of the file. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return await self._get( + f"/v1/files/{file_id}/details", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=File, + ) + + async def move( + self, + *, + destination_path: str, + source_file_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileMoveResponse: + """ + This will move a file and all its versions from one folder to another. + + Note: If any file at the destination has the same name as the source file, then + the source file and its versions will be appended to the destination file. + + Args: + destination_path: Full path to the folder you want to move the above file into. + + source_file_path: The full path of the file you want to move. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/files/move", + body=await async_maybe_transform( + { + "destination_path": destination_path, + "source_file_path": source_file_path, + }, + file_move_params.FileMoveParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileMoveResponse, + ) + + async def rename( + self, + *, + file_path: str, + new_file_name: str, + purge_cache: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileRenameResponse: + """ + You can rename an already existing file in the media library using rename file + API. This operation would rename all file versions of the file. + + Note: The old URLs will stop working. The file/file version URLs cached on CDN + will continue to work unless a purge is requested. + + Args: + file_path: The full path of the file you want to rename. + + new_file_name: + The new name of the file. A filename can contain: + + Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, + and numerals in other languages). Special Characters: `.`, `_`, and `-`. + + Any other character, including space, will be replaced by `_`. + + purge_cache: Option to purge cache for the old file and its versions' URLs. + + When set to true, it will internally issue a purge cache request on CDN to + remove cached content of old file and its versions. This purge request is + counted against your monthly purge quota. + + Note: If the old file were accessible at + `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be + issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard + at the end). It will remove the file and its versions' URLs and any + transformations made using query parameters on this file or its versions. + However, the cache for file transformations made using path parameters will + persist. You can purge them using the purge API. For more details, refer to the + purge API documentation. + + Default value - `false` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._put( + "/v1/files/rename", + body=await async_maybe_transform( + { + "file_path": file_path, + "new_file_name": new_file_name, + "purge_cache": purge_cache, + }, + file_rename_params.FileRenameParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileRenameResponse, + ) + + async def upload( + self, + *, + file: FileTypes, + file_name: str, + token: str | NotGiven = NOT_GIVEN, + checks: str | NotGiven = NOT_GIVEN, + custom_coordinates: str | NotGiven = NOT_GIVEN, + custom_metadata: Dict[str, object] | NotGiven = NOT_GIVEN, + description: str | NotGiven = NOT_GIVEN, + expire: int | NotGiven = NOT_GIVEN, + extensions: Iterable[file_upload_params.Extension] | NotGiven = NOT_GIVEN, + folder: str | NotGiven = NOT_GIVEN, + is_private_file: bool | NotGiven = NOT_GIVEN, + is_published: bool | NotGiven = NOT_GIVEN, + overwrite_ai_tags: bool | NotGiven = NOT_GIVEN, + overwrite_custom_metadata: bool | NotGiven = NOT_GIVEN, + overwrite_file: bool | NotGiven = NOT_GIVEN, + overwrite_tags: bool | NotGiven = NOT_GIVEN, + public_key: str | NotGiven = NOT_GIVEN, + response_fields: List[ + Literal[ + "tags", + "customCoordinates", + "isPrivateFile", + "embeddedMetadata", + "isPublished", + "customMetadata", + "metadata", + ] + ] + | NotGiven = NOT_GIVEN, + signature: str | NotGiven = NOT_GIVEN, + tags: SequenceNotStr[str] | NotGiven = NOT_GIVEN, + transformation: file_upload_params.Transformation | NotGiven = NOT_GIVEN, + use_unique_file_name: bool | NotGiven = NOT_GIVEN, + webhook_url: str | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FileUploadResponse: + """ + ImageKit.io allows you to upload files directly from both the server and client + sides. For server-side uploads, private API key authentication is used. For + client-side uploads, generate a one-time `token`, `signature`, and `expire` from + your secure backend using private API. + [Learn more](/docs/api-reference/upload-file/upload-file#how-to-implement-client-side-file-upload) + about how to implement client-side file upload. + + The [V2 API](/docs/api-reference/upload-file/upload-file-v2) enhances security + by verifying the entire payload using JWT. + + **File size limit** \\ + On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw + files and 100MB for videos. On the paid plan, these limits increase to 40MB for images, + audio, and raw files and 2GB for videos. These limits can be further increased with + higher-tier plans. + + **Version limit** \\ + A file can have a maximum of 100 versions. + + **Demo applications** + + - A full-fledged + [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), + supporting file selections from local storage, URL, Dropbox, Google Drive, + Instagram, and more. + - [Quick start guides](/docs/quick-start-guides) for various frameworks and + technologies. + + Args: + file: + The API accepts any of the following: + + - **Binary data** – send the raw bytes as `multipart/form-data`. + - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + fetch. + - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + + When supplying a URL, the server must receive the response headers within 8 + seconds; otherwise the request fails with 400 Bad Request. + + file_name: + The name with which the file has to be uploaded. The file name can contain: + + - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`. + - Special Characters: `.`, `-` + + Any other character including space will be replaced by `_` + + token: A unique value that the ImageKit.io server will use to recognize and prevent + subsequent retries for the same request. We suggest using V4 UUIDs, or another + random string with enough entropy to avoid collisions. This field is only + required for authentication when uploading a file from the client side. + + **Note**: Sending a value that has been used in the past will result in a + validation error. Even if your previous request resulted in an error, you should + always send a new value for this field. + + checks: Server-side checks to run on the asset. Read more about + [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks). + + custom_coordinates: Define an important area in the image. This is only relevant for image type + files. + + - To be passed as a string with the x and y coordinates of the top-left corner, + and width and height of the area of interest in the format `x,y,width,height`. + For example - `10,10,100,100` + - Can be used with fo-customtransformation. + - If this field is not specified and the file is overwritten, then + customCoordinates will be removed. + + custom_metadata: JSON key-value pairs to associate with the asset. Create the custom metadata + fields before setting these values. + + description: Optional text to describe the contents of the file. + + expire: The time until your signature is valid. It must be a + [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into + the future. It should be in seconds. This field is only required for + authentication when uploading a file from the client side. + + extensions: Array of extensions to be applied to the image. Each extension can be configured + with specific parameters based on the extension type. + + folder: The folder path in which the image has to be uploaded. If the folder(s) didn't + exist before, a new folder(s) is created. + + The folder name can contain: + + - Alphanumeric Characters: `a-z` , `A-Z` , `0-9` + - Special Characters: `/` , `_` , `-` + + Using multiple `/` creates a nested folder. + + is_private_file: Whether to mark the file as private or not. + + If `true`, the file is marked as private and is accessible only using named + transformation or signed URL. + + is_published: Whether to upload file as published or not. + + If `false`, the file is marked as unpublished, which restricts access to the + file only via the media library. Files in draft or unpublished state can only be + publicly accessed after being published. + + The option to upload in draft state is only available in custom enterprise + pricing plans. + + overwrite_ai_tags: If set to `true` and a file already exists at the exact location, its AITags + will be removed. Set `overwriteAITags` to `false` to preserve AITags. + + overwrite_custom_metadata: If the request does not have `customMetadata`, and a file already exists at the + exact location, existing customMetadata will be removed. + + overwrite_file: If `false` and `useUniqueFileName` is also `false`, and a file already exists at + the exact location, upload API will return an error immediately. + + overwrite_tags: If the request does not have `tags`, and a file already exists at the exact + location, existing tags will be removed. + + public_key: Your ImageKit.io public key. This field is only required for authentication when + uploading a file from the client side. + + response_fields: Array of response field keys to include in the API response body. + + signature: HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + key. Learn how to create a signature on the page below. This should be in + lowercase. + + Signature must be calculated on the server-side. This field is only required for + authentication when uploading a file from the client side. + + tags: Set the tags while uploading the file. Provide an array of tag strings (e.g. + `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + exceed 500, and the `%` character is not allowed. If this field is not specified + and the file is overwritten, the existing tags will be removed. + + transformation: Configure pre-processing (`pre`) and post-processing (`post`) transformations. + + - `pre` — applied before the file is uploaded to the Media Library. + Useful for reducing file size or applying basic optimizations upfront (e.g., + resize, compress). + + - `post` — applied immediately after upload. + Ideal for generating transformed versions (like video encodes or thumbnails) + in advance, so they're ready for delivery without delay. + + You can mix and match any combination of post-processing types. + + use_unique_file_name: Whether to use a unique filename for this file or not. + + If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + a unique filename. + + If `false`, then the image is uploaded with the provided filename parameter, and + any existing file with the same name is replaced. + + webhook_url: The final status of extensions after they have completed execution will be + delivered to this endpoint as a POST request. + [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + about the webhook payload structure. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + body = deepcopy_minimal( + { + "file": file, + "file_name": file_name, + "token": token, + "checks": checks, + "custom_coordinates": custom_coordinates, + "custom_metadata": custom_metadata, + "description": description, + "expire": expire, + "extensions": extensions, + "folder": folder, + "is_private_file": is_private_file, + "is_published": is_published, + "overwrite_ai_tags": overwrite_ai_tags, + "overwrite_custom_metadata": overwrite_custom_metadata, + "overwrite_file": overwrite_file, + "overwrite_tags": overwrite_tags, + "public_key": public_key, + "response_fields": response_fields, + "signature": signature, + "tags": tags, + "transformation": transformation, + "use_unique_file_name": use_unique_file_name, + "webhook_url": webhook_url, + } + ) + files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + return await self._post( + "/api/v1/files/upload" + if self._client._base_url_overridden + else "https://upload.imagekit.io/api/v1/files/upload", + body=await async_maybe_transform(body, file_upload_params.FileUploadParams), + files=files, + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileUploadResponse, + ) + + +class FilesResourceWithRawResponse: + def __init__(self, files: FilesResource) -> None: + self._files = files + + self.update = to_raw_response_wrapper( + files.update, + ) + self.delete = to_raw_response_wrapper( + files.delete, + ) + self.copy = to_raw_response_wrapper( + files.copy, + ) + self.get = to_raw_response_wrapper( + files.get, + ) + self.move = to_raw_response_wrapper( + files.move, + ) + self.rename = to_raw_response_wrapper( + files.rename, + ) + self.upload = to_raw_response_wrapper( + files.upload, + ) + + @cached_property + def bulk(self) -> BulkResourceWithRawResponse: + return BulkResourceWithRawResponse(self._files.bulk) + + @cached_property + def versions(self) -> VersionsResourceWithRawResponse: + return VersionsResourceWithRawResponse(self._files.versions) + + @cached_property + def metadata(self) -> MetadataResourceWithRawResponse: + return MetadataResourceWithRawResponse(self._files.metadata) + + +class AsyncFilesResourceWithRawResponse: + def __init__(self, files: AsyncFilesResource) -> None: + self._files = files + + self.update = async_to_raw_response_wrapper( + files.update, + ) + self.delete = async_to_raw_response_wrapper( + files.delete, + ) + self.copy = async_to_raw_response_wrapper( + files.copy, + ) + self.get = async_to_raw_response_wrapper( + files.get, + ) + self.move = async_to_raw_response_wrapper( + files.move, + ) + self.rename = async_to_raw_response_wrapper( + files.rename, + ) + self.upload = async_to_raw_response_wrapper( + files.upload, + ) + + @cached_property + def bulk(self) -> AsyncBulkResourceWithRawResponse: + return AsyncBulkResourceWithRawResponse(self._files.bulk) + + @cached_property + def versions(self) -> AsyncVersionsResourceWithRawResponse: + return AsyncVersionsResourceWithRawResponse(self._files.versions) + + @cached_property + def metadata(self) -> AsyncMetadataResourceWithRawResponse: + return AsyncMetadataResourceWithRawResponse(self._files.metadata) + + +class FilesResourceWithStreamingResponse: + def __init__(self, files: FilesResource) -> None: + self._files = files + + self.update = to_streamed_response_wrapper( + files.update, + ) + self.delete = to_streamed_response_wrapper( + files.delete, + ) + self.copy = to_streamed_response_wrapper( + files.copy, + ) + self.get = to_streamed_response_wrapper( + files.get, + ) + self.move = to_streamed_response_wrapper( + files.move, + ) + self.rename = to_streamed_response_wrapper( + files.rename, + ) + self.upload = to_streamed_response_wrapper( + files.upload, + ) + + @cached_property + def bulk(self) -> BulkResourceWithStreamingResponse: + return BulkResourceWithStreamingResponse(self._files.bulk) + + @cached_property + def versions(self) -> VersionsResourceWithStreamingResponse: + return VersionsResourceWithStreamingResponse(self._files.versions) + + @cached_property + def metadata(self) -> MetadataResourceWithStreamingResponse: + return MetadataResourceWithStreamingResponse(self._files.metadata) + + +class AsyncFilesResourceWithStreamingResponse: + def __init__(self, files: AsyncFilesResource) -> None: + self._files = files + + self.update = async_to_streamed_response_wrapper( + files.update, + ) + self.delete = async_to_streamed_response_wrapper( + files.delete, + ) + self.copy = async_to_streamed_response_wrapper( + files.copy, + ) + self.get = async_to_streamed_response_wrapper( + files.get, + ) + self.move = async_to_streamed_response_wrapper( + files.move, + ) + self.rename = async_to_streamed_response_wrapper( + files.rename, + ) + self.upload = async_to_streamed_response_wrapper( + files.upload, + ) + + @cached_property + def bulk(self) -> AsyncBulkResourceWithStreamingResponse: + return AsyncBulkResourceWithStreamingResponse(self._files.bulk) + + @cached_property + def versions(self) -> AsyncVersionsResourceWithStreamingResponse: + return AsyncVersionsResourceWithStreamingResponse(self._files.versions) + + @cached_property + def metadata(self) -> AsyncMetadataResourceWithStreamingResponse: + return AsyncMetadataResourceWithStreamingResponse(self._files.metadata) diff --git a/src/imagekit/resources/files/metadata.py b/src/imagekit/resources/files/metadata.py new file mode 100644 index 0000000..e68348a --- /dev/null +++ b/src/imagekit/resources/files/metadata.py @@ -0,0 +1,263 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.files import metadata_get_from_url_params +from ..._base_client import make_request_options +from ...types.metadata import Metadata + +__all__ = ["MetadataResource", "AsyncMetadataResource"] + + +class MetadataResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> MetadataResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return MetadataResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> MetadataResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return MetadataResourceWithStreamingResponse(self) + + def get( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Metadata: + """ + You can programmatically get image EXIF, pHash, and other metadata for uploaded + files in the ImageKit.io media library using this API. + + You can also get the metadata in upload API response by passing `metadata` in + `responseFields` parameter. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return self._get( + f"/v1/files/{file_id}/metadata", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Metadata, + ) + + def get_from_url( + self, + *, + url: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Metadata: + """ + Get image EXIF, pHash, and other metadata from ImageKit.io powered remote URL + using this API. + + Args: + url: Should be a valid file URL. It should be accessible using your ImageKit.io + account. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get( + "/v1/files/metadata", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"url": url}, metadata_get_from_url_params.MetadataGetFromURLParams), + ), + cast_to=Metadata, + ) + + +class AsyncMetadataResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncMetadataResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncMetadataResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncMetadataResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncMetadataResourceWithStreamingResponse(self) + + async def get( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Metadata: + """ + You can programmatically get image EXIF, pHash, and other metadata for uploaded + files in the ImageKit.io media library using this API. + + You can also get the metadata in upload API response by passing `metadata` in + `responseFields` parameter. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return await self._get( + f"/v1/files/{file_id}/metadata", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Metadata, + ) + + async def get_from_url( + self, + *, + url: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> Metadata: + """ + Get image EXIF, pHash, and other metadata from ImageKit.io powered remote URL + using this API. + + Args: + url: Should be a valid file URL. It should be accessible using your ImageKit.io + account. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._get( + "/v1/files/metadata", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform({"url": url}, metadata_get_from_url_params.MetadataGetFromURLParams), + ), + cast_to=Metadata, + ) + + +class MetadataResourceWithRawResponse: + def __init__(self, metadata: MetadataResource) -> None: + self._metadata = metadata + + self.get = to_raw_response_wrapper( + metadata.get, + ) + self.get_from_url = to_raw_response_wrapper( + metadata.get_from_url, + ) + + +class AsyncMetadataResourceWithRawResponse: + def __init__(self, metadata: AsyncMetadataResource) -> None: + self._metadata = metadata + + self.get = async_to_raw_response_wrapper( + metadata.get, + ) + self.get_from_url = async_to_raw_response_wrapper( + metadata.get_from_url, + ) + + +class MetadataResourceWithStreamingResponse: + def __init__(self, metadata: MetadataResource) -> None: + self._metadata = metadata + + self.get = to_streamed_response_wrapper( + metadata.get, + ) + self.get_from_url = to_streamed_response_wrapper( + metadata.get_from_url, + ) + + +class AsyncMetadataResourceWithStreamingResponse: + def __init__(self, metadata: AsyncMetadataResource) -> None: + self._metadata = metadata + + self.get = async_to_streamed_response_wrapper( + metadata.get, + ) + self.get_from_url = async_to_streamed_response_wrapper( + metadata.get_from_url, + ) diff --git a/src/imagekit/resources/files/versions.py b/src/imagekit/resources/files/versions.py new file mode 100644 index 0000000..77c22c3 --- /dev/null +++ b/src/imagekit/resources/files/versions.py @@ -0,0 +1,425 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ...types.file import File +from ..._base_client import make_request_options +from ...types.files.version_list_response import VersionListResponse +from ...types.files.version_delete_response import VersionDeleteResponse + +__all__ = ["VersionsResource", "AsyncVersionsResource"] + + +class VersionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> VersionsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return VersionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> VersionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return VersionsResourceWithStreamingResponse(self) + + def list( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VersionListResponse: + """ + This API returns details of all versions of a file. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return self._get( + f"/v1/files/{file_id}/versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VersionListResponse, + ) + + def delete( + self, + version_id: str, + *, + file_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VersionDeleteResponse: + """This API deletes a non-current file version permanently. + + The API returns an + empty response. + + Note: If you want to delete all versions of a file, use the delete file API. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return self._delete( + f"/v1/files/{file_id}/versions/{version_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VersionDeleteResponse, + ) + + def get( + self, + version_id: str, + *, + file_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> File: + """ + This API returns an object with details or attributes of a file version. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return self._get( + f"/v1/files/{file_id}/versions/{version_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=File, + ) + + def restore( + self, + version_id: str, + *, + file_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> File: + """ + This API restores a file version as the current file version. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return self._put( + f"/v1/files/{file_id}/versions/{version_id}/restore", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=File, + ) + + +class AsyncVersionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncVersionsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncVersionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncVersionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncVersionsResourceWithStreamingResponse(self) + + async def list( + self, + file_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VersionListResponse: + """ + This API returns details of all versions of a file. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + return await self._get( + f"/v1/files/{file_id}/versions", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VersionListResponse, + ) + + async def delete( + self, + version_id: str, + *, + file_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> VersionDeleteResponse: + """This API deletes a non-current file version permanently. + + The API returns an + empty response. + + Note: If you want to delete all versions of a file, use the delete file API. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return await self._delete( + f"/v1/files/{file_id}/versions/{version_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=VersionDeleteResponse, + ) + + async def get( + self, + version_id: str, + *, + file_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> File: + """ + This API returns an object with details or attributes of a file version. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return await self._get( + f"/v1/files/{file_id}/versions/{version_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=File, + ) + + async def restore( + self, + version_id: str, + *, + file_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> File: + """ + This API restores a file version as the current file version. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not file_id: + raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") + if not version_id: + raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}") + return await self._put( + f"/v1/files/{file_id}/versions/{version_id}/restore", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=File, + ) + + +class VersionsResourceWithRawResponse: + def __init__(self, versions: VersionsResource) -> None: + self._versions = versions + + self.list = to_raw_response_wrapper( + versions.list, + ) + self.delete = to_raw_response_wrapper( + versions.delete, + ) + self.get = to_raw_response_wrapper( + versions.get, + ) + self.restore = to_raw_response_wrapper( + versions.restore, + ) + + +class AsyncVersionsResourceWithRawResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: + self._versions = versions + + self.list = async_to_raw_response_wrapper( + versions.list, + ) + self.delete = async_to_raw_response_wrapper( + versions.delete, + ) + self.get = async_to_raw_response_wrapper( + versions.get, + ) + self.restore = async_to_raw_response_wrapper( + versions.restore, + ) + + +class VersionsResourceWithStreamingResponse: + def __init__(self, versions: VersionsResource) -> None: + self._versions = versions + + self.list = to_streamed_response_wrapper( + versions.list, + ) + self.delete = to_streamed_response_wrapper( + versions.delete, + ) + self.get = to_streamed_response_wrapper( + versions.get, + ) + self.restore = to_streamed_response_wrapper( + versions.restore, + ) + + +class AsyncVersionsResourceWithStreamingResponse: + def __init__(self, versions: AsyncVersionsResource) -> None: + self._versions = versions + + self.list = async_to_streamed_response_wrapper( + versions.list, + ) + self.delete = async_to_streamed_response_wrapper( + versions.delete, + ) + self.get = async_to_streamed_response_wrapper( + versions.get, + ) + self.restore = async_to_streamed_response_wrapper( + versions.restore, + ) diff --git a/src/imagekit/resources/folders/__init__.py b/src/imagekit/resources/folders/__init__.py new file mode 100644 index 0000000..a88720f --- /dev/null +++ b/src/imagekit/resources/folders/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .job import ( + JobResource, + AsyncJobResource, + JobResourceWithRawResponse, + AsyncJobResourceWithRawResponse, + JobResourceWithStreamingResponse, + AsyncJobResourceWithStreamingResponse, +) +from .folders import ( + FoldersResource, + AsyncFoldersResource, + FoldersResourceWithRawResponse, + AsyncFoldersResourceWithRawResponse, + FoldersResourceWithStreamingResponse, + AsyncFoldersResourceWithStreamingResponse, +) + +__all__ = [ + "JobResource", + "AsyncJobResource", + "JobResourceWithRawResponse", + "AsyncJobResourceWithRawResponse", + "JobResourceWithStreamingResponse", + "AsyncJobResourceWithStreamingResponse", + "FoldersResource", + "AsyncFoldersResource", + "FoldersResourceWithRawResponse", + "AsyncFoldersResourceWithRawResponse", + "FoldersResourceWithStreamingResponse", + "AsyncFoldersResourceWithStreamingResponse", +] diff --git a/src/imagekit/resources/folders/folders.py b/src/imagekit/resources/folders/folders.py new file mode 100644 index 0000000..7b71a40 --- /dev/null +++ b/src/imagekit/resources/folders/folders.py @@ -0,0 +1,713 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .job import ( + JobResource, + AsyncJobResource, + JobResourceWithRawResponse, + AsyncJobResourceWithRawResponse, + JobResourceWithStreamingResponse, + AsyncJobResourceWithStreamingResponse, +) +from ...types import ( + folder_copy_params, + folder_move_params, + folder_create_params, + folder_delete_params, + folder_rename_params, +) +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.folder_copy_response import FolderCopyResponse +from ...types.folder_move_response import FolderMoveResponse +from ...types.folder_create_response import FolderCreateResponse +from ...types.folder_delete_response import FolderDeleteResponse +from ...types.folder_rename_response import FolderRenameResponse + +__all__ = ["FoldersResource", "AsyncFoldersResource"] + + +class FoldersResource(SyncAPIResource): + @cached_property + def job(self) -> JobResource: + return JobResource(self._client) + + @cached_property + def with_raw_response(self) -> FoldersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return FoldersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FoldersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return FoldersResourceWithStreamingResponse(self) + + def create( + self, + *, + folder_name: str, + parent_folder_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderCreateResponse: + """This will create a new folder. + + You can specify the folder name and location of + the parent folder where this new folder should be created. + + Args: + folder_name: The folder will be created with this name. + + All characters except alphabets and numbers (inclusive of unicode letters, + marks, and numerals in other languages) will be replaced by an underscore i.e. + `_`. + + parent_folder_path: The folder where the new folder should be created, for root use `/` else the + path e.g. `containing/folder/`. + + Note: If any folder(s) is not present in the parentFolderPath parameter, it will + be automatically created. For example, if you pass `/product/images/summer`, + then `product`, `images`, and `summer` folders will be created if they don't + already exist. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/folder", + body=maybe_transform( + { + "folder_name": folder_name, + "parent_folder_path": parent_folder_path, + }, + folder_create_params.FolderCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderCreateResponse, + ) + + def delete( + self, + *, + folder_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderDeleteResponse: + """This will delete a folder and all its contents permanently. + + The API returns an + empty response. + + Args: + folder_path: Full path to the folder you want to delete. For example `/folder/to/delete/`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._delete( + "/v1/folder", + body=maybe_transform({"folder_path": folder_path}, folder_delete_params.FolderDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderDeleteResponse, + ) + + def copy( + self, + *, + destination_path: str, + source_folder_path: str, + include_versions: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderCopyResponse: + """This will copy one folder into another. + + The selected folder, its nested folders, + files, and their versions (in `includeVersions` is set to true) are copied in + this operation. Note: If any file at the destination has the same name as the + source file, then the source file and its versions will be appended to the + destination file version history. + + Args: + destination_path: Full path to the destination folder where you want to copy the source folder + into. + + source_folder_path: The full path to the source folder you want to copy. + + include_versions: Option to copy all versions of files that are nested inside the selected folder. + By default, only the current version of each file will be copied. When set to + true, all versions of each file will be copied. Default value - `false`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/bulkJobs/copyFolder", + body=maybe_transform( + { + "destination_path": destination_path, + "source_folder_path": source_folder_path, + "include_versions": include_versions, + }, + folder_copy_params.FolderCopyParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderCopyResponse, + ) + + def move( + self, + *, + destination_path: str, + source_folder_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderMoveResponse: + """This will move one folder into another. + + The selected folder, its nested folders, + files, and their versions are moved in this operation. Note: If any file at the + destination has the same name as the source file, then the source file and its + versions will be appended to the destination file version history. + + Args: + destination_path: Full path to the destination folder where you want to move the source folder + into. + + source_folder_path: The full path to the source folder you want to move. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/bulkJobs/moveFolder", + body=maybe_transform( + { + "destination_path": destination_path, + "source_folder_path": source_folder_path, + }, + folder_move_params.FolderMoveParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderMoveResponse, + ) + + def rename( + self, + *, + folder_path: str, + new_folder_name: str, + purge_cache: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderRenameResponse: + """This API allows you to rename an existing folder. + + The folder and all its nested + assets and sub-folders will remain unchanged, but their paths will be updated to + reflect the new folder name. + + Args: + folder_path: The full path to the folder you want to rename. + + new_folder_name: The new name for the folder. + + All characters except alphabets and numbers (inclusive of unicode letters, + marks, and numerals in other languages) and `-` will be replaced by an + underscore i.e. `_`. + + purge_cache: Option to purge cache for the old nested files and their versions' URLs. + + When set to true, it will internally issue a purge cache request on CDN to + remove the cached content of the old nested files and their versions. There will + only be one purge request for all the nested files, which will be counted + against your monthly purge quota. + + Note: A purge cache request will be issued against + `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This + will remove all nested files, their versions' URLs, and any transformations made + using query parameters on these files or their versions. However, the cache for + file transformations made using path parameters will persist. You can purge them + using the purge API. For more details, refer to the purge API documentation. + + Default value - `false` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/v1/bulkJobs/renameFolder", + body=maybe_transform( + { + "folder_path": folder_path, + "new_folder_name": new_folder_name, + "purge_cache": purge_cache, + }, + folder_rename_params.FolderRenameParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderRenameResponse, + ) + + +class AsyncFoldersResource(AsyncAPIResource): + @cached_property + def job(self) -> AsyncJobResource: + return AsyncJobResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncFoldersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncFoldersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFoldersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncFoldersResourceWithStreamingResponse(self) + + async def create( + self, + *, + folder_name: str, + parent_folder_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderCreateResponse: + """This will create a new folder. + + You can specify the folder name and location of + the parent folder where this new folder should be created. + + Args: + folder_name: The folder will be created with this name. + + All characters except alphabets and numbers (inclusive of unicode letters, + marks, and numerals in other languages) will be replaced by an underscore i.e. + `_`. + + parent_folder_path: The folder where the new folder should be created, for root use `/` else the + path e.g. `containing/folder/`. + + Note: If any folder(s) is not present in the parentFolderPath parameter, it will + be automatically created. For example, if you pass `/product/images/summer`, + then `product`, `images`, and `summer` folders will be created if they don't + already exist. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/folder", + body=await async_maybe_transform( + { + "folder_name": folder_name, + "parent_folder_path": parent_folder_path, + }, + folder_create_params.FolderCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderCreateResponse, + ) + + async def delete( + self, + *, + folder_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderDeleteResponse: + """This will delete a folder and all its contents permanently. + + The API returns an + empty response. + + Args: + folder_path: Full path to the folder you want to delete. For example `/folder/to/delete/`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._delete( + "/v1/folder", + body=await async_maybe_transform({"folder_path": folder_path}, folder_delete_params.FolderDeleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderDeleteResponse, + ) + + async def copy( + self, + *, + destination_path: str, + source_folder_path: str, + include_versions: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderCopyResponse: + """This will copy one folder into another. + + The selected folder, its nested folders, + files, and their versions (in `includeVersions` is set to true) are copied in + this operation. Note: If any file at the destination has the same name as the + source file, then the source file and its versions will be appended to the + destination file version history. + + Args: + destination_path: Full path to the destination folder where you want to copy the source folder + into. + + source_folder_path: The full path to the source folder you want to copy. + + include_versions: Option to copy all versions of files that are nested inside the selected folder. + By default, only the current version of each file will be copied. When set to + true, all versions of each file will be copied. Default value - `false`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/bulkJobs/copyFolder", + body=await async_maybe_transform( + { + "destination_path": destination_path, + "source_folder_path": source_folder_path, + "include_versions": include_versions, + }, + folder_copy_params.FolderCopyParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderCopyResponse, + ) + + async def move( + self, + *, + destination_path: str, + source_folder_path: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderMoveResponse: + """This will move one folder into another. + + The selected folder, its nested folders, + files, and their versions are moved in this operation. Note: If any file at the + destination has the same name as the source file, then the source file and its + versions will be appended to the destination file version history. + + Args: + destination_path: Full path to the destination folder where you want to move the source folder + into. + + source_folder_path: The full path to the source folder you want to move. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/bulkJobs/moveFolder", + body=await async_maybe_transform( + { + "destination_path": destination_path, + "source_folder_path": source_folder_path, + }, + folder_move_params.FolderMoveParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderMoveResponse, + ) + + async def rename( + self, + *, + folder_path: str, + new_folder_name: str, + purge_cache: bool | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> FolderRenameResponse: + """This API allows you to rename an existing folder. + + The folder and all its nested + assets and sub-folders will remain unchanged, but their paths will be updated to + reflect the new folder name. + + Args: + folder_path: The full path to the folder you want to rename. + + new_folder_name: The new name for the folder. + + All characters except alphabets and numbers (inclusive of unicode letters, + marks, and numerals in other languages) and `-` will be replaced by an + underscore i.e. `_`. + + purge_cache: Option to purge cache for the old nested files and their versions' URLs. + + When set to true, it will internally issue a purge cache request on CDN to + remove the cached content of the old nested files and their versions. There will + only be one purge request for all the nested files, which will be counted + against your monthly purge quota. + + Note: A purge cache request will be issued against + `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This + will remove all nested files, their versions' URLs, and any transformations made + using query parameters on these files or their versions. However, the cache for + file transformations made using path parameters will persist. You can purge them + using the purge API. For more details, refer to the purge API documentation. + + Default value - `false` + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/v1/bulkJobs/renameFolder", + body=await async_maybe_transform( + { + "folder_path": folder_path, + "new_folder_name": new_folder_name, + "purge_cache": purge_cache, + }, + folder_rename_params.FolderRenameParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FolderRenameResponse, + ) + + +class FoldersResourceWithRawResponse: + def __init__(self, folders: FoldersResource) -> None: + self._folders = folders + + self.create = to_raw_response_wrapper( + folders.create, + ) + self.delete = to_raw_response_wrapper( + folders.delete, + ) + self.copy = to_raw_response_wrapper( + folders.copy, + ) + self.move = to_raw_response_wrapper( + folders.move, + ) + self.rename = to_raw_response_wrapper( + folders.rename, + ) + + @cached_property + def job(self) -> JobResourceWithRawResponse: + return JobResourceWithRawResponse(self._folders.job) + + +class AsyncFoldersResourceWithRawResponse: + def __init__(self, folders: AsyncFoldersResource) -> None: + self._folders = folders + + self.create = async_to_raw_response_wrapper( + folders.create, + ) + self.delete = async_to_raw_response_wrapper( + folders.delete, + ) + self.copy = async_to_raw_response_wrapper( + folders.copy, + ) + self.move = async_to_raw_response_wrapper( + folders.move, + ) + self.rename = async_to_raw_response_wrapper( + folders.rename, + ) + + @cached_property + def job(self) -> AsyncJobResourceWithRawResponse: + return AsyncJobResourceWithRawResponse(self._folders.job) + + +class FoldersResourceWithStreamingResponse: + def __init__(self, folders: FoldersResource) -> None: + self._folders = folders + + self.create = to_streamed_response_wrapper( + folders.create, + ) + self.delete = to_streamed_response_wrapper( + folders.delete, + ) + self.copy = to_streamed_response_wrapper( + folders.copy, + ) + self.move = to_streamed_response_wrapper( + folders.move, + ) + self.rename = to_streamed_response_wrapper( + folders.rename, + ) + + @cached_property + def job(self) -> JobResourceWithStreamingResponse: + return JobResourceWithStreamingResponse(self._folders.job) + + +class AsyncFoldersResourceWithStreamingResponse: + def __init__(self, folders: AsyncFoldersResource) -> None: + self._folders = folders + + self.create = async_to_streamed_response_wrapper( + folders.create, + ) + self.delete = async_to_streamed_response_wrapper( + folders.delete, + ) + self.copy = async_to_streamed_response_wrapper( + folders.copy, + ) + self.move = async_to_streamed_response_wrapper( + folders.move, + ) + self.rename = async_to_streamed_response_wrapper( + folders.rename, + ) + + @cached_property + def job(self) -> AsyncJobResourceWithStreamingResponse: + return AsyncJobResourceWithStreamingResponse(self._folders.job) diff --git a/src/imagekit/resources/folders/job.py b/src/imagekit/resources/folders/job.py new file mode 100644 index 0000000..c76445f --- /dev/null +++ b/src/imagekit/resources/folders/job.py @@ -0,0 +1,163 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.folders.job_get_response import JobGetResponse + +__all__ = ["JobResource", "AsyncJobResource"] + + +class JobResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> JobResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return JobResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> JobResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return JobResourceWithStreamingResponse(self) + + def get( + self, + job_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> JobGetResponse: + """ + This API returns the status of a bulk job like copy and move folder operations. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not job_id: + raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}") + return self._get( + f"/v1/bulkJobs/{job_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=JobGetResponse, + ) + + +class AsyncJobResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncJobResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#accessing-raw-response-data-eg-headers + """ + return AsyncJobResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncJobResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/imagekit-developer/imagekit-python#with_streaming_response + """ + return AsyncJobResourceWithStreamingResponse(self) + + async def get( + self, + job_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> JobGetResponse: + """ + This API returns the status of a bulk job like copy and move folder operations. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not job_id: + raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}") + return await self._get( + f"/v1/bulkJobs/{job_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=JobGetResponse, + ) + + +class JobResourceWithRawResponse: + def __init__(self, job: JobResource) -> None: + self._job = job + + self.get = to_raw_response_wrapper( + job.get, + ) + + +class AsyncJobResourceWithRawResponse: + def __init__(self, job: AsyncJobResource) -> None: + self._job = job + + self.get = async_to_raw_response_wrapper( + job.get, + ) + + +class JobResourceWithStreamingResponse: + def __init__(self, job: JobResource) -> None: + self._job = job + + self.get = to_streamed_response_wrapper( + job.get, + ) + + +class AsyncJobResourceWithStreamingResponse: + def __init__(self, job: AsyncJobResource) -> None: + self._job = job + + self.get = async_to_streamed_response_wrapper( + job.get, + ) diff --git a/src/imagekit/resources/webhooks.py b/src/imagekit/resources/webhooks.py new file mode 100644 index 0000000..7c5ed39 --- /dev/null +++ b/src/imagekit/resources/webhooks.py @@ -0,0 +1,88 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import json +from typing import Mapping, cast + +from .._models import construct_type +from .._resource import SyncAPIResource, AsyncAPIResource +from .._exceptions import ImageKitError +from ..types.unwrap_webhook_event import UnwrapWebhookEvent +from ..types.unsafe_unwrap_webhook_event import UnsafeUnwrapWebhookEvent + +__all__ = ["WebhooksResource", "AsyncWebhooksResource"] + + +class WebhooksResource(SyncAPIResource): + def unsafe_unwrap(self, payload: str) -> UnsafeUnwrapWebhookEvent: + return cast( + UnsafeUnwrapWebhookEvent, + construct_type( + type_=UnsafeUnwrapWebhookEvent, + value=json.loads(payload), + ), + ) + + def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None) -> UnwrapWebhookEvent: + try: + from standardwebhooks import Webhook + except ImportError as exc: + raise ImageKitError("You need to install `imagekit[webhooks]` to use this method") from exc + + if key is None: + key = self._client.webhook_secret + if key is None: + raise ValueError( + "Cannot verify a webhook without a key on either the client's webhook_secret or passed in as an argument" + ) + + if not isinstance(headers, dict): + headers = dict(headers) + + Webhook(key).verify(payload, headers) + + return cast( + UnwrapWebhookEvent, + construct_type( + type_=UnwrapWebhookEvent, + value=json.loads(payload), + ), + ) + + +class AsyncWebhooksResource(AsyncAPIResource): + def unsafe_unwrap(self, payload: str) -> UnsafeUnwrapWebhookEvent: + return cast( + UnsafeUnwrapWebhookEvent, + construct_type( + type_=UnsafeUnwrapWebhookEvent, + value=json.loads(payload), + ), + ) + + def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None) -> UnwrapWebhookEvent: + try: + from standardwebhooks import Webhook + except ImportError as exc: + raise ImageKitError("You need to install `imagekit[webhooks]` to use this method") from exc + + if key is None: + key = self._client.webhook_secret + if key is None: + raise ValueError( + "Cannot verify a webhook without a key on either the client's webhook_secret or passed in as an argument" + ) + + if not isinstance(headers, dict): + headers = dict(headers) + + Webhook(key).verify(payload, headers) + + return cast( + UnwrapWebhookEvent, + construct_type( + type_=UnwrapWebhookEvent, + value=json.loads(payload), + ), + ) diff --git a/src/imagekit/types/__init__.py b/src/imagekit/types/__init__.py new file mode 100644 index 0000000..ed4a09d --- /dev/null +++ b/src/imagekit/types/__init__.py @@ -0,0 +1,78 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from . import shared +from .. import _compat +from .file import File as File +from .folder import Folder as Folder +from .shared import ( + Overlay as Overlay, + SrcOptions as SrcOptions, + BaseOverlay as BaseOverlay, + TextOverlay as TextOverlay, + ImageOverlay as ImageOverlay, + VideoOverlay as VideoOverlay, + OverlayTiming as OverlayTiming, + Transformation as Transformation, + OverlayPosition as OverlayPosition, + SubtitleOverlay as SubtitleOverlay, + SolidColorOverlay as SolidColorOverlay, + StreamingResolution as StreamingResolution, + TransformationPosition as TransformationPosition, + TextOverlayTransformation as TextOverlayTransformation, + SubtitleOverlayTransformation as SubtitleOverlayTransformation, + SolidColorOverlayTransformation as SolidColorOverlayTransformation, +) +from .metadata import Metadata as Metadata +from .file_copy_params import FileCopyParams as FileCopyParams +from .file_move_params import FileMoveParams as FileMoveParams +from .asset_list_params import AssetListParams as AssetListParams +from .base_webhook_event import BaseWebhookEvent as BaseWebhookEvent +from .file_copy_response import FileCopyResponse as FileCopyResponse +from .file_move_response import FileMoveResponse as FileMoveResponse +from .file_rename_params import FileRenameParams as FileRenameParams +from .file_update_params import FileUpdateParams as FileUpdateParams +from .file_upload_params import FileUploadParams as FileUploadParams +from .folder_copy_params import FolderCopyParams as FolderCopyParams +from .folder_move_params import FolderMoveParams as FolderMoveParams +from .asset_list_response import AssetListResponse as AssetListResponse +from .file_rename_response import FileRenameResponse as FileRenameResponse +from .file_update_response import FileUpdateResponse as FileUpdateResponse +from .file_upload_response import FileUploadResponse as FileUploadResponse +from .folder_copy_response import FolderCopyResponse as FolderCopyResponse +from .folder_create_params import FolderCreateParams as FolderCreateParams +from .folder_delete_params import FolderDeleteParams as FolderDeleteParams +from .folder_move_response import FolderMoveResponse as FolderMoveResponse +from .folder_rename_params import FolderRenameParams as FolderRenameParams +from .unwrap_webhook_event import UnwrapWebhookEvent as UnwrapWebhookEvent +from .custom_metadata_field import CustomMetadataField as CustomMetadataField +from .folder_create_response import FolderCreateResponse as FolderCreateResponse +from .folder_delete_response import FolderDeleteResponse as FolderDeleteResponse +from .folder_rename_response import FolderRenameResponse as FolderRenameResponse +from .unsafe_unwrap_webhook_event import UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent +from .upload_pre_transform_error_event import UploadPreTransformErrorEvent as UploadPreTransformErrorEvent +from .video_transformation_error_event import VideoTransformationErrorEvent as VideoTransformationErrorEvent +from .video_transformation_ready_event import VideoTransformationReadyEvent as VideoTransformationReadyEvent +from .custom_metadata_field_list_params import CustomMetadataFieldListParams as CustomMetadataFieldListParams +from .upload_post_transform_error_event import UploadPostTransformErrorEvent as UploadPostTransformErrorEvent +from .upload_pre_transform_success_event import UploadPreTransformSuccessEvent as UploadPreTransformSuccessEvent +from .custom_metadata_field_create_params import CustomMetadataFieldCreateParams as CustomMetadataFieldCreateParams +from .custom_metadata_field_list_response import CustomMetadataFieldListResponse as CustomMetadataFieldListResponse +from .custom_metadata_field_update_params import CustomMetadataFieldUpdateParams as CustomMetadataFieldUpdateParams +from .upload_post_transform_success_event import UploadPostTransformSuccessEvent as UploadPostTransformSuccessEvent +from .video_transformation_accepted_event import VideoTransformationAcceptedEvent as VideoTransformationAcceptedEvent +from .custom_metadata_field_delete_response import ( + CustomMetadataFieldDeleteResponse as CustomMetadataFieldDeleteResponse, +) + +# Rebuild cyclical models only after all modules are imported. +# This ensures that, when building the deferred (due to cyclical references) model schema, +# Pydantic can resolve the necessary references. +# See: https://github.com/pydantic/pydantic/issues/11250 for more context. +if _compat.PYDANTIC_V2: + shared.src_options.SrcOptions.model_rebuild(_parent_namespace_depth=0) + shared.transformation.Transformation.model_rebuild(_parent_namespace_depth=0) +else: + shared.src_options.SrcOptions.update_forward_refs() # type: ignore + shared.transformation.Transformation.update_forward_refs() # type: ignore diff --git a/src/imagekit/types/accounts/__init__.py b/src/imagekit/types/accounts/__init__.py new file mode 100644 index 0000000..3d713db --- /dev/null +++ b/src/imagekit/types/accounts/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .origin_response import OriginResponse as OriginResponse +from .usage_get_params import UsageGetParams as UsageGetParams +from .usage_get_response import UsageGetResponse as UsageGetResponse +from .origin_create_params import OriginCreateParams as OriginCreateParams +from .origin_list_response import OriginListResponse as OriginListResponse +from .origin_request_param import OriginRequestParam as OriginRequestParam +from .origin_update_params import OriginUpdateParams as OriginUpdateParams +from .url_endpoint_response import URLEndpointResponse as URLEndpointResponse +from .url_endpoint_create_params import URLEndpointCreateParams as URLEndpointCreateParams +from .url_endpoint_list_response import URLEndpointListResponse as URLEndpointListResponse +from .url_endpoint_update_params import URLEndpointUpdateParams as URLEndpointUpdateParams diff --git a/src/imagekit/types/accounts/origin_create_params.py b/src/imagekit/types/accounts/origin_create_params.py new file mode 100644 index 0000000..adb74db --- /dev/null +++ b/src/imagekit/types/accounts/origin_create_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .origin_request_param import OriginRequestParam + +__all__ = ["OriginCreateParams"] + + +class OriginCreateParams(TypedDict, total=False): + origin: Required[OriginRequestParam] + """Schema for origin request resources.""" diff --git a/src/imagekit/types/accounts/origin_list_response.py b/src/imagekit/types/accounts/origin_list_response.py new file mode 100644 index 0000000..b0e0931 --- /dev/null +++ b/src/imagekit/types/accounts/origin_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .origin_response import OriginResponse + +__all__ = ["OriginListResponse"] + +OriginListResponse: TypeAlias = List[OriginResponse] diff --git a/src/imagekit/types/accounts/origin_request_param.py b/src/imagekit/types/accounts/origin_request_param.py new file mode 100644 index 0000000..a2864ad --- /dev/null +++ b/src/imagekit/types/accounts/origin_request_param.py @@ -0,0 +1,208 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "OriginRequestParam", + "S3", + "S3Compatible", + "CloudinaryBackup", + "WebFolder", + "WebProxy", + "Gcs", + "AzureBlob", + "AkeneoPim", +] + + +class S3(TypedDict, total=False): + access_key: Required[Annotated[str, PropertyInfo(alias="accessKey")]] + """Access key for the bucket.""" + + bucket: Required[str] + """S3 bucket name.""" + + name: Required[str] + """Display name of the origin.""" + + secret_key: Required[Annotated[str, PropertyInfo(alias="secretKey")]] + """Secret key for the bucket.""" + + type: Required[Literal["S3"]] + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + prefix: str + """Path prefix inside the bucket.""" + + +class S3Compatible(TypedDict, total=False): + access_key: Required[Annotated[str, PropertyInfo(alias="accessKey")]] + """Access key for the bucket.""" + + bucket: Required[str] + """S3 bucket name.""" + + endpoint: Required[str] + """Custom S3-compatible endpoint.""" + + name: Required[str] + """Display name of the origin.""" + + secret_key: Required[Annotated[str, PropertyInfo(alias="secretKey")]] + """Secret key for the bucket.""" + + type: Required[Literal["S3_COMPATIBLE"]] + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + prefix: str + """Path prefix inside the bucket.""" + + s3_force_path_style: Annotated[bool, PropertyInfo(alias="s3ForcePathStyle")] + """Use path-style S3 URLs?""" + + +class CloudinaryBackup(TypedDict, total=False): + access_key: Required[Annotated[str, PropertyInfo(alias="accessKey")]] + """Access key for the bucket.""" + + bucket: Required[str] + """S3 bucket name.""" + + name: Required[str] + """Display name of the origin.""" + + secret_key: Required[Annotated[str, PropertyInfo(alias="secretKey")]] + """Secret key for the bucket.""" + + type: Required[Literal["CLOUDINARY_BACKUP"]] + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + prefix: str + """Path prefix inside the bucket.""" + + +class WebFolder(TypedDict, total=False): + base_url: Required[Annotated[str, PropertyInfo(alias="baseUrl")]] + """Root URL for the web folder origin.""" + + name: Required[str] + """Display name of the origin.""" + + type: Required[Literal["WEB_FOLDER"]] + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + forward_host_header_to_origin: Annotated[bool, PropertyInfo(alias="forwardHostHeaderToOrigin")] + """Forward the Host header to origin?""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + +class WebProxy(TypedDict, total=False): + name: Required[str] + """Display name of the origin.""" + + type: Required[Literal["WEB_PROXY"]] + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + +class Gcs(TypedDict, total=False): + bucket: Required[str] + + client_email: Required[Annotated[str, PropertyInfo(alias="clientEmail")]] + + name: Required[str] + """Display name of the origin.""" + + private_key: Required[Annotated[str, PropertyInfo(alias="privateKey")]] + + type: Required[Literal["GCS"]] + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + prefix: str + + +class AzureBlob(TypedDict, total=False): + account_name: Required[Annotated[str, PropertyInfo(alias="accountName")]] + + container: Required[str] + + name: Required[str] + """Display name of the origin.""" + + sas_token: Required[Annotated[str, PropertyInfo(alias="sasToken")]] + + type: Required[Literal["AZURE_BLOB"]] + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + prefix: str + + +class AkeneoPim(TypedDict, total=False): + base_url: Required[Annotated[str, PropertyInfo(alias="baseUrl")]] + """Akeneo instance base URL.""" + + client_id: Required[Annotated[str, PropertyInfo(alias="clientId")]] + """Akeneo API client ID.""" + + client_secret: Required[Annotated[str, PropertyInfo(alias="clientSecret")]] + """Akeneo API client secret.""" + + name: Required[str] + """Display name of the origin.""" + + password: Required[str] + """Akeneo API password.""" + + type: Required[Literal["AKENEO_PIM"]] + + username: Required[str] + """Akeneo API username.""" + + base_url_for_canonical_header: Annotated[str, PropertyInfo(alias="baseUrlForCanonicalHeader")] + """URL used in the Canonical header (if enabled).""" + + include_canonical_header: Annotated[bool, PropertyInfo(alias="includeCanonicalHeader")] + """Whether to send a Canonical header.""" + + +OriginRequestParam: TypeAlias = Union[ + S3, S3Compatible, CloudinaryBackup, WebFolder, WebProxy, Gcs, AzureBlob, AkeneoPim +] diff --git a/src/imagekit/types/accounts/origin_response.py b/src/imagekit/types/accounts/origin_response.py new file mode 100644 index 0000000..d437447 --- /dev/null +++ b/src/imagekit/types/accounts/origin_response.py @@ -0,0 +1,224 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias + +from pydantic import Field as FieldInfo + +from ..._utils import PropertyInfo +from ..._models import BaseModel + +__all__ = [ + "OriginResponse", + "S3", + "S3Compatible", + "CloudinaryBackup", + "WebFolder", + "WebProxy", + "Gcs", + "AzureBlob", + "AkeneoPim", +] + + +class S3(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + bucket: str + """S3 bucket name.""" + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + prefix: str + """Path prefix inside the bucket.""" + + type: Literal["S3"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +class S3Compatible(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + bucket: str + """S3 bucket name.""" + + endpoint: str + """Custom S3-compatible endpoint.""" + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + prefix: str + """Path prefix inside the bucket.""" + + s3_force_path_style: bool = FieldInfo(alias="s3ForcePathStyle") + """Use path-style S3 URLs?""" + + type: Literal["S3_COMPATIBLE"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +class CloudinaryBackup(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + bucket: str + """S3 bucket name.""" + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + prefix: str + """Path prefix inside the bucket.""" + + type: Literal["CLOUDINARY_BACKUP"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +class WebFolder(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + base_url: str = FieldInfo(alias="baseUrl") + """Root URL for the web folder origin.""" + + forward_host_header_to_origin: bool = FieldInfo(alias="forwardHostHeaderToOrigin") + """Forward the Host header to origin?""" + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + type: Literal["WEB_FOLDER"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +class WebProxy(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + type: Literal["WEB_PROXY"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +class Gcs(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + bucket: str + + client_email: str = FieldInfo(alias="clientEmail") + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + prefix: str + + type: Literal["GCS"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +class AzureBlob(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + account_name: str = FieldInfo(alias="accountName") + + container: str + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + prefix: str + + type: Literal["AZURE_BLOB"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +class AkeneoPim(BaseModel): + id: str + """Unique identifier for the origin. + + This is generated by ImageKit when you create a new origin. + """ + + base_url: str = FieldInfo(alias="baseUrl") + """Akeneo instance base URL.""" + + include_canonical_header: bool = FieldInfo(alias="includeCanonicalHeader") + """Whether to send a Canonical header.""" + + name: str + """Display name of the origin.""" + + type: Literal["AKENEO_PIM"] + + base_url_for_canonical_header: Optional[str] = FieldInfo(alias="baseUrlForCanonicalHeader", default=None) + """URL used in the Canonical header (if enabled).""" + + +OriginResponse: TypeAlias = Annotated[ + Union[S3, S3Compatible, CloudinaryBackup, WebFolder, WebProxy, Gcs, AzureBlob, AkeneoPim], + PropertyInfo(discriminator="type"), +] diff --git a/src/imagekit/types/accounts/origin_update_params.py b/src/imagekit/types/accounts/origin_update_params.py new file mode 100644 index 0000000..138bf3c --- /dev/null +++ b/src/imagekit/types/accounts/origin_update_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from .origin_request_param import OriginRequestParam + +__all__ = ["OriginUpdateParams"] + + +class OriginUpdateParams(TypedDict, total=False): + origin: Required[OriginRequestParam] + """Schema for origin request resources.""" diff --git a/src/imagekit/types/accounts/url_endpoint_create_params.py b/src/imagekit/types/accounts/url_endpoint_create_params.py new file mode 100644 index 0000000..1c4653f --- /dev/null +++ b/src/imagekit/types/accounts/url_endpoint_create_params.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["URLEndpointCreateParams", "URLRewriter", "URLRewriterCloudinary", "URLRewriterImgix", "URLRewriterAkamai"] + + +class URLEndpointCreateParams(TypedDict, total=False): + description: Required[str] + """Description of the URL endpoint.""" + + origins: SequenceNotStr[str] + """ + Ordered list of origin IDs to try when the file isn’t in the Media Library; + ImageKit checks them in the sequence provided. Origin must be created before it + can be used in a URL endpoint. + """ + + url_prefix: Annotated[str, PropertyInfo(alias="urlPrefix")] + """ + Path segment appended to your base URL to form the endpoint (letters, digits, + and hyphens only — or empty for the default endpoint). + """ + + url_rewriter: Annotated[URLRewriter, PropertyInfo(alias="urlRewriter")] + """Configuration for third-party URL rewriting.""" + + +class URLRewriterCloudinary(TypedDict, total=False): + type: Required[Literal["CLOUDINARY"]] + + preserve_asset_delivery_types: Annotated[bool, PropertyInfo(alias="preserveAssetDeliveryTypes")] + """Whether to preserve `/` in the rewritten URL.""" + + +class URLRewriterImgix(TypedDict, total=False): + type: Required[Literal["IMGIX"]] + + +class URLRewriterAkamai(TypedDict, total=False): + type: Required[Literal["AKAMAI"]] + + +URLRewriter: TypeAlias = Union[URLRewriterCloudinary, URLRewriterImgix, URLRewriterAkamai] diff --git a/src/imagekit/types/accounts/url_endpoint_list_response.py b/src/imagekit/types/accounts/url_endpoint_list_response.py new file mode 100644 index 0000000..a51a8df --- /dev/null +++ b/src/imagekit/types/accounts/url_endpoint_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .url_endpoint_response import URLEndpointResponse + +__all__ = ["URLEndpointListResponse"] + +URLEndpointListResponse: TypeAlias = List[URLEndpointResponse] diff --git a/src/imagekit/types/accounts/url_endpoint_response.py b/src/imagekit/types/accounts/url_endpoint_response.py new file mode 100644 index 0000000..c868c7c --- /dev/null +++ b/src/imagekit/types/accounts/url_endpoint_response.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias + +from pydantic import Field as FieldInfo + +from ..._utils import PropertyInfo +from ..._models import BaseModel + +__all__ = ["URLEndpointResponse", "URLRewriter", "URLRewriterCloudinary", "URLRewriterImgix", "URLRewriterAkamai"] + + +class URLRewriterCloudinary(BaseModel): + preserve_asset_delivery_types: bool = FieldInfo(alias="preserveAssetDeliveryTypes") + """Whether to preserve `/` in the rewritten URL.""" + + type: Literal["CLOUDINARY"] + + +class URLRewriterImgix(BaseModel): + type: Literal["IMGIX"] + + +class URLRewriterAkamai(BaseModel): + type: Literal["AKAMAI"] + + +URLRewriter: TypeAlias = Annotated[ + Union[URLRewriterCloudinary, URLRewriterImgix, URLRewriterAkamai], PropertyInfo(discriminator="type") +] + + +class URLEndpointResponse(BaseModel): + id: str + """Unique identifier for the URL-endpoint. + + This is generated by ImageKit when you create a new URL-endpoint. For the + default URL-endpoint, this is always `default`. + """ + + description: str + """Description of the URL endpoint.""" + + origins: List[str] + """ + Ordered list of origin IDs to try when the file isn’t in the Media Library; + ImageKit checks them in the sequence provided. Origin must be created before it + can be used in a URL endpoint. + """ + + url_prefix: str = FieldInfo(alias="urlPrefix") + """ + Path segment appended to your base URL to form the endpoint (letters, digits, + and hyphens only — or empty for the default endpoint). + """ + + url_rewriter: Optional[URLRewriter] = FieldInfo(alias="urlRewriter", default=None) + """Configuration for third-party URL rewriting.""" diff --git a/src/imagekit/types/accounts/url_endpoint_update_params.py b/src/imagekit/types/accounts/url_endpoint_update_params.py new file mode 100644 index 0000000..e34f27b --- /dev/null +++ b/src/imagekit/types/accounts/url_endpoint_update_params.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["URLEndpointUpdateParams", "URLRewriter", "URLRewriterCloudinary", "URLRewriterImgix", "URLRewriterAkamai"] + + +class URLEndpointUpdateParams(TypedDict, total=False): + description: Required[str] + """Description of the URL endpoint.""" + + origins: SequenceNotStr[str] + """ + Ordered list of origin IDs to try when the file isn’t in the Media Library; + ImageKit checks them in the sequence provided. Origin must be created before it + can be used in a URL endpoint. + """ + + url_prefix: Annotated[str, PropertyInfo(alias="urlPrefix")] + """ + Path segment appended to your base URL to form the endpoint (letters, digits, + and hyphens only — or empty for the default endpoint). + """ + + url_rewriter: Annotated[URLRewriter, PropertyInfo(alias="urlRewriter")] + """Configuration for third-party URL rewriting.""" + + +class URLRewriterCloudinary(TypedDict, total=False): + type: Required[Literal["CLOUDINARY"]] + + preserve_asset_delivery_types: Annotated[bool, PropertyInfo(alias="preserveAssetDeliveryTypes")] + """Whether to preserve `/` in the rewritten URL.""" + + +class URLRewriterImgix(TypedDict, total=False): + type: Required[Literal["IMGIX"]] + + +class URLRewriterAkamai(TypedDict, total=False): + type: Required[Literal["AKAMAI"]] + + +URLRewriter: TypeAlias = Union[URLRewriterCloudinary, URLRewriterImgix, URLRewriterAkamai] diff --git a/src/imagekit/types/accounts/usage_get_params.py b/src/imagekit/types/accounts/usage_get_params.py new file mode 100644 index 0000000..298a969 --- /dev/null +++ b/src/imagekit/types/accounts/usage_get_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import date +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["UsageGetParams"] + + +class UsageGetParams(TypedDict, total=False): + end_date: Required[Annotated[Union[str, date], PropertyInfo(alias="endDate", format="iso8601")]] + """Specify a `endDate` in `YYYY-MM-DD` format. + + It should be after the `startDate`. The difference between `startDate` and + `endDate` should be less than 90 days. + """ + + start_date: Required[Annotated[Union[str, date], PropertyInfo(alias="startDate", format="iso8601")]] + """Specify a `startDate` in `YYYY-MM-DD` format. + + It should be before the `endDate`. The difference between `startDate` and + `endDate` should be less than 90 days. + """ diff --git a/src/imagekit/types/accounts/usage_get_response.py b/src/imagekit/types/accounts/usage_get_response.py new file mode 100644 index 0000000..651552c --- /dev/null +++ b/src/imagekit/types/accounts/usage_get_response.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["UsageGetResponse"] + + +class UsageGetResponse(BaseModel): + bandwidth_bytes: Optional[int] = FieldInfo(alias="bandwidthBytes", default=None) + """Amount of bandwidth used in bytes.""" + + extension_units_count: Optional[int] = FieldInfo(alias="extensionUnitsCount", default=None) + """Number of extension units used.""" + + media_library_storage_bytes: Optional[int] = FieldInfo(alias="mediaLibraryStorageBytes", default=None) + """Storage used by media library in bytes.""" + + original_cache_storage_bytes: Optional[int] = FieldInfo(alias="originalCacheStorageBytes", default=None) + """Storage used by the original cache in bytes.""" + + video_processing_units_count: Optional[int] = FieldInfo(alias="videoProcessingUnitsCount", default=None) + """Number of video processing units used.""" diff --git a/src/imagekit/types/asset_list_params.py b/src/imagekit/types/asset_list_params.py new file mode 100644 index 0000000..ea4024e --- /dev/null +++ b/src/imagekit/types/asset_list_params.py @@ -0,0 +1,81 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["AssetListParams"] + + +class AssetListParams(TypedDict, total=False): + file_type: Annotated[Literal["all", "image", "non-image"], PropertyInfo(alias="fileType")] + """Filter results by file type. + + - `all` — include all file types + - `image` — include only image files + - `non-image` — include only non-image files (e.g., JS, CSS, video) + """ + + limit: int + """The maximum number of results to return in response.""" + + path: str + """Folder path if you want to limit the search within a specific folder. + + For example, `/sales-banner/` will only search in folder sales-banner. + + Note : If your use case involves searching within a folder as well as its + subfolders, you can use `path` parameter in `searchQuery` with appropriate + operator. Checkout + [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) + for more information. + """ + + search_query: Annotated[str, PropertyInfo(alias="searchQuery")] + """Query string in a Lucene-like query language e.g. `createdAt > "7d"`. + + Note : When the searchQuery parameter is present, the following query parameters + will have no effect on the result: + + 1. `tags` + 2. `type` + 3. `name` + + [Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) + from examples. + """ + + skip: int + """The number of results to skip before returning results.""" + + sort: Literal[ + "ASC_NAME", + "DESC_NAME", + "ASC_CREATED", + "DESC_CREATED", + "ASC_UPDATED", + "DESC_UPDATED", + "ASC_HEIGHT", + "DESC_HEIGHT", + "ASC_WIDTH", + "DESC_WIDTH", + "ASC_SIZE", + "DESC_SIZE", + "ASC_RELEVANCE", + "DESC_RELEVANCE", + ] + """ + Sort the results by one of the supported fields in ascending or descending + order. + """ + + type: Literal["file", "file-version", "folder", "all"] + """Filter results by asset type. + + - `file` — returns only files + - `file-version` — returns specific file versions + - `folder` — returns only folders + - `all` — returns both files and folders (excludes `file-version`) + """ diff --git a/src/imagekit/types/asset_list_response.py b/src/imagekit/types/asset_list_response.py new file mode 100644 index 0000000..00596e2 --- /dev/null +++ b/src/imagekit/types/asset_list_response.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union +from typing_extensions import TypeAlias + +from .file import File +from .folder import Folder + +__all__ = ["AssetListResponse", "AssetListResponseItem"] + +AssetListResponseItem: TypeAlias = Union[File, Folder] + +AssetListResponse: TypeAlias = List[AssetListResponseItem] diff --git a/src/imagekit/types/base_webhook_event.py b/src/imagekit/types/base_webhook_event.py new file mode 100644 index 0000000..b37e44a --- /dev/null +++ b/src/imagekit/types/base_webhook_event.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["BaseWebhookEvent"] + + +class BaseWebhookEvent(BaseModel): + id: str + """Unique identifier for the event.""" + + type: str + """The type of webhook event.""" diff --git a/src/imagekit/types/beta/__init__.py b/src/imagekit/types/beta/__init__.py new file mode 100644 index 0000000..f8ee8b1 --- /dev/null +++ b/src/imagekit/types/beta/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations diff --git a/src/imagekit/types/beta/v2/__init__.py b/src/imagekit/types/beta/v2/__init__.py new file mode 100644 index 0000000..c5c3d83 --- /dev/null +++ b/src/imagekit/types/beta/v2/__init__.py @@ -0,0 +1,6 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .file_upload_params import FileUploadParams as FileUploadParams +from .file_upload_response import FileUploadResponse as FileUploadResponse diff --git a/src/imagekit/types/beta/v2/file_upload_params.py b/src/imagekit/types/beta/v2/file_upload_params.py new file mode 100644 index 0000000..fa66233 --- /dev/null +++ b/src/imagekit/types/beta/v2/file_upload_params.py @@ -0,0 +1,320 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Iterable +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from ...._types import FileTypes, SequenceNotStr +from ...._utils import PropertyInfo + +__all__ = [ + "FileUploadParams", + "Extension", + "ExtensionRemoveBg", + "ExtensionRemoveBgOptions", + "ExtensionAutoTaggingExtension", + "ExtensionAIAutoDescription", + "Transformation", + "TransformationPost", + "TransformationPostTransformation", + "TransformationPostGifToVideo", + "TransformationPostThumbnail", + "TransformationPostAbs", +] + + +class FileUploadParams(TypedDict, total=False): + file: Required[FileTypes] + """The API accepts any of the following: + + - **Binary data** – send the raw bytes as `multipart/form-data`. + - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + fetch. + - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + + When supplying a URL, the server must receive the response headers within 8 + seconds; otherwise the request fails with 400 Bad Request. + """ + + file_name: Required[Annotated[str, PropertyInfo(alias="fileName")]] + """The name with which the file has to be uploaded.""" + + token: str + """This is the client-generated JSON Web Token (JWT). + + The ImageKit.io server uses it to authenticate and check that the upload request + parameters have not been tampered with after the token has been generated. Learn + how to create the token on the page below. This field is only required for + authentication when uploading a file from the client side. + + **Note**: Sending a JWT that has been used in the past will result in a + validation error. Even if your previous request resulted in an error, you should + always send a new token. + + **⚠️Warning**: JWT must be generated on the server-side because it is generated + using your account's private API key. This field is required for authentication + when uploading a file from the client-side. + """ + + checks: str + """ + Server-side checks to run on the asset. Read more about + [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks). + """ + + custom_coordinates: Annotated[str, PropertyInfo(alias="customCoordinates")] + """Define an important area in the image. + + This is only relevant for image type files. + + - To be passed as a string with the x and y coordinates of the top-left corner, + and width and height of the area of interest in the format `x,y,width,height`. + For example - `10,10,100,100` + - Can be used with fo-customtransformation. + - If this field is not specified and the file is overwritten, then + customCoordinates will be removed. + """ + + custom_metadata: Annotated[Dict[str, object], PropertyInfo(alias="customMetadata")] + """JSON key-value pairs to associate with the asset. + + Create the custom metadata fields before setting these values. + """ + + description: str + """Optional text to describe the contents of the file.""" + + extensions: Iterable[Extension] + """Array of extensions to be applied to the image. + + Each extension can be configured with specific parameters based on the extension + type. + """ + + folder: str + """The folder path in which the image has to be uploaded. + + If the folder(s) didn't exist before, a new folder(s) is created. Using multiple + `/` creates a nested folder. + """ + + is_private_file: Annotated[bool, PropertyInfo(alias="isPrivateFile")] + """Whether to mark the file as private or not. + + If `true`, the file is marked as private and is accessible only using named + transformation or signed URL. + """ + + is_published: Annotated[bool, PropertyInfo(alias="isPublished")] + """Whether to upload file as published or not. + + If `false`, the file is marked as unpublished, which restricts access to the + file only via the media library. Files in draft or unpublished state can only be + publicly accessed after being published. + + The option to upload in draft state is only available in custom enterprise + pricing plans. + """ + + overwrite_ai_tags: Annotated[bool, PropertyInfo(alias="overwriteAITags")] + """ + If set to `true` and a file already exists at the exact location, its AITags + will be removed. Set `overwriteAITags` to `false` to preserve AITags. + """ + + overwrite_custom_metadata: Annotated[bool, PropertyInfo(alias="overwriteCustomMetadata")] + """ + If the request does not have `customMetadata`, and a file already exists at the + exact location, existing customMetadata will be removed. + """ + + overwrite_file: Annotated[bool, PropertyInfo(alias="overwriteFile")] + """ + If `false` and `useUniqueFileName` is also `false`, and a file already exists at + the exact location, upload API will return an error immediately. + """ + + overwrite_tags: Annotated[bool, PropertyInfo(alias="overwriteTags")] + """ + If the request does not have `tags`, and a file already exists at the exact + location, existing tags will be removed. + """ + + response_fields: Annotated[ + List[ + Literal[ + "tags", + "customCoordinates", + "isPrivateFile", + "embeddedMetadata", + "isPublished", + "customMetadata", + "metadata", + ] + ], + PropertyInfo(alias="responseFields"), + ] + """Array of response field keys to include in the API response body.""" + + tags: SequenceNotStr[str] + """Set the tags while uploading the file. Provide an array of tag strings (e.g. + + `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + exceed 500, and the `%` character is not allowed. If this field is not specified + and the file is overwritten, the existing tags will be removed. + """ + + transformation: Transformation + """Configure pre-processing (`pre`) and post-processing (`post`) transformations. + + - `pre` — applied before the file is uploaded to the Media Library. + Useful for reducing file size or applying basic optimizations upfront (e.g., + resize, compress). + + - `post` — applied immediately after upload. + Ideal for generating transformed versions (like video encodes or thumbnails) + in advance, so they're ready for delivery without delay. + + You can mix and match any combination of post-processing types. + """ + + use_unique_file_name: Annotated[bool, PropertyInfo(alias="useUniqueFileName")] + """Whether to use a unique filename for this file or not. + + If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + a unique filename. + + If `false`, then the image is uploaded with the provided filename parameter, and + any existing file with the same name is replaced. + """ + + webhook_url: Annotated[str, PropertyInfo(alias="webhookUrl")] + """ + The final status of extensions after they have completed execution will be + delivered to this endpoint as a POST request. + [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + about the webhook payload structure. + """ + + +class ExtensionRemoveBgOptions(TypedDict, total=False): + add_shadow: bool + """Whether to add an artificial shadow to the result. + + Default is false. Note: Adding shadows is currently only supported for car + photos. + """ + + bg_color: str + """ + Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + empty. + """ + + bg_image_url: str + """Sets a background image from a URL. + + If this parameter is set, `bg_color` must be empty. + """ + + semitransparency: bool + """Allows semi-transparent regions in the result. + + Default is true. Note: Semitransparency is currently only supported for car + windows. + """ + + +class ExtensionRemoveBg(TypedDict, total=False): + name: Required[Literal["remove-bg"]] + """Specifies the background removal extension.""" + + options: ExtensionRemoveBgOptions + + +class ExtensionAutoTaggingExtension(TypedDict, total=False): + max_tags: Required[Annotated[int, PropertyInfo(alias="maxTags")]] + """Maximum number of tags to attach to the asset.""" + + min_confidence: Required[Annotated[int, PropertyInfo(alias="minConfidence")]] + """Minimum confidence level for tags to be considered valid.""" + + name: Required[Literal["google-auto-tagging", "aws-auto-tagging"]] + """Specifies the auto-tagging extension used.""" + + +class ExtensionAIAutoDescription(TypedDict, total=False): + name: Required[Literal["ai-auto-description"]] + """Specifies the auto description extension.""" + + +Extension: TypeAlias = Union[ExtensionRemoveBg, ExtensionAutoTaggingExtension, ExtensionAIAutoDescription] + + +class TransformationPostTransformation(TypedDict, total=False): + type: Required[Literal["transformation"]] + """Transformation type.""" + + value: Required[str] + """Transformation string (e.g. + + `w-200,h-200`). + Same syntax as ImageKit URL-based transformations. + """ + + +class TransformationPostGifToVideo(TypedDict, total=False): + type: Required[Literal["gif-to-video"]] + """Converts an animated GIF into an MP4.""" + + value: str + """Optional transformation string to apply to the output video. + + **Example**: `q-80` + """ + + +class TransformationPostThumbnail(TypedDict, total=False): + type: Required[Literal["thumbnail"]] + """Generates a thumbnail image.""" + + value: str + """Optional transformation string. + + **Example**: `w-150,h-150` + """ + + +class TransformationPostAbs(TypedDict, total=False): + protocol: Required[Literal["hls", "dash"]] + """Streaming protocol to use (`hls` or `dash`).""" + + type: Required[Literal["abs"]] + """Adaptive Bitrate Streaming (ABS) setup.""" + + value: Required[str] + """ + List of different representations you want to create separated by an underscore. + """ + + +TransformationPost: TypeAlias = Union[ + TransformationPostTransformation, TransformationPostGifToVideo, TransformationPostThumbnail, TransformationPostAbs +] + + +class Transformation(TypedDict, total=False): + post: Iterable[TransformationPost] + """List of transformations to apply _after_ the file is uploaded. + + Each item must match one of the following types: `transformation`, + `gif-to-video`, `thumbnail`, `abs`. + """ + + pre: str + """Transformation string to apply before uploading the file to the Media Library. + + Useful for optimizing files at ingestion. + """ diff --git a/src/imagekit/types/beta/v2/file_upload_response.py b/src/imagekit/types/beta/v2/file_upload_response.py new file mode 100644 index 0000000..08f6ceb --- /dev/null +++ b/src/imagekit/types/beta/v2/file_upload_response.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ...._models import BaseModel +from ...metadata import Metadata + +__all__ = ["FileUploadResponse", "AITag", "ExtensionStatus", "VersionInfo"] + + +class AITag(BaseModel): + confidence: Optional[float] = None + """Confidence score of the tag.""" + + name: Optional[str] = None + """Name of the tag.""" + + source: Optional[str] = None + """Array of `AITags` associated with the image. + + If no `AITags` are set, it will be null. These tags can be added using the + `google-auto-tagging` or `aws-auto-tagging` extensions. + """ + + +class ExtensionStatus(BaseModel): + ai_auto_description: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="ai-auto-description", default=None + ) + + aws_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="aws-auto-tagging", default=None + ) + + google_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="google-auto-tagging", default=None + ) + + remove_bg: Optional[Literal["success", "pending", "failed"]] = FieldInfo(alias="remove-bg", default=None) + + +class VersionInfo(BaseModel): + id: Optional[str] = None + """Unique identifier of the file version.""" + + name: Optional[str] = None + """Name of the file version.""" + + +class FileUploadResponse(BaseModel): + ai_tags: Optional[List[AITag]] = FieldInfo(alias="AITags", default=None) + """An array of tags assigned to the uploaded file by auto tagging.""" + + audio_codec: Optional[str] = FieldInfo(alias="audioCodec", default=None) + """The audio codec used in the video (only for video).""" + + bit_rate: Optional[int] = FieldInfo(alias="bitRate", default=None) + """The bit rate of the video in kbps (only for video).""" + + custom_coordinates: Optional[str] = FieldInfo(alias="customCoordinates", default=None) + """ + Value of custom coordinates associated with the image in the format + `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + Send `customCoordinates` in `responseFields` in API request to get the value of + this field. + """ + + custom_metadata: Optional[Dict[str, object]] = FieldInfo(alias="customMetadata", default=None) + """A key-value data associated with the asset. + + Use `responseField` in API request to get `customMetadata` in the upload API + response. Before setting any custom metadata on an asset, you have to create the + field using custom metadata fields API. Send `customMetadata` in + `responseFields` in API request to get the value of this field. + """ + + description: Optional[str] = None + """Optional text to describe the contents of the file. + + Can be set by the user or the ai-auto-description extension. + """ + + duration: Optional[int] = None + """The duration of the video in seconds (only for video).""" + + embedded_metadata: Optional[Dict[str, object]] = FieldInfo(alias="embeddedMetadata", default=None) + """Consolidated embedded metadata associated with the file. + + It includes exif, iptc, and xmp data. Send `embeddedMetadata` in + `responseFields` in API request to get embeddedMetadata in the upload API + response. + """ + + extension_status: Optional[ExtensionStatus] = FieldInfo(alias="extensionStatus", default=None) + """ + Extension names with their processing status at the time of completion of the + request. It could have one of the following status values: + + `success`: The extension has been successfully applied. `failed`: The extension + has failed and will not be retried. `pending`: The extension will finish + processing in some time. On completion, the final status (success / failed) will + be sent to the `webhookUrl` provided. + + If no extension was requested, then this parameter is not returned. + """ + + file_id: Optional[str] = FieldInfo(alias="fileId", default=None) + """Unique fileId. + + Store this fileld in your database, as this will be used to perform update + action on this file. + """ + + file_path: Optional[str] = FieldInfo(alias="filePath", default=None) + """The relative path of the file in the media library e.g. + + `/marketing-assets/new-banner.jpg`. + """ + + file_type: Optional[str] = FieldInfo(alias="fileType", default=None) + """Type of the uploaded file. Possible values are `image`, `non-image`.""" + + height: Optional[float] = None + """Height of the image in pixels (Only for images)""" + + is_private_file: Optional[bool] = FieldInfo(alias="isPrivateFile", default=None) + """Is the file marked as private. + + It can be either `true` or `false`. Send `isPrivateFile` in `responseFields` in + API request to get the value of this field. + """ + + is_published: Optional[bool] = FieldInfo(alias="isPublished", default=None) + """Is the file published or in draft state. + + It can be either `true` or `false`. Send `isPublished` in `responseFields` in + API request to get the value of this field. + """ + + metadata: Optional[Metadata] = None + """Legacy metadata. + + Send `metadata` in `responseFields` in API request to get metadata in the upload + API response. + """ + + name: Optional[str] = None + """Name of the asset.""" + + size: Optional[float] = None + """Size of the image file in Bytes.""" + + tags: Optional[List[str]] = None + """The array of tags associated with the asset. + + If no tags are set, it will be `null`. Send `tags` in `responseFields` in API + request to get the value of this field. + """ + + thumbnail_url: Optional[str] = FieldInfo(alias="thumbnailUrl", default=None) + """In the case of an image, a small thumbnail URL.""" + + url: Optional[str] = None + """A publicly accessible URL of the file.""" + + version_info: Optional[VersionInfo] = FieldInfo(alias="versionInfo", default=None) + """An object containing the file or file version's `id` (versionId) and `name`.""" + + video_codec: Optional[str] = FieldInfo(alias="videoCodec", default=None) + """The video codec used in the video (only for video).""" + + width: Optional[float] = None + """Width of the image in pixels (Only for Images)""" diff --git a/src/imagekit/types/cache/__init__.py b/src/imagekit/types/cache/__init__.py new file mode 100644 index 0000000..76e5283 --- /dev/null +++ b/src/imagekit/types/cache/__init__.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .invalidation_get_response import InvalidationGetResponse as InvalidationGetResponse +from .invalidation_create_params import InvalidationCreateParams as InvalidationCreateParams +from .invalidation_create_response import InvalidationCreateResponse as InvalidationCreateResponse diff --git a/src/imagekit/types/cache/invalidation_create_params.py b/src/imagekit/types/cache/invalidation_create_params.py new file mode 100644 index 0000000..55df58f --- /dev/null +++ b/src/imagekit/types/cache/invalidation_create_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InvalidationCreateParams"] + + +class InvalidationCreateParams(TypedDict, total=False): + url: Required[str] + """The full URL of the file to be purged.""" diff --git a/src/imagekit/types/cache/invalidation_create_response.py b/src/imagekit/types/cache/invalidation_create_response.py new file mode 100644 index 0000000..2dfbce8 --- /dev/null +++ b/src/imagekit/types/cache/invalidation_create_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["InvalidationCreateResponse"] + + +class InvalidationCreateResponse(BaseModel): + request_id: Optional[str] = FieldInfo(alias="requestId", default=None) + """Unique identifier of the purge request. + + This can be used to check the status of the purge request. + """ diff --git a/src/imagekit/types/cache/invalidation_get_response.py b/src/imagekit/types/cache/invalidation_get_response.py new file mode 100644 index 0000000..96c1304 --- /dev/null +++ b/src/imagekit/types/cache/invalidation_get_response.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["InvalidationGetResponse"] + + +class InvalidationGetResponse(BaseModel): + status: Optional[Literal["Pending", "Completed"]] = None + """Status of the purge request.""" diff --git a/src/imagekit/types/custom_metadata_field.py b/src/imagekit/types/custom_metadata_field.py new file mode 100644 index 0000000..4c425f7 --- /dev/null +++ b/src/imagekit/types/custom_metadata_field.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["CustomMetadataField", "Schema"] + + +class Schema(BaseModel): + type: Literal["Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect", "MultiSelect"] + """Type of the custom metadata field.""" + + default_value: Union[str, float, bool, List[Union[str, float, bool]], None] = FieldInfo( + alias="defaultValue", default=None + ) + """The default value for this custom metadata field. + + Date type of default value depends on the field type. + """ + + is_value_required: Optional[bool] = FieldInfo(alias="isValueRequired", default=None) + """Specifies if the this custom metadata field is required or not.""" + + max_length: Optional[float] = FieldInfo(alias="maxLength", default=None) + """Maximum length of string. Only set if `type` is set to `Text` or `Textarea`.""" + + max_value: Union[str, float, None] = FieldInfo(alias="maxValue", default=None) + """Maximum value of the field. + + Only set if field type is `Date` or `Number`. For `Date` type field, the value + will be in ISO8601 string format. For `Number` type field, it will be a numeric + value. + """ + + min_length: Optional[float] = FieldInfo(alias="minLength", default=None) + """Minimum length of string. Only set if `type` is set to `Text` or `Textarea`.""" + + min_value: Union[str, float, None] = FieldInfo(alias="minValue", default=None) + """Minimum value of the field. + + Only set if field type is `Date` or `Number`. For `Date` type field, the value + will be in ISO8601 string format. For `Number` type field, it will be a numeric + value. + """ + + select_options: Optional[List[Union[str, float, bool]]] = FieldInfo(alias="selectOptions", default=None) + """An array of allowed values when field type is `SingleSelect` or `MultiSelect`.""" + + +class CustomMetadataField(BaseModel): + id: str + """Unique identifier for the custom metadata field. Use this to update the field.""" + + label: str + """Human readable name of the custom metadata field. + + This name is displayed as form field label to the users while setting field + value on the asset in the media library UI. + """ + + name: str + """API name of the custom metadata field. + + This becomes the key while setting `customMetadata` (key-value object) for an + asset using upload or update API. + """ + + schema_: Schema = FieldInfo(alias="schema") + """An object that describes the rules for the custom metadata field value.""" diff --git a/src/imagekit/types/custom_metadata_field_create_params.py b/src/imagekit/types/custom_metadata_field_create_params.py new file mode 100644 index 0000000..0e265b0 --- /dev/null +++ b/src/imagekit/types/custom_metadata_field_create_params.py @@ -0,0 +1,85 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._types import SequenceNotStr +from .._utils import PropertyInfo + +__all__ = ["CustomMetadataFieldCreateParams", "Schema"] + + +class CustomMetadataFieldCreateParams(TypedDict, total=False): + label: Required[str] + """Human readable name of the custom metadata field. + + This should be unique across all non deleted custom metadata fields. This name + is displayed as form field label to the users while setting field value on an + asset in the media library UI. + """ + + name: Required[str] + """API name of the custom metadata field. + + This should be unique across all (including deleted) custom metadata fields. + """ + + schema: Required[Schema] + + +class Schema(TypedDict, total=False): + type: Required[Literal["Text", "Textarea", "Number", "Date", "Boolean", "SingleSelect", "MultiSelect"]] + """Type of the custom metadata field.""" + + default_value: Annotated[ + Union[str, float, bool, SequenceNotStr[Union[str, float, bool]]], PropertyInfo(alias="defaultValue") + ] + """The default value for this custom metadata field. + + This property is only required if `isValueRequired` property is set to `true`. + The value should match the `type` of custom metadata field. + """ + + is_value_required: Annotated[bool, PropertyInfo(alias="isValueRequired")] + """Sets this custom metadata field as required. + + Setting custom metadata fields on an asset will throw error if the value for all + required fields are not present in upload or update asset API request body. + """ + + max_length: Annotated[float, PropertyInfo(alias="maxLength")] + """Maximum length of string. + + Only set this property if `type` is set to `Text` or `Textarea`. + """ + + max_value: Annotated[Union[str, float], PropertyInfo(alias="maxValue")] + """Maximum value of the field. + + Only set this property if field type is `Date` or `Number`. For `Date` type + field, set the minimum date in ISO8601 string format. For `Number` type field, + set the minimum numeric value. + """ + + min_length: Annotated[float, PropertyInfo(alias="minLength")] + """Minimum length of string. + + Only set this property if `type` is set to `Text` or `Textarea`. + """ + + min_value: Annotated[Union[str, float], PropertyInfo(alias="minValue")] + """Minimum value of the field. + + Only set this property if field type is `Date` or `Number`. For `Date` type + field, set the minimum date in ISO8601 string format. For `Number` type field, + set the minimum numeric value. + """ + + select_options: Annotated[SequenceNotStr[Union[str, float, bool]], PropertyInfo(alias="selectOptions")] + """An array of allowed values. + + This property is only required if `type` property is set to `SingleSelect` or + `MultiSelect`. + """ diff --git a/src/imagekit/types/custom_metadata_field_delete_response.py b/src/imagekit/types/custom_metadata_field_delete_response.py new file mode 100644 index 0000000..247d6a9 --- /dev/null +++ b/src/imagekit/types/custom_metadata_field_delete_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["CustomMetadataFieldDeleteResponse"] + + +class CustomMetadataFieldDeleteResponse(BaseModel): + pass diff --git a/src/imagekit/types/custom_metadata_field_list_params.py b/src/imagekit/types/custom_metadata_field_list_params.py new file mode 100644 index 0000000..41eb2bd --- /dev/null +++ b/src/imagekit/types/custom_metadata_field_list_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["CustomMetadataFieldListParams"] + + +class CustomMetadataFieldListParams(TypedDict, total=False): + include_deleted: Annotated[bool, PropertyInfo(alias="includeDeleted")] + """Set it to `true` to include deleted field objects in the API response.""" diff --git a/src/imagekit/types/custom_metadata_field_list_response.py b/src/imagekit/types/custom_metadata_field_list_response.py new file mode 100644 index 0000000..f392874 --- /dev/null +++ b/src/imagekit/types/custom_metadata_field_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from .custom_metadata_field import CustomMetadataField + +__all__ = ["CustomMetadataFieldListResponse"] + +CustomMetadataFieldListResponse: TypeAlias = List[CustomMetadataField] diff --git a/src/imagekit/types/custom_metadata_field_update_params.py b/src/imagekit/types/custom_metadata_field_update_params.py new file mode 100644 index 0000000..96792a7 --- /dev/null +++ b/src/imagekit/types/custom_metadata_field_update_params.py @@ -0,0 +1,83 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Annotated, TypedDict + +from .._types import SequenceNotStr +from .._utils import PropertyInfo + +__all__ = ["CustomMetadataFieldUpdateParams", "Schema"] + + +class CustomMetadataFieldUpdateParams(TypedDict, total=False): + label: str + """Human readable name of the custom metadata field. + + This should be unique across all non deleted custom metadata fields. This name + is displayed as form field label to the users while setting field value on an + asset in the media library UI. This parameter is required if `schema` is not + provided. + """ + + schema: Schema + """An object that describes the rules for the custom metadata key. + + This parameter is required if `label` is not provided. Note: `type` cannot be + updated and will be ignored if sent with the `schema`. The schema will be + validated as per the existing `type`. + """ + + +class Schema(TypedDict, total=False): + default_value: Annotated[ + Union[str, float, bool, SequenceNotStr[Union[str, float, bool]]], PropertyInfo(alias="defaultValue") + ] + """The default value for this custom metadata field. + + This property is only required if `isValueRequired` property is set to `true`. + The value should match the `type` of custom metadata field. + """ + + is_value_required: Annotated[bool, PropertyInfo(alias="isValueRequired")] + """Sets this custom metadata field as required. + + Setting custom metadata fields on an asset will throw error if the value for all + required fields are not present in upload or update asset API request body. + """ + + max_length: Annotated[float, PropertyInfo(alias="maxLength")] + """Maximum length of string. + + Only set this property if `type` is set to `Text` or `Textarea`. + """ + + max_value: Annotated[Union[str, float], PropertyInfo(alias="maxValue")] + """Maximum value of the field. + + Only set this property if field type is `Date` or `Number`. For `Date` type + field, set the minimum date in ISO8601 string format. For `Number` type field, + set the minimum numeric value. + """ + + min_length: Annotated[float, PropertyInfo(alias="minLength")] + """Minimum length of string. + + Only set this property if `type` is set to `Text` or `Textarea`. + """ + + min_value: Annotated[Union[str, float], PropertyInfo(alias="minValue")] + """Minimum value of the field. + + Only set this property if field type is `Date` or `Number`. For `Date` type + field, set the minimum date in ISO8601 string format. For `Number` type field, + set the minimum numeric value. + """ + + select_options: Annotated[SequenceNotStr[Union[str, float, bool]], PropertyInfo(alias="selectOptions")] + """An array of allowed values. + + This property is only required if `type` property is set to `SingleSelect` or + `MultiSelect`. + """ diff --git a/src/imagekit/types/file.py b/src/imagekit/types/file.py new file mode 100644 index 0000000..69b0b39 --- /dev/null +++ b/src/imagekit/types/file.py @@ -0,0 +1,121 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["File", "AITag", "VersionInfo"] + + +class AITag(BaseModel): + confidence: Optional[float] = None + """Confidence score of the tag.""" + + name: Optional[str] = None + """Name of the tag.""" + + source: Optional[str] = None + """Source of the tag. + + Possible values are `google-auto-tagging` and `aws-auto-tagging`. + """ + + +class VersionInfo(BaseModel): + id: Optional[str] = None + """Unique identifier of the file version.""" + + name: Optional[str] = None + """Name of the file version.""" + + +class File(BaseModel): + ai_tags: Optional[List[AITag]] = FieldInfo(alias="AITags", default=None) + """An array of tags assigned to the file by auto tagging.""" + + created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) + """Date and time when the file was uploaded. + + The date and time is in ISO8601 format. + """ + + custom_coordinates: Optional[str] = FieldInfo(alias="customCoordinates", default=None) + """An string with custom coordinates of the file.""" + + custom_metadata: Optional[Dict[str, object]] = FieldInfo(alias="customMetadata", default=None) + """An object with custom metadata for the file.""" + + description: Optional[str] = None + """Optional text to describe the contents of the file. + + Can be set by the user or the ai-auto-description extension. + """ + + file_id: Optional[str] = FieldInfo(alias="fileId", default=None) + """Unique identifier of the asset.""" + + file_path: Optional[str] = FieldInfo(alias="filePath", default=None) + """Path of the file. + + This is the path you would use in the URL to access the file. For example, if + the file is at the root of the media library, the path will be `/file.jpg`. If + the file is inside a folder named `images`, the path will be `/images/file.jpg`. + """ + + file_type: Optional[str] = FieldInfo(alias="fileType", default=None) + """Type of the file. Possible values are `image`, `non-image`.""" + + has_alpha: Optional[bool] = FieldInfo(alias="hasAlpha", default=None) + """Specifies if the image has an alpha channel.""" + + height: Optional[float] = None + """Height of the file.""" + + is_private_file: Optional[bool] = FieldInfo(alias="isPrivateFile", default=None) + """Specifies if the file is private or not.""" + + is_published: Optional[bool] = FieldInfo(alias="isPublished", default=None) + """Specifies if the file is published or not.""" + + mime: Optional[str] = None + """MIME type of the file.""" + + name: Optional[str] = None + """Name of the asset.""" + + size: Optional[float] = None + """Size of the file in bytes.""" + + tags: Optional[List[str]] = None + """An array of tags assigned to the file. + + Tags are used to search files in the media library. + """ + + thumbnail: Optional[str] = None + """URL of the thumbnail image. + + This URL is used to access the thumbnail image of the file in the media library. + """ + + type: Optional[Literal["file", "file-version"]] = None + """Type of the asset.""" + + updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) + """Date and time when the file was last updated. + + The date and time is in ISO8601 format. + """ + + url: Optional[str] = None + """URL of the file.""" + + version_info: Optional[VersionInfo] = FieldInfo(alias="versionInfo", default=None) + """An object with details of the file version.""" + + width: Optional[float] = None + """Width of the file.""" diff --git a/src/imagekit/types/file_copy_params.py b/src/imagekit/types/file_copy_params.py new file mode 100644 index 0000000..e8a8f94 --- /dev/null +++ b/src/imagekit/types/file_copy_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FileCopyParams"] + + +class FileCopyParams(TypedDict, total=False): + destination_path: Required[Annotated[str, PropertyInfo(alias="destinationPath")]] + """Full path to the folder you want to copy the above file into.""" + + source_file_path: Required[Annotated[str, PropertyInfo(alias="sourceFilePath")]] + """The full path of the file you want to copy.""" + + include_file_versions: Annotated[bool, PropertyInfo(alias="includeFileVersions")] + """Option to copy all versions of a file. + + By default, only the current version of the file is copied. When set to true, + all versions of the file will be copied. Default value - `false`. + """ diff --git a/src/imagekit/types/file_copy_response.py b/src/imagekit/types/file_copy_response.py new file mode 100644 index 0000000..81267b0 --- /dev/null +++ b/src/imagekit/types/file_copy_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["FileCopyResponse"] + + +class FileCopyResponse(BaseModel): + pass diff --git a/src/imagekit/types/file_move_params.py b/src/imagekit/types/file_move_params.py new file mode 100644 index 0000000..1fc2a9e --- /dev/null +++ b/src/imagekit/types/file_move_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FileMoveParams"] + + +class FileMoveParams(TypedDict, total=False): + destination_path: Required[Annotated[str, PropertyInfo(alias="destinationPath")]] + """Full path to the folder you want to move the above file into.""" + + source_file_path: Required[Annotated[str, PropertyInfo(alias="sourceFilePath")]] + """The full path of the file you want to move.""" diff --git a/src/imagekit/types/file_move_response.py b/src/imagekit/types/file_move_response.py new file mode 100644 index 0000000..b92b949 --- /dev/null +++ b/src/imagekit/types/file_move_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["FileMoveResponse"] + + +class FileMoveResponse(BaseModel): + pass diff --git a/src/imagekit/types/file_rename_params.py b/src/imagekit/types/file_rename_params.py new file mode 100644 index 0000000..22ada89 --- /dev/null +++ b/src/imagekit/types/file_rename_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FileRenameParams"] + + +class FileRenameParams(TypedDict, total=False): + file_path: Required[Annotated[str, PropertyInfo(alias="filePath")]] + """The full path of the file you want to rename.""" + + new_file_name: Required[Annotated[str, PropertyInfo(alias="newFileName")]] + """The new name of the file. A filename can contain: + + Alphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, + and numerals in other languages). Special Characters: `.`, `_`, and `-`. + + Any other character, including space, will be replaced by `_`. + """ + + purge_cache: Annotated[bool, PropertyInfo(alias="purgeCache")] + """Option to purge cache for the old file and its versions' URLs. + + When set to true, it will internally issue a purge cache request on CDN to + remove cached content of old file and its versions. This purge request is + counted against your monthly purge quota. + + Note: If the old file were accessible at + `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be + issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard + at the end). It will remove the file and its versions' URLs and any + transformations made using query parameters on this file or its versions. + However, the cache for file transformations made using path parameters will + persist. You can purge them using the purge API. For more details, refer to the + purge API documentation. + + Default value - `false` + """ diff --git a/src/imagekit/types/file_rename_response.py b/src/imagekit/types/file_rename_response.py new file mode 100644 index 0000000..2ef8d82 --- /dev/null +++ b/src/imagekit/types/file_rename_response.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["FileRenameResponse"] + + +class FileRenameResponse(BaseModel): + purge_request_id: Optional[str] = FieldInfo(alias="purgeRequestId", default=None) + """Unique identifier of the purge request. + + This can be used to check the status of the purge request. + """ diff --git a/src/imagekit/types/file_update_params.py b/src/imagekit/types/file_update_params.py new file mode 100644 index 0000000..fefbe40 --- /dev/null +++ b/src/imagekit/types/file_update_params.py @@ -0,0 +1,156 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from .._types import SequenceNotStr +from .._utils import PropertyInfo + +__all__ = [ + "FileUpdateParams", + "Update", + "UpdateUpdateFileDetails", + "UpdateUpdateFileDetailsExtension", + "UpdateUpdateFileDetailsExtensionRemoveBg", + "UpdateUpdateFileDetailsExtensionRemoveBgOptions", + "UpdateUpdateFileDetailsExtensionAutoTaggingExtension", + "UpdateUpdateFileDetailsExtensionAIAutoDescription", + "UpdateChangePublicationStatus", + "UpdateChangePublicationStatusPublish", +] + + +class FileUpdateParams(TypedDict, total=False): + update: Update + + +class UpdateUpdateFileDetailsExtensionRemoveBgOptions(TypedDict, total=False): + add_shadow: bool + """Whether to add an artificial shadow to the result. + + Default is false. Note: Adding shadows is currently only supported for car + photos. + """ + + bg_color: str + """ + Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + empty. + """ + + bg_image_url: str + """Sets a background image from a URL. + + If this parameter is set, `bg_color` must be empty. + """ + + semitransparency: bool + """Allows semi-transparent regions in the result. + + Default is true. Note: Semitransparency is currently only supported for car + windows. + """ + + +class UpdateUpdateFileDetailsExtensionRemoveBg(TypedDict, total=False): + name: Required[Literal["remove-bg"]] + """Specifies the background removal extension.""" + + options: UpdateUpdateFileDetailsExtensionRemoveBgOptions + + +class UpdateUpdateFileDetailsExtensionAutoTaggingExtension(TypedDict, total=False): + max_tags: Required[Annotated[int, PropertyInfo(alias="maxTags")]] + """Maximum number of tags to attach to the asset.""" + + min_confidence: Required[Annotated[int, PropertyInfo(alias="minConfidence")]] + """Minimum confidence level for tags to be considered valid.""" + + name: Required[Literal["google-auto-tagging", "aws-auto-tagging"]] + """Specifies the auto-tagging extension used.""" + + +class UpdateUpdateFileDetailsExtensionAIAutoDescription(TypedDict, total=False): + name: Required[Literal["ai-auto-description"]] + """Specifies the auto description extension.""" + + +UpdateUpdateFileDetailsExtension: TypeAlias = Union[ + UpdateUpdateFileDetailsExtensionRemoveBg, + UpdateUpdateFileDetailsExtensionAutoTaggingExtension, + UpdateUpdateFileDetailsExtensionAIAutoDescription, +] + + +class UpdateUpdateFileDetails(TypedDict, total=False): + custom_coordinates: Annotated[Optional[str], PropertyInfo(alias="customCoordinates")] + """Define an important area in the image in the format `x,y,width,height` e.g. + + `10,10,100,100`. Send `null` to unset this value. + """ + + custom_metadata: Annotated[Dict[str, object], PropertyInfo(alias="customMetadata")] + """A key-value data to be associated with the asset. + + To unset a key, send `null` value for that key. Before setting any custom + metadata on an asset you have to create the field using custom metadata fields + API. + """ + + description: str + """Optional text to describe the contents of the file.""" + + extensions: Iterable[UpdateUpdateFileDetailsExtension] + """Array of extensions to be applied to the asset. + + Each extension can be configured with specific parameters based on the extension + type. + """ + + remove_ai_tags: Annotated[Union[SequenceNotStr[str], Literal["all"]], PropertyInfo(alias="removeAITags")] + """An array of AITags associated with the file that you want to remove, e.g. + + `["car", "vehicle", "motorsports"]`. + + If you want to remove all AITags associated with the file, send a string - + "all". + + Note: The remove operation for `AITags` executes before any of the `extensions` + are processed. + """ + + tags: Optional[SequenceNotStr[str]] + """An array of tags associated with the file, such as `["tag1", "tag2"]`. + + Send `null` to unset all tags associated with the file. + """ + + webhook_url: Annotated[str, PropertyInfo(alias="webhookUrl")] + """ + The final status of extensions after they have completed execution will be + delivered to this endpoint as a POST request. + [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + about the webhook payload structure. + """ + + +class UpdateChangePublicationStatusPublish(TypedDict, total=False): + is_published: Required[Annotated[bool, PropertyInfo(alias="isPublished")]] + """Set to `true` to publish the file. Set to `false` to unpublish the file.""" + + include_file_versions: Annotated[bool, PropertyInfo(alias="includeFileVersions")] + """Set to `true` to publish/unpublish all versions of the file. + + Set to `false` to publish/unpublish only the current version of the file. + """ + + +class UpdateChangePublicationStatus(TypedDict, total=False): + publish: UpdateChangePublicationStatusPublish + """Configure the publication status of a file and its versions.""" + + +Update: TypeAlias = Union[UpdateUpdateFileDetails, UpdateChangePublicationStatus] diff --git a/src/imagekit/types/file_update_response.py b/src/imagekit/types/file_update_response.py new file mode 100644 index 0000000..34b9731 --- /dev/null +++ b/src/imagekit/types/file_update_response.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .file import File +from .._models import BaseModel + +__all__ = ["FileUpdateResponse", "FileUpdateResponseExtensionStatus"] + + +class FileUpdateResponseExtensionStatus(BaseModel): + ai_auto_description: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="ai-auto-description", default=None + ) + + aws_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="aws-auto-tagging", default=None + ) + + google_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="google-auto-tagging", default=None + ) + + remove_bg: Optional[Literal["success", "pending", "failed"]] = FieldInfo(alias="remove-bg", default=None) + + +class FileUpdateResponse(File): + extension_status: Optional[FileUpdateResponseExtensionStatus] = FieldInfo(alias="extensionStatus", default=None) diff --git a/src/imagekit/types/file_upload_params.py b/src/imagekit/types/file_upload_params.py new file mode 100644 index 0000000..961db92 --- /dev/null +++ b/src/imagekit/types/file_upload_params.py @@ -0,0 +1,352 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Union, Iterable +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from .._types import FileTypes, SequenceNotStr +from .._utils import PropertyInfo + +__all__ = [ + "FileUploadParams", + "Extension", + "ExtensionRemoveBg", + "ExtensionRemoveBgOptions", + "ExtensionAutoTaggingExtension", + "ExtensionAIAutoDescription", + "Transformation", + "TransformationPost", + "TransformationPostTransformation", + "TransformationPostGifToVideo", + "TransformationPostThumbnail", + "TransformationPostAbs", +] + + +class FileUploadParams(TypedDict, total=False): + file: Required[FileTypes] + """The API accepts any of the following: + + - **Binary data** – send the raw bytes as `multipart/form-data`. + - **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can + fetch. + - **Base64 string** – the file encoded as a Base64 data URI or plain Base64. + + When supplying a URL, the server must receive the response headers within 8 + seconds; otherwise the request fails with 400 Bad Request. + """ + + file_name: Required[Annotated[str, PropertyInfo(alias="fileName")]] + """The name with which the file has to be uploaded. The file name can contain: + + - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`. + - Special Characters: `.`, `-` + + Any other character including space will be replaced by `_` + """ + + token: str + """ + A unique value that the ImageKit.io server will use to recognize and prevent + subsequent retries for the same request. We suggest using V4 UUIDs, or another + random string with enough entropy to avoid collisions. This field is only + required for authentication when uploading a file from the client side. + + **Note**: Sending a value that has been used in the past will result in a + validation error. Even if your previous request resulted in an error, you should + always send a new value for this field. + """ + + checks: str + """ + Server-side checks to run on the asset. Read more about + [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks). + """ + + custom_coordinates: Annotated[str, PropertyInfo(alias="customCoordinates")] + """Define an important area in the image. + + This is only relevant for image type files. + + - To be passed as a string with the x and y coordinates of the top-left corner, + and width and height of the area of interest in the format `x,y,width,height`. + For example - `10,10,100,100` + - Can be used with fo-customtransformation. + - If this field is not specified and the file is overwritten, then + customCoordinates will be removed. + """ + + custom_metadata: Annotated[Dict[str, object], PropertyInfo(alias="customMetadata")] + """JSON key-value pairs to associate with the asset. + + Create the custom metadata fields before setting these values. + """ + + description: str + """Optional text to describe the contents of the file.""" + + expire: int + """The time until your signature is valid. + + It must be a [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 + hour into the future. It should be in seconds. This field is only required for + authentication when uploading a file from the client side. + """ + + extensions: Iterable[Extension] + """Array of extensions to be applied to the image. + + Each extension can be configured with specific parameters based on the extension + type. + """ + + folder: str + """The folder path in which the image has to be uploaded. + + If the folder(s) didn't exist before, a new folder(s) is created. + + The folder name can contain: + + - Alphanumeric Characters: `a-z` , `A-Z` , `0-9` + - Special Characters: `/` , `_` , `-` + + Using multiple `/` creates a nested folder. + """ + + is_private_file: Annotated[bool, PropertyInfo(alias="isPrivateFile")] + """Whether to mark the file as private or not. + + If `true`, the file is marked as private and is accessible only using named + transformation or signed URL. + """ + + is_published: Annotated[bool, PropertyInfo(alias="isPublished")] + """Whether to upload file as published or not. + + If `false`, the file is marked as unpublished, which restricts access to the + file only via the media library. Files in draft or unpublished state can only be + publicly accessed after being published. + + The option to upload in draft state is only available in custom enterprise + pricing plans. + """ + + overwrite_ai_tags: Annotated[bool, PropertyInfo(alias="overwriteAITags")] + """ + If set to `true` and a file already exists at the exact location, its AITags + will be removed. Set `overwriteAITags` to `false` to preserve AITags. + """ + + overwrite_custom_metadata: Annotated[bool, PropertyInfo(alias="overwriteCustomMetadata")] + """ + If the request does not have `customMetadata`, and a file already exists at the + exact location, existing customMetadata will be removed. + """ + + overwrite_file: Annotated[bool, PropertyInfo(alias="overwriteFile")] + """ + If `false` and `useUniqueFileName` is also `false`, and a file already exists at + the exact location, upload API will return an error immediately. + """ + + overwrite_tags: Annotated[bool, PropertyInfo(alias="overwriteTags")] + """ + If the request does not have `tags`, and a file already exists at the exact + location, existing tags will be removed. + """ + + public_key: Annotated[str, PropertyInfo(alias="publicKey")] + """Your ImageKit.io public key. + + This field is only required for authentication when uploading a file from the + client side. + """ + + response_fields: Annotated[ + List[ + Literal[ + "tags", + "customCoordinates", + "isPrivateFile", + "embeddedMetadata", + "isPublished", + "customMetadata", + "metadata", + ] + ], + PropertyInfo(alias="responseFields"), + ] + """Array of response field keys to include in the API response body.""" + + signature: str + """ + HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a + key. Learn how to create a signature on the page below. This should be in + lowercase. + + Signature must be calculated on the server-side. This field is only required for + authentication when uploading a file from the client side. + """ + + tags: SequenceNotStr[str] + """Set the tags while uploading the file. Provide an array of tag strings (e.g. + + `["tag1", "tag2", "tag3"]`). The combined length of all tag characters must not + exceed 500, and the `%` character is not allowed. If this field is not specified + and the file is overwritten, the existing tags will be removed. + """ + + transformation: Transformation + """Configure pre-processing (`pre`) and post-processing (`post`) transformations. + + - `pre` — applied before the file is uploaded to the Media Library. + Useful for reducing file size or applying basic optimizations upfront (e.g., + resize, compress). + + - `post` — applied immediately after upload. + Ideal for generating transformed versions (like video encodes or thumbnails) + in advance, so they're ready for delivery without delay. + + You can mix and match any combination of post-processing types. + """ + + use_unique_file_name: Annotated[bool, PropertyInfo(alias="useUniqueFileName")] + """Whether to use a unique filename for this file or not. + + If `true`, ImageKit.io will add a unique suffix to the filename parameter to get + a unique filename. + + If `false`, then the image is uploaded with the provided filename parameter, and + any existing file with the same name is replaced. + """ + + webhook_url: Annotated[str, PropertyInfo(alias="webhookUrl")] + """ + The final status of extensions after they have completed execution will be + delivered to this endpoint as a POST request. + [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) + about the webhook payload structure. + """ + + +class ExtensionRemoveBgOptions(TypedDict, total=False): + add_shadow: bool + """Whether to add an artificial shadow to the result. + + Default is false. Note: Adding shadows is currently only supported for car + photos. + """ + + bg_color: str + """ + Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or + color name (e.g., "green"). If this parameter is set, `bg_image_url` must be + empty. + """ + + bg_image_url: str + """Sets a background image from a URL. + + If this parameter is set, `bg_color` must be empty. + """ + + semitransparency: bool + """Allows semi-transparent regions in the result. + + Default is true. Note: Semitransparency is currently only supported for car + windows. + """ + + +class ExtensionRemoveBg(TypedDict, total=False): + name: Required[Literal["remove-bg"]] + """Specifies the background removal extension.""" + + options: ExtensionRemoveBgOptions + + +class ExtensionAutoTaggingExtension(TypedDict, total=False): + max_tags: Required[Annotated[int, PropertyInfo(alias="maxTags")]] + """Maximum number of tags to attach to the asset.""" + + min_confidence: Required[Annotated[int, PropertyInfo(alias="minConfidence")]] + """Minimum confidence level for tags to be considered valid.""" + + name: Required[Literal["google-auto-tagging", "aws-auto-tagging"]] + """Specifies the auto-tagging extension used.""" + + +class ExtensionAIAutoDescription(TypedDict, total=False): + name: Required[Literal["ai-auto-description"]] + """Specifies the auto description extension.""" + + +Extension: TypeAlias = Union[ExtensionRemoveBg, ExtensionAutoTaggingExtension, ExtensionAIAutoDescription] + + +class TransformationPostTransformation(TypedDict, total=False): + type: Required[Literal["transformation"]] + """Transformation type.""" + + value: Required[str] + """Transformation string (e.g. + + `w-200,h-200`). + Same syntax as ImageKit URL-based transformations. + """ + + +class TransformationPostGifToVideo(TypedDict, total=False): + type: Required[Literal["gif-to-video"]] + """Converts an animated GIF into an MP4.""" + + value: str + """Optional transformation string to apply to the output video. + + **Example**: `q-80` + """ + + +class TransformationPostThumbnail(TypedDict, total=False): + type: Required[Literal["thumbnail"]] + """Generates a thumbnail image.""" + + value: str + """Optional transformation string. + + **Example**: `w-150,h-150` + """ + + +class TransformationPostAbs(TypedDict, total=False): + protocol: Required[Literal["hls", "dash"]] + """Streaming protocol to use (`hls` or `dash`).""" + + type: Required[Literal["abs"]] + """Adaptive Bitrate Streaming (ABS) setup.""" + + value: Required[str] + """ + List of different representations you want to create separated by an underscore. + """ + + +TransformationPost: TypeAlias = Union[ + TransformationPostTransformation, TransformationPostGifToVideo, TransformationPostThumbnail, TransformationPostAbs +] + + +class Transformation(TypedDict, total=False): + post: Iterable[TransformationPost] + """List of transformations to apply _after_ the file is uploaded. + + Each item must match one of the following types: `transformation`, + `gif-to-video`, `thumbnail`, `abs`. + """ + + pre: str + """Transformation string to apply before uploading the file to the Media Library. + + Useful for optimizing files at ingestion. + """ diff --git a/src/imagekit/types/file_upload_response.py b/src/imagekit/types/file_upload_response.py new file mode 100644 index 0000000..56a1098 --- /dev/null +++ b/src/imagekit/types/file_upload_response.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .metadata import Metadata + +__all__ = ["FileUploadResponse", "AITag", "ExtensionStatus", "VersionInfo"] + + +class AITag(BaseModel): + confidence: Optional[float] = None + """Confidence score of the tag.""" + + name: Optional[str] = None + """Name of the tag.""" + + source: Optional[str] = None + """Array of `AITags` associated with the image. + + If no `AITags` are set, it will be null. These tags can be added using the + `google-auto-tagging` or `aws-auto-tagging` extensions. + """ + + +class ExtensionStatus(BaseModel): + ai_auto_description: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="ai-auto-description", default=None + ) + + aws_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="aws-auto-tagging", default=None + ) + + google_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="google-auto-tagging", default=None + ) + + remove_bg: Optional[Literal["success", "pending", "failed"]] = FieldInfo(alias="remove-bg", default=None) + + +class VersionInfo(BaseModel): + id: Optional[str] = None + """Unique identifier of the file version.""" + + name: Optional[str] = None + """Name of the file version.""" + + +class FileUploadResponse(BaseModel): + ai_tags: Optional[List[AITag]] = FieldInfo(alias="AITags", default=None) + """An array of tags assigned to the uploaded file by auto tagging.""" + + audio_codec: Optional[str] = FieldInfo(alias="audioCodec", default=None) + """The audio codec used in the video (only for video).""" + + bit_rate: Optional[int] = FieldInfo(alias="bitRate", default=None) + """The bit rate of the video in kbps (only for video).""" + + custom_coordinates: Optional[str] = FieldInfo(alias="customCoordinates", default=None) + """ + Value of custom coordinates associated with the image in the format + `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + Send `customCoordinates` in `responseFields` in API request to get the value of + this field. + """ + + custom_metadata: Optional[Dict[str, object]] = FieldInfo(alias="customMetadata", default=None) + """A key-value data associated with the asset. + + Use `responseField` in API request to get `customMetadata` in the upload API + response. Before setting any custom metadata on an asset, you have to create the + field using custom metadata fields API. Send `customMetadata` in + `responseFields` in API request to get the value of this field. + """ + + description: Optional[str] = None + """Optional text to describe the contents of the file. + + Can be set by the user or the ai-auto-description extension. + """ + + duration: Optional[int] = None + """The duration of the video in seconds (only for video).""" + + embedded_metadata: Optional[Dict[str, object]] = FieldInfo(alias="embeddedMetadata", default=None) + """Consolidated embedded metadata associated with the file. + + It includes exif, iptc, and xmp data. Send `embeddedMetadata` in + `responseFields` in API request to get embeddedMetadata in the upload API + response. + """ + + extension_status: Optional[ExtensionStatus] = FieldInfo(alias="extensionStatus", default=None) + """ + Extension names with their processing status at the time of completion of the + request. It could have one of the following status values: + + `success`: The extension has been successfully applied. `failed`: The extension + has failed and will not be retried. `pending`: The extension will finish + processing in some time. On completion, the final status (success / failed) will + be sent to the `webhookUrl` provided. + + If no extension was requested, then this parameter is not returned. + """ + + file_id: Optional[str] = FieldInfo(alias="fileId", default=None) + """Unique fileId. + + Store this fileld in your database, as this will be used to perform update + action on this file. + """ + + file_path: Optional[str] = FieldInfo(alias="filePath", default=None) + """The relative path of the file in the media library e.g. + + `/marketing-assets/new-banner.jpg`. + """ + + file_type: Optional[str] = FieldInfo(alias="fileType", default=None) + """Type of the uploaded file. Possible values are `image`, `non-image`.""" + + height: Optional[float] = None + """Height of the image in pixels (Only for images)""" + + is_private_file: Optional[bool] = FieldInfo(alias="isPrivateFile", default=None) + """Is the file marked as private. + + It can be either `true` or `false`. Send `isPrivateFile` in `responseFields` in + API request to get the value of this field. + """ + + is_published: Optional[bool] = FieldInfo(alias="isPublished", default=None) + """Is the file published or in draft state. + + It can be either `true` or `false`. Send `isPublished` in `responseFields` in + API request to get the value of this field. + """ + + metadata: Optional[Metadata] = None + """Legacy metadata. + + Send `metadata` in `responseFields` in API request to get metadata in the upload + API response. + """ + + name: Optional[str] = None + """Name of the asset.""" + + size: Optional[float] = None + """Size of the image file in Bytes.""" + + tags: Optional[List[str]] = None + """The array of tags associated with the asset. + + If no tags are set, it will be `null`. Send `tags` in `responseFields` in API + request to get the value of this field. + """ + + thumbnail_url: Optional[str] = FieldInfo(alias="thumbnailUrl", default=None) + """In the case of an image, a small thumbnail URL.""" + + url: Optional[str] = None + """A publicly accessible URL of the file.""" + + version_info: Optional[VersionInfo] = FieldInfo(alias="versionInfo", default=None) + """An object containing the file or file version's `id` (versionId) and `name`.""" + + video_codec: Optional[str] = FieldInfo(alias="videoCodec", default=None) + """The video codec used in the video (only for video).""" + + width: Optional[float] = None + """Width of the image in pixels (Only for Images)""" diff --git a/src/imagekit/types/files/__init__.py b/src/imagekit/types/files/__init__.py new file mode 100644 index 0000000..b46129a --- /dev/null +++ b/src/imagekit/types/files/__init__.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .bulk_delete_params import BulkDeleteParams as BulkDeleteParams +from .bulk_add_tags_params import BulkAddTagsParams as BulkAddTagsParams +from .bulk_delete_response import BulkDeleteResponse as BulkDeleteResponse +from .version_list_response import VersionListResponse as VersionListResponse +from .bulk_add_tags_response import BulkAddTagsResponse as BulkAddTagsResponse +from .bulk_remove_tags_params import BulkRemoveTagsParams as BulkRemoveTagsParams +from .version_delete_response import VersionDeleteResponse as VersionDeleteResponse +from .bulk_remove_tags_response import BulkRemoveTagsResponse as BulkRemoveTagsResponse +from .bulk_remove_ai_tags_params import BulkRemoveAITagsParams as BulkRemoveAITagsParams +from .bulk_remove_ai_tags_response import BulkRemoveAITagsResponse as BulkRemoveAITagsResponse +from .metadata_get_from_url_params import MetadataGetFromURLParams as MetadataGetFromURLParams diff --git a/src/imagekit/types/files/bulk_add_tags_params.py b/src/imagekit/types/files/bulk_add_tags_params.py new file mode 100644 index 0000000..f83f577 --- /dev/null +++ b/src/imagekit/types/files/bulk_add_tags_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["BulkAddTagsParams"] + + +class BulkAddTagsParams(TypedDict, total=False): + file_ids: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="fileIds")]] + """An array of fileIds to which you want to add tags.""" + + tags: Required[SequenceNotStr[str]] + """An array of tags that you want to add to the files.""" diff --git a/src/imagekit/types/files/bulk_add_tags_response.py b/src/imagekit/types/files/bulk_add_tags_response.py new file mode 100644 index 0000000..059ae52 --- /dev/null +++ b/src/imagekit/types/files/bulk_add_tags_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["BulkAddTagsResponse"] + + +class BulkAddTagsResponse(BaseModel): + successfully_updated_file_ids: Optional[List[str]] = FieldInfo(alias="successfullyUpdatedFileIds", default=None) + """An array of fileIds that in which tags were successfully added.""" diff --git a/src/imagekit/types/files/bulk_delete_params.py b/src/imagekit/types/files/bulk_delete_params.py new file mode 100644 index 0000000..2df1ee5 --- /dev/null +++ b/src/imagekit/types/files/bulk_delete_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["BulkDeleteParams"] + + +class BulkDeleteParams(TypedDict, total=False): + file_ids: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="fileIds")]] + """An array of fileIds which you want to delete.""" diff --git a/src/imagekit/types/files/bulk_delete_response.py b/src/imagekit/types/files/bulk_delete_response.py new file mode 100644 index 0000000..af431f3 --- /dev/null +++ b/src/imagekit/types/files/bulk_delete_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["BulkDeleteResponse"] + + +class BulkDeleteResponse(BaseModel): + successfully_deleted_file_ids: Optional[List[str]] = FieldInfo(alias="successfullyDeletedFileIds", default=None) + """An array of fileIds that were successfully deleted.""" diff --git a/src/imagekit/types/files/bulk_remove_ai_tags_params.py b/src/imagekit/types/files/bulk_remove_ai_tags_params.py new file mode 100644 index 0000000..7d69ed3 --- /dev/null +++ b/src/imagekit/types/files/bulk_remove_ai_tags_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["BulkRemoveAITagsParams"] + + +class BulkRemoveAITagsParams(TypedDict, total=False): + ai_tags: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="AITags")]] + """An array of AITags that you want to remove from the files.""" + + file_ids: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="fileIds")]] + """An array of fileIds from which you want to remove AITags.""" diff --git a/src/imagekit/types/files/bulk_remove_ai_tags_response.py b/src/imagekit/types/files/bulk_remove_ai_tags_response.py new file mode 100644 index 0000000..155d03c --- /dev/null +++ b/src/imagekit/types/files/bulk_remove_ai_tags_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["BulkRemoveAITagsResponse"] + + +class BulkRemoveAITagsResponse(BaseModel): + successfully_updated_file_ids: Optional[List[str]] = FieldInfo(alias="successfullyUpdatedFileIds", default=None) + """An array of fileIds that in which AITags were successfully removed.""" diff --git a/src/imagekit/types/files/bulk_remove_tags_params.py b/src/imagekit/types/files/bulk_remove_tags_params.py new file mode 100644 index 0000000..02e7f24 --- /dev/null +++ b/src/imagekit/types/files/bulk_remove_tags_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._types import SequenceNotStr +from ..._utils import PropertyInfo + +__all__ = ["BulkRemoveTagsParams"] + + +class BulkRemoveTagsParams(TypedDict, total=False): + file_ids: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="fileIds")]] + """An array of fileIds from which you want to remove tags.""" + + tags: Required[SequenceNotStr[str]] + """An array of tags that you want to remove from the files.""" diff --git a/src/imagekit/types/files/bulk_remove_tags_response.py b/src/imagekit/types/files/bulk_remove_tags_response.py new file mode 100644 index 0000000..37c1c67 --- /dev/null +++ b/src/imagekit/types/files/bulk_remove_tags_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["BulkRemoveTagsResponse"] + + +class BulkRemoveTagsResponse(BaseModel): + successfully_updated_file_ids: Optional[List[str]] = FieldInfo(alias="successfullyUpdatedFileIds", default=None) + """An array of fileIds that in which tags were successfully removed.""" diff --git a/src/imagekit/types/files/metadata_get_from_url_params.py b/src/imagekit/types/files/metadata_get_from_url_params.py new file mode 100644 index 0000000..6fdbb63 --- /dev/null +++ b/src/imagekit/types/files/metadata_get_from_url_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["MetadataGetFromURLParams"] + + +class MetadataGetFromURLParams(TypedDict, total=False): + url: Required[str] + """Should be a valid file URL. + + It should be accessible using your ImageKit.io account. + """ diff --git a/src/imagekit/types/files/version_delete_response.py b/src/imagekit/types/files/version_delete_response.py new file mode 100644 index 0000000..51b121f --- /dev/null +++ b/src/imagekit/types/files/version_delete_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["VersionDeleteResponse"] + + +class VersionDeleteResponse(BaseModel): + pass diff --git a/src/imagekit/types/files/version_list_response.py b/src/imagekit/types/files/version_list_response.py new file mode 100644 index 0000000..6d0c3f0 --- /dev/null +++ b/src/imagekit/types/files/version_list_response.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import TypeAlias + +from ..file import File + +__all__ = ["VersionListResponse"] + +VersionListResponse: TypeAlias = List[File] diff --git a/src/imagekit/types/folder.py b/src/imagekit/types/folder.py new file mode 100644 index 0000000..17b7287 --- /dev/null +++ b/src/imagekit/types/folder.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["Folder"] + + +class Folder(BaseModel): + created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None) + """Date and time when the folder was created. + + The date and time is in ISO8601 format. + """ + + folder_id: Optional[str] = FieldInfo(alias="folderId", default=None) + """Unique identifier of the asset.""" + + folder_path: Optional[str] = FieldInfo(alias="folderPath", default=None) + """Path of the folder. + + This is the path you would use in the URL to access the folder. For example, if + the folder is at the root of the media library, the path will be /folder. If the + folder is inside another folder named images, the path will be /images/folder. + """ + + name: Optional[str] = None + """Name of the asset.""" + + type: Optional[Literal["folder"]] = None + """Type of the asset.""" + + updated_at: Optional[datetime] = FieldInfo(alias="updatedAt", default=None) + """Date and time when the folder was last updated. + + The date and time is in ISO8601 format. + """ diff --git a/src/imagekit/types/folder_copy_params.py b/src/imagekit/types/folder_copy_params.py new file mode 100644 index 0000000..4ccc7fa --- /dev/null +++ b/src/imagekit/types/folder_copy_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FolderCopyParams"] + + +class FolderCopyParams(TypedDict, total=False): + destination_path: Required[Annotated[str, PropertyInfo(alias="destinationPath")]] + """ + Full path to the destination folder where you want to copy the source folder + into. + """ + + source_folder_path: Required[Annotated[str, PropertyInfo(alias="sourceFolderPath")]] + """The full path to the source folder you want to copy.""" + + include_versions: Annotated[bool, PropertyInfo(alias="includeVersions")] + """Option to copy all versions of files that are nested inside the selected folder. + + By default, only the current version of each file will be copied. When set to + true, all versions of each file will be copied. Default value - `false`. + """ diff --git a/src/imagekit/types/folder_copy_response.py b/src/imagekit/types/folder_copy_response.py new file mode 100644 index 0000000..6ca3b1a --- /dev/null +++ b/src/imagekit/types/folder_copy_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["FolderCopyResponse"] + + +class FolderCopyResponse(BaseModel): + job_id: str = FieldInfo(alias="jobId") + """Unique identifier of the bulk job. + + This can be used to check the status of the bulk job. + """ diff --git a/src/imagekit/types/folder_create_params.py b/src/imagekit/types/folder_create_params.py new file mode 100644 index 0000000..82863b5 --- /dev/null +++ b/src/imagekit/types/folder_create_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FolderCreateParams"] + + +class FolderCreateParams(TypedDict, total=False): + folder_name: Required[Annotated[str, PropertyInfo(alias="folderName")]] + """The folder will be created with this name. + + All characters except alphabets and numbers (inclusive of unicode letters, + marks, and numerals in other languages) will be replaced by an underscore i.e. + `_`. + """ + + parent_folder_path: Required[Annotated[str, PropertyInfo(alias="parentFolderPath")]] + """ + The folder where the new folder should be created, for root use `/` else the + path e.g. `containing/folder/`. + + Note: If any folder(s) is not present in the parentFolderPath parameter, it will + be automatically created. For example, if you pass `/product/images/summer`, + then `product`, `images`, and `summer` folders will be created if they don't + already exist. + """ diff --git a/src/imagekit/types/folder_create_response.py b/src/imagekit/types/folder_create_response.py new file mode 100644 index 0000000..1f10670 --- /dev/null +++ b/src/imagekit/types/folder_create_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["FolderCreateResponse"] + + +class FolderCreateResponse(BaseModel): + pass diff --git a/src/imagekit/types/folder_delete_params.py b/src/imagekit/types/folder_delete_params.py new file mode 100644 index 0000000..8b5ff52 --- /dev/null +++ b/src/imagekit/types/folder_delete_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FolderDeleteParams"] + + +class FolderDeleteParams(TypedDict, total=False): + folder_path: Required[Annotated[str, PropertyInfo(alias="folderPath")]] + """Full path to the folder you want to delete. For example `/folder/to/delete/`.""" diff --git a/src/imagekit/types/folder_delete_response.py b/src/imagekit/types/folder_delete_response.py new file mode 100644 index 0000000..40686cb --- /dev/null +++ b/src/imagekit/types/folder_delete_response.py @@ -0,0 +1,9 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel + +__all__ = ["FolderDeleteResponse"] + + +class FolderDeleteResponse(BaseModel): + pass diff --git a/src/imagekit/types/folder_move_params.py b/src/imagekit/types/folder_move_params.py new file mode 100644 index 0000000..59f63cd --- /dev/null +++ b/src/imagekit/types/folder_move_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FolderMoveParams"] + + +class FolderMoveParams(TypedDict, total=False): + destination_path: Required[Annotated[str, PropertyInfo(alias="destinationPath")]] + """ + Full path to the destination folder where you want to move the source folder + into. + """ + + source_folder_path: Required[Annotated[str, PropertyInfo(alias="sourceFolderPath")]] + """The full path to the source folder you want to move.""" diff --git a/src/imagekit/types/folder_move_response.py b/src/imagekit/types/folder_move_response.py new file mode 100644 index 0000000..a2ff321 --- /dev/null +++ b/src/imagekit/types/folder_move_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["FolderMoveResponse"] + + +class FolderMoveResponse(BaseModel): + job_id: str = FieldInfo(alias="jobId") + """Unique identifier of the bulk job. + + This can be used to check the status of the bulk job. + """ diff --git a/src/imagekit/types/folder_rename_params.py b/src/imagekit/types/folder_rename_params.py new file mode 100644 index 0000000..8c9caba --- /dev/null +++ b/src/imagekit/types/folder_rename_params.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FolderRenameParams"] + + +class FolderRenameParams(TypedDict, total=False): + folder_path: Required[Annotated[str, PropertyInfo(alias="folderPath")]] + """The full path to the folder you want to rename.""" + + new_folder_name: Required[Annotated[str, PropertyInfo(alias="newFolderName")]] + """The new name for the folder. + + All characters except alphabets and numbers (inclusive of unicode letters, + marks, and numerals in other languages) and `-` will be replaced by an + underscore i.e. `_`. + """ + + purge_cache: Annotated[bool, PropertyInfo(alias="purgeCache")] + """Option to purge cache for the old nested files and their versions' URLs. + + When set to true, it will internally issue a purge cache request on CDN to + remove the cached content of the old nested files and their versions. There will + only be one purge request for all the nested files, which will be counted + against your monthly purge quota. + + Note: A purge cache request will be issued against + `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This + will remove all nested files, their versions' URLs, and any transformations made + using query parameters on these files or their versions. However, the cache for + file transformations made using path parameters will persist. You can purge them + using the purge API. For more details, refer to the purge API documentation. + + Default value - `false` + """ diff --git a/src/imagekit/types/folder_rename_response.py b/src/imagekit/types/folder_rename_response.py new file mode 100644 index 0000000..f6b4d37 --- /dev/null +++ b/src/imagekit/types/folder_rename_response.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["FolderRenameResponse"] + + +class FolderRenameResponse(BaseModel): + job_id: str = FieldInfo(alias="jobId") + """Unique identifier of the bulk job. + + This can be used to check the status of the bulk job. + """ diff --git a/src/imagekit/types/folders/__init__.py b/src/imagekit/types/folders/__init__.py new file mode 100644 index 0000000..8c60dd2 --- /dev/null +++ b/src/imagekit/types/folders/__init__.py @@ -0,0 +1,5 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .job_get_response import JobGetResponse as JobGetResponse diff --git a/src/imagekit/types/folders/job_get_response.py b/src/imagekit/types/folders/job_get_response.py new file mode 100644 index 0000000..17a11ef --- /dev/null +++ b/src/imagekit/types/folders/job_get_response.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["JobGetResponse"] + + +class JobGetResponse(BaseModel): + job_id: Optional[str] = FieldInfo(alias="jobId", default=None) + """Unique identifier of the bulk job.""" + + purge_request_id: Optional[str] = FieldInfo(alias="purgeRequestId", default=None) + """Unique identifier of the purge request. + + This will be present only if `purgeCache` is set to `true` in the rename folder + API request. + """ + + status: Optional[Literal["Pending", "Completed"]] = None + """Status of the bulk job.""" + + type: Optional[Literal["COPY_FOLDER", "MOVE_FOLDER", "RENAME_FOLDER"]] = None + """Type of the bulk job.""" diff --git a/src/imagekit/types/metadata.py b/src/imagekit/types/metadata.py new file mode 100644 index 0000000..85bb814 --- /dev/null +++ b/src/imagekit/types/metadata.py @@ -0,0 +1,173 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["Metadata", "Exif", "ExifExif", "ExifGps", "ExifImage", "ExifInteroperability", "ExifThumbnail"] + + +class ExifExif(BaseModel): + aperture_value: Optional[float] = FieldInfo(alias="ApertureValue", default=None) + + color_space: Optional[int] = FieldInfo(alias="ColorSpace", default=None) + + create_date: Optional[str] = FieldInfo(alias="CreateDate", default=None) + + custom_rendered: Optional[int] = FieldInfo(alias="CustomRendered", default=None) + + date_time_original: Optional[str] = FieldInfo(alias="DateTimeOriginal", default=None) + + exif_image_height: Optional[int] = FieldInfo(alias="ExifImageHeight", default=None) + + exif_image_width: Optional[int] = FieldInfo(alias="ExifImageWidth", default=None) + + exif_version: Optional[str] = FieldInfo(alias="ExifVersion", default=None) + + exposure_compensation: Optional[float] = FieldInfo(alias="ExposureCompensation", default=None) + + exposure_mode: Optional[int] = FieldInfo(alias="ExposureMode", default=None) + + exposure_program: Optional[int] = FieldInfo(alias="ExposureProgram", default=None) + + exposure_time: Optional[float] = FieldInfo(alias="ExposureTime", default=None) + + flash: Optional[int] = FieldInfo(alias="Flash", default=None) + + flashpix_version: Optional[str] = FieldInfo(alias="FlashpixVersion", default=None) + + f_number: Optional[float] = FieldInfo(alias="FNumber", default=None) + + focal_length: Optional[int] = FieldInfo(alias="FocalLength", default=None) + + focal_plane_resolution_unit: Optional[int] = FieldInfo(alias="FocalPlaneResolutionUnit", default=None) + + focal_plane_x_resolution: Optional[float] = FieldInfo(alias="FocalPlaneXResolution", default=None) + + focal_plane_y_resolution: Optional[float] = FieldInfo(alias="FocalPlaneYResolution", default=None) + + interop_offset: Optional[int] = FieldInfo(alias="InteropOffset", default=None) + + iso: Optional[int] = FieldInfo(alias="ISO", default=None) + + metering_mode: Optional[int] = FieldInfo(alias="MeteringMode", default=None) + + scene_capture_type: Optional[int] = FieldInfo(alias="SceneCaptureType", default=None) + + shutter_speed_value: Optional[float] = FieldInfo(alias="ShutterSpeedValue", default=None) + + sub_sec_time: Optional[str] = FieldInfo(alias="SubSecTime", default=None) + + white_balance: Optional[int] = FieldInfo(alias="WhiteBalance", default=None) + + +class ExifGps(BaseModel): + gps_version_id: Optional[List[int]] = FieldInfo(alias="GPSVersionID", default=None) + + +class ExifImage(BaseModel): + exif_offset: Optional[int] = FieldInfo(alias="ExifOffset", default=None) + + gps_info: Optional[int] = FieldInfo(alias="GPSInfo", default=None) + + make: Optional[str] = FieldInfo(alias="Make", default=None) + + model: Optional[str] = FieldInfo(alias="Model", default=None) + + modify_date: Optional[str] = FieldInfo(alias="ModifyDate", default=None) + + orientation: Optional[int] = FieldInfo(alias="Orientation", default=None) + + resolution_unit: Optional[int] = FieldInfo(alias="ResolutionUnit", default=None) + + software: Optional[str] = FieldInfo(alias="Software", default=None) + + x_resolution: Optional[int] = FieldInfo(alias="XResolution", default=None) + + y_cb_cr_positioning: Optional[int] = FieldInfo(alias="YCbCrPositioning", default=None) + + y_resolution: Optional[int] = FieldInfo(alias="YResolution", default=None) + + +class ExifInteroperability(BaseModel): + interop_index: Optional[str] = FieldInfo(alias="InteropIndex", default=None) + + interop_version: Optional[str] = FieldInfo(alias="InteropVersion", default=None) + + +class ExifThumbnail(BaseModel): + compression: Optional[int] = FieldInfo(alias="Compression", default=None) + + resolution_unit: Optional[int] = FieldInfo(alias="ResolutionUnit", default=None) + + thumbnail_length: Optional[int] = FieldInfo(alias="ThumbnailLength", default=None) + + thumbnail_offset: Optional[int] = FieldInfo(alias="ThumbnailOffset", default=None) + + x_resolution: Optional[int] = FieldInfo(alias="XResolution", default=None) + + y_resolution: Optional[int] = FieldInfo(alias="YResolution", default=None) + + +class Exif(BaseModel): + exif: Optional[ExifExif] = None + """Object containing Exif details.""" + + gps: Optional[ExifGps] = None + """Object containing GPS information.""" + + image: Optional[ExifImage] = None + """Object containing EXIF image information.""" + + interoperability: Optional[ExifInteroperability] = None + """JSON object.""" + + makernote: Optional[Dict[str, object]] = None + + thumbnail: Optional[ExifThumbnail] = None + """Object containing Thumbnail information.""" + + +class Metadata(BaseModel): + audio_codec: Optional[str] = FieldInfo(alias="audioCodec", default=None) + """The audio codec used in the video (only for video).""" + + bit_rate: Optional[int] = FieldInfo(alias="bitRate", default=None) + """The bit rate of the video in kbps (only for video).""" + + density: Optional[int] = None + """The density of the image in DPI.""" + + duration: Optional[int] = None + """The duration of the video in seconds (only for video).""" + + exif: Optional[Exif] = None + + format: Optional[str] = None + """The format of the file (e.g., 'jpg', 'mp4').""" + + has_color_profile: Optional[bool] = FieldInfo(alias="hasColorProfile", default=None) + """Indicates if the image has a color profile.""" + + has_transparency: Optional[bool] = FieldInfo(alias="hasTransparency", default=None) + """Indicates if the image contains transparent areas.""" + + height: Optional[int] = None + """The height of the image or video in pixels.""" + + p_hash: Optional[str] = FieldInfo(alias="pHash", default=None) + """Perceptual hash of the image.""" + + quality: Optional[int] = None + """The quality indicator of the image.""" + + size: Optional[int] = None + """The file size in bytes.""" + + video_codec: Optional[str] = FieldInfo(alias="videoCodec", default=None) + """The video codec used in the video (only for video).""" + + width: Optional[int] = None + """The width of the image or video in pixels.""" diff --git a/src/imagekit/types/shared/__init__.py b/src/imagekit/types/shared/__init__.py new file mode 100644 index 0000000..794a18b --- /dev/null +++ b/src/imagekit/types/shared/__init__.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .overlay import Overlay as Overlay +from .src_options import SrcOptions as SrcOptions +from .base_overlay import BaseOverlay as BaseOverlay +from .text_overlay import TextOverlay as TextOverlay +from .image_overlay import ImageOverlay as ImageOverlay +from .video_overlay import VideoOverlay as VideoOverlay +from .overlay_timing import OverlayTiming as OverlayTiming +from .transformation import Transformation as Transformation +from .overlay_position import OverlayPosition as OverlayPosition +from .subtitle_overlay import SubtitleOverlay as SubtitleOverlay +from .solid_color_overlay import SolidColorOverlay as SolidColorOverlay +from .streaming_resolution import StreamingResolution as StreamingResolution +from .transformation_position import TransformationPosition as TransformationPosition +from .text_overlay_transformation import TextOverlayTransformation as TextOverlayTransformation +from .subtitle_overlay_transformation import SubtitleOverlayTransformation as SubtitleOverlayTransformation +from .solid_color_overlay_transformation import SolidColorOverlayTransformation as SolidColorOverlayTransformation diff --git a/src/imagekit/types/shared/base_overlay.py b/src/imagekit/types/shared/base_overlay.py new file mode 100644 index 0000000..fa490a4 --- /dev/null +++ b/src/imagekit/types/shared/base_overlay.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .overlay_timing import OverlayTiming +from .overlay_position import OverlayPosition + +__all__ = ["BaseOverlay"] + + +class BaseOverlay(BaseModel): + position: Optional[OverlayPosition] = None + + timing: Optional[OverlayTiming] = None diff --git a/src/imagekit/types/shared/image_overlay.py b/src/imagekit/types/shared/image_overlay.py new file mode 100644 index 0000000..178864c --- /dev/null +++ b/src/imagekit/types/shared/image_overlay.py @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal + +from .base_overlay import BaseOverlay + +__all__ = ["ImageOverlay"] + + +class ImageOverlay(BaseOverlay): + input: str + """Specifies the relative path to the image used as an overlay.""" + + type: Literal["image"] + + encoding: Optional[Literal["auto", "plain", "base64"]] = None + """ + The input path can be included in the layer as either `i-{input}` or + `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + format automatically. To always use base64 encoding (`ie-{base64}`), set this + parameter to `base64`. To always use plain text (`i-{input}`), set it to + `plain`. + """ + + transformation: Optional[List["Transformation"]] = None + """Array of transformations to be applied to the overlay image. + + Supported transformations depends on the base/parent asset. See overlays on + [Images](https://imagekit.io/docs/add-overlays-on-images#list-of-supported-image-transformations-in-image-layers) + and + [Videos](https://imagekit.io/docs/add-overlays-on-videos#list-of-transformations-supported-on-image-overlay). + """ + + +from .transformation import Transformation diff --git a/src/imagekit/types/shared/overlay.py b/src/imagekit/types/shared/overlay.py new file mode 100644 index 0000000..00e685a --- /dev/null +++ b/src/imagekit/types/shared/overlay.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import TYPE_CHECKING, Union +from typing_extensions import Annotated, TypeAlias, TypeAliasType + +from ..._utils import PropertyInfo +from ..._compat import PYDANTIC_V2 +from .text_overlay import TextOverlay +from .subtitle_overlay import SubtitleOverlay +from .solid_color_overlay import SolidColorOverlay + +__all__ = ["Overlay"] + +if TYPE_CHECKING or PYDANTIC_V2: + Overlay = TypeAliasType( + "Overlay", + Annotated[ + Union[TextOverlay, "ImageOverlay", "VideoOverlay", SubtitleOverlay, SolidColorOverlay], + PropertyInfo(discriminator="type"), + ], + ) +else: + Overlay: TypeAlias = Annotated[ + Union[TextOverlay, "ImageOverlay", "VideoOverlay", SubtitleOverlay, SolidColorOverlay], + PropertyInfo(discriminator="type"), + ] + +from .image_overlay import ImageOverlay +from .video_overlay import VideoOverlay diff --git a/src/imagekit/types/shared/overlay_position.py b/src/imagekit/types/shared/overlay_position.py new file mode 100644 index 0000000..a6fe5f8 --- /dev/null +++ b/src/imagekit/types/shared/overlay_position.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["OverlayPosition"] + + +class OverlayPosition(BaseModel): + focus: Optional[ + Literal["center", "top", "left", "bottom", "right", "top_left", "top_right", "bottom_left", "bottom_right"] + ] = None + """ + Specifies the position of the overlay relative to the parent image or video. + Maps to `lfo` in the URL. + """ + + x: Union[float, str, None] = None + """ + Specifies the x-coordinate of the top-left corner of the base asset where the + overlay's top-left corner will be positioned. It also accepts arithmetic + expressions such as `bw_mul_0.4` or `bw_sub_cw`. Maps to `lx` in the URL. Learn + about + [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + """ + + y: Union[float, str, None] = None + """ + Specifies the y-coordinate of the top-left corner of the base asset where the + overlay's top-left corner will be positioned. It also accepts arithmetic + expressions such as `bh_mul_0.4` or `bh_sub_ch`. Maps to `ly` in the URL. Learn + about + [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + """ diff --git a/src/imagekit/types/shared/overlay_timing.py b/src/imagekit/types/shared/overlay_timing.py new file mode 100644 index 0000000..f4d9c67 --- /dev/null +++ b/src/imagekit/types/shared/overlay_timing.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union + +from ..._models import BaseModel + +__all__ = ["OverlayTiming"] + + +class OverlayTiming(BaseModel): + duration: Union[float, str, None] = None + """ + Specifies the duration (in seconds) during which the overlay should appear on + the base video. Accepts a positive number up to two decimal places (e.g., `20` + or `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + Applies only if the base asset is a video. Maps to `ldu` in the URL. + """ + + end: Union[float, str, None] = None + """ + Specifies the end time (in seconds) for when the overlay should disappear from + the base video. If both end and duration are provided, duration is ignored. + Accepts a positive number up to two decimal places (e.g., `20` or `20.50`) and + arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. Applies only if + the base asset is a video. Maps to `leo` in the URL. + """ + + start: Union[float, str, None] = None + """ + Specifies the start time (in seconds) for when the overlay should appear on the + base video. Accepts a positive number up to two decimal places (e.g., `20` or + `20.50`) and arithmetic expressions such as `bdu_mul_0.4` or `bdu_sub_idu`. + Applies only if the base asset is a video. Maps to `lso` in the URL. + """ diff --git a/src/imagekit/types/shared/solid_color_overlay.py b/src/imagekit/types/shared/solid_color_overlay.py new file mode 100644 index 0000000..49c11a9 --- /dev/null +++ b/src/imagekit/types/shared/solid_color_overlay.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .base_overlay import BaseOverlay +from .solid_color_overlay_transformation import SolidColorOverlayTransformation + +__all__ = ["SolidColorOverlay"] + + +class SolidColorOverlay(BaseOverlay): + color: str + """ + Specifies the color of the block using an RGB hex code (e.g., `FF0000`), an RGBA + code (e.g., `FFAABB50`), or a color name (e.g., `red`). If an 8-character value + is provided, the last two characters represent the opacity level (from `00` for + 0.00 to `99` for 0.99). + """ + + type: Literal["solidColor"] + + transformation: Optional[List[SolidColorOverlayTransformation]] = None + """Control width and height of the solid color overlay. + + Supported transformations depend on the base/parent asset. See overlays on + [Images](https://imagekit.io/docs/add-overlays-on-images#apply-transformation-on-solid-color-overlay) + and + [Videos](https://imagekit.io/docs/add-overlays-on-videos#apply-transformations-on-solid-color-block-overlay). + """ diff --git a/src/imagekit/types/shared/solid_color_overlay_transformation.py b/src/imagekit/types/shared/solid_color_overlay_transformation.py new file mode 100644 index 0000000..4e0f173 --- /dev/null +++ b/src/imagekit/types/shared/solid_color_overlay_transformation.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["SolidColorOverlayTransformation"] + + +class SolidColorOverlayTransformation(BaseModel): + alpha: Optional[float] = None + """Specifies the transparency level of the solid color overlay. + + Accepts integers from `1` to `9`. + """ + + background: Optional[str] = None + """Specifies the background color of the solid color overlay. + + Accepts an RGB hex code (e.g., `FF0000`), an RGBA code (e.g., `FFAABB50`), or a + color name. + """ + + gradient: Union[Literal[True], str, None] = None + """Creates a linear gradient with two colors. + + Pass `true` for a default gradient, or provide a string for a custom gradient. + Only works if the base asset is an image. See + [gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + """ + + height: Union[float, str, None] = None + """Controls the height of the solid color overlay. + + Accepts a numeric value or an arithmetic expression. Learn about + [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + """ + + radius: Union[float, Literal["max"], None] = None + """Specifies the corner radius of the solid color overlay. + + Set to `max` for circular or oval shape. See + [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + """ + + width: Union[float, str, None] = None + """Controls the width of the solid color overlay. + + Accepts a numeric value or an arithmetic expression (e.g., `bw_mul_0.2` or + `bh_div_2`). Learn about + [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + """ diff --git a/src/imagekit/types/shared/src_options.py b/src/imagekit/types/shared/src_options.py new file mode 100644 index 0000000..981860d --- /dev/null +++ b/src/imagekit/types/shared/src_options.py @@ -0,0 +1,77 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Optional + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .transformation_position import TransformationPosition + +__all__ = ["SrcOptions"] + + +class SrcOptions(BaseModel): + src: str + """Accepts a relative or absolute path of the resource. + + If a relative path is provided, it is appended to the `urlEndpoint`. If an + absolute path is provided, `urlEndpoint` is ignored. + """ + + url_endpoint: str = FieldInfo(alias="urlEndpoint") + """ + Get your urlEndpoint from the + [ImageKit dashboard](https://imagekit.io/dashboard/url-endpoints). + """ + + expires_in: Optional[float] = FieldInfo(alias="expiresIn", default=None) + """When you want the signed URL to expire, specified in seconds. + + If `expiresIn` is anything above 0, the URL will always be signed even if + `signed` is set to false. If not specified and `signed` is `true`, the signed + URL will not expire (valid indefinitely). + + Example: Setting `expiresIn: 3600` will make the URL expire 1 hour from + generation time. After the expiry time, the signed URL will no longer be valid + and ImageKit will return a 401 Unauthorized status code. + + [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + """ + + query_parameters: Optional[Dict[str, str]] = FieldInfo(alias="queryParameters", default=None) + """ + These are additional query parameters that you want to add to the final URL. + They can be any query parameters and not necessarily related to ImageKit. This + is especially useful if you want to add a versioning parameter to your URLs. + """ + + signed: Optional[bool] = None + """Whether to sign the URL or not. + + Set this to `true` if you want to generate a signed URL. If `signed` is `true` + and `expiresIn` is not specified, the signed URL will not expire (valid + indefinitely). Note: If `expiresIn` is set to any value above 0, the URL will + always be signed regardless of this setting. + [Learn more](https://imagekit.io/docs/media-delivery-basic-security#how-to-generate-signed-urls). + """ + + transformation: Optional[List["Transformation"]] = None + """An array of objects specifying the transformations to be applied in the URL. + + If more than one transformation is specified, they are applied in the order they + are specified as chained transformations. See + [Chained transformations](https://imagekit.io/docs/transformations#chained-transformations). + """ + + transformation_position: Optional[TransformationPosition] = FieldInfo(alias="transformationPosition", default=None) + """ + By default, the transformation string is added as a query parameter in the URL, + e.g., `?tr=w-100,h-100`. If you want to add the transformation string in the + path of the URL, set this to `path`. Learn more in the + [Transformations guide](https://imagekit.io/docs/transformations). + """ + + +from .transformation import Transformation diff --git a/src/imagekit/types/shared/streaming_resolution.py b/src/imagekit/types/shared/streaming_resolution.py new file mode 100644 index 0000000..6eb3008 --- /dev/null +++ b/src/imagekit/types/shared/streaming_resolution.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["StreamingResolution"] + +StreamingResolution: TypeAlias = Literal["240", "360", "480", "720", "1080", "1440", "2160"] diff --git a/src/imagekit/types/shared/subtitle_overlay.py b/src/imagekit/types/shared/subtitle_overlay.py new file mode 100644 index 0000000..f44f3c4 --- /dev/null +++ b/src/imagekit/types/shared/subtitle_overlay.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .base_overlay import BaseOverlay +from .subtitle_overlay_transformation import SubtitleOverlayTransformation + +__all__ = ["SubtitleOverlay"] + + +class SubtitleOverlay(BaseOverlay): + input: str + """Specifies the relative path to the subtitle file used as an overlay.""" + + type: Literal["subtitle"] + + encoding: Optional[Literal["auto", "plain", "base64"]] = None + """ + The input path can be included in the layer as either `i-{input}` or + `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + format automatically. To always use base64 encoding (`ie-{base64}`), set this + parameter to `base64`. To always use plain text (`i-{input}`), set it to + `plain`. + """ + + transformation: Optional[List[SubtitleOverlayTransformation]] = None + """Control styling of the subtitle. + + See + [Styling subtitles](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer). + """ diff --git a/src/imagekit/types/shared/subtitle_overlay_transformation.py b/src/imagekit/types/shared/subtitle_overlay_transformation.py new file mode 100644 index 0000000..fb692be --- /dev/null +++ b/src/imagekit/types/shared/subtitle_overlay_transformation.py @@ -0,0 +1,75 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["SubtitleOverlayTransformation"] + + +class SubtitleOverlayTransformation(BaseModel): + background: Optional[str] = None + """ + Specifies the subtitle background color using a standard color name, an RGB + color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + + [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + """ + + color: Optional[str] = None + """ + Sets the font color of the subtitle text using a standard color name, an RGB + color code (e.g., FF0000), or an RGBA color code (e.g., FFAABB50). + + [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + """ + + font_family: Optional[str] = FieldInfo(alias="fontFamily", default=None) + """Font family for subtitles. + + Refer to the + [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list). + """ + + font_outline: Optional[str] = FieldInfo(alias="fontOutline", default=None) + """Sets the font outline of the subtitle text. + + Requires the outline width (an integer) and the outline color (as an RGB color + code, RGBA color code, or standard web color name) separated by an underscore. + Example: `fol-2_blue` (outline width of 2px and outline color blue), + `fol-2_A1CCDD` (outline width of 2px and outline color `#A1CCDD`) and + `fol-2_A1CCDD50` (outline width of 2px and outline color `#A1CCDD` at 50% + opacity). + + [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + """ + + font_shadow: Optional[str] = FieldInfo(alias="fontShadow", default=None) + """Sets the font shadow for the subtitle text. + + Requires the shadow color (as an RGB color code, RGBA color code, or standard + web color name) and shadow indent (an integer) separated by an underscore. + Example: `fsh-blue_2` (shadow color blue, indent of 2px), `fsh-A1CCDD_3` (shadow + color `#A1CCDD`, indent of 3px), `fsh-A1CCDD50_3` (shadow color `#A1CCDD` at 50% + opacity, indent of 3px). + + [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + """ + + font_size: Optional[float] = FieldInfo(alias="fontSize", default=None) + """Sets the font size of subtitle text. + + [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + """ + + typography: Optional[Literal["b", "i", "b_i"]] = None + """Sets the typography style of the subtitle text. + + Supports values are `b` for bold, `i` for italics, and `b_i` for bold with + italics. + + [Subtitle styling options](https://imagekit.io/docs/add-overlays-on-videos#styling-controls-for-subtitles-layer) + """ diff --git a/src/imagekit/types/shared/text_overlay.py b/src/imagekit/types/shared/text_overlay.py new file mode 100644 index 0000000..b156834 --- /dev/null +++ b/src/imagekit/types/shared/text_overlay.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .base_overlay import BaseOverlay +from .text_overlay_transformation import TextOverlayTransformation + +__all__ = ["TextOverlay"] + + +class TextOverlay(BaseOverlay): + text: str + """Specifies the text to be displayed in the overlay. + + The SDK automatically handles special characters and encoding. + """ + + type: Literal["text"] + + encoding: Optional[Literal["auto", "plain", "base64"]] = None + """ + Text can be included in the layer as either `i-{input}` (plain text) or + `ie-{base64_encoded_input}` (base64). By default, the SDK selects the + appropriate format based on the input text. To always use base64 + (`ie-{base64}`), set this parameter to `base64`. To always use plain text + (`i-{input}`), set it to `plain`. + """ + + transformation: Optional[List[TextOverlayTransformation]] = None + """Control styling of the text overlay. + + See + [Text overlays](https://imagekit.io/docs/add-overlays-on-images#text-overlay). + """ diff --git a/src/imagekit/types/shared/text_overlay_transformation.py b/src/imagekit/types/shared/text_overlay_transformation.py new file mode 100644 index 0000000..8aa0711 --- /dev/null +++ b/src/imagekit/types/shared/text_overlay_transformation.py @@ -0,0 +1,99 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = ["TextOverlayTransformation"] + + +class TextOverlayTransformation(BaseModel): + alpha: Optional[float] = None + """Specifies the transparency level of the text overlay. + + Accepts integers from `1` to `9`. + """ + + background: Optional[str] = None + """ + Specifies the background color of the text overlay. Accepts an RGB hex code, an + RGBA code, or a color name. + """ + + flip: Optional[Literal["h", "v", "h_v", "v_h"]] = None + """Flip the text overlay horizontally, vertically, or both.""" + + font_color: Optional[str] = FieldInfo(alias="fontColor", default=None) + """Specifies the font color of the overlaid text. + + Accepts an RGB hex code (e.g., `FF0000`), an RGBA code (e.g., `FFAABB50`), or a + color name. + """ + + font_family: Optional[str] = FieldInfo(alias="fontFamily", default=None) + """Specifies the font family of the overlaid text. + + Choose from the supported fonts list or use a custom font. See + [Supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list) + and + [Custom font](https://imagekit.io/docs/add-overlays-on-images#change-font-family-in-text-overlay). + """ + + font_size: Union[float, str, None] = FieldInfo(alias="fontSize", default=None) + """Specifies the font size of the overlaid text. + + Accepts a numeric value or an arithmetic expression. + """ + + inner_alignment: Optional[Literal["left", "right", "center"]] = FieldInfo(alias="innerAlignment", default=None) + """ + Specifies the inner alignment of the text when width is more than the text + length. + """ + + line_height: Union[float, str, None] = FieldInfo(alias="lineHeight", default=None) + """Specifies the line height of the text overlay. + + Accepts integer values representing line height in points. It can also accept + [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations) + such as `bw_mul_0.2`, or `bh_div_20`. + """ + + padding: Union[float, str, None] = None + """ + Specifies the padding around the overlaid text. Can be provided as a single + positive integer or multiple values separated by underscores (following CSS + shorthand order). Arithmetic expressions are also accepted. + """ + + radius: Union[float, Literal["max"], None] = None + """ + Specifies the corner radius of the text overlay. Set to `max` to achieve a + circular or oval shape. + """ + + rotation: Union[float, str, None] = None + """ + Specifies the rotation angle of the text overlay. Accepts a numeric value for + clockwise rotation or a string prefixed with "N" for counter-clockwise rotation. + """ + + typography: Optional[str] = None + """Specifies the typography style of the text. Supported values: + + - Single styles: `b` (bold), `i` (italic), `strikethrough`. + - Combinations: Any combination separated by underscores, e.g., `b_i`, + `b_i_strikethrough`. + """ + + width: Union[float, str, None] = None + """Specifies the maximum width (in pixels) of the overlaid text. + + The text wraps automatically, and arithmetic expressions (e.g., `bw_mul_0.2` or + `bh_div_2`) are supported. Useful when used in conjunction with the + `background`. Learn about + [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + """ diff --git a/src/imagekit/types/shared/transformation.py b/src/imagekit/types/shared/transformation.py new file mode 100644 index 0000000..970d9e9 --- /dev/null +++ b/src/imagekit/types/shared/transformation.py @@ -0,0 +1,426 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel +from .streaming_resolution import StreamingResolution + +__all__ = ["Transformation"] + + +class Transformation(BaseModel): + ai_change_background: Optional[str] = FieldInfo(alias="aiChangeBackground", default=None) + """Uses AI to change the background. + + Provide a text prompt or a base64-encoded prompt, e.g., `prompt-snow road` or + `prompte-[urlencoded_base64_encoded_text]`. Not supported inside overlay. See + [AI Change Background](https://imagekit.io/docs/ai-transformations#change-background-e-changebg). + """ + + ai_drop_shadow: Union[Literal[True], str, None] = FieldInfo(alias="aiDropShadow", default=None) + """ + Adds an AI-based drop shadow around a foreground object on a transparent or + removed background. Optionally, control the direction, elevation, and saturation + of the light source (e.g., `az-45` to change light direction). Pass `true` for + the default drop shadow, or provide a string for a custom drop shadow. Supported + inside overlay. See + [AI Drop Shadow](https://imagekit.io/docs/ai-transformations#ai-drop-shadow-e-dropshadow). + """ + + ai_edit: Optional[str] = FieldInfo(alias="aiEdit", default=None) + """Uses AI to edit images based on a text prompt. + + Provide a text prompt or a base64-encoded prompt, e.g., `prompt-snow road` or + `prompte-[urlencoded_base64_encoded_text]`. Not supported inside overlay. + See [AI Edit](https://imagekit.io/docs/ai-transformations#edit-image-e-edit). + """ + + ai_remove_background: Optional[Literal[True]] = FieldInfo(alias="aiRemoveBackground", default=None) + """Applies ImageKit's in-house background removal. + + Supported inside overlay. See + [AI Background Removal](https://imagekit.io/docs/ai-transformations#imagekit-background-removal-e-bgremove). + """ + + ai_remove_background_external: Optional[Literal[True]] = FieldInfo(alias="aiRemoveBackgroundExternal", default=None) + """Uses third-party background removal. + + Note: It is recommended to use aiRemoveBackground, ImageKit's in-house solution, + which is more cost-effective. Supported inside overlay. See + [External Background Removal](https://imagekit.io/docs/ai-transformations#background-removal-e-removedotbg). + """ + + ai_retouch: Optional[Literal[True]] = FieldInfo(alias="aiRetouch", default=None) + """Performs AI-based retouching to improve faces or product shots. + + Not supported inside overlay. See + [AI Retouch](https://imagekit.io/docs/ai-transformations#retouch-e-retouch). + """ + + ai_upscale: Optional[Literal[True]] = FieldInfo(alias="aiUpscale", default=None) + """Upscales images beyond their original dimensions using AI. + + Not supported inside overlay. See + [AI Upscale](https://imagekit.io/docs/ai-transformations#upscale-e-upscale). + """ + + ai_variation: Optional[Literal[True]] = FieldInfo(alias="aiVariation", default=None) + """Generates a variation of an image using AI. + + This produces a new image with slight variations from the original, such as + changes in color, texture, and other visual elements, while preserving the + structure and essence of the original image. Not supported inside overlay. See + [AI Generate Variations](https://imagekit.io/docs/ai-transformations#generate-variations-of-an-image-e-genvar). + """ + + aspect_ratio: Union[float, str, None] = FieldInfo(alias="aspectRatio", default=None) + """Specifies the aspect ratio for the output, e.g., "ar-4-3". + + Typically used with either width or height (but not both). For example: + aspectRatio = `4:3`, `4_3`, or an expression like `iar_div_2`. See + [Image resize and crop – Aspect ratio](https://imagekit.io/docs/image-resize-and-crop#aspect-ratio---ar). + """ + + audio_codec: Optional[Literal["aac", "opus", "none"]] = FieldInfo(alias="audioCodec", default=None) + """Specifies the audio codec, e.g., `aac`, `opus`, or `none`. + + See [Audio codec](https://imagekit.io/docs/video-optimization#audio-codec---ac). + """ + + background: Optional[str] = None + """ + Specifies the background to be used in conjunction with certain cropping + strategies when resizing an image. + + - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See + [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background). + - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See + [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background). + - Expand the image boundaries using generative fill: `genfill`. Not supported + inside overlay. Optionally, control the background scene by passing a text + prompt: `genfill[:-prompt-${text}]` or + `genfill[:-prompte-${urlencoded_base64_encoded_text}]`. See + [Generative fill background](https://imagekit.io/docs/ai-transformations#generative-fill-bg-genfill). + """ + + blur: Optional[float] = None + """Specifies the Gaussian blur level. + + Accepts an integer value between 1 and 100, or an expression like `bl-10`. See + [Blur](https://imagekit.io/docs/effects-and-enhancements#blur---bl). + """ + + border: Optional[str] = None + """Adds a border to the output media. + + Accepts a string in the format `_` (e.g., `5_FFF000` for + a 5px yellow border), or an expression like `ih_div_20_FF00FF`. See + [Border](https://imagekit.io/docs/effects-and-enhancements#border---b). + """ + + color_profile: Optional[bool] = FieldInfo(alias="colorProfile", default=None) + """ + Indicates whether the output image should retain the original color profile. See + [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp). + """ + + contrast_stretch: Optional[Literal[True]] = FieldInfo(alias="contrastStretch", default=None) + """ + Automatically enhances the contrast of an image (contrast stretch). See + [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast). + """ + + crop: Optional[Literal["force", "at_max", "at_max_enlarge", "at_least", "maintain_ratio"]] = None + """Crop modes for image resizing. + + See + [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + """ + + crop_mode: Optional[Literal["pad_resize", "extract", "pad_extract"]] = FieldInfo(alias="cropMode", default=None) + """Additional crop modes for image resizing. + + See + [Crop modes & focus](https://imagekit.io/docs/image-resize-and-crop#crop-crop-modes--focus). + """ + + default_image: Optional[str] = FieldInfo(alias="defaultImage", default=None) + """ + Specifies a fallback image if the resource is not found, e.g., a URL or file + path. See + [Default image](https://imagekit.io/docs/image-transformation#default-image---di). + """ + + dpr: Optional[float] = None + """ + Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio + (DPR) calculation. See + [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr). + """ + + duration: Union[float, str, None] = None + """Specifies the duration (in seconds) for trimming videos, e.g., `5` or `10.5`. + + Typically used with startOffset to indicate the length from the start offset. + Arithmetic expressions are supported. See + [Trim videos – Duration](https://imagekit.io/docs/trim-videos#duration---du). + """ + + end_offset: Union[float, str, None] = FieldInfo(alias="endOffset", default=None) + """Specifies the end offset (in seconds) for trimming videos, e.g., `5` or `10.5`. + + Typically used with startOffset to define a time window. Arithmetic expressions + are supported. See + [Trim videos – End offset](https://imagekit.io/docs/trim-videos#end-offset---eo). + """ + + flip: Optional[Literal["h", "v", "h_v", "v_h"]] = None + """Flips or mirrors an image either horizontally, vertically, or both. + + Acceptable values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and + vertical), or `v_h`. See + [Flip](https://imagekit.io/docs/effects-and-enhancements#flip---fl). + """ + + focus: Optional[str] = None + """ + Refines padding and cropping behavior for pad resize, maintain ratio, and + extract crop modes. Supports manual positions and coordinate-based focus. With + AI-based cropping, you can automatically keep key subjects in frame—such as + faces or detected objects (e.g., `fo-face`, `fo-person`, `fo-car`)— while + resizing. + + - See [Focus](https://imagekit.io/docs/image-resize-and-crop#focus---fo). + - [Object aware cropping](https://imagekit.io/docs/image-resize-and-crop#object-aware-cropping---fo-object-name) + """ + + format: Optional[Literal["auto", "webp", "jpg", "jpeg", "png", "gif", "svg", "mp4", "webm", "avif", "orig"]] = None + """ + Specifies the output format for images or videos, e.g., `jpg`, `png`, `webp`, + `mp4`, or `auto`. You can also pass `orig` for images to return the original + format. ImageKit automatically delivers images and videos in the optimal format + based on device support unless overridden by the dashboard settings or the + format parameter. See + [Image format](https://imagekit.io/docs/image-optimization#format---f) and + [Video format](https://imagekit.io/docs/video-optimization#format---f). + """ + + gradient: Union[Literal[True], str, None] = None + """Creates a linear gradient with two colors. + + Pass `true` for a default gradient, or provide a string for a custom gradient. + See + [Gradient](https://imagekit.io/docs/effects-and-enhancements#gradient---e-gradient). + """ + + grayscale: Optional[Literal[True]] = None + """Enables a grayscale effect for images. + + See + [Grayscale](https://imagekit.io/docs/effects-and-enhancements#grayscale---e-grayscale). + """ + + height: Union[float, str, None] = None + """Specifies the height of the output. + + If a value between 0 and 1 is provided, it is treated as a percentage (e.g., + `0.5` represents 50% of the original height). You can also supply arithmetic + expressions (e.g., `ih_mul_0.5`). Height transformation – + [Images](https://imagekit.io/docs/image-resize-and-crop#height---h) · + [Videos](https://imagekit.io/docs/video-resize-and-crop#height---h) + """ + + lossless: Optional[bool] = None + """ + Specifies whether the output image (in JPEG or PNG) should be compressed + losslessly. See + [Lossless compression](https://imagekit.io/docs/image-optimization#lossless-webp-and-png---lo). + """ + + metadata: Optional[bool] = None + """By default, ImageKit removes all metadata during automatic image compression. + + Set this to true to preserve metadata. See + [Image metadata](https://imagekit.io/docs/image-optimization#image-metadata---md). + """ + + named: Optional[str] = None + """Named transformation reference. + + See + [Named transformations](https://imagekit.io/docs/transformations#named-transformations). + """ + + opacity: Optional[float] = None + """Specifies the opacity level of the output image. + + See [Opacity](https://imagekit.io/docs/effects-and-enhancements#opacity---o). + """ + + original: Optional[bool] = None + """ + If set to true, serves the original file without applying any transformations. + See + [Deliver original file as-is](https://imagekit.io/docs/core-delivery-features#deliver-original-file-as-is---orig-true). + """ + + overlay: Optional["Overlay"] = None + """Specifies an overlay to be applied on the parent image or video. + + ImageKit supports overlays including images, text, videos, subtitles, and solid + colors. See + [Overlay using layers](https://imagekit.io/docs/transformations#overlay-using-layers). + """ + + page: Union[float, str, None] = None + """ + Extracts a specific page or frame from multi-page or layered files (PDF, PSD, + AI). For example, specify by number (e.g., `2`), a range (e.g., `3-4` for the + 2nd and 3rd layers), or by name (e.g., `name-layer-4` for a PSD layer). See + [Thumbnail extraction](https://imagekit.io/docs/vector-and-animated-images#get-thumbnail-from-psd-pdf-ai-eps-and-animated-files). + """ + + progressive: Optional[bool] = None + """Specifies whether the output JPEG image should be rendered progressively. + + Progressive loading begins with a low-quality, pixelated version of the full + image, which gradually improves to provide a faster perceived load time. See + [Progressive images](https://imagekit.io/docs/image-optimization#progressive-image---pr). + """ + + quality: Optional[float] = None + """ + Specifies the quality of the output image for lossy formats such as JPEG, WebP, + and AVIF. A higher quality value results in a larger file size with better + quality, while a lower value produces a smaller file size with reduced quality. + See [Quality](https://imagekit.io/docs/image-optimization#quality---q). + """ + + radius: Union[float, Literal["max"], None] = None + """ + Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular + or oval shape. See + [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r). + """ + + raw: Optional[str] = None + """Pass any transformation not directly supported by the SDK. + + This transformation string is appended to the URL as provided. + """ + + rotation: Union[float, str, None] = None + """Specifies the rotation angle in degrees. + + Positive values rotate the image clockwise; you can also use, for example, `N40` + for counterclockwise rotation or `auto` to use the orientation specified in the + image's EXIF data. For videos, only the following values are supported: 0, 90, + 180, 270, or 360. See + [Rotate](https://imagekit.io/docs/effects-and-enhancements#rotate---rt). + """ + + shadow: Union[Literal[True], str, None] = None + """Adds a shadow beneath solid objects in an image with a transparent background. + + For AI-based drop shadows, refer to aiDropShadow. Pass `true` for a default + shadow, or provide a string for a custom shadow. See + [Shadow](https://imagekit.io/docs/effects-and-enhancements#shadow---e-shadow). + """ + + sharpen: Union[Literal[True], float, None] = None + """Sharpens the input image, highlighting edges and finer details. + + Pass `true` for default sharpening, or provide a numeric value for custom + sharpening. See + [Sharpen](https://imagekit.io/docs/effects-and-enhancements#sharpen---e-sharpen). + """ + + start_offset: Union[float, str, None] = FieldInfo(alias="startOffset", default=None) + """Specifies the start offset (in seconds) for trimming videos, e.g., `5` or + `10.5`. + + Arithmetic expressions are also supported. See + [Trim videos – Start offset](https://imagekit.io/docs/trim-videos#start-offset---so). + """ + + streaming_resolutions: Optional[List[StreamingResolution]] = FieldInfo(alias="streamingResolutions", default=None) + """ + An array of resolutions for adaptive bitrate streaming, e.g., [`240`, `360`, + `480`, `720`, `1080`]. See + [Adaptive Bitrate Streaming](https://imagekit.io/docs/adaptive-bitrate-streaming). + """ + + trim: Union[Literal[True], float, None] = None + """Useful for images with a solid or nearly solid background and a central object. + + This parameter trims the background, leaving only the central object in the + output image. See + [Trim edges](https://imagekit.io/docs/effects-and-enhancements#trim-edges---t). + """ + + unsharp_mask: Union[Literal[True], str, None] = FieldInfo(alias="unsharpMask", default=None) + """Applies Unsharp Masking (USM), an image sharpening technique. + + Pass `true` for a default unsharp mask, or provide a string for a custom unsharp + mask. See + [Unsharp Mask](https://imagekit.io/docs/effects-and-enhancements#unsharp-mask---e-usm). + """ + + video_codec: Optional[Literal["h264", "vp9", "av1", "none"]] = FieldInfo(alias="videoCodec", default=None) + """Specifies the video codec, e.g., `h264`, `vp9`, `av1`, or `none`. + + See [Video codec](https://imagekit.io/docs/video-optimization#video-codec---vc). + """ + + width: Union[float, str, None] = None + """Specifies the width of the output. + + If a value between 0 and 1 is provided, it is treated as a percentage (e.g., + `0.4` represents 40% of the original width). You can also supply arithmetic + expressions (e.g., `iw_div_2`). Width transformation – + [Images](https://imagekit.io/docs/image-resize-and-crop#width---w) · + [Videos](https://imagekit.io/docs/video-resize-and-crop#width---w) + """ + + x: Union[float, str, None] = None + """Focus using cropped image coordinates - X coordinate. + + See + [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + """ + + x_center: Union[float, str, None] = FieldInfo(alias="xCenter", default=None) + """Focus using cropped image coordinates - X center coordinate. + + See + [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + """ + + y: Union[float, str, None] = None + """Focus using cropped image coordinates - Y coordinate. + + See + [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + """ + + y_center: Union[float, str, None] = FieldInfo(alias="yCenter", default=None) + """Focus using cropped image coordinates - Y center coordinate. + + See + [Focus using cropped coordinates](https://imagekit.io/docs/image-resize-and-crop#example---focus-using-cropped-image-coordinates). + """ + + zoom: Optional[float] = None + """ + Accepts a numeric value that determines how much to zoom in or out of the + cropped area. It should be used in conjunction with fo-face or fo-. + See [Zoom](https://imagekit.io/docs/image-resize-and-crop#zoom---z). + """ + + +from .overlay import Overlay diff --git a/src/imagekit/types/shared/transformation_position.py b/src/imagekit/types/shared/transformation_position.py new file mode 100644 index 0000000..bded9e8 --- /dev/null +++ b/src/imagekit/types/shared/transformation_position.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["TransformationPosition"] + +TransformationPosition: TypeAlias = Literal["path", "query"] diff --git a/src/imagekit/types/shared/video_overlay.py b/src/imagekit/types/shared/video_overlay.py new file mode 100644 index 0000000..3cc64c6 --- /dev/null +++ b/src/imagekit/types/shared/video_overlay.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal + +from .base_overlay import BaseOverlay + +__all__ = ["VideoOverlay"] + + +class VideoOverlay(BaseOverlay): + input: str + """Specifies the relative path to the video used as an overlay.""" + + type: Literal["video"] + + encoding: Optional[Literal["auto", "plain", "base64"]] = None + """ + The input path can be included in the layer as either `i-{input}` or + `ie-{base64_encoded_input}`. By default, the SDK determines the appropriate + format automatically. To always use base64 encoding (`ie-{base64}`), set this + parameter to `base64`. To always use plain text (`i-{input}`), set it to + `plain`. + """ + + transformation: Optional[List["Transformation"]] = None + """Array of transformation to be applied to the overlay video. + + Except `streamingResolutions`, all other video transformations are supported. + See [Video transformations](https://imagekit.io/docs/video-transformation). + """ + + +from .transformation import Transformation diff --git a/src/imagekit/types/unsafe_unwrap_webhook_event.py b/src/imagekit/types/unsafe_unwrap_webhook_event.py new file mode 100644 index 0000000..c04c98a --- /dev/null +++ b/src/imagekit/types/unsafe_unwrap_webhook_event.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import TypeAlias + +from .upload_pre_transform_error_event import UploadPreTransformErrorEvent +from .video_transformation_error_event import VideoTransformationErrorEvent +from .video_transformation_ready_event import VideoTransformationReadyEvent +from .upload_post_transform_error_event import UploadPostTransformErrorEvent +from .upload_pre_transform_success_event import UploadPreTransformSuccessEvent +from .upload_post_transform_success_event import UploadPostTransformSuccessEvent +from .video_transformation_accepted_event import VideoTransformationAcceptedEvent + +__all__ = ["UnsafeUnwrapWebhookEvent"] + +UnsafeUnwrapWebhookEvent: TypeAlias = Union[ + VideoTransformationAcceptedEvent, + VideoTransformationReadyEvent, + VideoTransformationErrorEvent, + UploadPreTransformSuccessEvent, + UploadPreTransformErrorEvent, + UploadPostTransformSuccessEvent, + UploadPostTransformErrorEvent, +] diff --git a/src/imagekit/types/unwrap_webhook_event.py b/src/imagekit/types/unwrap_webhook_event.py new file mode 100644 index 0000000..dddf005 --- /dev/null +++ b/src/imagekit/types/unwrap_webhook_event.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import TypeAlias + +from .upload_pre_transform_error_event import UploadPreTransformErrorEvent +from .video_transformation_error_event import VideoTransformationErrorEvent +from .video_transformation_ready_event import VideoTransformationReadyEvent +from .upload_post_transform_error_event import UploadPostTransformErrorEvent +from .upload_pre_transform_success_event import UploadPreTransformSuccessEvent +from .upload_post_transform_success_event import UploadPostTransformSuccessEvent +from .video_transformation_accepted_event import VideoTransformationAcceptedEvent + +__all__ = ["UnwrapWebhookEvent"] + +UnwrapWebhookEvent: TypeAlias = Union[ + VideoTransformationAcceptedEvent, + VideoTransformationReadyEvent, + VideoTransformationErrorEvent, + UploadPreTransformSuccessEvent, + UploadPreTransformErrorEvent, + UploadPostTransformSuccessEvent, + UploadPostTransformErrorEvent, +] diff --git a/src/imagekit/types/upload_post_transform_error_event.py b/src/imagekit/types/upload_post_transform_error_event.py new file mode 100644 index 0000000..3b3c332 --- /dev/null +++ b/src/imagekit/types/upload_post_transform_error_event.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .base_webhook_event import BaseWebhookEvent + +__all__ = [ + "UploadPostTransformErrorEvent", + "UploadPostTransformErrorEventData", + "UploadPostTransformErrorEventDataTransformation", + "UploadPostTransformErrorEventDataTransformationError", + "UploadPostTransformErrorEventRequest", + "UploadPostTransformErrorEventRequestTransformation", +] + + +class UploadPostTransformErrorEventDataTransformationError(BaseModel): + reason: str + """Reason for the post-transformation failure.""" + + +class UploadPostTransformErrorEventDataTransformation(BaseModel): + error: UploadPostTransformErrorEventDataTransformationError + + +class UploadPostTransformErrorEventData(BaseModel): + file_id: str = FieldInfo(alias="fileId") + """Unique identifier of the originally uploaded file.""" + + name: str + """Name of the file.""" + + path: str + """Path of the file.""" + + transformation: UploadPostTransformErrorEventDataTransformation + + url: str + """URL of the attempted post-transformation.""" + + +class UploadPostTransformErrorEventRequestTransformation(BaseModel): + type: Literal["transformation", "abs", "gif-to-video", "thumbnail"] + """Type of the requested post-transformation.""" + + protocol: Optional[Literal["hls", "dash"]] = None + """Only applicable if transformation type is 'abs'. Streaming protocol used.""" + + value: Optional[str] = None + """Value for the requested transformation type.""" + + +class UploadPostTransformErrorEventRequest(BaseModel): + transformation: UploadPostTransformErrorEventRequestTransformation + + x_request_id: str + """Unique identifier for the originating request.""" + + +class UploadPostTransformErrorEvent(BaseWebhookEvent): + created_at: datetime + """Timestamp of when the event occurred in ISO8601 format.""" + + data: UploadPostTransformErrorEventData + + request: UploadPostTransformErrorEventRequest + + type: Literal["upload.post-transform.error"] # type: ignore diff --git a/src/imagekit/types/upload_post_transform_success_event.py b/src/imagekit/types/upload_post_transform_success_event.py new file mode 100644 index 0000000..5026cfc --- /dev/null +++ b/src/imagekit/types/upload_post_transform_success_event.py @@ -0,0 +1,57 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .base_webhook_event import BaseWebhookEvent + +__all__ = [ + "UploadPostTransformSuccessEvent", + "UploadPostTransformSuccessEventData", + "UploadPostTransformSuccessEventRequest", + "UploadPostTransformSuccessEventRequestTransformation", +] + + +class UploadPostTransformSuccessEventData(BaseModel): + file_id: str = FieldInfo(alias="fileId") + """Unique identifier of the originally uploaded file.""" + + name: str + """Name of the file.""" + + url: str + """URL of the generated post-transformation.""" + + +class UploadPostTransformSuccessEventRequestTransformation(BaseModel): + type: Literal["transformation", "abs", "gif-to-video", "thumbnail"] + """Type of the requested post-transformation.""" + + protocol: Optional[Literal["hls", "dash"]] = None + """Only applicable if transformation type is 'abs'. Streaming protocol used.""" + + value: Optional[str] = None + """Value for the requested transformation type.""" + + +class UploadPostTransformSuccessEventRequest(BaseModel): + transformation: UploadPostTransformSuccessEventRequestTransformation + + x_request_id: str + """Unique identifier for the originating request.""" + + +class UploadPostTransformSuccessEvent(BaseWebhookEvent): + created_at: datetime + """Timestamp of when the event occurred in ISO8601 format.""" + + data: UploadPostTransformSuccessEventData + + request: UploadPostTransformSuccessEventRequest + + type: Literal["upload.post-transform.success"] # type: ignore diff --git a/src/imagekit/types/upload_pre_transform_error_event.py b/src/imagekit/types/upload_pre_transform_error_event.py new file mode 100644 index 0000000..6140795 --- /dev/null +++ b/src/imagekit/types/upload_pre_transform_error_event.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .base_webhook_event import BaseWebhookEvent + +__all__ = [ + "UploadPreTransformErrorEvent", + "UploadPreTransformErrorEventData", + "UploadPreTransformErrorEventDataTransformation", + "UploadPreTransformErrorEventDataTransformationError", + "UploadPreTransformErrorEventRequest", +] + + +class UploadPreTransformErrorEventDataTransformationError(BaseModel): + reason: str + """Reason for the pre-transformation failure.""" + + +class UploadPreTransformErrorEventDataTransformation(BaseModel): + error: UploadPreTransformErrorEventDataTransformationError + + +class UploadPreTransformErrorEventData(BaseModel): + name: str + """Name of the file.""" + + path: str + """Path of the file.""" + + transformation: UploadPreTransformErrorEventDataTransformation + + +class UploadPreTransformErrorEventRequest(BaseModel): + transformation: str + """The requested pre-transformation string.""" + + x_request_id: str + """Unique identifier for the originating request.""" + + +class UploadPreTransformErrorEvent(BaseWebhookEvent): + created_at: datetime + """Timestamp of when the event occurred in ISO8601 format.""" + + data: UploadPreTransformErrorEventData + + request: UploadPreTransformErrorEventRequest + + type: Literal["upload.pre-transform.error"] # type: ignore diff --git a/src/imagekit/types/upload_pre_transform_success_event.py b/src/imagekit/types/upload_pre_transform_success_event.py new file mode 100644 index 0000000..e29cd64 --- /dev/null +++ b/src/imagekit/types/upload_pre_transform_success_event.py @@ -0,0 +1,207 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .metadata import Metadata +from .base_webhook_event import BaseWebhookEvent + +__all__ = [ + "UploadPreTransformSuccessEvent", + "UploadPreTransformSuccessEventData", + "UploadPreTransformSuccessEventDataAITag", + "UploadPreTransformSuccessEventDataExtensionStatus", + "UploadPreTransformSuccessEventDataVersionInfo", + "UploadPreTransformSuccessEventRequest", +] + + +class UploadPreTransformSuccessEventDataAITag(BaseModel): + confidence: Optional[float] = None + """Confidence score of the tag.""" + + name: Optional[str] = None + """Name of the tag.""" + + source: Optional[str] = None + """Array of `AITags` associated with the image. + + If no `AITags` are set, it will be null. These tags can be added using the + `google-auto-tagging` or `aws-auto-tagging` extensions. + """ + + +class UploadPreTransformSuccessEventDataExtensionStatus(BaseModel): + ai_auto_description: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="ai-auto-description", default=None + ) + + aws_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="aws-auto-tagging", default=None + ) + + google_auto_tagging: Optional[Literal["success", "pending", "failed"]] = FieldInfo( + alias="google-auto-tagging", default=None + ) + + remove_bg: Optional[Literal["success", "pending", "failed"]] = FieldInfo(alias="remove-bg", default=None) + + +class UploadPreTransformSuccessEventDataVersionInfo(BaseModel): + id: Optional[str] = None + """Unique identifier of the file version.""" + + name: Optional[str] = None + """Name of the file version.""" + + +class UploadPreTransformSuccessEventData(BaseModel): + ai_tags: Optional[List[UploadPreTransformSuccessEventDataAITag]] = FieldInfo(alias="AITags", default=None) + """An array of tags assigned to the uploaded file by auto tagging.""" + + audio_codec: Optional[str] = FieldInfo(alias="audioCodec", default=None) + """The audio codec used in the video (only for video).""" + + bit_rate: Optional[int] = FieldInfo(alias="bitRate", default=None) + """The bit rate of the video in kbps (only for video).""" + + custom_coordinates: Optional[str] = FieldInfo(alias="customCoordinates", default=None) + """ + Value of custom coordinates associated with the image in the format + `x,y,width,height`. If `customCoordinates` are not defined, then it is `null`. + Send `customCoordinates` in `responseFields` in API request to get the value of + this field. + """ + + custom_metadata: Optional[Dict[str, object]] = FieldInfo(alias="customMetadata", default=None) + """A key-value data associated with the asset. + + Use `responseField` in API request to get `customMetadata` in the upload API + response. Before setting any custom metadata on an asset, you have to create the + field using custom metadata fields API. Send `customMetadata` in + `responseFields` in API request to get the value of this field. + """ + + description: Optional[str] = None + """Optional text to describe the contents of the file. + + Can be set by the user or the ai-auto-description extension. + """ + + duration: Optional[int] = None + """The duration of the video in seconds (only for video).""" + + embedded_metadata: Optional[Dict[str, object]] = FieldInfo(alias="embeddedMetadata", default=None) + """Consolidated embedded metadata associated with the file. + + It includes exif, iptc, and xmp data. Send `embeddedMetadata` in + `responseFields` in API request to get embeddedMetadata in the upload API + response. + """ + + extension_status: Optional[UploadPreTransformSuccessEventDataExtensionStatus] = FieldInfo( + alias="extensionStatus", default=None + ) + """ + Extension names with their processing status at the time of completion of the + request. It could have one of the following status values: + + `success`: The extension has been successfully applied. `failed`: The extension + has failed and will not be retried. `pending`: The extension will finish + processing in some time. On completion, the final status (success / failed) will + be sent to the `webhookUrl` provided. + + If no extension was requested, then this parameter is not returned. + """ + + file_id: Optional[str] = FieldInfo(alias="fileId", default=None) + """Unique fileId. + + Store this fileld in your database, as this will be used to perform update + action on this file. + """ + + file_path: Optional[str] = FieldInfo(alias="filePath", default=None) + """The relative path of the file in the media library e.g. + + `/marketing-assets/new-banner.jpg`. + """ + + file_type: Optional[str] = FieldInfo(alias="fileType", default=None) + """Type of the uploaded file. Possible values are `image`, `non-image`.""" + + height: Optional[float] = None + """Height of the image in pixels (Only for images)""" + + is_private_file: Optional[bool] = FieldInfo(alias="isPrivateFile", default=None) + """Is the file marked as private. + + It can be either `true` or `false`. Send `isPrivateFile` in `responseFields` in + API request to get the value of this field. + """ + + is_published: Optional[bool] = FieldInfo(alias="isPublished", default=None) + """Is the file published or in draft state. + + It can be either `true` or `false`. Send `isPublished` in `responseFields` in + API request to get the value of this field. + """ + + metadata: Optional[Metadata] = None + """Legacy metadata. + + Send `metadata` in `responseFields` in API request to get metadata in the upload + API response. + """ + + name: Optional[str] = None + """Name of the asset.""" + + size: Optional[float] = None + """Size of the image file in Bytes.""" + + tags: Optional[List[str]] = None + """The array of tags associated with the asset. + + If no tags are set, it will be `null`. Send `tags` in `responseFields` in API + request to get the value of this field. + """ + + thumbnail_url: Optional[str] = FieldInfo(alias="thumbnailUrl", default=None) + """In the case of an image, a small thumbnail URL.""" + + url: Optional[str] = None + """A publicly accessible URL of the file.""" + + version_info: Optional[UploadPreTransformSuccessEventDataVersionInfo] = FieldInfo(alias="versionInfo", default=None) + """An object containing the file or file version's `id` (versionId) and `name`.""" + + video_codec: Optional[str] = FieldInfo(alias="videoCodec", default=None) + """The video codec used in the video (only for video).""" + + width: Optional[float] = None + """Width of the image in pixels (Only for Images)""" + + +class UploadPreTransformSuccessEventRequest(BaseModel): + transformation: str + """The requested pre-transformation string.""" + + x_request_id: str + """Unique identifier for the originating request.""" + + +class UploadPreTransformSuccessEvent(BaseWebhookEvent): + created_at: datetime + """Timestamp of when the event occurred in ISO8601 format.""" + + data: UploadPreTransformSuccessEventData + """Object containing details of a successful upload.""" + + request: UploadPreTransformSuccessEventRequest + + type: Literal["upload.pre-transform.success"] # type: ignore diff --git a/src/imagekit/types/video_transformation_accepted_event.py b/src/imagekit/types/video_transformation_accepted_event.py new file mode 100644 index 0000000..18ff4df --- /dev/null +++ b/src/imagekit/types/video_transformation_accepted_event.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .base_webhook_event import BaseWebhookEvent + +__all__ = [ + "VideoTransformationAcceptedEvent", + "VideoTransformationAcceptedEventData", + "VideoTransformationAcceptedEventDataAsset", + "VideoTransformationAcceptedEventDataTransformation", + "VideoTransformationAcceptedEventDataTransformationOptions", + "VideoTransformationAcceptedEventRequest", +] + + +class VideoTransformationAcceptedEventDataAsset(BaseModel): + url: str + """URL to download or access the source video file.""" + + +class VideoTransformationAcceptedEventDataTransformationOptions(BaseModel): + audio_codec: Optional[Literal["aac", "opus"]] = None + """Audio codec used for encoding (aac or opus).""" + + auto_rotate: Optional[bool] = None + """Whether to automatically rotate the video based on metadata.""" + + format: Optional[Literal["mp4", "webm", "jpg", "png", "webp"]] = None + """Output format for the transformed video or thumbnail.""" + + quality: Optional[int] = None + """Quality setting for the output video.""" + + stream_protocol: Optional[Literal["HLS", "DASH"]] = None + """Streaming protocol for adaptive bitrate streaming.""" + + variants: Optional[List[str]] = None + """Array of quality representations for adaptive bitrate streaming.""" + + video_codec: Optional[Literal["h264", "vp9", "av1"]] = None + """Video codec used for encoding (h264, vp9, or av1).""" + + +class VideoTransformationAcceptedEventDataTransformation(BaseModel): + type: Literal["video-transformation", "gif-to-video", "video-thumbnail"] + """Type of video transformation: + + - `video-transformation`: Standard video processing (resize, format conversion, + etc.) + - `gif-to-video`: Convert animated GIF to video format + - `video-thumbnail`: Generate thumbnail image from video + """ + + options: Optional[VideoTransformationAcceptedEventDataTransformationOptions] = None + """Configuration options for video transformations.""" + + +class VideoTransformationAcceptedEventData(BaseModel): + asset: VideoTransformationAcceptedEventDataAsset + """Information about the source video asset being transformed.""" + + transformation: VideoTransformationAcceptedEventDataTransformation + """Base information about a video transformation request.""" + + +class VideoTransformationAcceptedEventRequest(BaseModel): + url: str + """Full URL of the transformation request that was submitted.""" + + x_request_id: str + """Unique identifier for the originating transformation request.""" + + user_agent: Optional[str] = None + """User-Agent header from the original request that triggered the transformation.""" + + +class VideoTransformationAcceptedEvent(BaseWebhookEvent): + created_at: datetime + """Timestamp when the event was created in ISO8601 format.""" + + data: VideoTransformationAcceptedEventData + + request: VideoTransformationAcceptedEventRequest + """Information about the original request that triggered the video transformation.""" + + type: Literal["video.transformation.accepted"] # type: ignore diff --git a/src/imagekit/types/video_transformation_error_event.py b/src/imagekit/types/video_transformation_error_event.py new file mode 100644 index 0000000..7e1970e --- /dev/null +++ b/src/imagekit/types/video_transformation_error_event.py @@ -0,0 +1,103 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .base_webhook_event import BaseWebhookEvent + +__all__ = [ + "VideoTransformationErrorEvent", + "VideoTransformationErrorEventData", + "VideoTransformationErrorEventDataAsset", + "VideoTransformationErrorEventDataTransformation", + "VideoTransformationErrorEventDataTransformationError", + "VideoTransformationErrorEventDataTransformationOptions", + "VideoTransformationErrorEventRequest", +] + + +class VideoTransformationErrorEventDataAsset(BaseModel): + url: str + """URL to download or access the source video file.""" + + +class VideoTransformationErrorEventDataTransformationError(BaseModel): + reason: Literal["encoding_failed", "download_failed", "internal_server_error"] + """Specific reason for the transformation failure: + + - `encoding_failed`: Error during video encoding process + - `download_failed`: Could not download source video + - `internal_server_error`: Unexpected server error + """ + + +class VideoTransformationErrorEventDataTransformationOptions(BaseModel): + audio_codec: Optional[Literal["aac", "opus"]] = None + """Audio codec used for encoding (aac or opus).""" + + auto_rotate: Optional[bool] = None + """Whether to automatically rotate the video based on metadata.""" + + format: Optional[Literal["mp4", "webm", "jpg", "png", "webp"]] = None + """Output format for the transformed video or thumbnail.""" + + quality: Optional[int] = None + """Quality setting for the output video.""" + + stream_protocol: Optional[Literal["HLS", "DASH"]] = None + """Streaming protocol for adaptive bitrate streaming.""" + + variants: Optional[List[str]] = None + """Array of quality representations for adaptive bitrate streaming.""" + + video_codec: Optional[Literal["h264", "vp9", "av1"]] = None + """Video codec used for encoding (h264, vp9, or av1).""" + + +class VideoTransformationErrorEventDataTransformation(BaseModel): + type: Literal["video-transformation", "gif-to-video", "video-thumbnail"] + """Type of video transformation: + + - `video-transformation`: Standard video processing (resize, format conversion, + etc.) + - `gif-to-video`: Convert animated GIF to video format + - `video-thumbnail`: Generate thumbnail image from video + """ + + error: Optional[VideoTransformationErrorEventDataTransformationError] = None + """Details about the transformation error.""" + + options: Optional[VideoTransformationErrorEventDataTransformationOptions] = None + """Configuration options for video transformations.""" + + +class VideoTransformationErrorEventData(BaseModel): + asset: VideoTransformationErrorEventDataAsset + """Information about the source video asset being transformed.""" + + transformation: VideoTransformationErrorEventDataTransformation + + +class VideoTransformationErrorEventRequest(BaseModel): + url: str + """Full URL of the transformation request that was submitted.""" + + x_request_id: str + """Unique identifier for the originating transformation request.""" + + user_agent: Optional[str] = None + """User-Agent header from the original request that triggered the transformation.""" + + +class VideoTransformationErrorEvent(BaseWebhookEvent): + created_at: datetime + """Timestamp when the event was created in ISO8601 format.""" + + data: VideoTransformationErrorEventData + + request: VideoTransformationErrorEventRequest + """Information about the original request that triggered the video transformation.""" + + type: Literal["video.transformation.error"] # type: ignore diff --git a/src/imagekit/types/video_transformation_ready_event.py b/src/imagekit/types/video_transformation_ready_event.py new file mode 100644 index 0000000..1b52dcd --- /dev/null +++ b/src/imagekit/types/video_transformation_ready_event.py @@ -0,0 +1,131 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel +from .base_webhook_event import BaseWebhookEvent + +__all__ = [ + "VideoTransformationReadyEvent", + "VideoTransformationReadyEventData", + "VideoTransformationReadyEventDataAsset", + "VideoTransformationReadyEventDataTransformation", + "VideoTransformationReadyEventDataTransformationOptions", + "VideoTransformationReadyEventDataTransformationOutput", + "VideoTransformationReadyEventDataTransformationOutputVideoMetadata", + "VideoTransformationReadyEventRequest", + "VideoTransformationReadyEventTimings", +] + + +class VideoTransformationReadyEventDataAsset(BaseModel): + url: str + """URL to download or access the source video file.""" + + +class VideoTransformationReadyEventDataTransformationOptions(BaseModel): + audio_codec: Optional[Literal["aac", "opus"]] = None + """Audio codec used for encoding (aac or opus).""" + + auto_rotate: Optional[bool] = None + """Whether to automatically rotate the video based on metadata.""" + + format: Optional[Literal["mp4", "webm", "jpg", "png", "webp"]] = None + """Output format for the transformed video or thumbnail.""" + + quality: Optional[int] = None + """Quality setting for the output video.""" + + stream_protocol: Optional[Literal["HLS", "DASH"]] = None + """Streaming protocol for adaptive bitrate streaming.""" + + variants: Optional[List[str]] = None + """Array of quality representations for adaptive bitrate streaming.""" + + video_codec: Optional[Literal["h264", "vp9", "av1"]] = None + """Video codec used for encoding (h264, vp9, or av1).""" + + +class VideoTransformationReadyEventDataTransformationOutputVideoMetadata(BaseModel): + bitrate: int + """Bitrate of the output video in bits per second.""" + + duration: float + """Duration of the output video in seconds.""" + + height: int + """Height of the output video in pixels.""" + + width: int + """Width of the output video in pixels.""" + + +class VideoTransformationReadyEventDataTransformationOutput(BaseModel): + url: str + """URL to access the transformed video.""" + + video_metadata: Optional[VideoTransformationReadyEventDataTransformationOutputVideoMetadata] = None + """Metadata of the output video file.""" + + +class VideoTransformationReadyEventDataTransformation(BaseModel): + type: Literal["video-transformation", "gif-to-video", "video-thumbnail"] + """Type of video transformation: + + - `video-transformation`: Standard video processing (resize, format conversion, + etc.) + - `gif-to-video`: Convert animated GIF to video format + - `video-thumbnail`: Generate thumbnail image from video + """ + + options: Optional[VideoTransformationReadyEventDataTransformationOptions] = None + """Configuration options for video transformations.""" + + output: Optional[VideoTransformationReadyEventDataTransformationOutput] = None + """Information about the transformed output video.""" + + +class VideoTransformationReadyEventData(BaseModel): + asset: VideoTransformationReadyEventDataAsset + """Information about the source video asset being transformed.""" + + transformation: VideoTransformationReadyEventDataTransformation + + +class VideoTransformationReadyEventRequest(BaseModel): + url: str + """Full URL of the transformation request that was submitted.""" + + x_request_id: str + """Unique identifier for the originating transformation request.""" + + user_agent: Optional[str] = None + """User-Agent header from the original request that triggered the transformation.""" + + +class VideoTransformationReadyEventTimings(BaseModel): + download_duration: Optional[int] = None + """ + Time spent downloading the source video from your origin or media library, in + milliseconds. + """ + + encoding_duration: Optional[int] = None + """Time spent encoding the video, in milliseconds.""" + + +class VideoTransformationReadyEvent(BaseWebhookEvent): + created_at: datetime + """Timestamp when the event was created in ISO8601 format.""" + + data: VideoTransformationReadyEventData + + request: VideoTransformationReadyEventRequest + """Information about the original request that triggered the video transformation.""" + + type: Literal["video.transformation.ready"] # type: ignore + + timings: Optional[VideoTransformationReadyEventTimings] = None + """Performance metrics for the transformation process.""" diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..fd8019a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/accounts/__init__.py b/tests/api_resources/accounts/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/accounts/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/accounts/test_origins.py b/tests/api_resources/accounts/test_origins.py new file mode 100644 index 0000000..ba060f6 --- /dev/null +++ b/tests/api_resources/accounts/test_origins.py @@ -0,0 +1,565 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types.accounts import ( + OriginResponse, + OriginListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestOrigins: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: ImageKit) -> None: + origin = client.accounts.origins.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: ImageKit) -> None: + origin = client.accounts.origins.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + "base_url_for_canonical_header": "https://cdn.example.com", + "include_canonical_header": False, + "prefix": "images", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: ImageKit) -> None: + response = client.accounts.origins.with_raw_response.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: ImageKit) -> None: + with client.accounts.origins.with_streaming_response.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update(self, client: ImageKit) -> None: + origin = client.accounts.origins.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: ImageKit) -> None: + origin = client.accounts.origins.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + "base_url_for_canonical_header": "https://cdn.example.com", + "include_canonical_header": False, + "prefix": "images", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_update(self, client: ImageKit) -> None: + response = client.accounts.origins.with_raw_response.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_update(self, client: ImageKit) -> None: + with client.accounts.origins.with_streaming_response.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_update(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.accounts.origins.with_raw_response.update( + id="", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: ImageKit) -> None: + origin = client.accounts.origins.list() + assert_matches_type(OriginListResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: ImageKit) -> None: + response = client.accounts.origins.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = response.parse() + assert_matches_type(OriginListResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: ImageKit) -> None: + with client.accounts.origins.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = response.parse() + assert_matches_type(OriginListResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: ImageKit) -> None: + origin = client.accounts.origins.delete( + "id", + ) + assert origin is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: ImageKit) -> None: + response = client.accounts.origins.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = response.parse() + assert origin is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: ImageKit) -> None: + with client.accounts.origins.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = response.parse() + assert origin is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.accounts.origins.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + origin = client.accounts.origins.get( + "id", + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.accounts.origins.with_raw_response.get( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.accounts.origins.with_streaming_response.get( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_get(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.accounts.origins.with_raw_response.get( + "", + ) + + +class TestAsyncOrigins: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncImageKit) -> None: + origin = await async_client.accounts.origins.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncImageKit) -> None: + origin = await async_client.accounts.origins.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + "base_url_for_canonical_header": "https://cdn.example.com", + "include_canonical_header": False, + "prefix": "images", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.origins.with_raw_response.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = await response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.origins.with_streaming_response.create( + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = await response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncImageKit) -> None: + origin = await async_client.accounts.origins.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncImageKit) -> None: + origin = await async_client.accounts.origins.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + "base_url_for_canonical_header": "https://cdn.example.com", + "include_canonical_header": False, + "prefix": "images", + }, + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.origins.with_raw_response.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = await response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.origins.with_streaming_response.update( + id="id", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = await response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.accounts.origins.with_raw_response.update( + id="", + origin={ + "access_key": "AKIATEST123", + "bucket": "test-bucket", + "name": "My S3 Origin", + "secret_key": "secrettest123", + "type": "S3", + }, + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncImageKit) -> None: + origin = await async_client.accounts.origins.list() + assert_matches_type(OriginListResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.origins.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = await response.parse() + assert_matches_type(OriginListResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.origins.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = await response.parse() + assert_matches_type(OriginListResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncImageKit) -> None: + origin = await async_client.accounts.origins.delete( + "id", + ) + assert origin is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.origins.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = await response.parse() + assert origin is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.origins.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = await response.parse() + assert origin is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.accounts.origins.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + origin = await async_client.accounts.origins.get( + "id", + ) + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.origins.with_raw_response.get( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + origin = await response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.origins.with_streaming_response.get( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + origin = await response.parse() + assert_matches_type(OriginResponse, origin, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_get(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.accounts.origins.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/accounts/test_url_endpoints.py b/tests/api_resources/accounts/test_url_endpoints.py new file mode 100644 index 0000000..714a7c0 --- /dev/null +++ b/tests/api_resources/accounts/test_url_endpoints.py @@ -0,0 +1,469 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types.accounts import ( + URLEndpointResponse, + URLEndpointListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestURLEndpoints: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: ImageKit) -> None: + url_endpoint = client.accounts.url_endpoints.create( + description="My custom URL endpoint", + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: ImageKit) -> None: + url_endpoint = client.accounts.url_endpoints.create( + description="My custom URL endpoint", + origins=["origin-id-1"], + url_prefix="product-images", + url_rewriter={ + "type": "CLOUDINARY", + "preserve_asset_delivery_types": True, + }, + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: ImageKit) -> None: + response = client.accounts.url_endpoints.with_raw_response.create( + description="My custom URL endpoint", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: ImageKit) -> None: + with client.accounts.url_endpoints.with_streaming_response.create( + description="My custom URL endpoint", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update(self, client: ImageKit) -> None: + url_endpoint = client.accounts.url_endpoints.update( + id="id", + description="My custom URL endpoint", + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: ImageKit) -> None: + url_endpoint = client.accounts.url_endpoints.update( + id="id", + description="My custom URL endpoint", + origins=["origin-id-1"], + url_prefix="product-images", + url_rewriter={ + "type": "CLOUDINARY", + "preserve_asset_delivery_types": True, + }, + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_update(self, client: ImageKit) -> None: + response = client.accounts.url_endpoints.with_raw_response.update( + id="id", + description="My custom URL endpoint", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_update(self, client: ImageKit) -> None: + with client.accounts.url_endpoints.with_streaming_response.update( + id="id", + description="My custom URL endpoint", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_update(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.accounts.url_endpoints.with_raw_response.update( + id="", + description="My custom URL endpoint", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: ImageKit) -> None: + url_endpoint = client.accounts.url_endpoints.list() + assert_matches_type(URLEndpointListResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: ImageKit) -> None: + response = client.accounts.url_endpoints.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = response.parse() + assert_matches_type(URLEndpointListResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: ImageKit) -> None: + with client.accounts.url_endpoints.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = response.parse() + assert_matches_type(URLEndpointListResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: ImageKit) -> None: + url_endpoint = client.accounts.url_endpoints.delete( + "id", + ) + assert url_endpoint is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: ImageKit) -> None: + response = client.accounts.url_endpoints.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = response.parse() + assert url_endpoint is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: ImageKit) -> None: + with client.accounts.url_endpoints.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = response.parse() + assert url_endpoint is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.accounts.url_endpoints.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + url_endpoint = client.accounts.url_endpoints.get( + "id", + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.accounts.url_endpoints.with_raw_response.get( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.accounts.url_endpoints.with_streaming_response.get( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_get(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.accounts.url_endpoints.with_raw_response.get( + "", + ) + + +class TestAsyncURLEndpoints: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncImageKit) -> None: + url_endpoint = await async_client.accounts.url_endpoints.create( + description="My custom URL endpoint", + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncImageKit) -> None: + url_endpoint = await async_client.accounts.url_endpoints.create( + description="My custom URL endpoint", + origins=["origin-id-1"], + url_prefix="product-images", + url_rewriter={ + "type": "CLOUDINARY", + "preserve_asset_delivery_types": True, + }, + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.url_endpoints.with_raw_response.create( + description="My custom URL endpoint", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = await response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.url_endpoints.with_streaming_response.create( + description="My custom URL endpoint", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = await response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncImageKit) -> None: + url_endpoint = await async_client.accounts.url_endpoints.update( + id="id", + description="My custom URL endpoint", + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncImageKit) -> None: + url_endpoint = await async_client.accounts.url_endpoints.update( + id="id", + description="My custom URL endpoint", + origins=["origin-id-1"], + url_prefix="product-images", + url_rewriter={ + "type": "CLOUDINARY", + "preserve_asset_delivery_types": True, + }, + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.url_endpoints.with_raw_response.update( + id="id", + description="My custom URL endpoint", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = await response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.url_endpoints.with_streaming_response.update( + id="id", + description="My custom URL endpoint", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = await response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.accounts.url_endpoints.with_raw_response.update( + id="", + description="My custom URL endpoint", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncImageKit) -> None: + url_endpoint = await async_client.accounts.url_endpoints.list() + assert_matches_type(URLEndpointListResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.url_endpoints.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = await response.parse() + assert_matches_type(URLEndpointListResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.url_endpoints.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = await response.parse() + assert_matches_type(URLEndpointListResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncImageKit) -> None: + url_endpoint = await async_client.accounts.url_endpoints.delete( + "id", + ) + assert url_endpoint is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.url_endpoints.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = await response.parse() + assert url_endpoint is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.url_endpoints.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = await response.parse() + assert url_endpoint is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.accounts.url_endpoints.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + url_endpoint = await async_client.accounts.url_endpoints.get( + "id", + ) + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.url_endpoints.with_raw_response.get( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + url_endpoint = await response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.url_endpoints.with_streaming_response.get( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + url_endpoint = await response.parse() + assert_matches_type(URLEndpointResponse, url_endpoint, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_get(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.accounts.url_endpoints.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/accounts/test_usage.py b/tests/api_resources/accounts/test_usage.py new file mode 100644 index 0000000..3d65bf9 --- /dev/null +++ b/tests/api_resources/accounts/test_usage.py @@ -0,0 +1,99 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit._utils import parse_date +from imagekit.types.accounts import UsageGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestUsage: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + usage = client.accounts.usage.get( + end_date=parse_date("2019-12-27"), + start_date=parse_date("2019-12-27"), + ) + assert_matches_type(UsageGetResponse, usage, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.accounts.usage.with_raw_response.get( + end_date=parse_date("2019-12-27"), + start_date=parse_date("2019-12-27"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + usage = response.parse() + assert_matches_type(UsageGetResponse, usage, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.accounts.usage.with_streaming_response.get( + end_date=parse_date("2019-12-27"), + start_date=parse_date("2019-12-27"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = response.parse() + assert_matches_type(UsageGetResponse, usage, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncUsage: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + usage = await async_client.accounts.usage.get( + end_date=parse_date("2019-12-27"), + start_date=parse_date("2019-12-27"), + ) + assert_matches_type(UsageGetResponse, usage, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.accounts.usage.with_raw_response.get( + end_date=parse_date("2019-12-27"), + start_date=parse_date("2019-12-27"), + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + usage = await response.parse() + assert_matches_type(UsageGetResponse, usage, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.accounts.usage.with_streaming_response.get( + end_date=parse_date("2019-12-27"), + start_date=parse_date("2019-12-27"), + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + usage = await response.parse() + assert_matches_type(UsageGetResponse, usage, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/beta/__init__.py b/tests/api_resources/beta/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/beta/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/beta/v2/__init__.py b/tests/api_resources/beta/v2/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/beta/v2/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/beta/v2/test_files.py b/tests/api_resources/beta/v2/test_files.py new file mode 100644 index 0000000..e5757ff --- /dev/null +++ b/tests/api_resources/beta/v2/test_files.py @@ -0,0 +1,216 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types.beta.v2 import FileUploadResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFiles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_upload(self, client: ImageKit) -> None: + file = client.beta.v2.files.upload( + file=b"raw file contents", + file_name="fileName", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_upload_with_all_params(self, client: ImageKit) -> None: + file = client.beta.v2.files.upload( + file=b"raw file contents", + file_name="fileName", + token="token", + checks='"request.folder" : "marketing/"\n', + custom_coordinates="customCoordinates", + custom_metadata={ + "brand": "bar", + "color": "bar", + }, + description="Running shoes", + extensions=[ + { + "name": "remove-bg", + "options": { + "add_shadow": True, + "bg_color": "bg_color", + "bg_image_url": "bg_image_url", + "semitransparency": True, + }, + }, + { + "max_tags": 5, + "min_confidence": 95, + "name": "google-auto-tagging", + }, + {"name": "ai-auto-description"}, + ], + folder="folder", + is_private_file=True, + is_published=True, + overwrite_ai_tags=True, + overwrite_custom_metadata=True, + overwrite_file=True, + overwrite_tags=True, + response_fields=["tags", "customCoordinates", "isPrivateFile"], + tags=["t-shirt", "round-neck", "men"], + transformation={ + "post": [ + { + "type": "thumbnail", + "value": "w-150,h-150", + }, + { + "protocol": "dash", + "type": "abs", + "value": "sr-240_360_480_720_1080", + }, + ], + "pre": "w-300,h-300,q-80", + }, + use_unique_file_name=True, + webhook_url="https://example.com", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_upload(self, client: ImageKit) -> None: + response = client.beta.v2.files.with_raw_response.upload( + file=b"raw file contents", + file_name="fileName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_upload(self, client: ImageKit) -> None: + with client.beta.v2.files.with_streaming_response.upload( + file=b"raw file contents", + file_name="fileName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFiles: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_upload(self, async_client: AsyncImageKit) -> None: + file = await async_client.beta.v2.files.upload( + file=b"raw file contents", + file_name="fileName", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_upload_with_all_params(self, async_client: AsyncImageKit) -> None: + file = await async_client.beta.v2.files.upload( + file=b"raw file contents", + file_name="fileName", + token="token", + checks='"request.folder" : "marketing/"\n', + custom_coordinates="customCoordinates", + custom_metadata={ + "brand": "bar", + "color": "bar", + }, + description="Running shoes", + extensions=[ + { + "name": "remove-bg", + "options": { + "add_shadow": True, + "bg_color": "bg_color", + "bg_image_url": "bg_image_url", + "semitransparency": True, + }, + }, + { + "max_tags": 5, + "min_confidence": 95, + "name": "google-auto-tagging", + }, + {"name": "ai-auto-description"}, + ], + folder="folder", + is_private_file=True, + is_published=True, + overwrite_ai_tags=True, + overwrite_custom_metadata=True, + overwrite_file=True, + overwrite_tags=True, + response_fields=["tags", "customCoordinates", "isPrivateFile"], + tags=["t-shirt", "round-neck", "men"], + transformation={ + "post": [ + { + "type": "thumbnail", + "value": "w-150,h-150", + }, + { + "protocol": "dash", + "type": "abs", + "value": "sr-240_360_480_720_1080", + }, + ], + "pre": "w-300,h-300,q-80", + }, + use_unique_file_name=True, + webhook_url="https://example.com", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_upload(self, async_client: AsyncImageKit) -> None: + response = await async_client.beta.v2.files.with_raw_response.upload( + file=b"raw file contents", + file_name="fileName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_upload(self, async_client: AsyncImageKit) -> None: + async with async_client.beta.v2.files.with_streaming_response.upload( + file=b"raw file contents", + file_name="fileName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/cache/__init__.py b/tests/api_resources/cache/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/cache/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/cache/test_invalidation.py b/tests/api_resources/cache/test_invalidation.py new file mode 100644 index 0000000..4fe9317 --- /dev/null +++ b/tests/api_resources/cache/test_invalidation.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types.cache import InvalidationGetResponse, InvalidationCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInvalidation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: ImageKit) -> None: + invalidation = client.cache.invalidation.create( + url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + ) + assert_matches_type(InvalidationCreateResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: ImageKit) -> None: + response = client.cache.invalidation.with_raw_response.create( + url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + invalidation = response.parse() + assert_matches_type(InvalidationCreateResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: ImageKit) -> None: + with client.cache.invalidation.with_streaming_response.create( + url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + invalidation = response.parse() + assert_matches_type(InvalidationCreateResponse, invalidation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + invalidation = client.cache.invalidation.get( + "requestId", + ) + assert_matches_type(InvalidationGetResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.cache.invalidation.with_raw_response.get( + "requestId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + invalidation = response.parse() + assert_matches_type(InvalidationGetResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.cache.invalidation.with_streaming_response.get( + "requestId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + invalidation = response.parse() + assert_matches_type(InvalidationGetResponse, invalidation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_get(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + client.cache.invalidation.with_raw_response.get( + "", + ) + + +class TestAsyncInvalidation: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncImageKit) -> None: + invalidation = await async_client.cache.invalidation.create( + url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + ) + assert_matches_type(InvalidationCreateResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncImageKit) -> None: + response = await async_client.cache.invalidation.with_raw_response.create( + url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + invalidation = await response.parse() + assert_matches_type(InvalidationCreateResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncImageKit) -> None: + async with async_client.cache.invalidation.with_streaming_response.create( + url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + invalidation = await response.parse() + assert_matches_type(InvalidationCreateResponse, invalidation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + invalidation = await async_client.cache.invalidation.get( + "requestId", + ) + assert_matches_type(InvalidationGetResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.cache.invalidation.with_raw_response.get( + "requestId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + invalidation = await response.parse() + assert_matches_type(InvalidationGetResponse, invalidation, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.cache.invalidation.with_streaming_response.get( + "requestId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + invalidation = await response.parse() + assert_matches_type(InvalidationGetResponse, invalidation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_get(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `request_id` but received ''"): + await async_client.cache.invalidation.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/files/__init__.py b/tests/api_resources/files/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/files/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/files/test_bulk.py b/tests/api_resources/files/test_bulk.py new file mode 100644 index 0000000..3b7c825 --- /dev/null +++ b/tests/api_resources/files/test_bulk.py @@ -0,0 +1,319 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types.files import ( + BulkDeleteResponse, + BulkAddTagsResponse, + BulkRemoveTagsResponse, + BulkRemoveAITagsResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBulk: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: ImageKit) -> None: + bulk = client.files.bulk.delete( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: ImageKit) -> None: + response = client.files.bulk.with_raw_response.delete( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = response.parse() + assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: ImageKit) -> None: + with client.files.bulk.with_streaming_response.delete( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = response.parse() + assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_add_tags(self, client: ImageKit) -> None: + bulk = client.files.bulk.add_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + assert_matches_type(BulkAddTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_add_tags(self, client: ImageKit) -> None: + response = client.files.bulk.with_raw_response.add_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = response.parse() + assert_matches_type(BulkAddTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_add_tags(self, client: ImageKit) -> None: + with client.files.bulk.with_streaming_response.add_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = response.parse() + assert_matches_type(BulkAddTagsResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_remove_ai_tags(self, client: ImageKit) -> None: + bulk = client.files.bulk.remove_ai_tags( + ai_tags=["t-shirt", "round-neck", "sale2019"], + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + assert_matches_type(BulkRemoveAITagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_remove_ai_tags(self, client: ImageKit) -> None: + response = client.files.bulk.with_raw_response.remove_ai_tags( + ai_tags=["t-shirt", "round-neck", "sale2019"], + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = response.parse() + assert_matches_type(BulkRemoveAITagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_remove_ai_tags(self, client: ImageKit) -> None: + with client.files.bulk.with_streaming_response.remove_ai_tags( + ai_tags=["t-shirt", "round-neck", "sale2019"], + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = response.parse() + assert_matches_type(BulkRemoveAITagsResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_remove_tags(self, client: ImageKit) -> None: + bulk = client.files.bulk.remove_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + assert_matches_type(BulkRemoveTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_remove_tags(self, client: ImageKit) -> None: + response = client.files.bulk.with_raw_response.remove_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = response.parse() + assert_matches_type(BulkRemoveTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_remove_tags(self, client: ImageKit) -> None: + with client.files.bulk.with_streaming_response.remove_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = response.parse() + assert_matches_type(BulkRemoveTagsResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncBulk: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncImageKit) -> None: + bulk = await async_client.files.bulk.delete( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.bulk.with_raw_response.delete( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = await response.parse() + assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncImageKit) -> None: + async with async_client.files.bulk.with_streaming_response.delete( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = await response.parse() + assert_matches_type(BulkDeleteResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_add_tags(self, async_client: AsyncImageKit) -> None: + bulk = await async_client.files.bulk.add_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + assert_matches_type(BulkAddTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_add_tags(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.bulk.with_raw_response.add_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = await response.parse() + assert_matches_type(BulkAddTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_add_tags(self, async_client: AsyncImageKit) -> None: + async with async_client.files.bulk.with_streaming_response.add_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = await response.parse() + assert_matches_type(BulkAddTagsResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_remove_ai_tags(self, async_client: AsyncImageKit) -> None: + bulk = await async_client.files.bulk.remove_ai_tags( + ai_tags=["t-shirt", "round-neck", "sale2019"], + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + assert_matches_type(BulkRemoveAITagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_remove_ai_tags(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.bulk.with_raw_response.remove_ai_tags( + ai_tags=["t-shirt", "round-neck", "sale2019"], + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = await response.parse() + assert_matches_type(BulkRemoveAITagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_remove_ai_tags(self, async_client: AsyncImageKit) -> None: + async with async_client.files.bulk.with_streaming_response.remove_ai_tags( + ai_tags=["t-shirt", "round-neck", "sale2019"], + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = await response.parse() + assert_matches_type(BulkRemoveAITagsResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_remove_tags(self, async_client: AsyncImageKit) -> None: + bulk = await async_client.files.bulk.remove_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + assert_matches_type(BulkRemoveTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_remove_tags(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.bulk.with_raw_response.remove_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bulk = await response.parse() + assert_matches_type(BulkRemoveTagsResponse, bulk, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_remove_tags(self, async_client: AsyncImageKit) -> None: + async with async_client.files.bulk.with_streaming_response.remove_tags( + file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"], + tags=["t-shirt", "round-neck", "sale2019"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bulk = await response.parse() + assert_matches_type(BulkRemoveTagsResponse, bulk, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/files/test_metadata.py b/tests/api_resources/files/test_metadata.py new file mode 100644 index 0000000..dc0d9f4 --- /dev/null +++ b/tests/api_resources/files/test_metadata.py @@ -0,0 +1,176 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types import Metadata + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestMetadata: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + metadata = client.files.metadata.get( + "fileId", + ) + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.files.metadata.with_raw_response.get( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metadata = response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.files.metadata.with_streaming_response.get( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metadata = response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_get(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.metadata.with_raw_response.get( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get_from_url(self, client: ImageKit) -> None: + metadata = client.files.metadata.get_from_url( + url="https://example.com", + ) + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get_from_url(self, client: ImageKit) -> None: + response = client.files.metadata.with_raw_response.get_from_url( + url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metadata = response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get_from_url(self, client: ImageKit) -> None: + with client.files.metadata.with_streaming_response.get_from_url( + url="https://example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metadata = response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncMetadata: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + metadata = await async_client.files.metadata.get( + "fileId", + ) + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.metadata.with_raw_response.get( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metadata = await response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.files.metadata.with_streaming_response.get( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metadata = await response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_get(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.metadata.with_raw_response.get( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get_from_url(self, async_client: AsyncImageKit) -> None: + metadata = await async_client.files.metadata.get_from_url( + url="https://example.com", + ) + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get_from_url(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.metadata.with_raw_response.get_from_url( + url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + metadata = await response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get_from_url(self, async_client: AsyncImageKit) -> None: + async with async_client.files.metadata.with_streaming_response.get_from_url( + url="https://example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + metadata = await response.parse() + assert_matches_type(Metadata, metadata, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/files/test_versions.py b/tests/api_resources/files/test_versions.py new file mode 100644 index 0000000..1d0121d --- /dev/null +++ b/tests/api_resources/files/test_versions.py @@ -0,0 +1,421 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types import File +from imagekit.types.files import VersionListResponse, VersionDeleteResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestVersions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: ImageKit) -> None: + version = client.files.versions.list( + "fileId", + ) + assert_matches_type(VersionListResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: ImageKit) -> None: + response = client.files.versions.with_raw_response.list( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = response.parse() + assert_matches_type(VersionListResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: ImageKit) -> None: + with client.files.versions.with_streaming_response.list( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = response.parse() + assert_matches_type(VersionListResponse, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_list(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.versions.with_raw_response.list( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: ImageKit) -> None: + version = client.files.versions.delete( + version_id="versionId", + file_id="fileId", + ) + assert_matches_type(VersionDeleteResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: ImageKit) -> None: + response = client.files.versions.with_raw_response.delete( + version_id="versionId", + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = response.parse() + assert_matches_type(VersionDeleteResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: ImageKit) -> None: + with client.files.versions.with_streaming_response.delete( + version_id="versionId", + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = response.parse() + assert_matches_type(VersionDeleteResponse, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.versions.with_raw_response.delete( + version_id="versionId", + file_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + client.files.versions.with_raw_response.delete( + version_id="", + file_id="fileId", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + version = client.files.versions.get( + version_id="versionId", + file_id="fileId", + ) + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.files.versions.with_raw_response.get( + version_id="versionId", + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = response.parse() + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.files.versions.with_streaming_response.get( + version_id="versionId", + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = response.parse() + assert_matches_type(File, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_get(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.versions.with_raw_response.get( + version_id="versionId", + file_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + client.files.versions.with_raw_response.get( + version_id="", + file_id="fileId", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_restore(self, client: ImageKit) -> None: + version = client.files.versions.restore( + version_id="versionId", + file_id="fileId", + ) + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_restore(self, client: ImageKit) -> None: + response = client.files.versions.with_raw_response.restore( + version_id="versionId", + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = response.parse() + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_restore(self, client: ImageKit) -> None: + with client.files.versions.with_streaming_response.restore( + version_id="versionId", + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = response.parse() + assert_matches_type(File, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_restore(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.versions.with_raw_response.restore( + version_id="versionId", + file_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + client.files.versions.with_raw_response.restore( + version_id="", + file_id="fileId", + ) + + +class TestAsyncVersions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncImageKit) -> None: + version = await async_client.files.versions.list( + "fileId", + ) + assert_matches_type(VersionListResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.versions.with_raw_response.list( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = await response.parse() + assert_matches_type(VersionListResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncImageKit) -> None: + async with async_client.files.versions.with_streaming_response.list( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = await response.parse() + assert_matches_type(VersionListResponse, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_list(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.versions.with_raw_response.list( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncImageKit) -> None: + version = await async_client.files.versions.delete( + version_id="versionId", + file_id="fileId", + ) + assert_matches_type(VersionDeleteResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.versions.with_raw_response.delete( + version_id="versionId", + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = await response.parse() + assert_matches_type(VersionDeleteResponse, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncImageKit) -> None: + async with async_client.files.versions.with_streaming_response.delete( + version_id="versionId", + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = await response.parse() + assert_matches_type(VersionDeleteResponse, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.versions.with_raw_response.delete( + version_id="versionId", + file_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + await async_client.files.versions.with_raw_response.delete( + version_id="", + file_id="fileId", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + version = await async_client.files.versions.get( + version_id="versionId", + file_id="fileId", + ) + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.versions.with_raw_response.get( + version_id="versionId", + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = await response.parse() + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.files.versions.with_streaming_response.get( + version_id="versionId", + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = await response.parse() + assert_matches_type(File, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_get(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.versions.with_raw_response.get( + version_id="versionId", + file_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + await async_client.files.versions.with_raw_response.get( + version_id="", + file_id="fileId", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_restore(self, async_client: AsyncImageKit) -> None: + version = await async_client.files.versions.restore( + version_id="versionId", + file_id="fileId", + ) + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_restore(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.versions.with_raw_response.restore( + version_id="versionId", + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + version = await response.parse() + assert_matches_type(File, version, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_restore(self, async_client: AsyncImageKit) -> None: + async with async_client.files.versions.with_streaming_response.restore( + version_id="versionId", + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + version = await response.parse() + assert_matches_type(File, version, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_restore(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.versions.with_raw_response.restore( + version_id="versionId", + file_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `version_id` but received ''"): + await async_client.files.versions.with_raw_response.restore( + version_id="", + file_id="fileId", + ) diff --git a/tests/api_resources/folders/__init__.py b/tests/api_resources/folders/__init__.py new file mode 100644 index 0000000..fd8019a --- /dev/null +++ b/tests/api_resources/folders/__init__.py @@ -0,0 +1 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/folders/test_job.py b/tests/api_resources/folders/test_job.py new file mode 100644 index 0000000..c86539d --- /dev/null +++ b/tests/api_resources/folders/test_job.py @@ -0,0 +1,108 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types.folders import JobGetResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestJob: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + job = client.folders.job.get( + "jobId", + ) + assert_matches_type(JobGetResponse, job, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.folders.job.with_raw_response.get( + "jobId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + job = response.parse() + assert_matches_type(JobGetResponse, job, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.folders.job.with_streaming_response.get( + "jobId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + job = response.parse() + assert_matches_type(JobGetResponse, job, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_get(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): + client.folders.job.with_raw_response.get( + "", + ) + + +class TestAsyncJob: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + job = await async_client.folders.job.get( + "jobId", + ) + assert_matches_type(JobGetResponse, job, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.folders.job.with_raw_response.get( + "jobId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + job = await response.parse() + assert_matches_type(JobGetResponse, job, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.folders.job.with_streaming_response.get( + "jobId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + job = await response.parse() + assert_matches_type(JobGetResponse, job, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_get(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): + await async_client.folders.job.with_raw_response.get( + "", + ) diff --git a/tests/api_resources/test_assets.py b/tests/api_resources/test_assets.py new file mode 100644 index 0000000..d600600 --- /dev/null +++ b/tests/api_resources/test_assets.py @@ -0,0 +1,108 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types import AssetListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestAssets: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: ImageKit) -> None: + asset = client.assets.list() + assert_matches_type(AssetListResponse, asset, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: ImageKit) -> None: + asset = client.assets.list( + file_type="all", + limit=1, + path="path", + search_query="searchQuery", + skip=0, + sort="ASC_NAME", + type="file", + ) + assert_matches_type(AssetListResponse, asset, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: ImageKit) -> None: + response = client.assets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + asset = response.parse() + assert_matches_type(AssetListResponse, asset, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: ImageKit) -> None: + with client.assets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + asset = response.parse() + assert_matches_type(AssetListResponse, asset, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncAssets: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncImageKit) -> None: + asset = await async_client.assets.list() + assert_matches_type(AssetListResponse, asset, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncImageKit) -> None: + asset = await async_client.assets.list( + file_type="all", + limit=1, + path="path", + search_query="searchQuery", + skip=0, + sort="ASC_NAME", + type="file", + ) + assert_matches_type(AssetListResponse, asset, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncImageKit) -> None: + response = await async_client.assets.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + asset = await response.parse() + assert_matches_type(AssetListResponse, asset, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncImageKit) -> None: + async with async_client.assets.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + asset = await response.parse() + assert_matches_type(AssetListResponse, asset, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_custom_metadata_fields.py b/tests/api_resources/test_custom_metadata_fields.py new file mode 100644 index 0000000..a2e3318 --- /dev/null +++ b/tests/api_resources/test_custom_metadata_fields.py @@ -0,0 +1,422 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types import ( + CustomMetadataField, + CustomMetadataFieldListResponse, + CustomMetadataFieldDeleteResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCustomMetadataFields: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: ImageKit) -> None: + custom_metadata_field = client.custom_metadata_fields.create( + label="price", + name="price", + schema={"type": "Number"}, + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create_with_all_params(self, client: ImageKit) -> None: + custom_metadata_field = client.custom_metadata_fields.create( + label="price", + name="price", + schema={ + "type": "Number", + "default_value": "string", + "is_value_required": True, + "max_length": 0, + "max_value": 3000, + "min_length": 0, + "min_value": 1000, + "select_options": ["small", "medium", "large", 30, 40, True], + }, + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: ImageKit) -> None: + response = client.custom_metadata_fields.with_raw_response.create( + label="price", + name="price", + schema={"type": "Number"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: ImageKit) -> None: + with client.custom_metadata_fields.with_streaming_response.create( + label="price", + name="price", + schema={"type": "Number"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update(self, client: ImageKit) -> None: + custom_metadata_field = client.custom_metadata_fields.update( + id="id", + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: ImageKit) -> None: + custom_metadata_field = client.custom_metadata_fields.update( + id="id", + label="price", + schema={ + "default_value": "string", + "is_value_required": True, + "max_length": 0, + "max_value": 3000, + "min_length": 0, + "min_value": 1000, + "select_options": ["small", "medium", "large", 30, 40, True], + }, + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_update(self, client: ImageKit) -> None: + response = client.custom_metadata_fields.with_raw_response.update( + id="id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_update(self, client: ImageKit) -> None: + with client.custom_metadata_fields.with_streaming_response.update( + id="id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_update(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.custom_metadata_fields.with_raw_response.update( + id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list(self, client: ImageKit) -> None: + custom_metadata_field = client.custom_metadata_fields.list() + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_list_with_all_params(self, client: ImageKit) -> None: + custom_metadata_field = client.custom_metadata_fields.list( + include_deleted=True, + ) + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_list(self, client: ImageKit) -> None: + response = client.custom_metadata_fields.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_list(self, client: ImageKit) -> None: + with client.custom_metadata_fields.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: ImageKit) -> None: + custom_metadata_field = client.custom_metadata_fields.delete( + "id", + ) + assert_matches_type(CustomMetadataFieldDeleteResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: ImageKit) -> None: + response = client.custom_metadata_fields.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataFieldDeleteResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: ImageKit) -> None: + with client.custom_metadata_fields.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = response.parse() + assert_matches_type(CustomMetadataFieldDeleteResponse, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.custom_metadata_fields.with_raw_response.delete( + "", + ) + + +class TestAsyncCustomMetadataFields: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncImageKit) -> None: + custom_metadata_field = await async_client.custom_metadata_fields.create( + label="price", + name="price", + schema={"type": "Number"}, + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncImageKit) -> None: + custom_metadata_field = await async_client.custom_metadata_fields.create( + label="price", + name="price", + schema={ + "type": "Number", + "default_value": "string", + "is_value_required": True, + "max_length": 0, + "max_value": 3000, + "min_length": 0, + "min_value": 1000, + "select_options": ["small", "medium", "large", 30, 40, True], + }, + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncImageKit) -> None: + response = await async_client.custom_metadata_fields.with_raw_response.create( + label="price", + name="price", + schema={"type": "Number"}, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncImageKit) -> None: + async with async_client.custom_metadata_fields.with_streaming_response.create( + label="price", + name="price", + schema={"type": "Number"}, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncImageKit) -> None: + custom_metadata_field = await async_client.custom_metadata_fields.update( + id="id", + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncImageKit) -> None: + custom_metadata_field = await async_client.custom_metadata_fields.update( + id="id", + label="price", + schema={ + "default_value": "string", + "is_value_required": True, + "max_length": 0, + "max_value": 3000, + "min_length": 0, + "min_value": 1000, + "select_options": ["small", "medium", "large", 30, 40, True], + }, + ) + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncImageKit) -> None: + response = await async_client.custom_metadata_fields.with_raw_response.update( + id="id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncImageKit) -> None: + async with async_client.custom_metadata_fields.with_streaming_response.update( + id="id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataField, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.custom_metadata_fields.with_raw_response.update( + id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list(self, async_client: AsyncImageKit) -> None: + custom_metadata_field = await async_client.custom_metadata_fields.list() + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncImageKit) -> None: + custom_metadata_field = await async_client.custom_metadata_fields.list( + include_deleted=True, + ) + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_list(self, async_client: AsyncImageKit) -> None: + response = await async_client.custom_metadata_fields.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_list(self, async_client: AsyncImageKit) -> None: + async with async_client.custom_metadata_fields.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataFieldListResponse, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncImageKit) -> None: + custom_metadata_field = await async_client.custom_metadata_fields.delete( + "id", + ) + assert_matches_type(CustomMetadataFieldDeleteResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncImageKit) -> None: + response = await async_client.custom_metadata_fields.with_raw_response.delete( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataFieldDeleteResponse, custom_metadata_field, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncImageKit) -> None: + async with async_client.custom_metadata_fields.with_streaming_response.delete( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + custom_metadata_field = await response.parse() + assert_matches_type(CustomMetadataFieldDeleteResponse, custom_metadata_field, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.custom_metadata_fields.with_raw_response.delete( + "", + ) diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py new file mode 100644 index 0000000..f639534 --- /dev/null +++ b/tests/api_resources/test_files.py @@ -0,0 +1,825 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types import ( + File, + FileCopyResponse, + FileMoveResponse, + FileRenameResponse, + FileUpdateResponse, + FileUploadResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFiles: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update(self, client: ImageKit) -> None: + file = client.files.update( + file_id="fileId", + ) + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: ImageKit) -> None: + file = client.files.update( + file_id="fileId", + update={ + "custom_coordinates": "10,10,100,100", + "custom_metadata": { + "brand": "bar", + "color": "bar", + }, + "description": "description", + "extensions": [ + { + "name": "remove-bg", + "options": { + "add_shadow": True, + "bg_color": "bg_color", + "bg_image_url": "bg_image_url", + "semitransparency": True, + }, + }, + { + "max_tags": 10, + "min_confidence": 80, + "name": "google-auto-tagging", + }, + { + "max_tags": 10, + "min_confidence": 80, + "name": "aws-auto-tagging", + }, + {"name": "ai-auto-description"}, + ], + "remove_ai_tags": ["car", "vehicle", "motorsports"], + "tags": ["tag1", "tag2"], + "webhook_url": "https://webhook.site/0d6b6c7a-8e5a-4b3a-8b7c-0d6b6c7a8e5a", + }, + ) + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_update(self, client: ImageKit) -> None: + response = client.files.with_raw_response.update( + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_update(self, client: ImageKit) -> None: + with client.files.with_streaming_response.update( + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_update(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.with_raw_response.update( + file_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: ImageKit) -> None: + file = client.files.delete( + "fileId", + ) + assert file is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: ImageKit) -> None: + response = client.files.with_raw_response.delete( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert file is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: ImageKit) -> None: + with client.files.with_streaming_response.delete( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert file is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_delete(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_copy(self, client: ImageKit) -> None: + file = client.files.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + ) + assert_matches_type(FileCopyResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_copy_with_all_params(self, client: ImageKit) -> None: + file = client.files.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + include_file_versions=False, + ) + assert_matches_type(FileCopyResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_copy(self, client: ImageKit) -> None: + response = client.files.with_raw_response.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(FileCopyResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_copy(self, client: ImageKit) -> None: + with client.files.with_streaming_response.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileCopyResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_get(self, client: ImageKit) -> None: + file = client.files.get( + "fileId", + ) + assert_matches_type(File, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_get(self, client: ImageKit) -> None: + response = client.files.with_raw_response.get( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(File, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_get(self, client: ImageKit) -> None: + with client.files.with_streaming_response.get( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(File, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_path_params_get(self, client: ImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + client.files.with_raw_response.get( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_move(self, client: ImageKit) -> None: + file = client.files.move( + destination_path="/folder/to/move/into/", + source_file_path="/path/to/file.jpg", + ) + assert_matches_type(FileMoveResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_move(self, client: ImageKit) -> None: + response = client.files.with_raw_response.move( + destination_path="/folder/to/move/into/", + source_file_path="/path/to/file.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(FileMoveResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_move(self, client: ImageKit) -> None: + with client.files.with_streaming_response.move( + destination_path="/folder/to/move/into/", + source_file_path="/path/to/file.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileMoveResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_rename(self, client: ImageKit) -> None: + file = client.files.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + ) + assert_matches_type(FileRenameResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_rename_with_all_params(self, client: ImageKit) -> None: + file = client.files.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + purge_cache=True, + ) + assert_matches_type(FileRenameResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_rename(self, client: ImageKit) -> None: + response = client.files.with_raw_response.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(FileRenameResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_rename(self, client: ImageKit) -> None: + with client.files.with_streaming_response.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileRenameResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_upload(self, client: ImageKit) -> None: + file = client.files.upload( + file=b"raw file contents", + file_name="fileName", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_upload_with_all_params(self, client: ImageKit) -> None: + file = client.files.upload( + file=b"raw file contents", + file_name="fileName", + token="token", + checks='"request.folder" : "marketing/"\n', + custom_coordinates="customCoordinates", + custom_metadata={ + "brand": "bar", + "color": "bar", + }, + description="Running shoes", + expire=0, + extensions=[ + { + "name": "remove-bg", + "options": { + "add_shadow": True, + "bg_color": "bg_color", + "bg_image_url": "bg_image_url", + "semitransparency": True, + }, + }, + { + "max_tags": 5, + "min_confidence": 95, + "name": "google-auto-tagging", + }, + {"name": "ai-auto-description"}, + ], + folder="folder", + is_private_file=True, + is_published=True, + overwrite_ai_tags=True, + overwrite_custom_metadata=True, + overwrite_file=True, + overwrite_tags=True, + public_key="publicKey", + response_fields=["tags", "customCoordinates", "isPrivateFile"], + signature="signature", + tags=["t-shirt", "round-neck", "men"], + transformation={ + "post": [ + { + "type": "thumbnail", + "value": "w-150,h-150", + }, + { + "protocol": "dash", + "type": "abs", + "value": "sr-240_360_480_720_1080", + }, + ], + "pre": "w-300,h-300,q-80", + }, + use_unique_file_name=True, + webhook_url="https://example.com", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_upload(self, client: ImageKit) -> None: + response = client.files.with_raw_response.upload( + file=b"raw file contents", + file_name="fileName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_upload(self, client: ImageKit) -> None: + with client.files.with_streaming_response.upload( + file=b"raw file contents", + file_name="fileName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFiles: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.update( + file_id="fileId", + ) + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.update( + file_id="fileId", + update={ + "custom_coordinates": "10,10,100,100", + "custom_metadata": { + "brand": "bar", + "color": "bar", + }, + "description": "description", + "extensions": [ + { + "name": "remove-bg", + "options": { + "add_shadow": True, + "bg_color": "bg_color", + "bg_image_url": "bg_image_url", + "semitransparency": True, + }, + }, + { + "max_tags": 10, + "min_confidence": 80, + "name": "google-auto-tagging", + }, + { + "max_tags": 10, + "min_confidence": 80, + "name": "aws-auto-tagging", + }, + {"name": "ai-auto-description"}, + ], + "remove_ai_tags": ["car", "vehicle", "motorsports"], + "tags": ["tag1", "tag2"], + "webhook_url": "https://webhook.site/0d6b6c7a-8e5a-4b3a-8b7c-0d6b6c7a8e5a", + }, + ) + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.with_raw_response.update( + file_id="fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncImageKit) -> None: + async with async_client.files.with_streaming_response.update( + file_id="fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileUpdateResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.with_raw_response.update( + file_id="", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.delete( + "fileId", + ) + assert file is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.with_raw_response.delete( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert file is None + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncImageKit) -> None: + async with async_client.files.with_streaming_response.delete( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert file is None + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_delete(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.with_raw_response.delete( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_copy(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + ) + assert_matches_type(FileCopyResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_copy_with_all_params(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + include_file_versions=False, + ) + assert_matches_type(FileCopyResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_copy(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.with_raw_response.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(FileCopyResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_copy(self, async_client: AsyncImageKit) -> None: + async with async_client.files.with_streaming_response.copy( + destination_path="/folder/to/copy/into/", + source_file_path="/path/to/file.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileCopyResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_get(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.get( + "fileId", + ) + assert_matches_type(File, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_get(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.with_raw_response.get( + "fileId", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(File, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_get(self, async_client: AsyncImageKit) -> None: + async with async_client.files.with_streaming_response.get( + "fileId", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(File, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_path_params_get(self, async_client: AsyncImageKit) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): + await async_client.files.with_raw_response.get( + "", + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_move(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.move( + destination_path="/folder/to/move/into/", + source_file_path="/path/to/file.jpg", + ) + assert_matches_type(FileMoveResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_move(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.with_raw_response.move( + destination_path="/folder/to/move/into/", + source_file_path="/path/to/file.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(FileMoveResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_move(self, async_client: AsyncImageKit) -> None: + async with async_client.files.with_streaming_response.move( + destination_path="/folder/to/move/into/", + source_file_path="/path/to/file.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileMoveResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_rename(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + ) + assert_matches_type(FileRenameResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_rename_with_all_params(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + purge_cache=True, + ) + assert_matches_type(FileRenameResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_rename(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.with_raw_response.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(FileRenameResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_rename(self, async_client: AsyncImageKit) -> None: + async with async_client.files.with_streaming_response.rename( + file_path="/path/to/file.jpg", + new_file_name="newFileName.jpg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileRenameResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_upload(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.upload( + file=b"raw file contents", + file_name="fileName", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_upload_with_all_params(self, async_client: AsyncImageKit) -> None: + file = await async_client.files.upload( + file=b"raw file contents", + file_name="fileName", + token="token", + checks='"request.folder" : "marketing/"\n', + custom_coordinates="customCoordinates", + custom_metadata={ + "brand": "bar", + "color": "bar", + }, + description="Running shoes", + expire=0, + extensions=[ + { + "name": "remove-bg", + "options": { + "add_shadow": True, + "bg_color": "bg_color", + "bg_image_url": "bg_image_url", + "semitransparency": True, + }, + }, + { + "max_tags": 5, + "min_confidence": 95, + "name": "google-auto-tagging", + }, + {"name": "ai-auto-description"}, + ], + folder="folder", + is_private_file=True, + is_published=True, + overwrite_ai_tags=True, + overwrite_custom_metadata=True, + overwrite_file=True, + overwrite_tags=True, + public_key="publicKey", + response_fields=["tags", "customCoordinates", "isPrivateFile"], + signature="signature", + tags=["t-shirt", "round-neck", "men"], + transformation={ + "post": [ + { + "type": "thumbnail", + "value": "w-150,h-150", + }, + { + "protocol": "dash", + "type": "abs", + "value": "sr-240_360_480_720_1080", + }, + ], + "pre": "w-300,h-300,q-80", + }, + use_unique_file_name=True, + webhook_url="https://example.com", + ) + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_upload(self, async_client: AsyncImageKit) -> None: + response = await async_client.files.with_raw_response.upload( + file=b"raw file contents", + file_name="fileName", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file = await response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_upload(self, async_client: AsyncImageKit) -> None: + async with async_client.files.with_streaming_response.upload( + file=b"raw file contents", + file_name="fileName", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file = await response.parse() + assert_matches_type(FileUploadResponse, file, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_folders.py b/tests/api_resources/test_folders.py new file mode 100644 index 0000000..de14df0 --- /dev/null +++ b/tests/api_resources/test_folders.py @@ -0,0 +1,434 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from imagekit import ImageKit, AsyncImageKit +from tests.utils import assert_matches_type +from imagekit.types import ( + FolderCopyResponse, + FolderMoveResponse, + FolderCreateResponse, + FolderDeleteResponse, + FolderRenameResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFolders: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_create(self, client: ImageKit) -> None: + folder = client.folders.create( + folder_name="summer", + parent_folder_path="/product/images/", + ) + assert_matches_type(FolderCreateResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_create(self, client: ImageKit) -> None: + response = client.folders.with_raw_response.create( + folder_name="summer", + parent_folder_path="/product/images/", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = response.parse() + assert_matches_type(FolderCreateResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_create(self, client: ImageKit) -> None: + with client.folders.with_streaming_response.create( + folder_name="summer", + parent_folder_path="/product/images/", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = response.parse() + assert_matches_type(FolderCreateResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_delete(self, client: ImageKit) -> None: + folder = client.folders.delete( + folder_path="/folder/to/delete/", + ) + assert_matches_type(FolderDeleteResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_delete(self, client: ImageKit) -> None: + response = client.folders.with_raw_response.delete( + folder_path="/folder/to/delete/", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = response.parse() + assert_matches_type(FolderDeleteResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_delete(self, client: ImageKit) -> None: + with client.folders.with_streaming_response.delete( + folder_path="/folder/to/delete/", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = response.parse() + assert_matches_type(FolderDeleteResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_copy(self, client: ImageKit) -> None: + folder = client.folders.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_copy_with_all_params(self, client: ImageKit) -> None: + folder = client.folders.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + include_versions=True, + ) + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_copy(self, client: ImageKit) -> None: + response = client.folders.with_raw_response.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = response.parse() + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_copy(self, client: ImageKit) -> None: + with client.folders.with_streaming_response.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = response.parse() + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_move(self, client: ImageKit) -> None: + folder = client.folders.move( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + assert_matches_type(FolderMoveResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_move(self, client: ImageKit) -> None: + response = client.folders.with_raw_response.move( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = response.parse() + assert_matches_type(FolderMoveResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_move(self, client: ImageKit) -> None: + with client.folders.with_streaming_response.move( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = response.parse() + assert_matches_type(FolderMoveResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_rename(self, client: ImageKit) -> None: + folder = client.folders.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + ) + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_rename_with_all_params(self, client: ImageKit) -> None: + folder = client.folders.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + purge_cache=True, + ) + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_rename(self, client: ImageKit) -> None: + response = client.folders.with_raw_response.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = response.parse() + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_rename(self, client: ImageKit) -> None: + with client.folders.with_streaming_response.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = response.parse() + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFolders: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_create(self, async_client: AsyncImageKit) -> None: + folder = await async_client.folders.create( + folder_name="summer", + parent_folder_path="/product/images/", + ) + assert_matches_type(FolderCreateResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_create(self, async_client: AsyncImageKit) -> None: + response = await async_client.folders.with_raw_response.create( + folder_name="summer", + parent_folder_path="/product/images/", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = await response.parse() + assert_matches_type(FolderCreateResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_create(self, async_client: AsyncImageKit) -> None: + async with async_client.folders.with_streaming_response.create( + folder_name="summer", + parent_folder_path="/product/images/", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = await response.parse() + assert_matches_type(FolderCreateResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_delete(self, async_client: AsyncImageKit) -> None: + folder = await async_client.folders.delete( + folder_path="/folder/to/delete/", + ) + assert_matches_type(FolderDeleteResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_delete(self, async_client: AsyncImageKit) -> None: + response = await async_client.folders.with_raw_response.delete( + folder_path="/folder/to/delete/", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = await response.parse() + assert_matches_type(FolderDeleteResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncImageKit) -> None: + async with async_client.folders.with_streaming_response.delete( + folder_path="/folder/to/delete/", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = await response.parse() + assert_matches_type(FolderDeleteResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_copy(self, async_client: AsyncImageKit) -> None: + folder = await async_client.folders.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_copy_with_all_params(self, async_client: AsyncImageKit) -> None: + folder = await async_client.folders.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + include_versions=True, + ) + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_copy(self, async_client: AsyncImageKit) -> None: + response = await async_client.folders.with_raw_response.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = await response.parse() + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_copy(self, async_client: AsyncImageKit) -> None: + async with async_client.folders.with_streaming_response.copy( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = await response.parse() + assert_matches_type(FolderCopyResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_move(self, async_client: AsyncImageKit) -> None: + folder = await async_client.folders.move( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + assert_matches_type(FolderMoveResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_move(self, async_client: AsyncImageKit) -> None: + response = await async_client.folders.with_raw_response.move( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = await response.parse() + assert_matches_type(FolderMoveResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_move(self, async_client: AsyncImageKit) -> None: + async with async_client.folders.with_streaming_response.move( + destination_path="/path/of/destination/folder", + source_folder_path="/path/of/source/folder", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = await response.parse() + assert_matches_type(FolderMoveResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_rename(self, async_client: AsyncImageKit) -> None: + folder = await async_client.folders.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + ) + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_rename_with_all_params(self, async_client: AsyncImageKit) -> None: + folder = await async_client.folders.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + purge_cache=True, + ) + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_rename(self, async_client: AsyncImageKit) -> None: + response = await async_client.folders.with_raw_response.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + folder = await response.parse() + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_rename(self, async_client: AsyncImageKit) -> None: + async with async_client.folders.with_streaming_response.rename( + folder_path="/path/of/folder", + new_folder_name="new-folder-name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + folder = await response.parse() + assert_matches_type(FolderRenameResponse, folder, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_webhooks.py b/tests/api_resources/test_webhooks.py new file mode 100644 index 0000000..7ed992b --- /dev/null +++ b/tests/api_resources/test_webhooks.py @@ -0,0 +1,79 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from datetime import datetime, timezone + +import pytest +import standardwebhooks + +from imagekit import ImageKit + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestWebhooks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + def test_method_unwrap(self, client: ImageKit) -> None: + key = b"secret" + hook = standardwebhooks.Webhook(key) + + data = """{"id":"id","type":"video.transformation.accepted","created_at":"2019-12-27T18:11:19.117Z","data":{"asset":{"url":"https://example.com"},"transformation":{"type":"video-transformation","options":{"audio_codec":"aac","auto_rotate":true,"format":"mp4","quality":0,"stream_protocol":"HLS","variants":["string"],"video_codec":"h264"}}},"request":{"url":"https://example.com","x_request_id":"x_request_id","user_agent":"user_agent"}}""" + msg_id = "1" + timestamp = datetime.now(tz=timezone.utc) + sig = hook.sign(msg_id=msg_id, timestamp=timestamp, data=data) + headers = { + "webhook-id": msg_id, + "webhook-timestamp": str(int(timestamp.timestamp())), + "webhook-signature": sig, + } + + try: + _ = client.webhooks.unwrap(data, headers=headers, key=key) + except standardwebhooks.WebhookVerificationError as e: + raise AssertionError("Failed to unwrap valid webhook") from e + + bad_headers = [ + {**headers, "webhook-signature": hook.sign(msg_id=msg_id, timestamp=timestamp, data="xxx")}, + {**headers, "webhook-id": "bad"}, + {**headers, "webhook-timestamp": "0"}, + ] + for bad_header in bad_headers: + with pytest.raises(standardwebhooks.WebhookVerificationError): + _ = client.webhooks.unwrap(data, headers=bad_header, key=key) + + +class TestAsyncWebhooks: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + def test_method_unwrap(self, client: ImageKit) -> None: + key = b"secret" + hook = standardwebhooks.Webhook(key) + + data = """{"id":"id","type":"video.transformation.accepted","created_at":"2019-12-27T18:11:19.117Z","data":{"asset":{"url":"https://example.com"},"transformation":{"type":"video-transformation","options":{"audio_codec":"aac","auto_rotate":true,"format":"mp4","quality":0,"stream_protocol":"HLS","variants":["string"],"video_codec":"h264"}}},"request":{"url":"https://example.com","x_request_id":"x_request_id","user_agent":"user_agent"}}""" + msg_id = "1" + timestamp = datetime.now(tz=timezone.utc) + sig = hook.sign(msg_id=msg_id, timestamp=timestamp, data=data) + headers = { + "webhook-id": msg_id, + "webhook-timestamp": str(int(timestamp.timestamp())), + "webhook-signature": sig, + } + + try: + _ = client.webhooks.unwrap(data, headers=headers, key=key) + except standardwebhooks.WebhookVerificationError as e: + raise AssertionError("Failed to unwrap valid webhook") from e + + bad_headers = [ + {**headers, "webhook-signature": hook.sign(msg_id=msg_id, timestamp=timestamp, data="xxx")}, + {**headers, "webhook-id": "bad"}, + {**headers, "webhook-timestamp": "0"}, + ] + for bad_header in bad_headers: + with pytest.raises(standardwebhooks.WebhookVerificationError): + _ = client.webhooks.unwrap(data, headers=bad_header, key=key) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..347776e --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,91 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +import logging +from typing import TYPE_CHECKING, Iterator, AsyncIterator + +import httpx +import pytest +from pytest_asyncio import is_async_test + +from imagekit import ImageKit, AsyncImageKit, DefaultAioHttpClient +from imagekit._utils import is_dict + +if TYPE_CHECKING: + from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] + +pytest.register_assert_rewrite("tests.utils") + +logging.getLogger("imagekit").setLevel(logging.DEBUG) + + +# automatically add `pytest.mark.asyncio()` to all of our async tests +# so we don't have to add that boilerplate everywhere +def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: + pytest_asyncio_tests = (item for item in items if is_async_test(item)) + session_scope_marker = pytest.mark.asyncio(loop_scope="session") + for async_test in pytest_asyncio_tests: + async_test.add_marker(session_scope_marker, append=False) + + # We skip tests that use both the aiohttp client and respx_mock as respx_mock + # doesn't support custom transports. + for item in items: + if "async_client" not in item.fixturenames or "respx_mock" not in item.fixturenames: + continue + + if not hasattr(item, "callspec"): + continue + + async_client_param = item.callspec.params.get("async_client") + if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp": + item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock")) + + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + +private_api_key = "My Private API Key" +password = "My Password" + + +@pytest.fixture(scope="session") +def client(request: FixtureRequest) -> Iterator[ImageKit]: + strict = getattr(request, "param", True) + if not isinstance(strict, bool): + raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") + + with ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=strict + ) as client: + yield client + + +@pytest.fixture(scope="session") +async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncImageKit]: + param = getattr(request, "param", True) + + # defaults + strict = True + http_client: None | httpx.AsyncClient = None + + if isinstance(param, bool): + strict = param + elif is_dict(param): + strict = param.get("strict", True) + assert isinstance(strict, bool) + + http_client_type = param.get("http_client", "httpx") + if http_client_type == "aiohttp": + http_client = DefaultAioHttpClient() + else: + raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") + + async with AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=strict, + http_client=http_client, + ) as client: + yield client diff --git a/tests/dummy_data/__init__.py b/tests/dummy_data/__init__.py deleted file mode 100644 index ab7fb75..0000000 --- a/tests/dummy_data/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from . import file - -__all__ = ["file"] diff --git a/tests/dummy_data/file.py b/tests/dummy_data/file.py deleted file mode 100644 index 67be48e..0000000 --- a/tests/dummy_data/file.py +++ /dev/null @@ -1,60 +0,0 @@ -FAILED_GENERIC_RESP = {"message": "Hi There is an error"} -SUCCESS_GENERIC_RESP = {"response": "Success"} -AUTHENTICATION_ERR_MSG = { - "message": "Your account cannot be authenticated.", - "help": "For support kindly contact us at support@imagekit.io .", -} -FAILED_DELETE_RESP = {"message": "Item Not Found"} - -SUCCESS_PURGE_CACHE_MSG = {"request_id": "fake_abc_xyz"} - -SUCCESS_PURGE_CACHE_STATUS_MSG = {"status": "pending"} - -SERVER_ERR_MSG = { - "message": "We have experienced an internal error while processing your request.", - "help": "For support kindly contact us at support@imagekit.io .", -} - -SUCCESS_LIST_RESP_MESSAGE = { - "response": [ - { - "type": "file", - "name": "default-image.jpg", - "fileId": "53dgd6023f28ft7fse488992c", - "tags": None, - "customCoordinates": None, - "isPrivateFile": None, - "url": "https://ik.imagekit.io/fakeid/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/fakeid/tr:n-media_library_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - }, - { - "type": "file", - "name": "default-image.jpg", - "fileId": "53dgd6023f28ft7fse488992c", - "tags": None, - "customCoordinates": None, - "isPrivateFile": None, - "url": "https://ik.imagekit.io/fakeid/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/fakeid/tr:n-media_library_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - }, - ], -} - -SUCCESS_DETAIL_MSG = { - "response": { - "type": "file", - "name": "default-image.jpg", - "fileId": "53dgd6023f28ft7fse488992c", - "tags": None, - "customCoordinates": None, - "isPrivateFile": None, - "url": "https://ik.imagekit.io/fakeid/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/fakeid/tr:n-media_library_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - } -} diff --git a/tests/dummy_data/image.png b/tests/dummy_data/image.png deleted file mode 100644 index 4db4e06..0000000 Binary files a/tests/dummy_data/image.png and /dev/null differ diff --git a/tests/dummy_data/urls.py b/tests/dummy_data/urls.py deleted file mode 100644 index 2944b7e..0000000 --- a/tests/dummy_data/urls.py +++ /dev/null @@ -1,4 +0,0 @@ -URL_ENDPOINT = "https://ik.imagekit.io/your_imagekit_id/endpoint/" -BASIC_GENERATED_URL = ( - "https://ik.imagekit.io/your_imagekit_id/endpoint/tr:h-300,w-400/default-image.jpg", -) diff --git a/tests/helpers.py b/tests/helpers.py deleted file mode 100644 index 62fb542..0000000 --- a/tests/helpers.py +++ /dev/null @@ -1,63 +0,0 @@ -import base64 -import json -import re -import unittest -from unittest.mock import patch - -from imagekitio.client import ImageKit -from imagekitio.models.ListAndSearchFileRequestOptions import ( - ListAndSearchFileRequestOptions, -) - - -class ClientTestCase(unittest.TestCase): - """ - Base TestCase for Client - """ - - private_key = "fake122" - - @patch("imagekitio.file.File") - @patch("imagekitio.resource.ImageKitRequest") - def setUp(self, mock_file, mock_req): - """ - Tests if list_files work with skip and limit - """ - self.options = ListAndSearchFileRequestOptions( - type="file", - sort="ASC_CREATED", - path="/", - search_query="created_at >= '2d' OR size < '2mb' OR format='png'", - file_type="all", - limit=1, - skip=0, - tags="Tag-1, Tag-2, Tag-3", - ) - self.opt = ListAndSearchFileRequestOptions( - type="file", - sort="ASC_CREATED", - path="/", - search_query="created_at >= '2d' OR size < '2mb' OR format='png'", - file_type="all", - limit=1, - skip=0, - tags=["Tag-1", "Tag-2", "Tag-3"], - ) - self.client = ImageKit( - public_key="fake122", - private_key=ClientTestCase.private_key, - url_endpoint="fake122", - ) - - -def create_headers_for_test(): - headers = {"Accept-Encoding": "gzip, deflate"} - headers.update(get_auth_headers_for_test()) - return headers - - -def get_auth_headers_for_test(): - encoded_private_key = base64.b64encode( - (ClientTestCase.private_key + ":").encode() - ).decode("utf-8") - return {"Authorization": "Basic {}".format(encoded_private_key)} diff --git a/tests/sample.jpg b/tests/sample.jpg deleted file mode 100644 index 1db39e0..0000000 Binary files a/tests/sample.jpg and /dev/null differ diff --git a/tests/sample_file.txt b/tests/sample_file.txt new file mode 100644 index 0000000..af5626b --- /dev/null +++ b/tests/sample_file.txt @@ -0,0 +1 @@ +Hello, world! diff --git a/tests/test_client.py b/tests/test_client.py index 674bfae..ddb5db7 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,51 +1,1903 @@ -import unittest +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from imagekitio.client import ImageKit -from tests.helpers import ClientTestCase +from __future__ import annotations -imagekit_obj = ImageKit( - private_key="private_fake:", - public_key="public_fake123:", - url_endpoint="fake.com", +import gc +import os +import sys +import json +import time +import asyncio +import inspect +import subprocess +import tracemalloc +from typing import Any, Union, cast +from textwrap import dedent +from unittest import mock +from typing_extensions import Literal + +import httpx +import pytest +from respx import MockRouter +from pydantic import ValidationError + +from imagekit import ImageKit, AsyncImageKit, APIResponseValidationError +from imagekit._types import Omit +from imagekit._models import BaseModel, FinalRequestOptions +from imagekit._exceptions import ImageKitError, APIStatusError, APITimeoutError, APIResponseValidationError +from imagekit._base_client import ( + DEFAULT_TIMEOUT, + HTTPX_DEFAULT_TIMEOUT, + BaseClient, + DefaultHttpxClient, + DefaultAsyncHttpxClient, + make_request_options, ) +from .utils import update_env + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") +private_api_key = "My Private API Key" +password = "My Password" + + +def _get_params(client: BaseClient[Any, Any]) -> dict[str, str]: + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + url = httpx.URL(request.url) + return dict(url.params) + + +def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: + return 0.1 + + +def _get_open_connections(client: ImageKit | AsyncImageKit) -> int: + transport = client._client._transport + assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) + + pool = transport._pool + return len(pool._requests) + + +class TestImageKit: + client = ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + + @pytest.mark.respx(base_url=base_url) + def test_raw_response(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + @pytest.mark.respx(base_url=base_url) + def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock( + return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') + ) + + response = self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + def test_copy(self) -> None: + copied = self.client.copy() + assert id(copied) != id(self.client) + + copied = self.client.copy(private_api_key="another My Private API Key") + assert copied.private_api_key == "another My Private API Key" + assert self.client.private_api_key == "My Private API Key" + + copied = self.client.copy(password="another My Password") + assert copied.password == "another My Password" + assert self.client.password == "My Password" + + def test_copy_default_options(self) -> None: + # options that have a default are overridden correctly + copied = self.client.copy(max_retries=7) + assert copied.max_retries == 7 + assert self.client.max_retries == 2 + + copied2 = copied.copy(max_retries=6) + assert copied2.max_retries == 6 + assert copied.max_retries == 7 + + # timeout + assert isinstance(self.client.timeout, httpx.Timeout) + copied = self.client.copy(timeout=None) + assert copied.timeout is None + assert isinstance(self.client.timeout, httpx.Timeout) + + def test_copy_default_headers(self) -> None: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_headers={"X-Foo": "bar"}, + ) + assert client.default_headers["X-Foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert copied.default_headers["X-Foo"] == "bar" + + # merges already given headers + copied = client.copy(default_headers={"X-Bar": "stainless"}) + assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers["X-Bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_headers={"X-Foo": "stainless"}) + assert copied.default_headers["X-Foo"] == "stainless" + + # set_default_headers + + # completely overrides already set values + copied = client.copy(set_default_headers={}) + assert copied.default_headers.get("X-Foo") is None + + copied = client.copy(set_default_headers={"X-Bar": "Robert"}) + assert copied.default_headers["X-Bar"] == "Robert" + + with pytest.raises( + ValueError, + match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ): + client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + + def test_copy_default_query(self) -> None: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_query={"foo": "bar"}, + ) + assert _get_params(client)["foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert _get_params(copied)["foo"] == "bar" + + # merges already given params + copied = client.copy(default_query={"bar": "stainless"}) + params = _get_params(copied) + assert params["foo"] == "bar" + assert params["bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_query={"foo": "stainless"}) + assert _get_params(copied)["foo"] == "stainless" + + # set_default_query + + # completely overrides already set values + copied = client.copy(set_default_query={}) + assert _get_params(copied) == {} + + copied = client.copy(set_default_query={"bar": "Robert"}) + assert _get_params(copied)["bar"] == "Robert" + + with pytest.raises( + ValueError, + # TODO: update + match="`default_query` and `set_default_query` arguments are mutually exclusive", + ): + client.copy(set_default_query={}, default_query={"foo": "Bar"}) + + def test_copy_signature(self) -> None: + # ensure the same parameters that can be passed to the client are defined in the `.copy()` method + init_signature = inspect.signature( + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] + ) + copy_signature = inspect.signature(self.client.copy) + exclude_params = {"transport", "proxies", "_strict_response_validation"} + + for name in init_signature.parameters.keys(): + if name in exclude_params: + continue + + copy_param = copy_signature.parameters.get(name) + assert copy_param is not None, f"copy() signature is missing the {name} param" + + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + # + # removing the decorator fixes the leak for reasons we don't understand. + "imagekit/_legacy_response.py", + "imagekit/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "imagekit/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() + + def test_request_timeout(self) -> None: + request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + request = self.client._build_request( + FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) + ) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(100.0) + + def test_client_timeout_option(self) -> None: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + timeout=httpx.Timeout(0), + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(0) + + def test_http_client_timeout_option(self) -> None: + # custom timeout given to the httpx client should be used + with httpx.Client(timeout=None) as http_client: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=http_client, + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) + + # no timeout given to the httpx client should not use the httpx default + with httpx.Client() as http_client: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=http_client, + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + # explicitly passing the default timeout currently results in it being ignored + with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=http_client, + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default + + async def test_invalid_http_client(self) -> None: + with pytest.raises(TypeError, match="Invalid `http_client` arg"): + async with httpx.AsyncClient() as http_client: + ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=cast(Any, http_client), + ) + + def test_default_headers_option(self) -> None: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_headers={"X-Foo": "bar"}, + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "bar" + assert request.headers.get("x-stainless-lang") == "python" + + client2 = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }, + ) + request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "stainless" + assert request.headers.get("x-stainless-lang") == "my-overriding-header" + + def test_validate_headers(self) -> None: + client = ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert "Basic" in request.headers.get("Authorization") + + with pytest.raises(ImageKitError): + with update_env( + **{ + "IMAGEKIT_PRIVATE_API_KEY": Omit(), + "OPTIONAL_IMAGEKIT_IGNORES_THIS": Omit(), + } + ): + client2 = ImageKit( + base_url=base_url, private_api_key=None, password=None, _strict_response_validation=True + ) + _ = client2 + + def test_default_query_option(self) -> None: + client = ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_query={"query_param": "bar"}, + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + url = httpx.URL(request.url) + assert dict(url.params) == {"query_param": "bar"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo", + params={"foo": "baz", "query_param": "overridden"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + + def test_request_extra_json(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": False} + + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"baz": False} + + # `extra_json` takes priority over `json_data` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar", "baz": True}, + extra_json={"baz": None}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": None} + + def test_request_extra_headers(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options(extra_headers={"X-Foo": "Foo"}), + ), + ) + assert request.headers.get("X-Foo") == "Foo" + + # `extra_headers` takes priority over `default_headers` when keys clash + request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_headers={"X-Bar": "false"}, + ), + ), + ) + assert request.headers.get("X-Bar") == "false" + + def test_request_extra_query(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_query={"my_query_param": "Foo"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"my_query_param": "Foo"} + + # if both `query` and `extra_query` are given, they are merged + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"bar": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"bar": "1", "foo": "2"} + + # `extra_query` takes priority over `query` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"foo": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"foo": "2"} + + def test_multipart_repeating_array(self, client: ImageKit) -> None: + request = client._build_request( + FinalRequestOptions.construct( + method="post", + url="/foo", + headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, + json_data={"array": ["foo", "bar"]}, + files=[("foo.txt", b"hello world")], + ) + ) + + assert request.read().split(b"\r\n") == [ + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"foo", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"bar", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="foo.txt"; filename="upload"', + b"Content-Type: application/octet-stream", + b"", + b"hello world", + b"--6b7ba517decee4a450543ea6ae821c82--", + b"", + ] + + @pytest.mark.respx(base_url=base_url) + def test_basic_union_response(self, respx_mock: MockRouter) -> None: + class Model1(BaseModel): + name: str + + class Model2(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) -class TestPHashDistance(unittest.TestCase): - def test_phash_distance(self): - """Tests if phash_distance working properly""" - a, b = ("33699c96619cc69e", "968e978414fe04ea") - c, d = ("33699c96619cc69e", "33699c96619cc69e") - e, f = ("a4a65595ac94518b", "7838873e791f8400") + response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" - self.assertEqual(imagekit_obj.phash_distance(a, b), 30) - self.assertEqual(imagekit_obj.phash_distance(c, d), 0) - self.assertEqual(imagekit_obj.phash_distance(e, f), 37) - self.assertRaises(TypeError, imagekit_obj.phash_distance, "", "dkf90") - self.assertRaises(TypeError, imagekit_obj.phash_distance, 1234, 111) + @pytest.mark.respx(base_url=base_url) + def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + """Union of objects with the same field name using a different type""" + class Model1(BaseModel): + foo: int -class TestClientAndImageKitObjInit(ClientTestCase): - """ - Tests client and Imagekit classes object initialization - """ + class Model2(BaseModel): + foo: str - def test_all_variable_is_being_set_to_obj(self) -> None: + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + + response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model1) + assert response.foo == 1 + + @pytest.mark.respx(base_url=base_url) + def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: """ - Tests if variables are properly being set when creating - an object from ImageKit class + Response that sets Content-Type to something other than application/json but returns json data """ - self.assertIsNotNone(self.client.ik_request) - self.assertIsNotNone(self.client.url_obj) - self.assertIsNotNone(self.client.file) + class Model(BaseModel): + foo: int + + respx_mock.get("/foo").mock( + return_value=httpx.Response( + 200, + content=json.dumps({"foo": 2}), + headers={"Content-Type": "application/text"}, + ) + ) + + response = self.client.get("/foo", cast_to=Model) + assert isinstance(response, Model) + assert response.foo == 2 + + def test_base_url_setter(self) -> None: + client = ImageKit( + base_url="https://example.com/from_init", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ) + assert client.base_url == "https://example.com/from_init/" + + client.base_url = "https://example.com/from_setter" # type: ignore[assignment] + + assert client.base_url == "https://example.com/from_setter/" + + def test_base_url_env(self) -> None: + with update_env(IMAGE_KIT_BASE_URL="http://localhost:5000/from/env"): + client = ImageKit(private_api_key=private_api_key, password=password, _strict_response_validation=True) + assert client.base_url == "http://localhost:5000/from/env/" + + @pytest.mark.parametrize( + "client", + [ + ImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ), + ImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_trailing_slash(self, client: ImageKit) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + ImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ), + ImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_no_trailing_slash(self, client: ImageKit) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + ImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ), + ImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=httpx.Client(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_absolute_request_url(self, client: ImageKit) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="https://myapi.com/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "https://myapi.com/foo" + + def test_copied_client_does_not_close_http(self) -> None: + client = ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + assert not client.is_closed() + + copied = client.copy() + assert copied is not client + + del copied + + assert not client.is_closed() + + def test_client_context_manager(self) -> None: + client = ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + with client as c2: + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() + assert client.is_closed() + + @pytest.mark.respx(base_url=base_url) + def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) + + with pytest.raises(APIResponseValidationError) as exc: + self.client.get("/foo", cast_to=Model) + + assert isinstance(exc.value.__cause__, ValidationError) + + def test_client_max_retries_validation(self) -> None: + with pytest.raises(TypeError, match=r"max_retries cannot be None"): + ImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + max_retries=cast(Any, None), + ) + + @pytest.mark.respx(base_url=base_url) + def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + name: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) + + strict_client = ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + + with pytest.raises(APIResponseValidationError): + strict_client.get("/foo", cast_to=Model) + + client = ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=False + ) + + response = client.get("/foo", cast_to=Model) + assert isinstance(response, str) # type: ignore[unreachable] + + @pytest.mark.parametrize( + "remaining_retries,retry_after,timeout", + [ + [3, "20", 20], + [3, "0", 0.5], + [3, "-10", 0.5], + [3, "60", 60], + [3, "61", 0.5], + [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], + [3, "99999999999999999999999999999999999", 0.5], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "", 0.5], + [2, "", 0.5 * 2.0], + [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing + ], + ) + @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) + def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: + client = ImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + + headers = httpx.Headers({"retry-after": retry_after}) + options = FinalRequestOptions(method="get", url="/foo", max_retries=3) + calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: ImageKit) -> None: + respx_mock.post("/api/v1/files/upload").mock(side_effect=httpx.TimeoutException("Test timeout error")) + + with pytest.raises(APITimeoutError): + client.files.with_streaming_response.upload(file=b"raw file contents", file_name="fileName").__enter__() + + assert _get_open_connections(self.client) == 0 + + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: ImageKit) -> None: + respx_mock.post("/api/v1/files/upload").mock(return_value=httpx.Response(500)) + + with pytest.raises(APIStatusError): + client.files.with_streaming_response.upload(file=b"raw file contents", file_name="fileName").__enter__() + assert _get_open_connections(self.client) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + def test_retries_taken( + self, + client: ImageKit, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler) + + response = client.files.with_raw_response.upload(file=b"raw file contents", file_name="fileName") + + assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_omit_retry_count_header( + self, client: ImageKit, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler) + + response = client.files.with_raw_response.upload( + file=b"raw file contents", file_name="fileName", extra_headers={"x-stainless-retry-count": Omit()} + ) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_overwrite_retry_count_header( + self, client: ImageKit, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler) -class TestGetAuthenticationParameters(ClientTestCase): - def test_get_authentication_parameters_without_token(self) -> None: - result = self.client.get_authentication_parameters("", expire=444) - self.assertIsNotNone(result) + response = client.files.with_raw_response.upload( + file=b"raw file contents", file_name="fileName", extra_headers={"x-stainless-retry-count": "42"} + ) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" + + def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") - def test_get_authentication_param_with_token(self) -> None: - result = self.client.get_authentication_parameters( - "dc45da6e3286066265a09e", expire=4555 + client = DefaultHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), ) - self.assertIsNotNone(result) + + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" + + +class TestAsyncImageKit: + client = AsyncImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_raw_response(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = await self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + respx_mock.post("/foo").mock( + return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') + ) + + response = await self.client.post("/foo", cast_to=httpx.Response) + assert response.status_code == 200 + assert isinstance(response, httpx.Response) + assert response.json() == {"foo": "bar"} + + def test_copy(self) -> None: + copied = self.client.copy() + assert id(copied) != id(self.client) + + copied = self.client.copy(private_api_key="another My Private API Key") + assert copied.private_api_key == "another My Private API Key" + assert self.client.private_api_key == "My Private API Key" + + copied = self.client.copy(password="another My Password") + assert copied.password == "another My Password" + assert self.client.password == "My Password" + + def test_copy_default_options(self) -> None: + # options that have a default are overridden correctly + copied = self.client.copy(max_retries=7) + assert copied.max_retries == 7 + assert self.client.max_retries == 2 + + copied2 = copied.copy(max_retries=6) + assert copied2.max_retries == 6 + assert copied.max_retries == 7 + + # timeout + assert isinstance(self.client.timeout, httpx.Timeout) + copied = self.client.copy(timeout=None) + assert copied.timeout is None + assert isinstance(self.client.timeout, httpx.Timeout) + + def test_copy_default_headers(self) -> None: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_headers={"X-Foo": "bar"}, + ) + assert client.default_headers["X-Foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert copied.default_headers["X-Foo"] == "bar" + + # merges already given headers + copied = client.copy(default_headers={"X-Bar": "stainless"}) + assert copied.default_headers["X-Foo"] == "bar" + assert copied.default_headers["X-Bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_headers={"X-Foo": "stainless"}) + assert copied.default_headers["X-Foo"] == "stainless" + + # set_default_headers + + # completely overrides already set values + copied = client.copy(set_default_headers={}) + assert copied.default_headers.get("X-Foo") is None + + copied = client.copy(set_default_headers={"X-Bar": "Robert"}) + assert copied.default_headers["X-Bar"] == "Robert" + + with pytest.raises( + ValueError, + match="`default_headers` and `set_default_headers` arguments are mutually exclusive", + ): + client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + + def test_copy_default_query(self) -> None: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_query={"foo": "bar"}, + ) + assert _get_params(client)["foo"] == "bar" + + # does not override the already given value when not specified + copied = client.copy() + assert _get_params(copied)["foo"] == "bar" + + # merges already given params + copied = client.copy(default_query={"bar": "stainless"}) + params = _get_params(copied) + assert params["foo"] == "bar" + assert params["bar"] == "stainless" + + # uses new values for any already given headers + copied = client.copy(default_query={"foo": "stainless"}) + assert _get_params(copied)["foo"] == "stainless" + + # set_default_query + + # completely overrides already set values + copied = client.copy(set_default_query={}) + assert _get_params(copied) == {} + + copied = client.copy(set_default_query={"bar": "Robert"}) + assert _get_params(copied)["bar"] == "Robert" + + with pytest.raises( + ValueError, + # TODO: update + match="`default_query` and `set_default_query` arguments are mutually exclusive", + ): + client.copy(set_default_query={}, default_query={"foo": "Bar"}) + + def test_copy_signature(self) -> None: + # ensure the same parameters that can be passed to the client are defined in the `.copy()` method + init_signature = inspect.signature( + # mypy doesn't like that we access the `__init__` property. + self.client.__init__, # type: ignore[misc] + ) + copy_signature = inspect.signature(self.client.copy) + exclude_params = {"transport", "proxies", "_strict_response_validation"} + + for name in init_signature.parameters.keys(): + if name in exclude_params: + continue + + copy_param = copy_signature.parameters.get(name) + assert copy_param is not None, f"copy() signature is missing the {name} param" + + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + # + # removing the decorator fixes the leak for reasons we don't understand. + "imagekit/_legacy_response.py", + "imagekit/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "imagekit/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() + + async def test_request_timeout(self) -> None: + request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + request = self.client._build_request( + FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) + ) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(100.0) + + async def test_client_timeout_option(self) -> None: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + timeout=httpx.Timeout(0), + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(0) + + async def test_http_client_timeout_option(self) -> None: + # custom timeout given to the httpx client should be used + async with httpx.AsyncClient(timeout=None) as http_client: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=http_client, + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == httpx.Timeout(None) + + # no timeout given to the httpx client should not use the httpx default + async with httpx.AsyncClient() as http_client: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=http_client, + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT + + # explicitly passing the default timeout currently results in it being ignored + async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=http_client, + ) + + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore + assert timeout == DEFAULT_TIMEOUT # our default + + def test_invalid_http_client(self) -> None: + with pytest.raises(TypeError, match="Invalid `http_client` arg"): + with httpx.Client() as http_client: + AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=cast(Any, http_client), + ) + + def test_default_headers_option(self) -> None: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_headers={"X-Foo": "bar"}, + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "bar" + assert request.headers.get("x-stainless-lang") == "python" + + client2 = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_headers={ + "X-Foo": "stainless", + "X-Stainless-Lang": "my-overriding-header", + }, + ) + request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + assert request.headers.get("x-foo") == "stainless" + assert request.headers.get("x-stainless-lang") == "my-overriding-header" + + def test_validate_headers(self) -> None: + client = AsyncImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + assert "Basic" in request.headers.get("Authorization") + + with pytest.raises(ImageKitError): + with update_env( + **{ + "IMAGEKIT_PRIVATE_API_KEY": Omit(), + "OPTIONAL_IMAGEKIT_IGNORES_THIS": Omit(), + } + ): + client2 = AsyncImageKit( + base_url=base_url, private_api_key=None, password=None, _strict_response_validation=True + ) + _ = client2 + + def test_default_query_option(self) -> None: + client = AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + default_query={"query_param": "bar"}, + ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + url = httpx.URL(request.url) + assert dict(url.params) == {"query_param": "bar"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo", + params={"foo": "baz", "query_param": "overridden"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + + def test_request_extra_json(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": False} + + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + extra_json={"baz": False}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"baz": False} + + # `extra_json` takes priority over `json_data` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar", "baz": True}, + extra_json={"baz": None}, + ), + ) + data = json.loads(request.content.decode("utf-8")) + assert data == {"foo": "bar", "baz": None} + + def test_request_extra_headers(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options(extra_headers={"X-Foo": "Foo"}), + ), + ) + assert request.headers.get("X-Foo") == "Foo" + + # `extra_headers` takes priority over `default_headers` when keys clash + request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_headers={"X-Bar": "false"}, + ), + ), + ) + assert request.headers.get("X-Bar") == "false" + + def test_request_extra_query(self) -> None: + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + extra_query={"my_query_param": "Foo"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"my_query_param": "Foo"} + + # if both `query` and `extra_query` are given, they are merged + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"bar": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"bar": "1", "foo": "2"} + + # `extra_query` takes priority over `query` when keys clash + request = self.client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + **make_request_options( + query={"foo": "1"}, + extra_query={"foo": "2"}, + ), + ), + ) + params = dict(request.url.params) + assert params == {"foo": "2"} + + def test_multipart_repeating_array(self, async_client: AsyncImageKit) -> None: + request = async_client._build_request( + FinalRequestOptions.construct( + method="post", + url="/foo", + headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, + json_data={"array": ["foo", "bar"]}, + files=[("foo.txt", b"hello world")], + ) + ) + + assert request.read().split(b"\r\n") == [ + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"foo", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="array[]"', + b"", + b"bar", + b"--6b7ba517decee4a450543ea6ae821c82", + b'Content-Disposition: form-data; name="foo.txt"; filename="upload"', + b"Content-Type: application/octet-stream", + b"", + b"hello world", + b"--6b7ba517decee4a450543ea6ae821c82--", + b"", + ] + + @pytest.mark.respx(base_url=base_url) + async def test_basic_union_response(self, respx_mock: MockRouter) -> None: + class Model1(BaseModel): + name: str + + class Model2(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" + + @pytest.mark.respx(base_url=base_url) + async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + """Union of objects with the same field name using a different type""" + + class Model1(BaseModel): + foo: int + + class Model2(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + + response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model2) + assert response.foo == "bar" + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) + + response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + assert isinstance(response, Model1) + assert response.foo == 1 + + @pytest.mark.respx(base_url=base_url) + async def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + """ + Response that sets Content-Type to something other than application/json but returns json data + """ + + class Model(BaseModel): + foo: int + + respx_mock.get("/foo").mock( + return_value=httpx.Response( + 200, + content=json.dumps({"foo": 2}), + headers={"Content-Type": "application/text"}, + ) + ) + + response = await self.client.get("/foo", cast_to=Model) + assert isinstance(response, Model) + assert response.foo == 2 + + def test_base_url_setter(self) -> None: + client = AsyncImageKit( + base_url="https://example.com/from_init", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ) + assert client.base_url == "https://example.com/from_init/" + + client.base_url = "https://example.com/from_setter" # type: ignore[assignment] + + assert client.base_url == "https://example.com/from_setter/" + + def test_base_url_env(self) -> None: + with update_env(IMAGE_KIT_BASE_URL="http://localhost:5000/from/env"): + client = AsyncImageKit(private_api_key=private_api_key, password=password, _strict_response_validation=True) + assert client.base_url == "http://localhost:5000/from/env/" + + @pytest.mark.parametrize( + "client", + [ + AsyncImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ), + AsyncImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_trailing_slash(self, client: AsyncImageKit) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + AsyncImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ), + AsyncImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_base_url_no_trailing_slash(self, client: AsyncImageKit) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "http://localhost:5000/custom/path/foo" + + @pytest.mark.parametrize( + "client", + [ + AsyncImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + ), + AsyncImageKit( + base_url="http://localhost:5000/custom/path/", + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + http_client=httpx.AsyncClient(), + ), + ], + ids=["standard", "custom http client"], + ) + def test_absolute_request_url(self, client: AsyncImageKit) -> None: + request = client._build_request( + FinalRequestOptions( + method="post", + url="https://myapi.com/foo", + json_data={"foo": "bar"}, + ), + ) + assert request.url == "https://myapi.com/foo" + + async def test_copied_client_does_not_close_http(self) -> None: + client = AsyncImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + assert not client.is_closed() + + copied = client.copy() + assert copied is not client + + del copied + + await asyncio.sleep(0.2) + assert not client.is_closed() + + async def test_client_context_manager(self) -> None: + client = AsyncImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + async with client as c2: + assert c2 is client + assert not c2.is_closed() + assert not client.is_closed() + assert client.is_closed() + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + foo: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) + + with pytest.raises(APIResponseValidationError) as exc: + await self.client.get("/foo", cast_to=Model) + + assert isinstance(exc.value.__cause__, ValidationError) + + async def test_client_max_retries_validation(self) -> None: + with pytest.raises(TypeError, match=r"max_retries cannot be None"): + AsyncImageKit( + base_url=base_url, + private_api_key=private_api_key, + password=password, + _strict_response_validation=True, + max_retries=cast(Any, None), + ) + + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: + class Model(BaseModel): + name: str + + respx_mock.get("/foo").mock(return_value=httpx.Response(200, text="my-custom-format")) + + strict_client = AsyncImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + + with pytest.raises(APIResponseValidationError): + await strict_client.get("/foo", cast_to=Model) + + client = AsyncImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=False + ) + + response = await client.get("/foo", cast_to=Model) + assert isinstance(response, str) # type: ignore[unreachable] + + @pytest.mark.parametrize( + "remaining_retries,retry_after,timeout", + [ + [3, "20", 20], + [3, "0", 0.5], + [3, "-10", 0.5], + [3, "60", 60], + [3, "61", 0.5], + [3, "Fri, 29 Sep 2023 16:26:57 GMT", 20], + [3, "Fri, 29 Sep 2023 16:26:37 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "Fri, 29 Sep 2023 16:27:37 GMT", 60], + [3, "Fri, 29 Sep 2023 16:27:38 GMT", 0.5], + [3, "99999999999999999999999999999999999", 0.5], + [3, "Zun, 29 Sep 2023 16:26:27 GMT", 0.5], + [3, "", 0.5], + [2, "", 0.5 * 2.0], + [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing + ], + ) + @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) + @pytest.mark.asyncio + async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: + client = AsyncImageKit( + base_url=base_url, private_api_key=private_api_key, password=password, _strict_response_validation=True + ) + + headers = httpx.Headers({"retry-after": retry_after}) + options = FinalRequestOptions(method="get", url="/foo", max_retries=3) + calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] + + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_retrying_timeout_errors_doesnt_leak( + self, respx_mock: MockRouter, async_client: AsyncImageKit + ) -> None: + respx_mock.post("/api/v1/files/upload").mock(side_effect=httpx.TimeoutException("Test timeout error")) + + with pytest.raises(APITimeoutError): + await async_client.files.with_streaming_response.upload( + file=b"raw file contents", file_name="fileName" + ).__aenter__() + + assert _get_open_connections(self.client) == 0 + + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_retrying_status_errors_doesnt_leak( + self, respx_mock: MockRouter, async_client: AsyncImageKit + ) -> None: + respx_mock.post("/api/v1/files/upload").mock(return_value=httpx.Response(500)) + + with pytest.raises(APIStatusError): + await async_client.files.with_streaming_response.upload( + file=b"raw file contents", file_name="fileName" + ).__aenter__() + assert _get_open_connections(self.client) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + async def test_retries_taken( + self, + async_client: AsyncImageKit, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler) + + response = await client.files.with_raw_response.upload(file=b"raw file contents", file_name="fileName") + + assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_omit_retry_count_header( + self, async_client: AsyncImageKit, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler) + + response = await client.files.with_raw_response.upload( + file=b"raw file contents", file_name="fileName", extra_headers={"x-stainless-retry-count": Omit()} + ) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("imagekit._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.asyncio + async def test_overwrite_retry_count_header( + self, async_client: AsyncImageKit, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/api/v1/files/upload").mock(side_effect=retry_handler) + + response = await client.files.with_raw_response.upload( + file=b"raw file contents", file_name="fileName", extra_headers={"x-stainless-retry-count": "42"} + ) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" + + def test_get_platform(self) -> None: + # A previous implementation of asyncify could leave threads unterminated when + # used with nest_asyncio. + # + # Since nest_asyncio.apply() is global and cannot be un-applied, this + # test is run in a separate process to avoid affecting other tests. + test_code = dedent(""" + import asyncio + import nest_asyncio + import threading + + from imagekit._utils import asyncify + from imagekit._base_client import get_platform + + async def test_main() -> None: + result = await asyncify(get_platform)() + print(result) + for thread in threading.enumerate(): + print(thread.name) + + nest_asyncio.apply() + asyncio.run(test_main()) + """) + with subprocess.Popen( + [sys.executable, "-c", test_code], + text=True, + ) as process: + timeout = 10 # seconds + + start_time = time.monotonic() + while True: + return_code = process.poll() + if return_code is not None: + if return_code != 0: + raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") + + # success + break + + if time.monotonic() - start_time > timeout: + process.kill() + raise AssertionError("calling get_platform using asyncify resulted in a hung process") + + time.sleep(0.1) + + async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + + client = DefaultAsyncHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + async def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultAsyncHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), + ) + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + await self.client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response + ) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" diff --git a/tests/test_custom_metadata_fields_ops.py b/tests/test_custom_metadata_fields_ops.py deleted file mode 100644 index 49b2e03..0000000 --- a/tests/test_custom_metadata_fields_ops.py +++ /dev/null @@ -1,982 +0,0 @@ -import json - -import responses -from responses import matchers - -from imagekitio.constants.url import URL -from imagekitio.exceptions.BadRequestException import BadRequestException -from imagekitio.exceptions.ForbiddenException import ForbiddenException -from imagekitio.exceptions.NotFoundException import NotFoundException -from imagekitio.exceptions.UnknownException import UnknownException -from imagekitio.models.CreateCustomMetadataFieldsRequestOptions import ( - CreateCustomMetadataFieldsRequestOptions, -) -from imagekitio.models.CustomMetaDataTypeEnum import CustomMetaDataTypeEnum -from imagekitio.models.CustomMetadataFieldsSchema import CustomMetadataFieldsSchema -from imagekitio.models.UpdateCustomMetadataFieldsRequestOptions import ( - UpdateCustomMetadataFieldsRequestOptions, -) -from imagekitio.utils.formatter import camel_dict_to_snake_dict -from tests.helpers import ( - ClientTestCase, - create_headers_for_test, -) - - -class TestCustomMetadataFields(ClientTestCase): - """ - TestCustomMetadataFields class used to test CRUD methods of custom metadata fields - """ - - field_id = "field_id" - - @responses.activate - def test_get_custom_metadata_fields_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - try: - responses.add( - responses.GET, - url, - status=403, - body="""{"message": "Your account cannot be authenticated." - , "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.get_custom_metadata_fields(True) - self.assertRaises(ForbiddenException) - except UnknownException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_get_custom_metadata_fields_succeeds(self): - """ - Tests if get_custom_metadata_fields succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = create_headers_for_test() - responses.add( - responses.GET, - url, - body="""[{ - "id": "62a9d5f6db485107347bb7f2", - "name": "test10", - "label": "test10", - "schema": { - "type": "Number", - "isValueRequired": false, - "minValue": 10, - "maxValue": 1000 - } - }, { - "id": "62aab2cfdb4851833b8f5e64", - "name": "test11", - "label": "test11", - "schema": { - "type": "Number", - "isValueRequired": false, - "minValue": 10, - "maxValue": 1000 - } - }]""", - match=[matchers.query_string_matcher("includeDeleted=false")], - headers=headers, - ) - resp = self.client.get_custom_metadata_fields() - - mock_response_metadata = { - "raw": [ - { - "id": "62a9d5f6db485107347bb7f2", - "name": "test10", - "label": "test10", - "schema": { - "type": "Number", - "isValueRequired": False, - "minValue": 10, - "maxValue": 1000, - }, - }, - { - "id": "62aab2cfdb4851833b8f5e64", - "name": "test11", - "label": "test11", - "schema": { - "type": "Number", - "isValueRequired": False, - "minValue": 10, - "maxValue": 1000, - }, - }, - ], - "httpStatusCode": 200, - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("62a9d5f6db485107347bb7f2", resp.list[0].id) - self.assertEqual("62aab2cfdb4851833b8f5e64", resp.list[1].id) - self.assertEqual( - "http://test.com/v1/customMetadataFields?includeDeleted=false", - responses.calls[0].request.url, - ) - - @responses.activate - def test_get_custom_metadata_fields_succeeds_with_include_deleted_true(self): - """ - Tests if get_custom_metadata_fields succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = create_headers_for_test() - responses.add( - responses.GET, - url, - body="""[{ - "id": "62a9d5f6db485107347bb7f2", - "name": "test10", - "label": "test10", - "schema": { - "type": "Number", - "isValueRequired": false, - "minValue": 10, - "maxValue": 1000 - } - }, { - "id": "62aab2cfdb4851833b8f5e64", - "name": "test11", - "label": "test11", - "schema": { - "type": "Number", - "isValueRequired": false, - "minValue": 10, - "maxValue": 1000 - } - }]""", - match=[matchers.query_string_matcher("includeDeleted=true")], - headers=headers, - ) - resp = self.client.get_custom_metadata_fields(include_deleted=True) - - mock_response_metadata = { - "raw": [ - { - "id": "62a9d5f6db485107347bb7f2", - "name": "test10", - "label": "test10", - "schema": { - "type": "Number", - "isValueRequired": False, - "minValue": 10, - "maxValue": 1000, - }, - }, - { - "id": "62aab2cfdb4851833b8f5e64", - "name": "test11", - "label": "test11", - "schema": { - "type": "Number", - "isValueRequired": False, - "minValue": 10, - "maxValue": 1000, - }, - }, - ], - "httpStatusCode": 200, - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("62a9d5f6db485107347bb7f2", resp.list[0].id) - self.assertEqual("62aab2cfdb4851833b8f5e64", resp.list[1].id) - self.assertEqual( - "http://test.com/v1/customMetadataFields?includeDeleted=true", - responses.calls[0].request.url, - ) - - @responses.activate - def test_get_custom_metadata_fields_succeeds_with_additional_attributes_in_response(self): - """ - Tests if get_custom_metadata_fields succeeds with additional responses - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = create_headers_for_test() - responses.add( - responses.GET, - url, - body="""[{ - "id": "62a9d5f6db485107347bb7f2", - "name": "test10", - "label": "test10", - "schema": { - "type": "Number", - "isValueRequired": false, - "minValue": 10, - "maxValue": 1000, - "currentValue":100 - } - }, { - "id": "62aab2cfdb4851833b8f5e64", - "name": "test11", - "label": "test11", - "schema": { - "type": "Number", - "isValueRequired": false, - "minValue": 10, - "maxValue": 1000, - "currentValue":1000 - } - }]""", - match=[matchers.query_string_matcher("includeDeleted=true")], - headers=headers, - ) - resp = self.client.get_custom_metadata_fields(include_deleted=True) - - mock_response_metadata = { - "raw": [ - { - "id": "62a9d5f6db485107347bb7f2", - "name": "test10", - "label": "test10", - "schema": { - "type": "Number", - "isValueRequired": False, - "minValue": 10, - "maxValue": 1000, - "currentValue":100 - }, - }, - { - "id": "62aab2cfdb4851833b8f5e64", - "name": "test11", - "label": "test11", - "schema": { - "type": "Number", - "isValueRequired": False, - "minValue": 10, - "maxValue": 1000, - "currentValue":1000 - }, - }, - ], - "httpStatusCode": 200, - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(resp.list[0].schema.current_value,100) - self.assertEqual(resp.list[1].schema.current_value,1000) - self.assertEqual(resp.list[0].random,None) - - @responses.activate - def test_delete_custom_metadata_fields_succeeds(self): - """ - Tests if delete_custom_metadata_fields succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id) - headers = create_headers_for_test() - responses.add(responses.DELETE, url, status=204, headers=headers, body="{}") - resp = self.client.delete_custom_metadata_field(self.field_id) - - mock_response_metadata = { - "raw": None, - "httpStatusCode": 204, - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/customMetadataFields/field_id", - responses.calls[0].request.url, - ) - - @responses.activate - def test_delete_custom_metadata_fields_fails_with_404(self): - """ - Tests if delete_custom_metadata_fields succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id) - try: - headers = create_headers_for_test() - responses.add( - responses.DELETE, - url, - status=404, - headers=headers, - body="""{"message": "No such custom metadata field exists", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.delete_custom_metadata_field(self.field_id) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("No such custom metadata field exists", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_create_custom_metadata_fields_fails_with_400(self): - """ - Tests if create_custom_metadata_fields fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=400, - body="""{"message": "A custom metadata field with this name already exists" - , "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.create_custom_metadata_fields( - options=CreateCustomMetadataFieldsRequestOptions( - name="test", - label="test", - schema=CustomMetadataFieldsSchema( - type=CustomMetaDataTypeEnum.Number, min_value=100, max_value=200 - ), - ) - ) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "A custom metadata field with this name already exists", e.message - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - @responses.activate - def test_create_custom_metadata_fields_succeeds_with_type_number(self): - """ - Tests if create_custom_metadata_fields succeeds with type number - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=201, - headers=headers, - body="""{ - "id": "62dfc03b1b02a58936efca37", - "name": "test", - "label": "test", - "schema": { - "type": "Number", - "minValue": 100, - "maxValue": 200 - } - }""", - ) - resp = self.client.create_custom_metadata_fields( - options=CreateCustomMetadataFieldsRequestOptions( - name="test", - label="test", - schema=CustomMetadataFieldsSchema( - type=CustomMetaDataTypeEnum.Number, min_value=100, max_value=200 - ), - ) - ) - - mock_response_metadata = { - "raw": { - "id": "62dfc03b1b02a58936efca37", - "name": "test", - "label": "test", - "schema": {"type": "Number", "minValue": 100, "maxValue": 200}, - }, - "httpStatusCode": 201, - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - - request_body = json.dumps( - json.loads( - """{ - "name": "test", - "label": "test", - "schema": { - "type": "Number", - "minValue": 100, - "maxValue": 200 - } - }""" - ) - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/customMetadataFields", responses.calls[0].request.url - ) - self.assertMultiLineEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_create_custom_metadata_fields_succeeds_with_type_textarea(self): - """ - Tests if create_custom_metadata_fields succeeds with type textarea - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=201, - headers=headers, - body="""{ - "id": "62e0d7ae1b02a589360dc1fd", - "name": "test", - "label": "test", - "schema": { - "isValueRequired": true, - "defaultValue": "The", - "type": "Textarea", - "minLength": 3, - "maxLength": 200 - } - }""", - ) - resp = self.client.create_custom_metadata_fields( - options=CreateCustomMetadataFieldsRequestOptions( - name="test", - label="test", - schema=CustomMetadataFieldsSchema( - is_value_required=True, - default_value="The", - type=CustomMetaDataTypeEnum.Textarea, - min_length=3, - max_length=200, - ), - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 201, - "raw": { - "id": "62e0d7ae1b02a589360dc1fd", - "label": "test", - "name": "test", - "schema": { - "defaultValue": "The", - "isValueRequired": True, - "maxLength": 200, - "minLength": 3, - "type": "Textarea", - }, - }, - } - - request_body = json.dumps( - json.loads( - """{ - "name": "test", - "label": "test", - "schema": { - "type": "Textarea", - "defaultValue": "The", - "isValueRequired": true, - "minLength": 3, - "maxLength": 200 - } - }""" - ) - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/customMetadataFields", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_create_custom_metadata_fields_succeeds_with_type_date(self): - """ - Tests if create_custom_metadata_fields succeeds with type date - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=201, - headers=headers, - body="""{ - "id": "62dfc9f41b02a58936f0d284", - "name": "test-date", - "label": "test-date", - "schema": { - "type": "Date", - "minValue": "2022-11-29T10:11:10+00:00", - "maxValue": "2022-11-30T10:11:10+00:00" - } - }""", - ) - resp = self.client.create_custom_metadata_fields( - options=CreateCustomMetadataFieldsRequestOptions( - name="test-date", - label="test-date", - schema=CustomMetadataFieldsSchema( - type=CustomMetaDataTypeEnum.Date, - min_value="2022-11-29T10:11:10+00:00", - max_value="2022-11-30T10:11:10+00:00", - ), - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 201, - "raw": { - "id": "62dfc9f41b02a58936f0d284", - "label": "test-date", - "name": "test-date", - "schema": { - "maxValue": "2022-11-30T10:11:10+00:00", - "minValue": "2022-11-29T10:11:10+00:00", - "type": "Date", - }, - }, - } - - request_body = json.dumps( - json.loads( - """{ - "name": "test-date", - "label": "test-date", - "schema": { - "type": "Date", - "minValue": "2022-11-29T10:11:10+00:00", - "maxValue": "2022-11-30T10:11:10+00:00" - } - }""" - ) - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/customMetadataFields", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_create_custom_metadata_fields_succeeds_with_type_boolean(self): - """ - Tests if create_custom_metadata_fields succeeds with type boolean - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=201, - headers=headers, - body="""{ - "id": "62dfcb801b02a58936f0fc39", - "name": "test-boolean", - "label": "test-boolean", - "schema": { - "type": "Boolean", - "isValueRequired": true, - "defaultValue": true - } - }""", - ) - resp = self.client.create_custom_metadata_fields( - options=CreateCustomMetadataFieldsRequestOptions( - name="test-boolean", - label="test-boolean", - schema=CustomMetadataFieldsSchema( - type=CustomMetaDataTypeEnum.Boolean, - is_value_required=True, - default_value=True, - ), - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 201, - "raw": { - "id": "62dfcb801b02a58936f0fc39", - "label": "test-boolean", - "name": "test-boolean", - "schema": { - "defaultValue": True, - "isValueRequired": True, - "type": "Boolean", - }, - }, - } - - request_body = json.dumps( - json.loads( - """{ - "name": "test-boolean", - "label": "test-boolean", - "schema": { - "type": "Boolean", - "defaultValue": true, - "isValueRequired": true - } - }""" - ) - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/customMetadataFields", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_create_custom_metadata_fields_succeeds_with_type_single_select(self): - """ - Tests if create_custom_metadata_fields succeeds with type SingleSelect - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=201, - headers=headers, - body="""{ - "id": "62dfcdb21b02a58936f14c97", - "name": "test", - "label": "test", - "schema": { - "type": "SingleSelect", - "selectOptions": ["small", "medium", "large", 30, 40, true] - } - }""", - ) - resp = self.client.create_custom_metadata_fields( - options=CreateCustomMetadataFieldsRequestOptions( - name="test", - label="test", - schema=CustomMetadataFieldsSchema( - type=CustomMetaDataTypeEnum.SingleSelect, - select_options=["small", "medium", "large", 30, 40, True], - ), - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 201, - "raw": { - "id": "62dfcdb21b02a58936f14c97", - "label": "test", - "name": "test", - "schema": { - "selectOptions": ["small", "medium", "large", 30, 40, True], - "type": "SingleSelect", - }, - }, - } - - request_body = json.dumps( - json.loads( - """{ - "name": "test", - "label": "test", - "schema": - { - "type": "SingleSelect", - "selectOptions": ["small", "medium", "large", 30, 40, - true] - } - }""" - ) - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/customMetadataFields", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_create_custom_metadata_fields_succeeds_with_type_multi_select(self): - """ - Tests if create_custom_metadata_fields succeeds with type MultiSelect - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=201, - headers=headers, - body="""{ - "id": "62dfcf001b02a58936f17808", - "name": "test", - "label": "test", - "schema": { - "type": "MultiSelect", - "isValueRequired": true, - "defaultValue": ["small", 30, true], - "selectOptions": ["small", "medium", "large", 30, 40, true] - } - }""", - ) - resp = self.client.create_custom_metadata_fields( - options=CreateCustomMetadataFieldsRequestOptions( - name="test", - label="test", - schema=CustomMetadataFieldsSchema( - type=CustomMetaDataTypeEnum.MultiSelect, - is_value_required=True, - default_value=["small", 30, True], - select_options=["small", "medium", "large", 30, 40, True], - ), - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 201, - "raw": { - "id": "62dfcf001b02a58936f17808", - "label": "test", - "name": "test", - "schema": { - "defaultValue": ["small", 30, True], - "isValueRequired": True, - "selectOptions": ["small", "medium", "large", 30, 40, True], - "type": "MultiSelect", - }, - }, - } - - request_body = json.dumps( - json.loads( - """{ - "name": "test", - "label": "test", - "schema": { - "type": "MultiSelect", - "selectOptions": ["small", "medium", "large", 30, 40, true], - "defaultValue": ["small", 30, true], - "isValueRequired": true - } - }""" - ) - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/customMetadataFields", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_update_custom_metadata_fields_succeeds(self): - """ - Tests if update_custom_metadata_fields succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.PATCH, - url, - headers=headers, - body="""{ - "id": "62a9d5f6db485107347bb7f2", - "name": "test", - "label": "test-update", - "schema": { - "minValue": 100, - "maxValue": 200, - "type": "Number" - } - }""", - ) - - resp = self.client.update_custom_metadata_fields( - self.field_id, - options=UpdateCustomMetadataFieldsRequestOptions( - label="test-update", - schema=CustomMetadataFieldsSchema(min_value=100, max_value=200), - ), - ) - - mock_response_metadata = { - "raw": { - "id": "62a9d5f6db485107347bb7f2", - "name": "test", - "label": "test-update", - "schema": {"minValue": 100, "maxValue": 200, "type": "Number"}, - }, - "httpStatusCode": 200, - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - - request_body = json.dumps( - json.loads( - """{ - "label": "test-update", - "schema": { - "minValue": 100, - "maxValue": 200 - } - }""" - ) - ) - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("62a9d5f6db485107347bb7f2", resp.id) - self.assertEqual( - "http://test.com/v1/customMetadataFields/field_id", - responses.calls[0].request.url, - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_update_custom_metadata_fields_fails_with_404(self): - """ - Tests if update_custom_metadata_fields fails with 404 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id) - try: - responses.add( - responses.PATCH, - url, - status=404, - body="""{ - "message": "No such custom metadata field exists", - "help": "For support kindly contact us at support@imagekit.io ." - }""", - ) - - self.client.update_custom_metadata_fields( - self.field_id, - options=UpdateCustomMetadataFieldsRequestOptions( - label="test-update", - schema=CustomMetadataFieldsSchema(min_value=100, max_value=200), - ), - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("No such custom metadata field exists", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_update_custom_metadata_fields_fails_with_400(self): - """ - Tests if update_custom_metadata_fields fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/customMetadataFields/{}".format(URL.API_BASE_URL, self.field_id) - try: - responses.add( - responses.PATCH, - url, - status=400, - body="""{ - "message": "Your request contains invalid ID parameter.", - "help": "For support kindly contact us at support@imagekit.io ." - }""", - ) - - self.client.update_custom_metadata_fields( - self.field_id, - options=UpdateCustomMetadataFieldsRequestOptions( - label="test-update", - schema=CustomMetadataFieldsSchema(min_value=100, max_value=200), - ), - ) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual("Your request contains invalid ID parameter.", e.message) - self.assertEqual(400, e.response_metadata.http_status_code) diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py new file mode 100644 index 0000000..0a12266 --- /dev/null +++ b/tests/test_deepcopy.py @@ -0,0 +1,58 @@ +from imagekit._utils import deepcopy_minimal + + +def assert_different_identities(obj1: object, obj2: object) -> None: + assert obj1 == obj2 + assert id(obj1) != id(obj2) + + +def test_simple_dict() -> None: + obj1 = {"foo": "bar"} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + + +def test_nested_dict() -> None: + obj1 = {"foo": {"bar": True}} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert_different_identities(obj1["foo"], obj2["foo"]) + + +def test_complex_nested_dict() -> None: + obj1 = {"foo": {"bar": [{"hello": "world"}]}} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert_different_identities(obj1["foo"], obj2["foo"]) + assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"]) + assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0]) + + +def test_simple_list() -> None: + obj1 = ["a", "b", "c"] + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + + +def test_nested_list() -> None: + obj1 = ["a", [1, 2, 3]] + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert_different_identities(obj1[1], obj2[1]) + + +class MyObject: ... + + +def test_ignores_other_types() -> None: + # custom classes + my_obj = MyObject() + obj1 = {"foo": my_obj} + obj2 = deepcopy_minimal(obj1) + assert_different_identities(obj1, obj2) + assert obj1["foo"] is my_obj + + # tuples + obj3 = ("a", "b") + obj4 = deepcopy_minimal(obj3) + assert obj3 is obj4 diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py new file mode 100644 index 0000000..d55e402 --- /dev/null +++ b/tests/test_extract_files.py @@ -0,0 +1,64 @@ +from __future__ import annotations + +from typing import Sequence + +import pytest + +from imagekit._types import FileTypes +from imagekit._utils import extract_files + + +def test_removes_files_from_input() -> None: + query = {"foo": "bar"} + assert extract_files(query, paths=[]) == [] + assert query == {"foo": "bar"} + + query2 = {"foo": b"Bar", "hello": "world"} + assert extract_files(query2, paths=[["foo"]]) == [("foo", b"Bar")] + assert query2 == {"hello": "world"} + + query3 = {"foo": {"foo": {"bar": b"Bar"}}, "hello": "world"} + assert extract_files(query3, paths=[["foo", "foo", "bar"]]) == [("foo[foo][bar]", b"Bar")] + assert query3 == {"foo": {"foo": {}}, "hello": "world"} + + query4 = {"foo": {"bar": b"Bar", "baz": "foo"}, "hello": "world"} + assert extract_files(query4, paths=[["foo", "bar"]]) == [("foo[bar]", b"Bar")] + assert query4 == {"hello": "world", "foo": {"baz": "foo"}} + + +def test_multiple_files() -> None: + query = {"documents": [{"file": b"My first file"}, {"file": b"My second file"}]} + assert extract_files(query, paths=[["documents", "", "file"]]) == [ + ("documents[][file]", b"My first file"), + ("documents[][file]", b"My second file"), + ] + assert query == {"documents": [{}, {}]} + + +@pytest.mark.parametrize( + "query,paths,expected", + [ + [ + {"foo": {"bar": "baz"}}, + [["foo", "", "bar"]], + [], + ], + [ + {"foo": ["bar", "baz"]}, + [["foo", "bar"]], + [], + ], + [ + {"foo": {"bar": "baz"}}, + [["foo", "foo"]], + [], + ], + ], + ids=["dict expecting array", "array expecting dict", "unknown keys"], +) +def test_ignores_incorrect_paths( + query: dict[str, object], + paths: Sequence[Sequence[str]], + expected: list[tuple[str, FileTypes]], +) -> None: + assert extract_files(query, paths=paths) == expected diff --git a/tests/test_files.py b/tests/test_files.py new file mode 100644 index 0000000..d37ddba --- /dev/null +++ b/tests/test_files.py @@ -0,0 +1,51 @@ +from pathlib import Path + +import anyio +import pytest +from dirty_equals import IsDict, IsList, IsBytes, IsTuple + +from imagekit._files import to_httpx_files, async_to_httpx_files + +readme_path = Path(__file__).parent.parent.joinpath("README.md") + + +def test_pathlib_includes_file_name() -> None: + result = to_httpx_files({"file": readme_path}) + print(result) + assert result == IsDict({"file": IsTuple("README.md", IsBytes())}) + + +def test_tuple_input() -> None: + result = to_httpx_files([("file", readme_path)]) + print(result) + assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes()))) + + +@pytest.mark.asyncio +async def test_async_pathlib_includes_file_name() -> None: + result = await async_to_httpx_files({"file": readme_path}) + print(result) + assert result == IsDict({"file": IsTuple("README.md", IsBytes())}) + + +@pytest.mark.asyncio +async def test_async_supports_anyio_path() -> None: + result = await async_to_httpx_files({"file": anyio.Path(readme_path)}) + print(result) + assert result == IsDict({"file": IsTuple("README.md", IsBytes())}) + + +@pytest.mark.asyncio +async def test_async_tuple_input() -> None: + result = await async_to_httpx_files([("file", readme_path)]) + print(result) + assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes()))) + + +def test_string_not_allowed() -> None: + with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"): + to_httpx_files( + { + "file": "foo", # type: ignore + } + ) diff --git a/tests/test_files_ops.py b/tests/test_files_ops.py deleted file mode 100644 index 613406e..0000000 --- a/tests/test_files_ops.py +++ /dev/null @@ -1,3111 +0,0 @@ -import base64 -import json -import os - -import responses -from responses import matchers - -from imagekitio.client import ImageKit -from imagekitio.constants.url import URL -from imagekitio.exceptions.BadRequestException import BadRequestException -from imagekitio.exceptions.ConflictException import ConflictException -from imagekitio.exceptions.ForbiddenException import ForbiddenException -from imagekitio.exceptions.NotFoundException import NotFoundException -from imagekitio.exceptions.UnknownException import UnknownException -from imagekitio.models.CopyFileRequestOptions import CopyFileRequestOptions -from imagekitio.models.MoveFileRequestOptions import MoveFileRequestOptions -from imagekitio.models.RenameFileRequestOptions import RenameFileRequestOptions -from imagekitio.models.UpdateFileRequestOptions import UpdateFileRequestOptions -from imagekitio.models.UploadFileRequestOptions import UploadFileRequestOptions -from imagekitio.utils.formatter import camel_dict_to_snake_dict -from tests.helpers import ( - ClientTestCase, - create_headers_for_test, - get_auth_headers_for_test, -) - -imagekit_obj = ImageKit( - private_key="private_fake:", - public_key="public_fake123:", - url_endpoint="fake.com", -) - - -class TestUpload(ClientTestCase): - """ - TestUpload class used to test upload method - """ - - image = os.path.join( - os.path.dirname(os.path.realpath(__file__)), "dummy_data/image.png" - ) - - sample_image = os.path.join( - os.path.dirname(os.path.realpath(__file__)), "sample.jpg" - ) - filename = "test" - - @responses.activate - def test_upload_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.UPLOAD_BASE_URL = "http://test.com" - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - try: - responses.add( - responses.POST, - url, - status=403, - body="""{"message": "Your account cannot be authenticated." - , "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.upload_file( - file=self.image, - file_name=self.filename, - options=UploadFileRequestOptions( - use_unique_file_name=False, - tags=["abc", "def"], - folder="/testing-python-folder/", - is_private_file=False, - custom_coordinates="10,10,20,20", - response_fields=[ - "tags", - "custom_coordinates", - "is_private_file", - "embedded_metadata", - "custom_metadata", - ], - extensions=( - { - "name": "remove-bg", - "options": {"add_shadow": True, "bg_color": "pink"}, - }, - { - "name": "google-auto-tagging", - "minConfidence": 80, - "maxTags": 10, - }, - ), - webhook_url="https://webhook.site/c78d617f-33bc-40d9-9e61-608999721e2e", - overwrite_file=True, - overwrite_ai_tags=False, - overwrite_tags=False, - overwrite_custom_metadata=True, - custom_metadata={"testss": 12}, - ), - ) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(e.response_metadata.http_status_code, 403) - - @responses.activate - def test_binary_upload_succeeds(self): - """ - Tests if upload succeeds - """ - URL.UPLOAD_BASE_URL = "http://test.com" - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - headers = create_headers_for_test() - responses.add( - responses.POST, - url, - body="""{ - "fileId": "fake_file_id1234", - "name": "file_name.jpg", - "size": 102117, - "versionInfo": { - "id": "62d670648cdb697522602b45", - "name": "Version 11" - }, - "filePath": "/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "width": 1050, - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "tags": [ - "abc", - "def" - ], - "AITags": [ - { - "name": "Computer", - "confidence": 97.66, - "source": "google-auto-tagging" - }, - { - "name": "Personal computer", - "confidence": 94.96, - "source": "google-auto-tagging" - } - ], - "isPrivateFile": true, - "extensionStatus": { - "remove-bg": "pending", - "google-auto-tagging": "success" - } - }""", - headers=headers, - ) - - with open(self.sample_image, mode="rb") as img: - resp = self.client.upload_file( - file=img, - file_name="file_name.jpg", - options=UploadFileRequestOptions( - use_unique_file_name=False, - tags=["abc", "def"], - folder="/testing-python-folder/", - is_private_file=True, - response_fields=["is_private_file", "tags"], - extensions=( - { - "name": "remove-bg", - "options": {"add_shadow": True, "bg_color": "pink"}, - }, - {"name": "google-auto-tagging", "minConfidence": 80, "maxTags": 10}, - ), - webhook_url="url", - overwrite_file=True, - overwrite_ai_tags=False, - overwrite_tags=False, - overwrite_custom_metadata=True, - custom_metadata={"test100": 11}, - transformation={"pre": "h-100", "post": [{"type": "transformation", "value": "w-100"}]}, - checks="'request.folder' : '/testing-python-folder/'", - is_published=True - ), - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": [ - { - "confidence": 97.66, - "name": "Computer", - "source": "google-auto-tagging", - }, - { - "confidence": 94.96, - "name": "Personal computer", - "source": "google-auto-tagging", - }, - ], - "extensionStatus": { - "google-auto-tagging": "success", - "remove-bg": "pending", - }, - "fileId": "fake_file_id1234", - "filePath": "/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "isPrivateFile": True, - "name": "file_name.jpg", - "size": 102117, - "tags": ["abc", "def"], - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "versionInfo": {"id": "62d670648cdb697522602b45", "name": "Version 11"}, - "width": 1050 - }, - } - request_body = b'----randomBoundary---------------------\r\nContent-Disposition: form-data; name="file"; filename="file_name.jpg"\r\n\r\n\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00H\x00H\x00\x00\xff\xe2\x0cXICC_PROFILE\x00\x01\x01\x00\x00\x0cHLino\x02\x10\x00\x00mntrRGB XYZ \x07\xce\x00\x02\x00\t\x00\x06\x001\x00\x00acspMSFT\x00\x00\x00\x00IEC sRGB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf6\xd6\x00\x01\x00\x00\x00\x00\xd3-HP \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11cprt\x00\x00\x01P\x00\x00\x003desc\x00\x00\x01\x84\x00\x00\x00lwtpt\x00\x00\x01\xf0\x00\x00\x00\x14bkpt\x00\x00\x02\x04\x00\x00\x00\x14rXYZ\x00\x00\x02\x18\x00\x00\x00\x14gXYZ\x00\x00\x02,\x00\x00\x00\x14bXYZ\x00\x00\x02@\x00\x00\x00\x14dmnd\x00\x00\x02T\x00\x00\x00pdmdd\x00\x00\x02\xc4\x00\x00\x00\x88vued\x00\x00\x03L\x00\x00\x00\x86view\x00\x00\x03\xd4\x00\x00\x00$lumi\x00\x00\x03\xf8\x00\x00\x00\x14meas\x00\x00\x04\x0c\x00\x00\x00$tech\x00\x00\x040\x00\x00\x00\x0crTRC\x00\x00\x04<\x00\x00\x08\x0cgTRC\x00\x00\x04<\x00\x00\x08\x0cbTRC\x00\x00\x04<\x00\x00\x08\x0ctext\x00\x00\x00\x00Copyright (c) 1998 Hewlett-Packard Company\x00\x00desc\x00\x00\x00\x00\x00\x00\x00\x12sRGB IEC61966-2.1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12sRGB IEC61966-2.1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00\xf3Q\x00\x01\x00\x00\x00\x01\x16\xccXYZ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00o\xa2\x00\x008\xf5\x00\x00\x03\x90XYZ \x00\x00\x00\x00\x00\x00b\x99\x00\x00\xb7\x85\x00\x00\x18\xdaXYZ \x00\x00\x00\x00\x00\x00$\xa0\x00\x00\x0f\x84\x00\x00\xb6\xcfdesc\x00\x00\x00\x00\x00\x00\x00\x16IEC http://www.iec.ch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16IEC http://www.iec.ch\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00desc\x00\x00\x00\x00\x00\x00\x00.IEC 61966-2.1 Default RGB colour space - sRGB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00.IEC 61966-2.1 Default RGB colour space - sRGB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00desc\x00\x00\x00\x00\x00\x00\x00,Reference Viewing Condition in IEC61966-2.1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00,Reference Viewing Condition in IEC61966-2.1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00view\x00\x00\x00\x00\x00\x13\xa4\xfe\x00\x14_.\x00\x10\xcf\x14\x00\x03\xed\xcc\x00\x04\x13\x0b\x00\x03\\\x9e\x00\x00\x00\x01XYZ \x00\x00\x00\x00\x00L\tV\x00P\x00\x00\x00W\x1f\xe7meas\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x8f\x00\x00\x00\x02sig \x00\x00\x00\x00CRT curv\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x05\x00\n\x00\x0f\x00\x14\x00\x19\x00\x1e\x00#\x00(\x00-\x002\x007\x00;\x00@\x00E\x00J\x00O\x00T\x00Y\x00^\x00c\x00h\x00m\x00r\x00w\x00|\x00\x81\x00\x86\x00\x8b\x00\x90\x00\x95\x00\x9a\x00\x9f\x00\xa4\x00\xa9\x00\xae\x00\xb2\x00\xb7\x00\xbc\x00\xc1\x00\xc6\x00\xcb\x00\xd0\x00\xd5\x00\xdb\x00\xe0\x00\xe5\x00\xeb\x00\xf0\x00\xf6\x00\xfb\x01\x01\x01\x07\x01\r\x01\x13\x01\x19\x01\x1f\x01%\x01+\x012\x018\x01>\x01E\x01L\x01R\x01Y\x01`\x01g\x01n\x01u\x01|\x01\x83\x01\x8b\x01\x92\x01\x9a\x01\xa1\x01\xa9\x01\xb1\x01\xb9\x01\xc1\x01\xc9\x01\xd1\x01\xd9\x01\xe1\x01\xe9\x01\xf2\x01\xfa\x02\x03\x02\x0c\x02\x14\x02\x1d\x02&\x02/\x028\x02A\x02K\x02T\x02]\x02g\x02q\x02z\x02\x84\x02\x8e\x02\x98\x02\xa2\x02\xac\x02\xb6\x02\xc1\x02\xcb\x02\xd5\x02\xe0\x02\xeb\x02\xf5\x03\x00\x03\x0b\x03\x16\x03!\x03-\x038\x03C\x03O\x03Z\x03f\x03r\x03~\x03\x8a\x03\x96\x03\xa2\x03\xae\x03\xba\x03\xc7\x03\xd3\x03\xe0\x03\xec\x03\xf9\x04\x06\x04\x13\x04 \x04-\x04;\x04H\x04U\x04c\x04q\x04~\x04\x8c\x04\x9a\x04\xa8\x04\xb6\x04\xc4\x04\xd3\x04\xe1\x04\xf0\x04\xfe\x05\r\x05\x1c\x05+\x05:\x05I\x05X\x05g\x05w\x05\x86\x05\x96\x05\xa6\x05\xb5\x05\xc5\x05\xd5\x05\xe5\x05\xf6\x06\x06\x06\x16\x06\'\x067\x06H\x06Y\x06j\x06{\x06\x8c\x06\x9d\x06\xaf\x06\xc0\x06\xd1\x06\xe3\x06\xf5\x07\x07\x07\x19\x07+\x07=\x07O\x07a\x07t\x07\x86\x07\x99\x07\xac\x07\xbf\x07\xd2\x07\xe5\x07\xf8\x08\x0b\x08\x1f\x082\x08F\x08Z\x08n\x08\x82\x08\x96\x08\xaa\x08\xbe\x08\xd2\x08\xe7\x08\xfb\t\x10\t%\t:\tO\td\ty\t\x8f\t\xa4\t\xba\t\xcf\t\xe5\t\xfb\n\x11\n\'\n=\nT\nj\n\x81\n\x98\n\xae\n\xc5\n\xdc\n\xf3\x0b\x0b\x0b"\x0b9\x0bQ\x0bi\x0b\x80\x0b\x98\x0b\xb0\x0b\xc8\x0b\xe1\x0b\xf9\x0c\x12\x0c*\x0cC\x0c\\\x0cu\x0c\x8e\x0c\xa7\x0c\xc0\x0c\xd9\x0c\xf3\r\r\r&\r@\rZ\rt\r\x8e\r\xa9\r\xc3\r\xde\r\xf8\x0e\x13\x0e.\x0eI\x0ed\x0e\x7f\x0e\x9b\x0e\xb6\x0e\xd2\x0e\xee\x0f\t\x0f%\x0fA\x0f^\x0fz\x0f\x96\x0f\xb3\x0f\xcf\x0f\xec\x10\t\x10&\x10C\x10a\x10~\x10\x9b\x10\xb9\x10\xd7\x10\xf5\x11\x13\x111\x11O\x11m\x11\x8c\x11\xaa\x11\xc9\x11\xe8\x12\x07\x12&\x12E\x12d\x12\x84\x12\xa3\x12\xc3\x12\xe3\x13\x03\x13#\x13C\x13c\x13\x83\x13\xa4\x13\xc5\x13\xe5\x14\x06\x14\'\x14I\x14j\x14\x8b\x14\xad\x14\xce\x14\xf0\x15\x12\x154\x15V\x15x\x15\x9b\x15\xbd\x15\xe0\x16\x03\x16&\x16I\x16l\x16\x8f\x16\xb2\x16\xd6\x16\xfa\x17\x1d\x17A\x17e\x17\x89\x17\xae\x17\xd2\x17\xf7\x18\x1b\x18@\x18e\x18\x8a\x18\xaf\x18\xd5\x18\xfa\x19 \x19E\x19k\x19\x91\x19\x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f2\x8c\xf3\x19\xf3\xa7\xf44\xf4\xc2\xf5P\xf5\xde\xf6m\xf6\xfb\xf7\x8a\xf8\x19\xf8\xa8\xf98\xf9\xc7\xfaW\xfa\xe7\xfbw\xfc\x07\xfc\x98\xfd)\xfd\xba\xfeK\xfe\xdc\xffm\xff\xff\xff\xdb\x00C\x00\x03\x02\x02\x03\x02\x02\x03\x03\x03\x03\x04\x03\x03\x04\x05\x08\x05\x05\x04\x04\x05\n\x07\x07\x06\x08\x0c\n\x0c\x0c\x0b\n\x0b\x0b\r\x0e\x12\x10\r\x0e\x11\x0e\x0b\x0b\x10\x16\x10\x11\x13\x14\x15\x15\x15\x0c\x0f\x17\x18\x16\x14\x18\x12\x14\x15\x14\xff\xdb\x00C\x01\x03\x04\x04\x05\x04\x05\t\x05\x05\t\x14\r\x0b\r\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\x14\xff\xc2\x00\x11\x08\x02\xbc\x04\x1a\x03\x01\x11\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1c\x00\x00\x02\x03\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\xff\xc4\x00\x1b\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\xff\xda\x00\x0c\x03\x01\x00\x02\x10\x03\x10\x00\x00\x01\xf3\x7f\xcd\x7f\xab\xea\xe3\xd3\xd4\xfc\x7fn\xef?,\x9d\xbc\xfc\xefW\x82\xcc\xb4\xf2\xe9w=\xca(\xe9i\xdfY:\xd9\x8d\xea\xe54r\xcc\xa1\xc3\xdc\x87me\xbd\xf0\xf6s=\\)\xdf;\xb1\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xa6\xf9\xb1\xde\xd7\x8bo_.\x9e\xbcede\x04\xaa\x14\xa9AJ\x84\xaa\x12\xa5@\xa0\x80C\x00\x00\x86\x01D\x00\x8c\x02\x18#\x82\x00\x1c\x8eF\x08\xc0\xa3\x9f^o\x0fo\x0b\x1e\xef\x98s\xef\xe4\xf5k\xd1T\xf3m\xc2\xeer\xecf\xecK0h\xd1,iX\xa92YV\xacn\xed\xc7m\x9c{\xf4|\xbd~\x90\xf9\x1d\xff\x00g\x8bw\xdb\xf9\xfe\x8f\xaf\xcc\x8f=W\x8dC\x9e\xea\xc6\xea\xc7Jq\xd23\\_\x7f\xd1\xba\xf3\xb2\xe2\xcb\x89\xdc\xcd\'r\xeed\x92\xb1\xd8\r\x12\xa1*\x95*\x12\xa5\x04\xaa\x0bQ\x19R\xc6X\xb5\x15\x8c\xd4\x1a\x84\xd4\x1a\x82\xd7u\t\xaa\xd6\rU5U\xb4\xd6}g\xad\x9e}\x87\x9fn\xfc\xda\xbap\xbb\xa76\x80\x95J\x84\xaa\x05\x8a\xa0\x95BT\n\x08\x00J#\x00\x01\x80\x04\x80\xc2\x88\x06\x19\x8c \x82\x81\xc8\xe1\xa0\x06N]\xf9\xbc=\xbc\t\xec\xf8\xfe:\xf1zZ\xf5\x08\xbb\x16\xdc4s\xcd\xdc\xe5\xb9\xcc\xa1\xca\xc8\xd2\x15\x89\x0b#ez\x13\xa6\x9e^\x8d\xfe~\xfd//O\xab\xfa~\x05\xbe\x8e~\x93\xf4\x7f\x13\xa3\xc7\xce\xb2\x867^u_=\xd5\x8e\x95cuM\xbf\xa9,\xb9\x95\x93\xd6]\xcc\xa9\xd8\xecv=GM\x1d\x00\x80ZHP0\xa1\x1d\x14@)T\xb1\xc9MFX\xcb\x19\xa8\xcb\x19a5\x19\xa8MBj\x13U\xcd\xc2j\xb9\xb7W^Z7\xca\xfd\xf2\x9e\xf0()R\xa1J\x84\xaa\x12\x92\xa1\x02\x82\x01\x00\x00\xe8\x80\x06\x00\x00\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\xae\xe9\xb6\xad\xe2\x1a\x88\x88\xaaR\xd9\x9d_\x86\x99\x9b\x99\xb1$\x02\tP\x8a\xd6+\x19kj\x02\x12\xa1Y\x11"\x04"Q(\x9c1\xc1HU\x1bR\xc5cu\x10j\x15\x9a\xdau\x16\xeb\xab\xe3\\\x9a\x8b\x92\xc8*u\xaaM\x105\x19\xa9\xc7\xca\xbc?l\xd4\x94\x8e\xa6\x8c\x8e\xa57\x05\x92K%\x82Q\xa9\x9bY\xa7R\xbb\x95cIE\x84\xd2\x06}g>\xe45\x9a\xb4\x12\xd9tI\xab+$5\x99\x96\xc5\xd2M%M\x0b\n\x95\x96L\x88\xa9X\xaeec\x88\xd4u"\x85\x8a\xc2\xc9\xa6\xeew\xa1\xcbZ\xf9\xdb\xe5\xb6-\x89\x85%\x88\x04D\x8a\xa5T\x90\x05\x10R\x05\x9aI&\x92$2 )P\x80\xadjj*\x0c\x08\x10X\x82\x04a(9\'\x00\x00\x02\x8d+R\x82)\xb7&\xae-o6\xac*\xd2\xfa\xbe4I\xa0\xd1%\xf1i)\xa7,\x8f\x9e\xf9>\xa9b\xb1\x85\x92\x1b1J\xf7#p\x16\xe6\xa2\x8df\xa4Z\x91\xb0\xb2H$\xd2P\xac\xaa\xcc\xfb\x90\xd4\x8d\x8c\xb6-\x93Fe\xab4\x95\x96I4\x07RF\x8bRD\x99\x124X"\xd6J\x11Q`\x89\x15\x85\x97F\xbez\xd9\x8b\xab\x9bL\xb7E\x92\xc9@\x02"\x10\r@AZ"*\x862i!\xaaD\xa8%i\x15\xa5\xaaV#&\x80\x88+$\x05k\\\xb0T\xa8!\x8cd\xa0\x05q "\xd5-e\xd6\xb2\xb5F\x95\x11\xd6\x90\xeavN\xad[\x0b%\x92\xce_9\xe2\xf7\xab\x1a+\x1d\t&dB\xc8k0\xb0f\xc9Q]\x91\xb2W)\x15\x16\td\x96K\x1b!\xa9]\x8bR\xbb\x16\xb39,\xca\xd9l$\x93F\x85I$\x93\x18\xec\x91)\x96-Ear\x91h\xach\t\x0b#E\x92,\x8b\xf0\xd7\x8b\xaf\x16\xec\xdb%\xb2Y\x93\x18\x84\xa9\x12\xa9AZ#\x04\x00cF\xa0\xa0\n\x15K\x05\xa9\xaa\x16\x16\x896B*\xa2D\xd2A\x11\x9a\xad\xa8\xd2X\x80@1\x92\xcaK \x12\xa9\xa8\xdb\t\xa8\xad+F\xad\x16\xd3T\xdb]F\x92\x96\xaasP\xf1z\xe3`\x85\x0c\xba\x12hY\x0b#s\x1b\np$.]\x80X#\xb2qlH\x126F\xca\xaa\x9d\xe1j2q8\x9cM\x1d\x82;&Li2\xcc\xa6\x92F\x8a\x8dB\xe4\xb1\x11EL,V\x04l\x00\x0b#Fm\xf8\xbap\xd1\x95\xb3S&La\tb\xa0\x95,B\xc6\x08\x00\x94\x94\x10\x95\x11Z\xc8,-\x88*D\xa0\xd1\xc9!\x84\xac%J\x84 \x05d\xa1\x8ePj\x94T&\xa2\xb0\x96\xbb`\xd5\x0bE\xb9\xaa\x9a\xa6\xda\x96+o\x9b\xd0TR56D*I4dnc\xa4R7*\xe5\x06\xa0\x8d\x1cLq+\'\x12\x12+#ez\xcdu^\xe2\xb1\xa5\x99[\x13\x89XX\xc9\xd4\x92D\xe4\xb2I\xc9!\xd3B\xc2\xc1#J\x921\x08V\x16F\xa1I\x15In\xcbNZ9\xdd\x19\xb7f\xdb\x16\x92$N\x05K\x15\x8a\xa2"\xa4\x89R\xc6\x01\x89B D\x89\x15\x83P\xb6\x02@h\xd6P\xc7+\x86\x03\x10ZC\x86\n+Pr\x82\x13PX\x91\xb62\xc1\xa8\xadkL\xb4[\x99`\xb99\xf5t"\xa1&1\\\xcd,\x87dR:\x91\xb9\x8d\x90\xb1P\x8d\x99,\xd2y\x14\xaar9\x18Y\x0b+\xb2\x1a\x95\xeaCR\xc9,\x96\xc9,$\x92\rGR\x8939$L\x928\x90\xd1X\xacAJ\x92DB\xd0\x15\x90\xb2\x14\x82\x9cY\x1a3ua\xa7+\x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f5\xa8\x90X\xacn\xa2VV\xd2\x04\xf1\x96\xe9\xcd\xb6.\x96\xc8\x92X\x01M%2\xe9\x82$\x8d\x89\n,\x88X\xd2D\xb2t#%d\x89HP\x82+\x15\x16+\x16\xa3\xa9\xa4\x92q<\xc9\xa1h\x8cv\x01B\x04\xe2RN\x18\x08T\xa8\x11\x1a\x8dDV%\x11\x05\x85\x00\x91\xb5$\x8b%\xbb+\xb3n\xc2\xdc\xdbb\xc8\x9a\xce$\xacp\xe5P* B\xd8\x95\xdd@\x85\xb1 \x14AN\x18\x84!(\xa2\xb1\xca\xe1\x92\x95\xa8%B\xba\x85\xb1\xa8,*\x16\xa9b\xb0\x88Z\xaa5\xe1\x97FZb\xec\xdb\xe2\xc9ed\xe0Gc\x1c;\x18\x92,\x94\x82\xc0V$,u8i"D\x91\x8d\x18\x90\xb0\x0b\x1d\x80\xf5\rfRH\x94NF1\xd0\x08\x05\x8d\x1d9d\x8f)\x0e\x00\x15\n\x90\xa4F\xa3Q\xb0\x01\n\x95!Y\x11Z\xd2qfm\xf9]\x9bl\x96el\xb3\x8b\tJ\xd6Q(JDV%v\xd4\xdc*$HTD\x03\x01\x08`IZ\x84\xa5p*\x82\xd4E\xa5QXj\xc5amd-\x8a\xc6!ll\x8e\xa7\x85\x9a\xbf7Dj\xca\xe8\xba\'\x13$2R:\x01\x1a\x08\x91R\xa8\xd9\x1b\x1aF\x9b2%$\x96d\x89#\x04\x92\x04\xa9\xcc\xba,,v+\x18\xd1\x93\x89\x0chX\x02\x14\xc7\x0e\x9eL\x90\xe1\x82\x80\xa0H\xaa6*V*\x8d\x04H\xd9\x126\x82\xb1\n\xc9D\xe5\xbb+b\xe8\xb36\xdc\xae\xcak)f\xa48%K\x19\xa8T\n\xee\xa1H\x89\x10\xa4\x89P\x80\tT\xa5\x90\xd5\xc0%\x8a\xa9al-\x8dB\xe9,\n\xed\x85@\x89]\xb5\xeaB\xbc2\xe8\xcd\xbaM\x19\xbar\xba[\xf2\x9cI&IZ4\x01$4B\xb2)\rEM\x12\x16Hd\xe2D\x89#I\x13I\r%M\x0b\x15\x89\x15+\x192C\x92C@\x10\x18\xe9\xc3\x00\x19)e\x0c\x10RB\xd1\nDl\x8e\x8a\xa3Q"DU\x14T\xaa(\xa8\'\x16E\xb2\xdd\x95\xb9\xb6\xe5nm\x91`\xf3e4J\x96""F\xd8\xacT\x10R"\x90\xb6!L\x942Ci\x11"\xb1X\xdb\x05\x85V\xd4-\x89\n\x82\xc3H-UMS\xb9\xe2\xb3n\x92\xf9n\x8dX\xba2\xb8\xbb+r\x910FHI"h*Es\n\x8d\x8a\xc7`\x03\x198\x95\x92\x92\xc4\x91$\x992H\xd0\x15\x91\xb1Ti\\\xba\x98\xd2YId\x89\x05hPH \x01\x92\x89+\x87\x05\x03@\x05QH\xd2\xd2\x14\x88\xd4D\x88\x85\xb1\xb9\x8dF\xd4\xc9S\x96\xd8\xbb\x1a\xb4\xb3\x0br\xbb6\xd8\x9c\xd3\x95@\xb1\x00\x08-\x04\x04ZU\x11\x11\xa8\xa8\x8dA*\xa8\xaaTEamk\x0bk\xb6\xb2\x1bV\xb0\xa8\x14\xdb\x9bJl\xff\xc4\x001\x10\x00\x02\x01\x04\x02\x01\x03\x03\x04\x02\x03\x00\x03\x01\x01\x00\x00\x01\x02\x03\x04\x11\x12\x05\x13\x10\x14 !\x06\x150"1@P\x07\x16#2A\x17$3`4\xff\xda\x00\x08\x01\x01\x00\x01\x05\x02\xaf\xf3+h\xfe\xaaQ\xf8ER_\xbcD/\x0c\x7f\xb8\x84/c$M\x95_\xce~P\xbc/\xda\x88\x86U\x7f\x17\x0f\xf4VeVT?\xf6\x91jP(x\xac\\\x7f\xdb\x8f,\x88\x91\xfe\xcfl\x0e\xb6\t\xdc\x93\xb9%Y\xc8\xfd\xc5\xe1\x1b$N\xee1+\xf2z\xab\x9e]\xc8\xa9^u<1\xf9\xc7\x86c-\x1c-.\xdb\xc1\xae\xcb\x9a\xdf\t\x8d\x0cc^\'\x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\xe3\x06\x0c\x18\xf2\xa5\x825\x08\xd6\x15ALS763\xf9\xf2d\xc9\x93&L\x9b\r\x8d\x8c\xc9\x93&\xc6\xc6L\x9b\x1b\x193\xec\xc7\xe5\xc0\xe0:c\xa4:C\x80\xd7\x9d\x8d\xcd\xce\xcf\xc9\x8f\xc6\x8c\x180`q\x1c}\x99\xf1\x9fb~W\xb7\x1e0`\xc1\x83\x06\x0c\x181\xec\xc8\xaa4*\xc2\xaa*\x82\x99\xb1\xb1\xb1\x9ff\x0c\x18\xf7d\xc9\x93>2g\xcb\xf6d\xc9\x9f\x192d\xcf\xf1\xb08\x8e\x99*C\xa68\x8d\r\x18\xfc\x19\xf6\xe3\xf1\xe7\xdb\x81\xc7\xd8\x9f\xe1\xcf\xf1T\x85P\x8daU\x15ALR\x14\x8d\x8c\xfb0c\xdb\x93&L\x992g\xf0\xe4\xc9\x93&L\xf8\xc9\x9f\xe348\x92\xa6:gY\x93>\xf5\xfc\x0c\xfb\x99\x8f\x08F\x7f\x9d\x91T\x15R5\x08\xd4\x14\xc5!HR2g\xce\x0c\x18\xfcY3\xed\xc1\x83\x06\xcc\x180`\xc1\x83\x06=\xf9\xfe|X\x98\x98\x9f\xf4X\xfe\x1e\x0c\x18\xf1\x83\x06\x0c\x1a\x980`\xc1\x8f81\xe3"\x90\xa6)\x8ab\x99\xb1\x93c&}\xb80`\xc1\x81\xfe\x0c\x993\xfc\\\x99\xf3\x9f\x11b\x91\x19\t\x89\xff\x00?\x1e0`\xc7\xf11\xe7\x06\x0c\x180`\xc7\x8c{\xf2l)\x8ab\x98\xa6)\x8aF\xc6L\x99\xf7\xb3\x1e\xdc\x7f\'>rd\xc8\x98\x99\x16&dO\xc6\x7f\x06?\x8b\x83\x1e1\xfc\xac\x180`\xc1\x83\x06?\x06E!LS\x14\xc51HR2d\xc9\x9fv\x0c\x18\xf6`\xc7\xf0rd\xc9\x9ffF\xc6\xcc\x8aBb\x91\x19\nBb~3\xfc5\xf8\xb0c\xf9\xf81\xf92ln)\x8ab\x98\xa6n)\x193\xef\xc1\x83\x06\x0c\x180`\xc1\x8f\xca\xfcd\xc9\x93&L\x8d\x8eF\xde"\xc4E\x88Bb\x17\xe3\x7f\x9d\x7ff\x98\x99\x93&D\xc4\xcc\xfeL\x7f\t\xfb3\xe1\x99$\xcc\x9f\xff\xc4\x00.\x11\x00\x02\x02\x01\x03\x02\x07\x00\x02\x02\x03\x01\x01\x01\x00\x00\x00\x01\x02\x11\x12\x03\x10\x13 0\x04\x14!1@PQ"A\x05`#ap2q\x80\xff\xda\x00\x08\x01\x03\x01\x01?\x01\x9f\xb9\x04{!\x9a\x84\x84\x85\xd0\xbb\x08C$\xfa\xd8\x892o\xd0\x91!\xed\x03H\x81\x1d\x99\xa9\xb7\x88$?\xb3\xa1i\xd9\x1d\x12:$t\xd2=\x87\xb3)\xb2>\x1eR!\xe1"\xbd\xc5\x18\xc3\xd8\xbd\xdfR\x11\xa8\xea/i<`\xd9\xa7\xebr\x10\x85\xb2\xd9\xfa\xb2\x03\xdalb\x16\xcfe\xd8B\x19.\xcc\x99\xa8Hc\xda\x06\x99\x02;3So\x11\xecH\x7fd\xa3dt\x88\xe9\x0bN\xbaql\x8e\x8d\x91\xd2H\xf4^\xc3}\xb4\x84\x8f\x10\xfd\x12\xdb\xc6K\x1d\x13O\xd2"\x10\x84"\xcc\xed\x9ar\x1c\xc9L\x9c\xcc\x85####!H\xc8\xc8\xb2\xf6\xa2\x84\x8fa\xb1\xbf^\xcc\xcdA\x92\x18\x88\x1ad\x08\xec\xcdM\xb5\xfd\x89\x0f\xecR4\xe0CL\xf6\xe8PlZb\x8aE\xfew\x96\xde!\xdc\xabo\xf22\xf5P\xd9\x08]\x10\xd4\xf5!\xaa=RZ\xc4\xb5\x051L\xcc\xccs\x16\xa0\xb5\x0eAL\xe43\x16\xa0\xb5\x0531\xea\x0fPs\x14\xcc\xc533!Hlr\'#R^\x83ccb i\x90\x13\xd9\x9a\x9bk{\x12\x1f\xd8\xc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f]\x96YfFFE\x97\xd5\x7f!{m\x1fcM\x7fd\x99\xeeOJ\xfd\x87\x06\x86\x87\x1e\xe5\x14QB,\xb2\xf6\xa2\xbaR\x12\x12\x16\xf6Y\x91\x91\x91\x99\x99\x99\x99\x91\x91\x91e\x97\xb5\x96Ye\x96^\xf8\x98\x98\x94bQ\x89\x89\x89F%\x15\xf1\xac\xb2\xcb\xe9_\x1a\xba!\xe8\x8dI\x11\xf6,\xc1H\x9e\x81(48\x8e%v\xa8\xa2\x8a\xec\xd1BB\xda\xcb,\xb1\xb1\xbf\x8c\x84\xcb222,\xb3"\xcb,\xbe\x8b/k\xe9\xa2\x8a(\xa2\x8a\xeb\xae\x8a+\xe5e\xeas\x1a\x8f1jR\xa1M\xd9\x1dAM1\xe9\xc6d\xfc7\xe1-&\x87\x11\xc4q+\xab\x88ZG\x10\xf4\x8e3\x8c\xe38\xcc\x0c\x0cLG\xe8ddY\x91\x91e\xf4\xd1E\x14QE\x14Q]\x17\xd8\xb3####"\xcb,\xb2\xcb,\xb2\xfb\xd7\xf1\xaf\xb4\xba\xef\xd4h\xb3#"\xd6\xde\xa8Z\x8d\x0b\\z\xb1\x90\xd4X\xf4\xc7\xa6=3\x13\x12\x8a(be\xefE\x18\x98\x98\n\x08zd\xe28\x94$QE\x14Q\x89\x89\x89\x8b111000010$\x89z\x16^\xd6Y{^\xf6^\xf6^\xf6_\xc2}U\xdb\xaf\x8d\x17\xee\xc6\xfd:rb\xd4\x14\x93)3\x13\xf9#6\x8c\xcfFb=1\xe9\x1cL\xe3c\xde\x8a\xde\xcb,R2$\xaczg\x11\xc6``\x8c\x11\x8a1F(\xc5\x14QE\x15\xd7"^\xfb\xd9e\xf4_\xc2\xbe\xc5w\xef\xa9\x16-\xab\xb1}\x95\xff\x00\xc9>\xc2\x93\x16\xa1\x99\xe8\xccQ\x89\xea^\xd4\x8a\x12$\x85\xf2/\xb1"kw\xf4U\xd5],\xae\xe2\x19]\xd9?M\xa5\xea\xfby\nb\xd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8a(\xa2\x8a1(\xc4\xc4\xc4\xc4\xaf\xba\xb2\xfe\x82\xbe\x86\x8a\xde\x8a(\xa2\xbe\xe2\xbemmE\x15\xd8\xaf\xa1\xaf\xf4\xcb/\xe2\xd7\xfeS\x7f\xff\x00B\xaf\xf6;/\xff\x00\\_\xeaW\xfe\xa5\x7f\xf8\xbd\xff\x00\xe4\x9f\xff\xc4\x000\x11\x00\x02\x02\x01\x03\x03\x03\x04\x02\x01\x05\x01\x01\x01\x00\x00\x00\x01\x02\x11\x12\x03\x10\x13 !01@Q\x04\x14"PAa`\x05#2Rqp\x81B\xff\xda\x00\x08\x01\x02\x01\x01?\x01\xd3\xf45_boh\x08c\xddn\xc7\xd0\x84\xb6\x89\x05\xbb\xdd\xec\xc8\x9a~\xa4\x11\xa6\x88\x08\x99\xaeL{\xe9\x91\x10\x85\xfb;\x1c\xc9j\x0ec}Ni\x13\xfa\x8f\xe1\x15=OR:q\x8f\xa6\xeb{\xe9\xd4\xee\xd2\x11\x05l\xfa\xbf\xc7\r%\xfc!\xf5G\xb25Y-\xa2\xb6}\x0bv>\x85\xba"1\x8fv=\xa1\xeai.\xe4\r4Ci\x9a\xe4\xc7\xbe\x99\x01\x08^\xf2\xbd\xb3\x90\xe49\x0e]NtK[\xf8F2\x97\xfc\x85\x14\xbd\n\xf1\xb6z\xcfo\xa2\xd3\xe4\xd7\x8a>\xaaYj\xc8c\xe9p\xa4j\xc4p\x16\x99\x1d#\x8czg\x19\x81\x80\xb4\xcc\x0c\x07\x01\xc4\xc4\xa2\x85\xd8E\t\x11]\x861\xee\xfdG\xb4\x11\xa3\xeaG\xb1\x02;L\xd7$=\xf4\x91\x1d\x90\xbfb\xc91\xcb\xa9\xc8z\x97\xe8`\xe5\xff\x00!E/M\xab\xcb\xa7\xdf\xbe\xdf\xe9\x91\xa7-G\xfc!\xf7\xee1\xf4\xcfO\xb1\xa9\xa4p\x11\xd0\x16\x89\xc4=\x13\x84\xe18N\x11\xe8\x9c#\xd1\x1e\x89\xc2=\x13\x88\xe2\x16\x91\x1d!i\x0bO\xb0\xf4\xc7\xa6=3\x03\x02q\xa2\x9b\x14\x08@\xd1\x87r0!\x021(\x99\xacM\ro\xa6Gd/\xd8\xc8\x93\x1fC\x95\x16\xe5\xff\x00\x13\x8b\xfe\xc5W\xa1]5\xe1d\xdd"\n\x92[}:\xe3\xfa6\xfev{>\x89\xc8\x96\xc9\xa3$d\x8c\xcc\x91\x922FHrE\xa1\xb8\x9f\x88\x94Lba\x13\x04(!i\xa1i\xa3\x01\xe9\x8fLzg\x11\xc4OH\xe0#\xa2CD\xd2\xd2\xee-21\x14J&\x8dX\x13\x89(\x94(\xf74\xf4\xca\x18\x85\xfb\x19\x12\xdd\xba?)\xfa\x0bG\xfe\xc5|x\xeb\xa5\x8c\x97v\x90\x84k~\x1aZzc\x1e\xcf\xa1\xc8\xf5(\xa2\x8a(\xa1\xc4\xc4\xc4\xa2\x8cL\x0c\x0c\x0cLLJ\x11\x91\x91}\r2\x98\xbb\x11f\x9c\xa8Z\x88Z\x88Z\xa8\xe4C\x92\'L\x9cQ=3\x88\x86\x99\x08!\xa2B\x17\xbc\xafh\xc9\r\x0f\xb1\xf9K\xd0\x8e\x92^\xa5\x15\xb3\x1f\x86\xb6\xad\xd8\xc8\xfeS\x11\xf4\xba|\x9a\xaa\'\xd5K-V1\x8c}\x16_U\x14QE\x14QE\x15\xb5uY{_NB\x91\x98\xb5\x0eC\x90\xc8od\x84&JC\x10\xbf`\xc7\xb7\xab\xeac\xf1\xad\x98\xc93Ez\xb1\x1f\xe9\x90\xbd\\\xbe\tK&\xe5\xbb\xd9\xefF&&&&&&&&&&\x06\x06&\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06&%\x14WM\x96d_\xec\xd8\xf6\x8f\xce\xd5\xbb\x1f\x92\x86H\x90\xfbw4\x95Em\xf4K\x0f\xa6\x94\xfev{=\x9f\x8a\x8a(\xa2\x8a(\xa3\x13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2T\xf9\n|\x86]\xf8\x1a\x83hq=t2\xf4^\x87\xfe\x8a\x93X\x96\xf7\x8e\xe8w\x91\x17\xbc\x0bF\xc7r\xb0\xac\x0cQ\x86\xf0\xb3T!\xa67s\x90\xe3op\x9bv\x91r\xc7S\xe4%Z&\xb5\xff\x00~F \x82\x8a&\x12\xd8\x91\n\x03\xff\x00\x03\xf0\x1c\xa1\x04 \x9f\x03#\xf6\x1eS\xfd\xbf\x91\xe9\xebC\x1e\x08 \x84\xcc\x8a*J\x12\x14\x08\x90/A7\x8e\xa0\xa1\x93&L 4\r\x0ca\x18$2M\x10\r_\xfe\x07\x86\xe0X\xa5\x97\xbf\xf2)\x9b\xbf\xa8\xd1S\x0b\xff\x00\x02\x847\x07\xb5\xc1\xaf\x81 i\x88z\x13\x16\x1b/\xfa\xdd\x03i\x9cX\xe9Cc\xfb\x98\xf10\xdd\x191\xb2\x8d\x8d\x9c\x14\xa3pa1k\xc5M\xf0j\xc8\xcaDxF\xd5\xf8\xd0\xddm\xf9\x18\xc4\xc1\x04 \xbf\x02|\x0b\xc0/\x10\x89(^\x01x\x85\xe0\x17\x80\xf5\x1e\xa3\xd4z\x8fP\xfcG\xac\xf4\x0f\xc5\x83\xd0z\x89\'\x13_\x04x#\xc0\xfdO\x89\xf1\x1f\xa9\xe9>#\x06\x81\x01\xa0j\x1a\x04\x84x-\xd8Kab\xd1\x1cH.\x86\xff\x00\xd5SA\xa1\x93rG\xb0a\x86\xde;dE)F\xca<\xb44\x1c\xc4\xdd\x17\xbfr\xdc|\x1abK\xfc\xec\xf7\x08\xcf\x9ei\x86>\x80\x84\xc0\x82HHA\x04D]`I$\x92I\x04\x13\xf40\xb5$jA\x03Q\xa7\x81\xaf\x81\xaf\x81\xa7\x81\xf8\x06\x9e\x04\xf8\x1a\xf8\x1a\xf8\xc1,I\xf4o\xfaK\x87\xc6-L\xaa\xf0\xa9k\xef\x80\xf6\x1cn\x80\x99rR\x94\xa3\xe3\xa0\x11\x0e!\x9c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e\xd3\xe4O\x91\xa2\xee|\xc5]\xcfaB\xa2+\x02\xc1K\x86\x86\x8a\xc1\x89\x1eH\xe2)\xe7\x15\xc3R\xe1\x91\xb8\xdcP\xa6\xb2i\x92c\xe2XfpC\x07\xb8\xf7\x1e\xd1\xec5\x8e\x02&\x92Y\x0e0a\xbd\x94I\xf76vf?\x93\xf9\xc7\x96\x97\xea\xd1\xe8\ro\xea\x18\xa5\x10\x86\xe8HXO4X\x18l\x1c1\x08\x14\xcb\x10\xc1\xb9\x149|\x8d\xf8\x0bHi\xe4\xee\',\xfb\x88\xbc\xfbj\xd2B\x11\x82\xcd\xcbo!\xb3a\x8a\x889\x1cv0m\x85\xdb\x1bU\xb1\x89TX\xbf\x03\xf0G\xa8h\x16\xbb\x15\xe3\xa28\x11\x90\xa4\xe4s\xb4\x1d\xaa\x17\x16\xc4\x89\rWrND\xf9\x11BG\xc8\x8e\t(l\r\x9d\x8f\xc6\xd1\x85\x15\xd3\xd6\xa3\xf5\xcf\xa0\xe6)Q\xe8=\xc2\xa3\xf4\x1cM\xa5\xb31\xa9\x95M\xc7\xb2\x03\x82$\x8fa\xef-\xdc\xa0\xa9\xc3\xac\xac\xf0\xa4(\xde\x14\xb83\xcc\n;\x9b\x94|\x13m\xfe\xdf\x91\x1a\x93Q\xaf\xfb\xd8b\xe1\x0b\x04\xe8\xcb\x0b\xa1c\x92\xc2\x04\x92( \x91\x92B$\x1a\xdb\x12\xea" \xe4\x8d\x84h\xaf-\xb4.\x9c\xc62\xaa\x18\x87\x82w\xde\xff\x00O\xd8z\x97\x13Ds\x86\xce]\x9d\xe3\xa3-\xa1\x14\xf4\x85TD\x18t\xf6@\x96 H#\x0f\xb1/\xb0\xfcC\xf1\x1e\xa1\x11\xad\x08\x91\xad\xacDy6\x1eI\xa7\x91\xf7\x93aN\xe0{\x82\x8b\xb8\xda\x15\x87e\x16\x83\xcdb\x0b\x14\xc6\x8dfatXcC\xa8\xc1\t\x82\x0b3K\xc4\xdb\x85\x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xc9G\x94\xc4\xca\\\x97-\x8d\xe1F\x94b2\xf0\x18\x83/Q\xa9p\xb0\xd5,Th\xc1\xb2-\x1bBd\'\x13y\x19\xe4g\x91?\x91{\x1f1\x89\xf4q\x81\x8fc\xc0\xa0U\xd09&\x10H\\\x1d\x0c2\xf1t\xc1\x86\x13\x82b\xcc\x82be\x10\xbe\x88i\xd2)a\x81\xa8\xf7\x16\xca \xa8F\xdcBf\x94\xa5/\xd3\x06\xf2f\xc1\x04\xe3/\x02( \xcbF44L&iE\x8a\\1\xaa2\x86-\xe3p\xd4Di\x95\x94\x8b>g\xcc\xb7\x16\x1c\x9ca\x08hh\x83\x0b3\xa2\x10Bdy\xc8\x10BpA1ep&&0\x85\x89\x84\xc8\xfa\xe0Bc\\c\xfc\x9e\xf2\xd8\x91E\x04j\xc3]\x01\xacR\xf5\x05\xc9F\xf0c]"\xe2\xb3)z!\x08Bf\x973,hh S\xc0\xe5\x85\xab\x05\x174\xb9Al\x83D\x1eT\xa5(\x85\x84\xe0\x85\xc3CC\xac\x12\x14O\ntX\x82BxB\t\x89\x9730\x9dm\rb\x8dD\xcff;t\x00\x82\xca`\xc4\xc5/\xd0\rp\xd1\x06\x86\x86\x87\xd2\xcb\x15\xc9z/].\x18\xc6\xc6\xc61\xec@\x96!\x9b\xca\xf0,V\xe11\xa2nYy\x97\x1d\xa5\xe3n\x8fHJM\xcd\xb3\xa0\xcc$r\x7f\xaf\xcd\xc3<\xf6\x14\xdb\x084\xd1 \xdb\xcbi& \x04$/\x98A\x14\xe1P\xf0\x9f1\x00+\xbd\xf2\x9a\xf3c}\xcfut7+\xe0\xc9\xa9&,4\x1f\xef\xa8\xaa\x8c}[\xd9)E\x80\x10\x04\x8e#$\x91$\xfbj!\x05^5\xa2`\xb9cKe\xe4\x14\xe0\x006\x11e\xad\x169Y\x1d\xcfH\xff\x00{JV\ti\x8c_!\x87Pcv\x93\x16\x90\x00\x82K\xfb_\xed{/\\\xb7\xe8\t\xfc[L\xae\xb3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\x0f\x02\x15\xb2\xff\x00V]tY\x149K^b\xe3mm\xcc\x9e,\xe9\x82^\xb2\x81=\xebX\xa1\'\xe3!\xd1\xdaY\x88\xc8\x07\x8d\xcf\xae\x88O7\x0fL\x10ZT\x8fXJ\xcb,/~\x88\xaf[\x96@\xdd\xe6\x19 "\x8b\xb0\xc4\xbc\xa12l\x94\\A\x1b\x19\x8f\x0e4\xa2tJ&\xd2f\xc9;\xdf\x12L]\xdb\xdfm\x9cc\xcc\xc7(\x84~\\bU\xf3{\xc7\x07,\xa1\t"\x10\xaa\xdbq\x0e\xf5\x07Sx\xe7\xae\xc4\xec\x17\t\'\xbc\x15\x03*\xf3C\x91e\xbf\x86\xdd\xf3\x0f\xbe\xbb)vZ\xd0\x18(N@\xd1\xaf\x85N\x99\x04\xab\xfc$\xf3@\xa9N\x06.\xb1\xecq\x9f\x81/\xabP\x946\x04\xe61\xfa\xcf\xe7\x87/\x82}o2\x1dl\xbem\xa0\x04\xac\xae\xb4|A__"\xb1\xc4\xae\xe6\xdd+\x0b_l\xdb\x13\x19<\xa2rS;\x12\x86\x96\xf7\x02\xaa\xd8\xa3\x1av\xff\x00\xde\xce{\x8c\xf6d:\x91\xf6[f\xc4\x08a\x91\xc9%1\xf0Bk\x1c\xbb\x9e6\xc9\x0c\x96/\xcd)\xa4\n\xd0\xa5M\xd1\x99p\xf5l\xf6\xb5\xeb\xa31\x97\x1b\\\xe52I\x7f/\xd5\x00\xf4\xbev\x9e\xed#yIc\xf5]\xed\xcd\xf7\xa2\xe0\xed\xe8u\xcf\xe2f\xe2w5q\xbb2\xc4\xe6\xd3c\xff\xc4\x00)\x11\x00\x03\x01\x00\x02\x02\x02\x01\x03\x05\x01\x01\x01\x00\x00\x00\x00\x01\x11\x10 !1AQa0q\x91\xf0@\x81\xa1\xb1\xd1\xe1\xc1\xf1\xff\xda\x00\x08\x01\x03\x01\x01?\x10\xec\x1dpn\xce\x87g\xa1\x10^{<\x84\'\xe8\xa3}\xf1\xa9\x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\xe2\x16\x84\xd5\x82E\xa2:\x14\xb3\xc3EC\xaf#VQ\x8d& EI\x88cV&+\x83\xe6\xf9\xb2p\x84\xc5)N\xc9\xce\x1de\xaf\x83\x84[:\x12\x12 \xd0\xd6G\xb1\xa1,$#\xeb\x10J\x8846\x87%\xa2\x9fk\xfe\x84\xf2^~\x91\xff\x00\xf3\xfe\x96\xcf.\x8d\x0f\x06 \xf0\x8an\rF+\x1a\xc7\x04b\xd3\x08\xf8_\xec\xb1\xb9e\x146^\x0b/\xd1e\xf9)\x11\xf96\x8d\x95\x94\'\x11l\xd8\x90\x90\x94\x16_;\xf8)\x9e\xc9\x98R\xe2\t\xe1\xa7\xc5\xf5\x87\x814\xc2B\rhy\x18\xc8B\x10\x9c\x12\xa2k\x83h\xecJ4&\x9f\xaf\xec]\x17\xbf\xa2\xff\x00~\xa3\xc1\xe0\xd6\ra,$\x84\x8d\t!$\xc4\x82A!\x02L\xf3\x84\x10Nx\xca\xb8\xe5\x89\x1e7\x89\xa1$\x10<,<\x84\x84\xa0\x85\x8b\xce\xfe\x11\x933-Q\xa9\xc2\xe1\xac\xbc\x1ff\xa2H$$ \x98h2\r\x10\x98\x84&\x10K\x1b\xa3\x8fT\xf9\xd6)]\x12\xa5\x1e\xcf\xfb\xff\x00\xa8c\xe8c\xc12\xa5\x13\xc7gB\x16\x16\x11p\xb3\xd6V\xc8$DD4\x10C!\x8c0\xc4&\x0cW\x10|\x19A\x04^o\x13\x0f0\x99\x98\x84\xcc!\x08N4\xbc&fe\xc3\xc6lJ\xa1\xa7\x00AF<\xc1\x92\x90\x87D\x11qq\xa8\x84\xbdlQ\xcb\xbc\xb4)\xaa\xf4\x89\x7f\xbfH>\xf0\xc6 \xc6\x89\x84!\t2\x0b\x08\x82BD!\x08BR\x10H\xa9\r\x10\xe7\x03\x05\xe7\x86\xe3\x1a\x18\xc6\xb3\x07\x96\x88B\x13\xff\x00\xc1\x84\xe12\xca=\x91\xe5\xe1\xe4HH\xac\x12\x1a\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\x17\xb7\xbd\x89Vj\xfe\x14_\xef\xd8\xb8\\)y\x10\x84\xb0\x84!bp\x10A\x0f \xb4\xf0\x84\xa3v\xb18!3165\x05tv\xdcX\x85\xd9=\xb3\xdf\xf7\xec\x8f8C\xe2\xc6\x0e\x95d\x83D\xa4)\xbb\x04\xb4#\x8e\x10\xe9\xf0\xff\x00\x7fXX\xf1\xc9\x8f\x08H\x84\x12\xc2\x10\xb9 \x9e\x06\x8a\x12\x1a8t\x8e\x90\x90\x82BB\t\x08J\x90X"F\x8d\x0e\x94|E\xf0,\xa2|0\x9f#\xc4|ff\x18\x91\xa1\x8e\x8aQ2\xe5\xa2\x0c\x1e!\xa3\xa1"Q,\x96\x91\x0c\x16\x84\x84\x16\xb1,\xfa\x11\xf9\xc9\x7fc\xf3\x1b\xfa\xe5K\x97\x94\x84B\x13(\\&PhA(\x91\xd3y\xae!*A&$&\x84$-\x1ep\x84US\xbd\x8dG\xb1k\xe1Y\x9c\xd78"\x13\xe6\x98\x84\xe0\xf2\xce\xc2\x0b\xe7/\x16\x17%\xcb\x13\x8f\x0b\x13Aof\xed\x1fH\xd4(\x11\xb3\xb9\xb8\xc9\xb1\x13?\x01\xd7\xd8\xd4\x18\xb1\xd0\xf8\xbc$$B\x10\x82B\x10\xb184$\x10R]\r\x0f\xbc\x90\xfa\x12\x82[\x10\x90\x8f\x02\xc2\x10\x95C\xbd\x0cl\'x,.\x0b\x9a\xe6\x96\'\xc7>\x16\xb8<>\xce\xc5%\x93\x1e[)J\\2\xc1\xe9\xec\x88\x96\xce\x1851( Q\x0f\xb5<\xff\x00\x7f\'\x9c<\'\x99\x87\x87\x84\x84\xb11\t\x94\x89\xc5\x89\x82\x14\xd0\x91\x90x\xd0\x84-\x08B\x10\x8df\xaa\xa2\xaa\x94ap\\W(,\xac\xa4-s\x84\'9\xcd\xab\xc1\x8cBn\x89\x112\xf2\xc6t \x99h\xdeuf\xc2\xa0\x96$\xb4\xb1F\t\xa1"lO\xaaU\xfe\xbf\xe7\x842b\xf0xxHD&&P\xb8\xf5\x86\x844\x17\xce\x08=\x9b\xce\x81\x04\xb0\x90\x82YK\x08u\xa3\xbc\x8b$\x17%\x89\x99\xc2ee\x08\x9f\x83\x9c\xa6\x18\xc8u\x1d\x10\x84\xc3\\\xe9D\xc5\x8b$\x88\x8d[\xd3\x14(\xb3Dj$(O\x97\xfb\xfe\x97g\x8db\x95\r\xe6\x95\x17\x14\xa5\'\x08B\x13\x10\x9c\x1e\x1eD\xa8A\xa6\x99\xb4\x83D=\xe2\x08YB\xc2\x115*\x8b>\x14.3)p_\x86{\xc3\xe0\xd0\xc6#\xcd\xc5\xe1\xa2\x0f\x0cC\x10\x90\x90\x90\xd7E\xc6\xd7CWb\x9c\xd0\xef`\x96\xc4\xc3\xf0\x94\xa0\xde^\x17%/\x01\x18\xb5$D\xcc \x96\x17\x07\x87\x86%B\r\n)#qU\x08,,\xa2e\tQ\xe3d\xdd&\xf12\x96W\x14\xb9Bq\x9f\x1c\x1f\xc0\xd7\x17\x85\xd9!10\xd5\xc3\x1a\x1a!\r\x18\x9b\x10HJ\x1d\x0c6\x18\x8d\r\xc61\x08G\x9fz\xff\x00~\xe3{/\xc2\x03X>"D\xe18<=q \x94C\xa7\x85\xdd\x90Q!!\t\x08K\x0b\x0b\x15E\x16\x11\xa1a,\xa5\xc6\tr_\x1c:\x1f(Br\x84\xcfBSa$B\x13\x0ck\x0ccXK\x04\x12&\x86\x83\x0c\\YxM\xb7\xe8oz\xeb\x18|\x15\x8b\xc0\xbco\x8e\x84\xb1\x08NLxc\xc8\xb0BL\xf3\x94\xd6<\x0bYB\xd6V\x12\x9d\xd4\x8e\xd6\x12\xc2\xca\xe2\xb9\xae\x1d\x93\x9c\xf8\xa78\xf2L\th\x84\xc3D\x18\xd1\x06\x88"\x8a\xc0\x90x=\x18x\xa4c\xd9\x067\x9eZBc\xf0\x98\xbe@I#A\x86\x1eB\x13\x08$B\x10\x84!0\xf2\xf2b\x08-3I8H!a\x08_YB\xc5U*\x99fV\x12\xbcVfW%\xc6|\xcc\x9cZ\x1e\x13\x1c\x1a \xd1\x06\x885\x89D\x85\x81\x04\x86\x98\x1b\x18\xd0\xf1D\xc3\xf9\x97\xfb\xf8+\xbfee.\x0cQXQF\xd86+\x17\xc6\xd6\x1c\x1c\x1e\x18\xf0\x82\x08!&G"\x10\x84,\xac\xb5T!H\xecI\xc1.\x08\\\x90\xbf\x01\x08B\x13\x9c\xcb\x19\x0b3F\x10\x88a\xa1\xa2\x0c\x98!1\x0e\x91A\xb8\r\x1a"\x80\x95\xc19O\x85\x07\xa6\r\x10hh\x84\x1a\x84&\x1a\x1a6"e\x13\x9be\x18\xc6\xca\\l5\x82\x0bL\xeb\xc8\x0bB\x10\x84\x85\x95\x99\xa9dQ\x94\xb8\xac\xae4X_\x1c\xe7\t\xc5\xf2l$\x89\x884444*\x10HB\x10oE\x06\xf21\xa1\x8d(j\xdb(\xaf\xd6\xc6\xfdGM\xd9\x8d\x10hhhh\x83D\x1a\xc3CXM\x10I"B21\x184 lo\x03cf\xd8Q\x06\x84\x123\xc2Q\x13\xecK\tabae\xef\x1f\x9cH\xc4.+\x85\xe2\xb9.3\x13\x08k(\x99\x94X\x1c\x0f,J\xf1u\xc2\x0c\x84\x10K\x04\x85\xa1\xb1\xb1\x8ccT\x98e\x82\x0b\x08\xf1_\x08\x83CCCD\x1a\xc4\x1a\x1a \xd0\xd6F\xc3\n\xc5<;\xe3\x84]`\xc5,\x13\x13\x18\xc6 \xf1\x97\x1f\xc9 \x84\xb3\xde\'\x1a"\x02\xe1\xa1O\'\\\xae\x10\xb8R\xe6\xe1pK\x8a\xe6\xc4\xb2t\x8b0\xf0\xbb\xe2<\xc2\x10\x84\xc3cc\x18\xc7\x86A\x9d\x08\x87\xe6gJ\x06\x89\x83CXh\x84\x1a\x18\xc6<63\x1b\x1e\x0b\xe6\x02\xc1\xb8\x85\x1c\x0c\xactl\x1e\xc9\xbcY\xc2\x0cN\x8b\x92\xe3\xb8\xb2\xa3\x13\x1a\'\x05\xcab\x9777\n,R\x97\x8de\x16{\x14W\rBa\x93bVIg\xb2\x13\t\x8f\xac1\x86\xf0\xc6\xc61\xa1\xa1\xac=~\x84\xb6t="\xc6\x10cThhh\x98cC\x18\xf0\xb6PhH\x86\xf0X,\x14\xae\x02\x89\x8d\rp6&\xc4\xc6(\xc4(DH\x86\x9b\xc4\x9c\x95\x17\x14\xb8R\x8a\x99r\xe3\x86\xe8\x84!8\x04#(\xa2\r|\x0b\x8c\x166\xc1\xa7\x9aS\xb0\xba\x12BKG|1\t\xb1"\xcc\x12$\'\x06>\xc7\xb1\xe8c\x1e!\x06\x86\x8d\x10\xd4\x12S\xe8\xb5{\x7f\xd0\xd5\x98\xd1\x06\x8641\xacA\x8cc\x1e\x18X\xdd\x8eHx\xc2Bx\x12\x1a!\t\x04&@\xeb\xa1\xacB}Q\xab\xf1\x04\xde\x86\x06\xe8o\x8b\xcd{\x1d4&T\x15*\t\xbe\x02\x94\xa5)F\x93\x10\'\x13J\x13\t\xd8\x9b"+:|\x02\xb0\xac\x90\x84!\x110\x8e\xc2\xa5E\x83.{\x9b\x1a\x84\xd1\xdd\x8co!f\x0b\x0f,xc\xd8\xc8Llh\x83E\x86A"o\x840<\xb1\x8f\x0f\x0cd\x1e\x1eT\x84\x15\x16\x881\xad\xe2\xe1!l4B\x84\xcc\xb9Ea\xf5\x0bd\xd2\x81>\x02|\x0bJ(1\x94\xa0\xb9\xa6Es\xfe\xfa\x10\xac\x18\xd9A\xd8\x85\x04!)D@\x94J&\x0f\x14P\xfeS\xef\xb50\x9c\x16#d!\x04\xde\x1dN\xa7a\xe12A"\x1d\x0f\xb1\xe1\xe1\x8d\xc1\x8f0\x99hh\x82{\r\tW\xed\x8f\xd7\xdeX\xd8\xc7\x87\x86<1\xa1\xa2\nH"\x1d"d\x99\xdce\x13\x13\xf2\'qG\x92\xf7\x89\xd2,o\x15^\xfb <\x84\xae\xc51\xecHl\xd2\xc8\x8c,\x13 \x82D\xa4!\xaa\xd9#\xc05cR8$4X\xa0D\x90h\xd4(6*b\xc2BD\xc8\xb2\x18A\xe8cegd!\x08.\xce\xe3\xe8\xd8\xed\xc0t[\xc2\xfb\x1b\xf1\xc5\x8ccX\x83\x19\x0841\xea\xa2\x1a\xbdj\xfe\xe3X\xf44\xc6\xc51\xa3a\xb9\x1a)\x8d\x91E\r2\x86\xc3fV* \x82\x1a7`he\x82\x08-\x8a*\xec\xb6\xc4\xa3h\xe9\x94U1E\xb0\xdc>\xbc\x1fh\xc7\x93\xca\x1a\xed\r\xfb\x10\xf8\x94\x89\t!\x1f\x98k\x8c!\xfd\xb0k\xec\x7fa\x86\xc3f[\xf3\x83\xec\x17\xbb\x05\x8b\x14)\x95\x94&\xc4\xd8\x98\x84R\x89\x88Q11<\xbc\x18\xf19w A\x15C\x0cv\x13\x8c\x90\x82\x18\x95\x97\xd0\xdf\xb3\xcf&\x86L\xb4LA\xa1\x94\x99?\xd8\xa6\xf05\x19\x07\xf4,\xdc\xa67C\xbc\x1d\x1b\x12l9\xed\r\x0e\x96h\x9c\x0f\x80(Y\x8c\xb5\x1f\xa9dh\xad\t\x91\x0e\xc5%\xfb5\xf2(\xe9\x8d~F+\x86\xdb\n\x97\x91\xfb\x88y+\x0e\xc5\x96Y^\x06\xc3q\xb8\xca\xc4\xde\xf0\xa6%rO\x81\x14\xc2\xe0\t\x94LLAr\x00\xdc(|\xf2\x9aK\xa2\xc3tLR\x84\xe3\x10\xa4^\xc5;\x12\x92AJv4A\x90d&<\x8dF=\xecE\xbf\x85G\xba%\xb1(3\xc0\x9d\x89\xb1%\xb4&\xa8\xdb \x9a44\x9d\xb0\xce\xacl!B\xece<\x17\x12+\nP\xa7\xd1b\x19T\x19\r\xb1b\xcbDh\xd9Z\x13\x15\x83\x08&\xd8\x9c\x14\x160c\x1b\xb3b\x89\x89\x8b\xe0PT*\x14*\xc8\x90HTTR\x97\x10\x84\xcax\xb9\xac\xacA\xb1\x87Y\x1e\x1a\x1a61\xb66\x13\x8fC\x07\xa0\xcd\xe1"!\x06LB\x95\x96\x84\xc2dX\x82A0H\xcdp\x99\x84{\xc6\xdb\xde\x86;A)F/!~D\xd8\xd1S"\x16\xba6*\xf4TT\xf0\xda\xcb\x18\xe603\x19\x8d\x84l$"\xc3\x0e\t!\xcc\x18\xd9pm\xdd\tkb#\x12\x12\x131\xb3CP\xd46+\n&\x12\xe1\x04\x84\xc2mp\xfa\xd8\xa9X\x82\xc8\xbcQA\n<\x12,h\xa0\x9e \xc8NFy\x86\xa2\xd0\x98\x98\xc83\x84!\x08LL\x9f\x05t\x90\x99\t\xc4\xa2`\x99\xe4\xb4x\xa2\x06\xb1\x17\x98\x9a1\x8b\xb1(L\xb0\xa5e\xc8\x98L\xbf\x07n\x89\x92\xd0\xa0\xa5\xd8\xe8o\t\x8e\x0c6\xc7\x94\x88PVP\xb6\x07\xae:\x12I"\x11!\xc6\x10M\x91\x08,\x14Lt\xbb\xc4\xdae)J\xca(\x11E\x16\x1bl\xde\x13\x16\xf0\x98\x98\x99JR\xe6\xe2\x143\xb1\x0c\xd4\xd7\t\x04y)\xd8\xc3n\xc6\x88B\x13\x06\x96\x0f0j\x935\x89=1w\x84\x9e\x18T\xa6\xce>\xc4\xabCQ\x9bHL($bu\xd6\x14\x8c\xb4B\xc2e\x1b)J \x93\x1a"4\x86\xc6ChjH\x8b\xd7\x0bfR\x89\xa4@\x91"Q\x02\x9eO`d\xe0\xd0jo\x83\xa2\xa3!\x08B\x10\x82CL\x84dbL\x84\xc4 \xb0 \x90\x93bfQE\xe1E\x9bX\xa0\x98\xa2\xc5\x9bB\t\t\xc2E=\x92\xc6\x8f\x03\x11/\x04c\x0fh\xa3!\x8e\xf66CdL\xb4\xc9\x88B\x10hy5p\xd1\xab\xaf\xc0\xddCf\xc5\xf6\x1dP\xd6\x0c\xb4`U\t\xb0A\x87\xb4H\xc8\xc9JnP\x98LP\x98\xafx\xb2\xc32&\x9e\x1d\x06\x1a\x0cN\t\x94P\x9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B\xb3\xb3\xa6}\xa161\xb8\xcd\x8b\xe9\x92lI\xb6\x13\xb3\x16\x16U\x10\xd3F}g\xd3\x97Hu\x0b\x14O\x0b\x8e\x84\xf8\xc2\x10\x84\xcc!?\x01QQ\x08h%\rF>\xd1\xa3\xf2#\xd8\xd3\xd8\xd7\xc8\xcaI\x14\x14\x84[Q\xd1\x87M\xa1\xee5/b\x10J\xca\x8db\xbc\xa8\xac\xe8\xc2\xa1\xb4DB\r\x131\r\x10y\xa5/\x02:!\x8eF\xa1\xd8\x95D%$%$\x10\x9d\xc4\x91\x92b\xdb\xd8\xe8G\x01$\t\x08 HA\x04\x10A\x04\x12I\x02B\x08\xc8K\x8dG\xd8O*\x02I\'\x90\x01\x04\x92}\x84\x86\r^F\xa1\xfb\x86\xaf#G\x91\xfb\x87\xec\x1a\x8d\x99\xf7\r\x9e+,l>\xe3\xee/\xd9Br\xca/\x17\x94\x14\xec\xa0\xbb\xc8\x9d\x0cm\xe1\xe2\xa5\xd8\xac\x82\xa2\xfcb\x05\x1f\x16\xc4\xde\xf0\x14\xe8X\xc6\xc6\xc7\x82\x08\xef\t\xe50\xd0O\x0b\x84\x10\xd3\n\xec\xb9\xed\x10bb\r\x89\x94\x80\xe8a\x06\xee\np\xc0\xeb\x05\x03\xa1\xb2\x8d\x1e\x17\x05\x96Q\x19\x08B|W\x10\xa2\xb0\x95+\n\'\xec\x9cY\xa18\x99\r\xb1a\xee:\x1f\x15\xc9\xbcY\x8b\x8e\xf1D\xde\x04\xcb\n)p\xa1\xb1y\x93\x08\xc3\x04\x13!\xcc\xb9F\xc7\xccN\x9a\x1a\xa3B\xc1\xb0\x85\x96\x84\xa0\x9e\x14\x10\xb2\xf2\xf2Lu\x85)F\xca&B\xbcXB\x8d\xe0\x98\x98\xd2\x11\x83a\x86\x1a\x98o\xe4\x81\r\x10$@\xd6\x0c\xa5e\x15\x94QE)qJ^\x17\x8c\x1e\xb3HX^4\xa18\x9b:W\x82t \xa4Eb2\xc3e5\x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\xd9\x00K\xa7\x10DYD\xc2]\\\xe6l\x7f\x12\xc5^\xdd0\xe5\xff\x00\x91\x17\x9cT\xb2g\'\x88\x01\x8f\xb8\xe85]\xe5Z\xed\x1c\x05\xeejM\x83\nM\xe81\xde\\\x7f\x93\x9a\xfcT\xb0\xd1\xb7\x80-\xfcJ\x8e\xa5\x1b\xdaO\xb8X\x08\xa1\x03\x15A\x83\x08X\xb1\x96A\x03\xbc\x08*\x10\x86\xe1+\xa5M\xca\x97KI\xdd\xe9\x02\x81\xef\x01\x1aB\xd0\x1dK\xe8\xac\xb9{J1T\x1b\xb1uM?\xef\xfb*\x06\x8f\x84\xcdt\xad@\xc8\x99?\xb8\xdbm\x8d\xc9\x97\xc9\x89\xa0Xvs\x00e\xc0d\x86\xd09u\x08\xb7DG\xd0Z\x84.a\xccwY\xa3\x99\x98.P\x8b\x16]GIs\xba\\c\xb8\xc5\xd4b\xc6w\x9cF\x89_\xa1\x8b/\xa5\xf4\x0c\xb9vK\x97/\xf5\\\xbe\x84\xb9w\xd6\xfc\xc1\xe8\xb8\xb2\xf3\x16.\x19[\xf7\xd0|\x06^y\xb6\x89`\xe2\xae[x\x96\xab_S\xbf\x00\x8dE\x97\x86{\xfb\x86hRE\xcfx\xed\xde,\xc8{\xed\x15)W\x8ee6l\xeds9c\xe6`\xb6\xf8\x86<\xfb\x94\x93\x87p\xb8\t]\xa1\xc1\x1a\x05\xba\xf3\x08\xb6\xb3+E\x08\x8805Bw\x8b\x91\x0c\x1d\xd9\xacv}\x05C\xc2\xaf\xe5PO\xc9\xf8\x86NPWp7\xfe7\x16z8e\x06\xe2\xa87\xfa\x16\xf1)\xda\x08\x17\x02Vg\x10\x84!\x02WB8u\x0b\xc9R\x89\xc2sv4K\xa4)\xab\x18\x8bk\xad\x1eHS\x0f\x19\x98@\xb8\xc7\xaf\xf7\xf3\x0f4\xe3)\x8f\xf5B\xd9l\xcb\xee\x11\xc1\xc46\xd6\xf9\xc72\xc3X\xf53p\xb35\x16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b\xed\x18\xe6\xe6\xb3\n\t\x19\x96\x02\x9cs\x07\x18\xa1\xde\\\x19\x95\x9c\xf43\x088\xf1.\x0c\xb9r\xf3._\x9e\x97\x17r\xe2\xdc\xba\x97.]\xcb\xbdK\x97q\x97.,Yr\xe5\xf3\xd2\xe5\xc7\xf4]K\xb82\xf17\x15\x0c\xadJ\x91sc\xe2&YT\x96\xdd\xc1w\x9d\xc7r\xe4\xcc\xd5\x99~\x98%f\x14\x00\x18\xc4E$9\x99GR\xef\xb4\x06\x9d\xc2v\xb3\xc6!\xd8>j\x1a111?\x1cS.cT\xc7\xc4\xc8A\x0fk\x9aA\x05sEK\xd1\xa6v\xc0\x93\xd1}\x14u\xc0\x9b\x9am~\xc2/\xe6=\x0b:\xdf\x93\xa9(b\x0c\x1b\xe9p{\xc0J\\\x06\xe1\x15\xa9^\xf112\x91\x84\xfb\x8e1IT\xc7)\xe8\xb1\x84\xa0\x97\\\xb6\xe5\xe2\xf7\x94\x04\xdc\x10\x8e\xed\x902\xf7J\x11\x11q(\x11c\x119\xaa\xa8\xb0\xd6\x1f\xa9W\x19\x8a,\xe5\xfcE\xb8\xbf$c\x18\x1b\xa6WZ\x82\xe1m/\xcc\x05\x06\xf3\t\xac\xca\xcc\xca@J\xa4\xafyIN\xf2\x95\x1c&\xf3\x03\xa3)\xbe\xe5\xff\x00@c\xda]s\x18\\f,e\xcd\xc5\xfd\x17\x99sR\xe5\xcb\x8b\xde0\xae\xfd\x03.V\xe5\x18\x98\\\xcc\x91V1\xadn\xd72\xfb\xba\x97.e\xb2\xd0\xb9\x84\x84\x0c\xea\x1f(\x03r\x81"\x8b\xaf\xcaR9}\xca\xb8\xe7\x984w)\xbd\xaf\xeaR1\xe2P\n\xfcL,A\x04r\xa9I\x11\xbas)F@\xf1\x97\xf1\x06?\xa8r\xc0\xc7jO\xd9X\xb9v\x1d*\xa7\xceLe\x82\x99\xbd fO=,Qf|\xd3"k\xd4\x183\x1ee\x8eb\x8ec\x97x\x1e\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ee%sB\xce\n\xc7\x81k\xbd\xbe \xab+\xc5B\x8e^\xa2\xbb\xb9\xe0\x82\x164D\x8b\x15\xcd\x12\x82\x7f\x98\xe60\xe6X\xf8\x19\x8e\xd1\xa7x\xe5J^\xd1m\\\xf0\x9b\x98\x1b|\x11\x1d\x89\r3\xe6\x99cY]\x9c\xff\x00\x9c\x83<\xa5?\xeb9\x19\xfa\x8c\x7fI\x98\x9d|\xbabz\xc85\x89R#\xb4\x08E\xca/\xb4\xad\xd4(\xddOH!\x894\xb3\x15!*\xc0WS\x88\x86\xef\x00\xc4\x04\xa2`c\xa4\xb5iq\x1dn\x04\x08\xf1g\x0b\x1d\xdc\xe5\x967`;B\xe0\xc7j\xdf\xc4&_\xb0\x8c\xa4\x934I\xea7\x84\xfa\x95\xa6G\xc4\x001\x08\xe2\xa5|K\xe9\x8fS\x08\xf3\x06\x8a5\x1ff/3\x02l\xcf\x83\xa3O\x98\rZb\x10GKP\x0b)jy\xcb\xf6C\xe2\x16y?\xb8$&8\x02\xf5u\xf3\xc1\xf8#?\n\x10p\x86\xb7\x08y\x02\x1aWg)\x0b\xc3\x0f\x88B\x92\xf8\x97o\xd5*\xa5\xe1.\xb5\xae\xe9)\xc5\xdd\xc9P\x17\xfa\x8b\xb2\xb7\xc94c\x9e%0\x16\xd5\xf35by!\xce\xe3{O\x07\xdaS\x1aG\xce \x9b%\x83/\'c,\xae\x1cP\xa8\xdd\x85\x984\\K\xe2\xbe#]j\xb9\x98\x94[j-\x06\xda\x975\x0b\xf1\xb8=B;d\x03\xb9\xba\x11\xa8"\xb3\xc3\xf8\x080\x1frS\x8b\xe0\x82\x7f\x08"\x0f\xc9\xa9x\xd0wC\x06%\xc8\xa0$\x88\x8d\x97\xde=\xcb\x9f\x10\x11\xfce\xaf\xe1\xb8`\xd5\xf5*{%j\xc2)5ma\x18?P|>\xa1`\xbc`R\xa4\xc2\x0c\x0c\x010\xb1\x05\x94\xd6\xb1)\x8e\xc1\x11\xc19(`\\\x1d\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7\xe2#\xd4j\\\x16?0\xce\xf1\xef\xa9"\xc3\xb9\x06\xe6\n\xb7\x13\x19\x83\x92\x0c.i>\xa6\xe1\x98\x10Z\x86\xf75p\x96\x90\xb5\xce\xa0x\xf9\x82\xa1)\xb2\xe6\x84)\xd4\x99\xbb\xc4\x1a\\\xab\x12\xa8\xcd)\xfa#/\xee\xd0\xedP\x95\x97\xba\x9b\xf9\x98\x01W\xa3.>\n\xf4w\xcdBh\xfd,\xd9\xe4\x98\xd3eZ8nQA\r\x94\xd2\xc5M\x04\x94\x06+\xf7\x1f\xcd\xba\xff\x00\xd2P\xb6\xdeg\xf0\xc3\xccc\x119I\x95y\x98b\xa2\x05r\xabC\xf3\x18\xd4K\xdc\xb3H^9\x9a\xe8\xf0\\h\xaag\xb0\xbd\x9b\xfb \x9b\x13\xb2\x7f,MX\xed\xb2\x0f\xe2,\xd7\xc5\xff\x00\t\x81\xc5\x80\x19}\x96\x7f,r\x99\xdd\xb7\xf6AZ\x84A\xf8\x8eR2\xaf\x96\xcc1\xe7\x9f\xca"\x817\x9c?h|U\x16dL\xea.C_I\x88\xa3\\4p\xaf4\x01\x95@/\x11N\xc9?`Q\xf9\x99\x8dv\xa2\xbe/\xf1\x00\xdf\x0cw\xfbcB\x96\x85\x13\x85T_$\xb3\x9f;h\x9f$`\xa1\x0e\x02\x15;\x8b\xe1\x8d\x02\x98~\xd2\xea&\xb0\x16.\x15w\xbb\xc4pU\x0f\xf8\xc5\x8fZ\x87\xf3\x14r\xaa\x92\xec\xa8\x98D\xb7\x94\xfcAY\xea:\x94\xb4h\xe0\xafK+\xb8\x05\x90\x86\xb7\xe2"\x80{\x93k\x83\x86/_<\x12\xaf\xdem\x16z\x86k#\xccJb\x07\xa9\xbe\x9cGqg\x04\xee\xcb\x97D\xafhf\xba@7,\x0c\xd2\xc0b\xb6B\xea\xb1\r\xdc\xad\xd4&\x8e\xe0\x05\x91\x0c\xf1\xde\t\xef\x14s/Y%\x05\xea\x0ff\x03\xa8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b\xe1\x8akQO\x10\x830\x93p\x1d\xc8\x07L\xc8\xe1\x8aAM2\x8e\xc1\x83r\x92\xc6\xb3\x10\xf8\x8fa\n\x12\xab\x98\xa9\xda\x0c\xda,UK\x8c \xb2\xf8A$_\xa4\x8b%\xc5\x8fW\x06\xcbVaUE\x00\x07\xbcW\x9e|\x19N\xdd\xb2\xed\xab\xdd\xc0n\x948\xf7.#\x97i\xa3F\xb8\x98W\tL-\x0e2\xce\xe9\xbe\xfc@\x90\x06\xbdK\xa44{BZ\xb1\\F\x92\x80/<\xc0\xd3\x93Qb|1c(2\x9d\x98\x99\xbf\xdcux\x82\x92\xc5\x83\'\x98\xd2e\x0c\xf4 \xc0J\xeb\x82%2\xd6\x8b\x97v8\x19gv\x1c\x9e\xb0\xaa1W\x96[\xe6\xe0\xbc\n\xc6=\xca\xa9\xba\x8d\xaa_\x88\xb6i\xee\xa3\x86\xa5\xf8\x8b\xff\x00B!\x9b}"\x17K\xe2<\xef\xc2k:D\x80f@\xba}@\xb8\xfdC@}O\x17\xea\x12\x03\xd4\x08\xd6Q\xc6\xa0f\xb0\x1e\x136\x91\xff\x00\x81\x01\xc1?\xf3:A^>\xa8Y\xfcP?\xea\x81\xeb\xea\x81p\xfa\x94v>\xa1I\xae\x89Du\xe6 \xa2\xdf\x1d\t\xa5\x104\x03\xff\x00\x85\x08\x96\xd2o\xc7\xdc\x0f_\xb8\n\x8b\xe6\x06\xd8v\xc9\x87\x05;\x98?1\xf1\xed\x16\xc5\xa9\x1c\x97G\xe2e\xe6\xfd\xb2\x9a\xfa3\x01\xd1\xaaX\x84\xf3H\xa8\x10\xf2\xca\x84\x11\xd53Z#F\xe3m3\xe4\x87pL;\xb9~\xe05\xcc\x08\x16\x02\\\xfb\xc0\x98V\xbd\x99\xa7>#\x06\xe3\x9b\x80\x84\xb1\xdcqw{\xf3\x18\x06\xe0`\x8a\x00\x8c+1\xf3\xde\x1a\xf0P\x04X\x8b\x06\xe5\xf9\x96\xcbR%\xdaJ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f3\x05{a\xfc%\x0c\x03\xdaw\x96Kt\xca<\xc0c\xb9\x92\x01\xfdK8\x967\x88\xd8\xc3\x12\xb5\x88\x95\x130\x83\xb6_\xb8fC\xf1\x08q<\x84\xce]x\xa8\xa9\xbb\xf9"\xc3\xe5\xa3xhve \xdcwe5a\xe6U(\xfb\x84\x80XV\x91\x18*S\x02\x9b\x97v\x80\xbe\x9c\x84\xf2\xcc0\x02\n7QP\xc7\xcb\x0e4\xcb\xde+5\xfb\x82`|\xca\x02\xe2\xd2+\x06\x84\xc9\x95\xef\x03\xbe_\x12\xff\x00\x82{\x11\xecJ\x8d\xcb\xdd\xc8\x82\x9a\x808\xb8\x1d\xf3\xde%\xe7s:g\xc4B\xddb\x18\xa5\xc7F\xaa\x93\x7f\xfb\x01\xad\xdc\x1d9"&\xf1\x14\x8a\xc3\xbb\x8e\x98\xb5?k\x82\x97\x0e88\x85\xb1\x0c73\x80\x81\x95\x19\xe4\x8b\xc2\x1a\xd3\x08*nV\xd5\'0B6;\xc5\x02\x14@\xd4q\x04]^!\xa1\x82\xe0\x13,W\xcc^\x88\xed\xae\xd3\x10\xe6Z\xc3.r\x11\xdc~#9+\xdc0\xbc\xa8\xe5\x00\xee\xe6\x85\x9c\x84\xa3\xc8\xca\xaf$\xbf\xa8\xf8g\xfe,\x1b\xc6%\x98w(\x80\xd8\xce\xe4\x01\xb8\xbfx\x85 ,\xc5C\xb4\xa8%\x9c\xd4\xdfs\xbf\x06\xcc\x18\xdb\x9a\x8d\xb9\xc4|\xb1\x02\xaa\x08\x7f\xb9Q\x86\xaa!a\x88\xb8\xe6,\xe6\x7f\xeaJ\xf9b\xac\x18\xa5\xd4\xa5\xc3q\x14\xae\xe3\x1c\xbf\x98\xbc79\xdb\x87\x94|%\xdcHn\x107\x95\x88N"x\x85x\x96\x11S\x0c6+\x84\xdf\x08\xe5\x94|M\xf8zI\xa8G\x984\x17\xcc\xe4\xa1\x90L\x00\x1a\xca\xa7\xf7J\x88i\x9c\xa0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f0CGE]\x05\x89\xb3\xa1A,"\xcaE\xe2>/qo\'\xc4.\xe0\xae\xfe\xa6x\xb6\x17\xe5\x999\x86\x10\xbf\xa4\xcb\xeae\x8d\x13\x06n\x141a\x9b\x94\xb4\xab"x\x86q0H\xae\x0c\x7f\xf1\x16$\nc\x12\x8e\xf2\xf9\x8e|\xb3?R\xf9\xe0\xa8\xa2\x7f\x98\x8b70sqC\n\xe2.\x9b\x8e\x93=\xa6\xd0/\x89X\xa2\x0b\xff\x00\x90\x9bn\xa5\x89E\xac\xb5\x96\xc2\x06\xe5D\x89\x9e\x87\x95F\xfctvE \x8d\xb3\x1f\x8cb\x91\x83\x02\xce\xd0+SC\xf5\x18\xac\xc59\x8c%\xac\xb83\x99}@r\x96Ky\x809\xea\x03\xa0=\xbfB\x94L\xbc\xcc1\xacr\xc7E\x9f,\xb6\xba\x11\x1abq*\x98A\xf9\x98|\x1d\x18\xa2\xc7\xfb\x8d\xb8\xb9_P}\xe2\xf3\x06\x14\x84^\x0f\xbfK|j0\xb3$s\x9e\xe3\x8b\x136G\x86*\x8bE\xcav\xfcLc5\xe6^w\x967\x1b8\x97\x19\x94\x13\x08#,\xe2\xe78:\x85<\xcaWhR\x15\xe31\xae\xa1L\xc5\xa8a\xe6b\xf72\x99F<\x13\x1e:2\x8fL\x9d\xa53\xd69\xc6\xd8\xc4g\x19\xa4\xca4\x96\x9ab\xa9G3.\xf1(\xe6\x1dR\xc5s\x07\x0b\x86x\xe8\xd9\x0bM\xf7,je\x112\xc6~\xd9O\x12\xc9\xd8\x95q(\x8a\x93\xef\x11qrLN\xd0\xee\xd4\x03\nc\x7f\x11m\x9f\x07\xb8\xfe#)\x83U;\xbd\x03\x08|\xa0\x8dq\rtacG\xc4\xc7;p\xb3\xd0E\xcc\xa3\x98\xa2\xa8\xda| \xe37.\xc9s-]L]\xa5\xd9\xfd\xce$3\x85G\x83\x8e`~f\x12\xf3\r\xc1\xcc\x1f\x89\xe0G\xf9\x9aq\x0c#\x06q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R\xbc\xde<\xcb\xe3\x1af]\xc2M\x90yC\x08Z\x19\xcc\xe6Ya\x16\x0b\x8f(\xfc\xe36\xdck\x1a\x1a\x8f\x84\x17\x89Z\xd4Y\xc5C\x1b\x85|\xc0\x98q\tMD\'\x11jT\xcas(\xe8\xd9\x1dG-\xcf\xc3\x0f\xe3\xc4\xb9ze\xcc+\xdc\xa9e;"\x83?\xea\x82\xe6\xf9\x8a&n\xe2+\xdcr\xd7\x98\xb6\xf5\x18\xf3\xa8\x8c\xc8\x89C\xe6!y\x96\xb9`b\xfe\xd0n\nz\x119\xce\x8f\xee&\xa2Z\xb5\x9e\x8d\x90\x0f\xcdN\x0f1?z\x94\xab\x86\x8fD\x14\\\xc1\xa4\xf3\x13prF\xd2\xeeN\x0c:U\xb9\x99@\xc4\xe6\xa5\x11\x16\x91(\x89\x97\xc4\xde\x04Xg,L\xc5\x98)R\xe9&\xea8\xfb\x86\x99x\x82\x82\xd9\x11\x82F\x0c\x1c\xb0X\xd8!\xc4\x1a\xfa\x9b\xaf0\xe6\x0e\x0f1\xc3PQ\x12P\x97\x04\x04\x01IW~\xea!\x0f0\x15\x11\x02\xa0\xc4\x18\x82\xc6\x1a/\x9a\x8e\x13.s)\r\xcc,\xce\xfb\x89\x8d\x99\xdfCVb*\xe3~"\xcbU\xc5Es\x18\x8a\xea.\x19\xda!.\x02\xd8\x9cD@\x08\x00y\xfe\xa3k\xf5\x11O\x88\x96\r\xcdE\x98f!h\x99;E\xdb\x16&\xa2\x8f\x0cNQ!\x13\x9c\xf1\x1b\x1e\x9c\xc4b\xb1s\x19y\xd1)-\xf1\xd0\xff\xd9\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="fileName"\r\n\r\nfile_name.jpg\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="useUniqueFileName"\r\n\r\nfalse\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="tags"\r\n\r\nabc,def\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="folder"\r\n\r\n/testing-python-folder/\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="isPrivateFile"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="responseFields"\r\n\r\nisPrivateFile,tags\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="extensions"\r\n\r\n[{"name": "remove-bg", "options": {"add_shadow": true, "bg_color": "pink"}}, {"name": "google-auto-tagging", "minConfidence": 80, "maxTags": 10}]\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="webhookUrl"\r\n\r\nurl\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteFile"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteTags"\r\n\r\nfalse\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteCustomMetadata"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="customMetadata"\r\n\r\n{"test100": 11}\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="transformation"\r\n\r\n{"pre": "h-100", "post": [{"type": "transformation", "value": "w-100"}]}\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="checks"\r\n\r\n\'request.folder\' : \'/testing-python-folder/\'\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="isPublished"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteAITags"\r\n\r\nfalse\r\n----randomBoundary-----------------------\r\n' - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(url, responses.calls[0].request.url) - - @responses.activate() - def test_base64_upload_succeeds(self): - """ - Tests if upload succeeds - """ - URL.UPLOAD_BASE_URL = "http://test.com" - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - headers = create_headers_for_test() - responses.add( - responses.POST, - url, - body="""{ - "fileId": "fake_file_id1234", - "name": "file_name.jpg", - "size": 102117, - "versionInfo": { - "id": "62d670648cdb697522602b45", - "name": "Version 11" - }, - "filePath": "/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "width": 1050, - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "tags": [ - "abc", - "def" - ], - "AITags": [ - { - "name": "Computer", - "confidence": 97.66, - "source": "google-auto-tagging" - }, - { - "name": "Personal computer", - "confidence": 94.96, - "source": "google-auto-tagging" - } - ], - "isPrivateFile": true, - "extensionStatus": { - "remove-bg": "pending", - "google-auto-tagging": "success" - } - }""", - headers=headers, - ) - - with open(self.sample_image, mode="rb") as img: - resp = self.client.upload_file( - file=base64.b64encode(img.read()), - file_name="file_name.jpg", - options=UploadFileRequestOptions( - use_unique_file_name=False, - tags=["abc", "def"], - folder="/testing-python-folder/", - is_private_file=True, - response_fields=["is_private_file", "tags"], - extensions=( - { - "name": "remove-bg", - "options": {"add_shadow": True, "bg_color": "pink"}, - }, - {"name": "google-auto-tagging", "minConfidence": 80, "maxTags": 10}, - ), - webhook_url="url", - overwrite_file=True, - overwrite_ai_tags=False, - overwrite_tags=False, - overwrite_custom_metadata=True, - custom_metadata={"test100": 11}, - transformation={"pre": "h-100", "post": [{"type": "transformation", "value": "w-100"}]} - ), - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": [ - { - "confidence": 97.66, - "name": "Computer", - "source": "google-auto-tagging", - }, - { - "confidence": 94.96, - "name": "Personal computer", - "source": "google-auto-tagging", - }, - ], - "extensionStatus": { - "google-auto-tagging": "success", - "remove-bg": "pending", - }, - "fileId": "fake_file_id1234", - "filePath": "/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "isPrivateFile": True, - "name": "file_name.jpg", - "size": 102117, - "tags": ["abc", "def"], - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "versionInfo": {"id": "62d670648cdb697522602b45", "name": "Version 11"}, - "width": 1050, - }, - } - request_body = b'----randomBoundary---------------------\r\nContent-Disposition: form-data; name="file"\r\n\r\n/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAACGAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAAAIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVzYwAAAAAAAAASc1JHQiBJRUM2MTk2Ni0yLjEAAAAAAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWFlaIAAAAAAAAPNRAAEAAAABFsxYWVogAAAAAAAAAAAAAAAAAAAAAFhZWiAAAAAAAABvogAAOPUAAAOQWFlaIAAAAAAAAGKZ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HQMNSsQJUDtK/wCSqMzeobhhgrlEVk3MoxjM7jtG0acdQavRXUfjGsqo9AxVRD1HMWxDmaoVmZ5SWcxcQ+8NMP5hecoXhYYi4hHLpiztxJg6rRKSDLJVy6lzczg3CBeIfUJX3KV5jrEoIymM2yyNlcrIFy2L0K56ExXMdShOPE021K++Jj8dCqFm+YPaGPUI7nyg2xD7jX1PSNJQxsHL0tCzMS/MBDSLE0gyxDEGtahnzCMEzxG9dBlNNS1wKhFFi4QgXK+JWJUDGSVAviBMIlQtCBKj0PTpaS2NNRrGscJZxHDovQYaSvqWIhEOY/ec9zyTRmeeC1mWG4cKQjOZ4jkhGHnExSpY06DfxGeWIuLJ7I0yoWRTuQHEwlRYjmKQTDqo3uvM2dI2VcynoUzZKypFqpba5wLR+0pQ1mW0/aVYgjieieaCcwai8S8cEd9pfeLE7E37PRLOYleIdpXiVPKD9xZIv8xPE7lEweZlK/E2/qWQkuwp0HKMqNRU7Zhl2mPt0EMIRtKqceYBN+4E7yoKZhBNkG4hcDM+IFk/CMsNpRUe+6nw/oV/y4yueCJUac4g4bUqd1K83jzL4xpmXcJNkHlDCFoZzOZZYRYLjyj84zbcaxoaj4QXiVrUWcVDG4V8wJhxCU1EJxFqVMpzKOjZHUctz8MP48S5emXMK9ypZTsigz/qgub5iiZu4ivccteYtvUY86iMyIlD5iF5lrlgYv7Qbgp6ETnOj+4molq1no2QD81ODzE/epSrho9EFFzBpPMTcHJG0u5ODDpVuZlAxOalERaRKImXxN4EWGcsTMWYKVLpJuo4+4aZeIKC2RGCRgwcsFjYIcQa+puvMOYODzHDUFESUJcEBAFJV37qIQ8wFRECoMQYgsYaL5qOEy5zKQ3MLM77iY2Z30NWYirjfiLLVcVFcxiK6i4Z2iEuAticREAIAHn+o2v1EU+Ilg3NRZhmIWiZO0XbFiaijwxOUSETnPEbHpzEYrFzGXnRKS3x0P/Z\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="fileName"\r\n\r\nfile_name.jpg\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="useUniqueFileName"\r\n\r\nfalse\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="tags"\r\n\r\nabc,def\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="folder"\r\n\r\n/testing-python-folder/\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="isPrivateFile"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="responseFields"\r\n\r\nisPrivateFile,tags\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="extensions"\r\n\r\n[{"name": "remove-bg", "options": {"add_shadow": true, "bg_color": "pink"}}, {"name": "google-auto-tagging", "minConfidence": 80, "maxTags": 10}]\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="webhookUrl"\r\n\r\nurl\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteFile"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteTags"\r\n\r\nfalse\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteCustomMetadata"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="customMetadata"\r\n\r\n{"test100": 11}\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="transformation"\r\n\r\n{"pre": "h-100", "post": [{"type": "transformation", "value": "w-100"}]}\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteAITags"\r\n\r\nfalse\r\n----randomBoundary-----------------------\r\n' - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(url, responses.calls[0].request.url) - - - - @responses.activate - def test_upload_succeeds_with_url(self): - """ - Tests if upload succeeds - """ - URL.UPLOAD_BASE_URL = "http://test.com" - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - headers = create_headers_for_test() - responses.add( - responses.POST, - url, - body="""{ - "fileId": "fake_file_id1234", - "name": "file_name.jpg", - "size": 102117, - "versionInfo": { - "id": "62d670648cdb697522602b45", - "name": "Version 11" - }, - "filePath": "/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "width": 1050, - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "tags": [ - "abc", - "def" - ], - "AITags": [ - { - "name": "Computer", - "confidence": 97.66, - "source": "google-auto-tagging" - }, - { - "name": "Personal computer", - "confidence": 94.96, - "source": "google-auto-tagging" - } - ], - "isPrivateFile": true, - "extensionStatus": { - "remove-bg": "pending", - "google-auto-tagging": "success" - } - }""", - headers=headers, - ) - - file_upload_url = "https://file-examples.com/wp-content/uploads/2017/10/file_example_JPG_100kB.jpg" - resp = self.client.upload_file( - file=file_upload_url, - file_name="file_name.jpg", - options=UploadFileRequestOptions( - use_unique_file_name=False, - tags=["abc", "def"], - folder="/testing-python-folder/", - is_private_file=True, - response_fields=["is_private_file", "tags"], - extensions=( - { - "name": "remove-bg", - "options": {"add_shadow": True, "bg_color": "pink"}, - }, - {"name": "google-auto-tagging", "minConfidence": 80, "maxTags": 10}, - ), - webhook_url="url", - overwrite_file=True, - overwrite_ai_tags=False, - overwrite_tags=False, - overwrite_custom_metadata=True, - custom_metadata={"test100": 11}, - transformation={"pre": "h-100", "post": [{"type": "transformation", "value": "w-100"}]} - ), - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": [ - { - "confidence": 97.66, - "name": "Computer", - "source": "google-auto-tagging", - }, - { - "confidence": 94.96, - "name": "Personal computer", - "source": "google-auto-tagging", - }, - ], - "extensionStatus": { - "google-auto-tagging": "success", - "remove-bg": "pending", - }, - "fileId": "fake_file_id1234", - "filePath": "/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "isPrivateFile": True, - "name": "file_name.jpg", - "size": 102117, - "tags": ["abc", "def"], - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "versionInfo": {"id": "62d670648cdb697522602b45", "name": "Version 11"}, - "width": 1050, - }, - } - request_body = b'----randomBoundary---------------------\r\nContent-Disposition: form-data; name="file"\r\n\r\nhttps://file-examples.com/wp-content/uploads/2017/10/file_example_JPG_100kB.jpg\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="fileName"\r\n\r\nfile_name.jpg\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="useUniqueFileName"\r\n\r\nfalse\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="tags"\r\n\r\nabc,def\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="folder"\r\n\r\n/testing-python-folder/\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="isPrivateFile"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="responseFields"\r\n\r\nisPrivateFile,tags\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="extensions"\r\n\r\n[{"name": "remove-bg", "options": {"add_shadow": true, "bg_color": "pink"}}, {"name": "google-auto-tagging", "minConfidence": 80, "maxTags": 10}]\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="webhookUrl"\r\n\r\nurl\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteFile"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteTags"\r\n\r\nfalse\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteCustomMetadata"\r\n\r\ntrue\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="customMetadata"\r\n\r\n{"test100": 11}\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="transformation"\r\n\r\n{"pre": "h-100", "post": [{"type": "transformation", "value": "w-100"}]}\r\n----randomBoundary---------------------\r\nContent-Disposition: form-data; name="overwriteAITags"\r\n\r\nfalse\r\n----randomBoundary-----------------------\r\n' - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(url, responses.calls[0].request.url) - - @responses.activate - def test_embedded_metadata_recieved_on_upload(self): - """ - Tests if upload succeeds - """ - URL.UPLOAD_BASE_URL = "http://test.com" - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - headers = create_headers_for_test() - responses.add( - responses.POST, - url, - body="""{ - "fileId": "fake_file_id1234", - "name": "file_name.jpg", - "size": 102117, - "versionInfo": { - "id": "62d670648cdb697522602b45", - "name": "Version 11" - }, - "filePath": "/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "width": 1050, - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "tags": [ - "abc", - "def" - ], - "AITags": [ - { - "name": "Computer", - "confidence": 97.66, - "source": "google-auto-tagging" - }, - { - "name": "Personal computer", - "confidence": 94.96, - "source": "google-auto-tagging" - } - ], - "embeddedMetadata":{ - "XResolution":1,"YResolution":1,"DateCreated":"2023-06-21T11:49:39.850Z","DateTimeCreated":"2023-06-21T11:49:39.850Z" - }, - "isPrivateFile": true, - "extensionStatus": { - "remove-bg": "pending", - "google-auto-tagging": "success" - } - }""", - headers=headers, - ) - with open(self.sample_image,"rb") as img: - resp = self.client.upload( - file=img, - file_name="test.jpeg", - options=UploadFileRequestOptions( - tags = ["test"], - response_fields=["embedded_metadata"] - ) - ) - x_resolution = 1 - y_resolution = 1 - date_created = "2023-06-21T11:49:39.850Z" - date_time_created = "2023-06-21T11:49:39.850Z" - self.assertEqual(resp.embedded_metadata.x_resolution,x_resolution) - self.assertEqual(resp.embedded_metadata.y_resolution,y_resolution) - self.assertEqual(resp.embedded_metadata.date_created,date_created) - self.assertEqual(resp.embedded_metadata.date_time_created,date_time_created) - - # self.assertEqual(request_body, responses.calls[0].request.body) - # self.assertEqual( - # camel_dict_to_snake_dict(mock_response_metadata), - # resp.response_metadata.__dict__, - # ) - @responses.activate() - def test_upload_file_result_on_upload_with_non_breaking_changes_in_response(self): - """ - Tests if upload succeeds - """ - URL.UPLOAD_BASE_URL = "http://test.com" - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - headers = create_headers_for_test() - responses.add( - responses.POST, - url, - body="""{ - "fileId": "fake_file_id1234", - "name": "file_name.jpg", - "size": 102117, - "versionInfo": { - "id": "62d670648cdb697522602b45", - "name": "Version 11", - "decription":"Removed Background" - }, - "filePath": "/testing-python-folder/file_name.jpg", - "url": "https://ik.imagekit.io/your_imagekit_id/testing-python-folder/file_name.jpg", - "fileType": "image", - "height": 700, - "width": 1050, - "resolution":120, - "thumbnailUrl": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/testing-python-folder/file_name.jpg", - "tags": [ - "abc", - "def" - ], - "AITags": [ - { - "name": "Computer", - "confidence": 97.66, - "source": "google-auto-tagging", - "description":"automatically created tag" - }, - { - "name": "Personal computer", - "confidence": 94.96, - "source": "google-auto-tagging", - "description":"automatically created tag" - } - ], - "embeddedMetadata":{ - "XResolution":1,"YResolution":1,"DateCreated":"2023-06-21T11:49:39.850Z","DateTimeCreated":"2023-06-21T11:49:39.850Z","DPI":120 - }, - "isPrivateFile": true, - "extensionStatus": { - "remove-bg": "pending", - "google-auto-tagging": "success", - "image-enhancing":"pending" - } - }""", - headers=headers, - ) - with open(self.sample_image,"rb") as img: - resp = self.client.upload( - file=img, - file_name="test.jpeg", - options=UploadFileRequestOptions( - tags = ["test"], - response_fields=["embedded_metadata"] - ) - ) - self.assertEqual(resp.embedded_metadata.dpi,120) - self.assertEqual(resp.resolution,120) - self.assertEqual(resp.ai_tags[0].name,"Computer") - self.assertEqual(resp.ai_tags[0].description,"automatically created tag") - self.assertEqual(resp.extension_status["image-enhancing"],"pending") - - - def test_upload_fails_without_file_name(self) -> None: - """Test upload raises error on missing required params""" - try: - with open(self.sample_image, mode="rb") as img: - imgstr = base64.b64encode(img.read()) - self.client.upload_file(file=imgstr) - except TypeError as e: - self.assertEqual( - {"message": "Missing fileName parameter for upload", "help": ""}, - e.args[0], - ) - - def test_upload_fails_without_file(self) -> None: - """Test upload raises error on missing required params""" - try: - self.client.upload_file(file_name="file_name.jpg") - except TypeError as e: - self.assertEqual( - {"message": "Missing file parameter for upload", "help": ""}, e.args[0] - ) - - @responses.activate - def test_upload_fails_with_400_exception(self) -> None: - """Test upload raises 400 error""" - - URL.UPLOAD_BASE_URL = "http://test.com" - url = "%s%s" % (URL.UPLOAD_BASE_URL, "/api/v1/files/upload") - try: - responses.add( - responses.POST, - url, - status=400, - body="""{ - "message": "A file with the same name already exists at the exact location. We " - "could not overwrite it because both overwriteFile and " - "useUniqueFileName are set to false." - }""", - ) - self.client.upload_file( - file=self.image, - file_name=self.filename, - options=UploadFileRequestOptions( - use_unique_file_name=False, - tags=["abc", "def"], - folder="/testing-python-folder/", - is_private_file=False, - custom_coordinates="10,10,20,20", - response_fields=[ - "tags", - "custom_coordinates", - "is_private_file", - "embedded_metadata", - "custom_metadata", - ], - extensions=( - { - "name": "remove-bg", - "options": {"add_shadow": True, "bg_color": "pink"}, - }, - { - "name": "google-auto-tagging", - "minConfidence": 80, - "maxTags": 10, - }, - ), - webhook_url="https://webhook.site/c78d617f-33bc-40d9-9e61-608999721e2e", - overwrite_file=True, - overwrite_ai_tags=False, - overwrite_tags=False, - overwrite_custom_metadata=True, - custom_metadata={"testss": 12}, - ), - ) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "A file with the same name already exists at the exact location. We could not overwrite " - "it because both overwriteFile and useUniqueFileName are set to false.", - e.message, - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - -class TestListFiles(ClientTestCase): - """ - TestListFiles class used to test list_files method - """ - - @responses.activate - def test_list_files_fails_on_unauthenticated_request(self) -> None: - """Tests unauthenticated request restricted for list_files method""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files".format(URL.API_BASE_URL) - try: - responses.add( - responses.GET, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.list_files(self.options) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual("Your account cannot be authenticated.", e.message) - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_list_files_succeeds_with_basic_request_tags_with_array(self) -> None: - """ - Tests if list_files work with options which contains type, sort, path, searchQuery, fileType, limit, skip and tags - """ - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files".format(URL.API_BASE_URL) - - headers = create_headers_for_test() - responses.add( - responses.GET, - url, - body="""[{ - "type": "file", - "name": "sample-cat-image_gr64HPlJS.jpg", - "createdAt": "2022-06-15T08:19:00.843Z", - "updatedAt": "2022-06-15T08:19:45.169Z", - "fileId": "62a995f4d875ec08dc587b72", - "tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"], - "AITags": "", - "versionInfo": { - "id": "62a995f4d875ec08dc587b72", - "name": "Version 1" - }, - "embeddedMetadata": { - "XResolution": 250, - "YResolution": 250, - "DateCreated": "2022-06-15T08:19:01.523Z", - "DateTimeCreated": "2022-06-15T08:19:01.524Z" - }, - "customCoordinates": "10,10,20,20", - "customMetadata": { - "test100": 10 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/your_imagekit_id/sample-cat-image_gr64HPlJS.jpg", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/sample-cat-image_gr64HPlJS.jpg", - "fileType": "image", - "filePath": "/sample-cat-image_gr64HPlJS.jpg", - "height": 354, - "width": 236, - "size": 23023, - "hasAlpha": false, - "mime": "image/jpeg" - }]""", - headers=headers, - match=[ - matchers.query_string_matcher("type=file&sort=ASC_CREATED&path=%2F&searchQuery=created_at+%3E%3D+%272d%27+OR+size+%3C+%272mb%27+OR+format%3D%27png%27&fileType=all&limit=1&skip=0&tags=Tag-1%2C+Tag-2%2C+Tag-3" - ) - ], - ) - - resp = self.client.list_files(self.opt) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": [ - { - "AITags": "", - "createdAt": "2022-06-15T08:19:00.843Z", - "customCoordinates": "10,10,20,20", - "customMetadata": {"test100": 10}, - "embeddedMetadata": { - "DateCreated": "2022-06-15T08:19:01.523Z", - "DateTimeCreated": "2022-06-15T08:19:01.524Z", - "XResolution": 250, - "YResolution": 250, - }, - "fileId": "62a995f4d875ec08dc587b72", - "filePath": "/sample-cat-image_gr64HPlJS.jpg", - "fileType": "image", - "hasAlpha": False, - "height": 354, - "isPrivateFile": False, - "mime": "image/jpeg", - "name": "sample-cat-image_gr64HPlJS.jpg", - "size": 23023, - "tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"], - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/sample-cat-image_gr64HPlJS.jpg", - "type": "file", - "updatedAt": "2022-06-15T08:19:45.169Z", - "url": "https://ik.imagekit.io/your_imagekit_id/sample-cat-image_gr64HPlJS.jpg", - "versionInfo": { - "id": "62a995f4d875ec08dc587b72", - "name": "Version " "1", - }, - "width": 236, - } - ], - } - self.assertEqual( - "http://test.com/v1/files?type=file&sort=ASC_CREATED&path=%2F&searchQuery=created_at+%3E%3D+%272d%27+OR+size+%3C+%272mb%27+OR+format%3D%27png%27&fileType=all&limit=1&skip=0&tags=Tag-1%2C+Tag-2%2C+Tag-3", - responses.calls[0].request.url, - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - - @responses.activate - def test_list_files_succeeds_with_basic_request(self) -> None: - """ - Tests if list_files work with options which contains type, sort, path, searchQuery, fileType, limit, skip and tags - """ - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files".format(URL.API_BASE_URL) - - headers = create_headers_for_test() - responses.add( - responses.GET, - url, - body="""[{ - "type": "file", - "name": "sample-cat-image_gr64HPlJS.jpg", - "createdAt": "2022-06-15T08:19:00.843Z", - "updatedAt": "2022-06-15T08:19:45.169Z", - "fileId": "62a995f4d875ec08dc587b72", - "tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"], - "AITags": "", - "versionInfo": { - "id": "62a995f4d875ec08dc587b72", - "name": "Version 1" - }, - "embeddedMetadata": { - "XResolution": 250, - "YResolution": 250, - "DateCreated": "2022-06-15T08:19:01.523Z", - "DateTimeCreated": "2022-06-15T08:19:01.524Z" - }, - "customCoordinates": "10,10,20,20", - "customMetadata": { - "test100": 10 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/your_imagekit_id/sample-cat-image_gr64HPlJS.jpg", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/sample-cat-image_gr64HPlJS.jpg", - "fileType": "image", - "filePath": "/sample-cat-image_gr64HPlJS.jpg", - "height": 354, - "width": 236, - "size": 23023, - "hasAlpha": false, - "mime": "image/jpeg" - }]""", - headers=headers, - match=[ - matchers.query_string_matcher("type=file&sort=ASC_CREATED&path=%2F&searchQuery=created_at+%3E%3D+%272d%27+OR+size+%3C+%272mb%27+OR+format%3D%27png%27&fileType=all&limit=1&skip=0&tags=Tag-1%2C+Tag-2%2C+Tag-3" - ) - ], - ) - - resp = self.client.list_files(self.options) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": [ - { - "AITags": "", - "createdAt": "2022-06-15T08:19:00.843Z", - "customCoordinates": "10,10,20,20", - "customMetadata": {"test100": 10}, - "embeddedMetadata": { - "DateCreated": "2022-06-15T08:19:01.523Z", - "DateTimeCreated": "2022-06-15T08:19:01.524Z", - "XResolution": 250, - "YResolution": 250, - }, - "fileId": "62a995f4d875ec08dc587b72", - "filePath": "/sample-cat-image_gr64HPlJS.jpg", - "fileType": "image", - "hasAlpha": False, - "height": 354, - "isPrivateFile": False, - "mime": "image/jpeg", - "name": "sample-cat-image_gr64HPlJS.jpg", - "size": 23023, - "tags": ["Tag_1", " Tag_2", " Tag_3", "tag-to-add-2"], - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/sample-cat-image_gr64HPlJS.jpg", - "type": "file", - "updatedAt": "2022-06-15T08:19:45.169Z", - "url": "https://ik.imagekit.io/your_imagekit_id/sample-cat-image_gr64HPlJS.jpg", - "versionInfo": { - "id": "62a995f4d875ec08dc587b72", - "name": "Version " "1", - }, - "width": 236, - } - ], - } - self.assertEqual( - "http://test.com/v1/files?type=file&sort=ASC_CREATED&path=%2F&searchQuery=created_at+%3E%3D+%272d%27+OR+size+%3C+%272mb%27+OR+format%3D%27png%27&fileType=all&limit=1&skip=0&tags=Tag-1%2C+Tag-2%2C+Tag-3", - responses.calls[0].request.url, - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - - @responses.activate - def test_list_files_fails_with_400_exception(self) -> None: - """Test get list of files raises 400 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files".format(URL.API_BASE_URL) - try: - responses.add( - responses.GET, - url, - status=400, - body="""{"message": "Invalid search query - createdAt field must have a valid date value. Make " - "sure the value is enclosed within quotes. Please refer to the " - "documentation for syntax specification.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - match=[ - matchers.query_string_matcher("type=file&sort=ASC_CREATED&path=%2F&searchQuery=created_at+%3E%3D+%272d%27+OR+size+%3C+%272mb%27+OR+format%3D%27png%27&fileType=all&limit=1&skip=0&tags=Tag-1%2C+Tag-2%2C+Tag-3" - ) - ], - ) - self.client.list_files(self.options) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "Invalid search query - createdAt field must have a valid date value. Make " - "sure the value is enclosed within quotes. Please refer to the " - "documentation for syntax specification.", - e.message, - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - -class TestGetFileDetails(ClientTestCase): - """ - TestGetFileDetails class used to test get_file_details method - """ - - file_id = "fake_file_id1234" - file_url = "https://example.com/default.jpg" - - @responses.activate - def test_get_file_details_fails_on_unauthenticated_request(self) -> None: - """Tests of get_file_details raise error on unauthenticated request""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/details".format(URL.API_BASE_URL, self.file_id) - try: - responses.add( - responses.GET, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.get_file_details(self.file_id) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_file_details_succeeds_with_id(self) -> None: - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/details".format(URL.API_BASE_URL, self.file_id) - - headers = create_headers_for_test() - responses.add( - responses.GET, - url, - body="""{ - "type": "file", - "name": "default-image.jpg", - "createdAt": "2022-06-15T08:19:00.843Z", - "updatedAt": "2022-08-19T12:19:22.726Z", - "fileId": "fake_file_id1234", - "tags": [ - "{Software", - " Developer", - " Engineer}", - "tag-to-add-2" - ], - "AITags": null, - "versionInfo": { - "id": "62a995f4d875ec08dc587b72", - "name": "Version 1" - }, - "embeddedMetadata": { - "XResolution": 250, - "YResolution": 250, - "DateCreated": "2022-06-15T08:19:01.523Z", - "DateTimeCreated": "2022-06-15T08:19:01.524Z" - }, - "customCoordinates": "10,10,20,20", - "customMetadata": { - "test100": 10 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/xyxt2lnil/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/xyxt2lnil/tr:n-ik_ml_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - "height": 354, - "width": 236, - "size": 23023, - "hasAlpha": false, - "mime": "image/jpeg" - }""", - headers=headers, - ) - resp = self.client.get_file_details(self.file_id) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": None, - "createdAt": "2022-06-15T08:19:00.843Z", - "customCoordinates": "10,10,20,20", - "customMetadata": {"test100": 10}, - "embeddedMetadata": { - "DateCreated": "2022-06-15T08:19:01.523Z", - "DateTimeCreated": "2022-06-15T08:19:01.524Z", - "XResolution": 250, - "YResolution": 250, - }, - "fileId": "fake_file_id1234", - "filePath": "/default-image.jpg", - "fileType": "image", - "hasAlpha": False, - "height": 354, - "isPrivateFile": False, - "mime": "image/jpeg", - "name": "default-image.jpg", - "size": 23023, - "tags": ["{Software", " Developer", " Engineer}", "tag-to-add-2"], - "thumbnail": "https://ik.imagekit.io/xyxt2lnil/tr:n-ik_ml_thumbnail/default-image.jpg", - "type": "file", - "updatedAt": "2022-08-19T12:19:22.726Z", - "url": "https://ik.imagekit.io/xyxt2lnil/default-image.jpg", - "versionInfo": {"id": "62a995f4d875ec08dc587b72", "name": "Version 1"}, - "width": 236, - }, - } - - self.assertEqual( - "http://test.com/v1/files/fake_file_id1234/details", - responses.calls[0].request.url, - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("fake_file_id1234", resp.file_id) - - @responses.activate - def test_file_details_fails_with_400_exception(self) -> None: - """Test get file details raises 400 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/details".format(URL.API_BASE_URL, self.file_id) - try: - responses.add( - responses.GET, - url, - status=400, - body="""{"message": "Your request contains invalid fileId parameter.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.get_file_details(self.file_id) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "Your request contains invalid fileId parameter.", e.message - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - -class TestDeleteFile(ClientTestCase): - file_id = "fax_abx1223" - bulk_delete_ids = ["fake_123", "fake_222"] - - @responses.activate - def test_bulk_file_delete_fails_on_unauthenticated_request(self) -> None: - """Test bulk_file_delete on unauthenticated request - this function checks if raises error on unauthenticated request - to check if bulk_delete is only restricted to authenticated - requests - """ - - URL.API_BASE_URL = "http://test.com" - url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE - try: - responses.add( - responses.POST, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.bulk_file_delete(self.bulk_delete_ids) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(e.response_metadata.http_status_code, 403) - - @responses.activate - def test_bulk_file_delete_succeeds(self): - """Test bulk_delete on authenticated request - this function tests if bulk_file_delete working properly - """ - - URL.API_BASE_URL = "http://test.com" - url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - - responses.add( - responses.POST, - url, - body='{"successfullyDeletedFileIds": ["fake_123", "fake_222"]}', - headers=headers, - ) - - resp = self.client.bulk_file_delete(self.bulk_delete_ids) - - mock_response_metadata = { - "raw": {"successfullyDeletedFileIds": ["fake_123", "fake_222"]}, - "httpStatusCode": 200, - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - self.assertEqual( - '{"fileIds": ["fake_123", "fake_222"]}', responses.calls[0].request.body - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(["fake_123", "fake_222"], resp.successfully_deleted_file_ids) - self.assertEqual( - "http://test.com/v1/files/batch/deleteByFileIds", - responses.calls[0].request.url, - ) - - @responses.activate - def test_bulk_file_delete_succeeds_and_recieves_extra_non_breaking_changes_from_apii(self): - """Test bulk_delete on authenticated request - this function tests if bulk_file_delete working properly - """ - - URL.API_BASE_URL = "http://test.com" - url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - - responses.add( - responses.POST, - url, - body='{"successfullyDeletedFileIds": ["fake_123"],"nonDeletedFields":["fake_222"]}', - headers=headers, - ) - - resp = self.client.bulk_file_delete(self.bulk_delete_ids) - - mock_response_metadata = { - "raw": {"successfullyDeletedFileIds": ["fake_123"],"nonDeletedFields":["fake_222"]}, - "httpStatusCode": 200, - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - self.assertEqual( - '{"fileIds": ["fake_123", "fake_222"]}', responses.calls[0].request.body - ) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(["fake_123"], resp.successfully_deleted_file_ids) - self.assertEqual(["fake_222"], resp.non_deleted_fields) - self.assertEqual( - "http://test.com/v1/files/batch/deleteByFileIds", - responses.calls[0].request.url, - ) - @responses.activate - def test_bulk_file_delete_fails_with_404_exception(self) -> None: - """Test bulk_file_delete raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = URL.API_BASE_URL + "/v1/files" + URL.BULK_FILE_DELETE - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - try: - responses.add( - responses.POST, - url, - status=404, - body="""{ - "message": "The requested file(s) does not exist.", - "help": "For support kindly contact us at support@imagekit.io .", - "missingFileIds": ["fake_123", "fake_222"] - }""", - headers=headers, - ) - self.client.bulk_file_delete(self.bulk_delete_ids) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested file(s) does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - self.assertEqual( - ["fake_123", "fake_222"], e.response_metadata.raw["missingFileIds"] - ) - - @responses.activate - def test_file_delete_fails_with_400_exception(self): - """Test delete_file on unavailable content - this function raising 400 if the file - is not available - """ - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}".format(URL.API_BASE_URL, self.file_id) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - try: - responses.add( - responses.DELETE, - url, - status=400, - body="""{ - "message": "Your request contains invalid fileId parameter.", - "help": "For support kindly contact us at support@imagekit.io ." - }""", - headers=headers, - ) - self.client.delete_file(self.file_id) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "Your request contains invalid fileId parameter.", e.message - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - @responses.activate - def test_file_delete_succeeds(self): - """Test delete file on authenticated request - this function tests if delete_file working properly - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}".format(URL.API_BASE_URL, self.file_id) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - - responses.add(responses.DELETE, url, body="{}", status=204, headers=headers) - - resp = self.client.delete_file(self.file_id) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 204, - "raw": None, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/fax_abx1223", responses.calls[0].request.url - ) - - -class TestPurgeCache(ClientTestCase): - fake_image_url = "https://example.com/fakeid/fakeimage.jpg" - - @responses.activate - def test_purge_file_cache_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = URL.API_BASE_URL + "/v1/files/purge" - try: - responses.add( - responses.POST, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.purge_file_cache(self.fake_image_url) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_purge_file_cache_fails_with_400(self): - """ - Tests if the purge_file_cache fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = URL.API_BASE_URL + "/v1/files/purge" - try: - responses.add( - responses.POST, - url, - status=400, - body='{"message": "Invalid url"}', - ) - self.client.purge_file_cache("url") - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual("Invalid url", e.message) - self.assertEqual(400, e.response_metadata.http_status_code) - - @responses.activate - def test_purge_file_cache_succeeds(self): - """ - Tests if purge_file_cache succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = URL.API_BASE_URL + "/v1/files/purge" - responses.add( - responses.POST, - url, - status=201, - body='{"requestId": "requestId"}', - ) - resp = self.client.purge_file_cache(self.fake_image_url) - mock_response_metadata = { - "raw": {"requestId": "requestId"}, - "httpStatusCode": 201, - "headers": {"Content-Type": "text/plain"}, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("requestId", resp.request_id) - self.assertEqual( - "http://test.com/v1/files/purge", responses.calls[0].request.url - ) - self.assertEqual( - '{"url": "https://example.com/fakeid/fakeimage.jpg"}', - responses.calls[0].request.body, - ) - - -class TestPurgeCacheStatus(ClientTestCase): - cache_request_id = "fake1234" - - @responses.activate - def test_purge_file_cache_status_fails_with_400(self): - """ - Tests if the purge_file_cache_status fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/purge/{}".format(URL.API_BASE_URL, self.cache_request_id) - try: - responses.add( - responses.GET, - url, - status=400, - body="""{"message": "No request found for this requestId.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.get_purge_file_cache_status(self.cache_request_id) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual("No request found for this requestId.", e.message) - self.assertEqual(400, e.response_metadata.http_status_code) - - @responses.activate - def test_purge_file_cache_status_succeeds(self): - """ - Tests if purge_file_cache_status succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/purge/{}".format(URL.API_BASE_URL, self.cache_request_id) - responses.add( - responses.GET, - url, - body="""{"status": "Completed"}""", - ) - resp = self.client.get_purge_file_cache_status(self.cache_request_id) - mock_response_metadata = { - "headers": {"Content-Type": "text/plain"}, - "httpStatusCode": 200, - "raw": {"status": "Completed"}, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("Completed", resp.status) - self.assertEqual( - "http://test.com/v1/files/purge/fake1234", responses.calls[0].request.url - ) - - -class TestGetMetaData(ClientTestCase): - file_id = "fake_file_xbc" - - fake_image_url = "https://example.com/fakeid/fakeimage.jpg" - - @responses.activate - def test_get_file_metadata_fails_with_400(self): - """ - Tests if the get_file_metadata fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/metadata".format(URL.API_BASE_URL, self.file_id) - try: - responses.add( - responses.GET, - url, - status=400, - body="""{"message": "Your request contains invalid fileId parameter.", - "help": "For support kindly contact us at support@imagekit.io .", - "type": "INVALID_PARAM_ERROR"}""", - ) - self.client.get_file_metadata(self.file_id) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "Your request contains invalid fileId parameter.", e.message - ) - self.assertEqual(400, e.response_metadata.http_status_code) - self.assertEqual("INVALID_PARAM_ERROR", e.response_metadata.raw["type"]) - - @responses.activate - def test_get_file_metadata_succeeds(self): - """ - Tests if get_file_metadata succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/metadata".format(URL.API_BASE_URL, self.file_id) - responses.add( - responses.GET, - url, - body="""{ - "height": 354, - "width": 236, - "size": 7390, - "format": "jpg", - "hasColorProfile": false, - "quality": 0, - "density": 250, - "hasTransparency": false, - "exif": {}, - "pHash": "2e0ed1f12eda9525" - }""", - ) - resp = self.client.get_file_metadata(self.file_id) - mock_response_metadata = { - "headers": {"Content-Type": "text/plain"}, - "httpStatusCode": 200, - "raw": { - "density": 250, - "exif": {}, - "format": "jpg", - "hasColorProfile": False, - "hasTransparency": False, - "height": 354, - "pHash": "2e0ed1f12eda9525", - "quality": 0, - "size": 7390, - "width": 236, - }, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/fake_file_xbc/metadata", - responses.calls[0].request.url, - ) - - @responses.activate - def test_get_remote_file_url_metadata_fails_with_400(self): - """ - Tests if the get_remote_file_url_metadata fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/metadata".format(URL.API_BASE_URL) - try: - responses.add( - responses.GET, - url, - status=400, - body="""{ - "message": "https://example.com/fakeid/fakeimage.jpg should be accessible using your ImageKit.io account.", - "help": "For support kindly contact us at support@imagekit.io ." - }""", - match=[ - matchers.query_string_matcher( - "url=https://example.com/fakeid/fakeimage.jpg" - ) - ], - ) - self.client.get_remote_file_url_metadata(self.fake_image_url) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "https://example.com/fakeid/fakeimage.jpg should be accessible using your ImageKit.io account.", - e.message, - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - @responses.activate - def test_get_remote_file_url_metadata_succeeds(self): - """ - Tests if get_remote_file_url_metadata succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/metadata".format(URL.API_BASE_URL) - responses.add( - responses.GET, - url, - body="""{ - "height": 354, - "width": 236, - "size": 7390, - "format": "jpg", - "hasColorProfile": false, - "quality": 0, - "density": 250, - "hasTransparency": false, - "exif": {}, - "pHash": "2e0ed1f12eda9525" - }""", - match=[ - matchers.query_string_matcher( - "url=https://example.com/fakeid/fakeimage.jpg" - ) - ], - ) - resp = self.client.get_remote_file_url_metadata(self.fake_image_url) - mock_response_metadata = { - "headers": {"Content-Type": "text/plain"}, - "httpStatusCode": 200, - "raw": { - "density": 250, - "exif": {}, - "format": "jpg", - "hasColorProfile": False, - "hasTransparency": False, - "height": 354, - "pHash": "2e0ed1f12eda9525", - "quality": 0, - "size": 7390, - "width": 236, - }, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/metadata?url=https%3A%2F%2Fexample.com%2Ffakeid%2Ffakeimage.jpg", - responses.calls[0].request.url, - ) - - -class TestUpdateFileDetails(ClientTestCase): - """ - TestUpdateFileDetails class used to update file details method - """ - - file_id = "fake_123" - - valid_options = UpdateFileRequestOptions( - tags=["tag1", "tag2"], custom_coordinates="10,10,100,100" - ) - - @responses.activate - def test_update_file_details_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/details/".format(URL.API_BASE_URL, self.file_id) - try: - responses.add( - responses.PATCH, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.update_file_details( - file_id=self.file_id, options=self.valid_options - ) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_update_file_details_succeeds_with_id(self): - """ - Tests if update file details succeeds with file id - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/details/".format(URL.API_BASE_URL, self.file_id) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - responses.add( - responses.PATCH, - url, - body="""{ - "type": "file", - "name": "default-image.jpg", - "createdAt": "2022-07-21T10:31:22.529Z", - "updatedAt": "2022-07-21T10:37:11.848Z", - "fileId": "fake_123", - "tags": ["tag1", "tag2"], - "AITags": [{ - "name": "Corridor", - "confidence": 99.39, - "source": "aws-auto-tagging" - }, { - "name": "Floor", - "confidence": 97.59, - "source": "aws-auto-tagging" - }], - "versionInfo": { - "id": "versionId", - "name": "Version 2" - }, - "embeddedMetadata": { - "XResolution": 1, - "YResolution": 1, - "DateCreated": "2022-07-21T10:35:34.497Z", - "DateTimeCreated": "2022-07-21T10:35:34.500Z" - }, - "customCoordinates": "10,10,100,100", - "customMetadata": { - "test": 11 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - "height": 1000, - "width": 1000, - "size": 184425, - "hasAlpha": false, - "mime": "image/jpeg", - "extensionStatus": { - "remove-bg": "pending", - "google-auto-tagging": "success" - } - }""", - headers=headers, - ) - - request_body = json.dumps( - json.loads( - """{ - "removeAITags": ["ai-tag1", "ai-tag2"], - "webhookUrl": "url", - "extensions": [{ - "name": "remove-bg", - "options": { - "add_shadow": true, - "bg_color": "red" - } - }, { - "name": "google-auto-tagging", - "minConfidence": 80, - "maxTags": 10 - }], - "tags": ["tag1", "tag2"], - "customCoordinates": "10,10,100,100", - "customMetadata": { - "test": 11 - } - }""" - ) - ) - resp = self.client.update_file_details( - file_id=self.file_id, - options=UpdateFileRequestOptions( - remove_ai_tags=["ai-tag1", "ai-tag2"], - webhook_url="url", - extensions=[ - { - "name": "remove-bg", - "options": {"add_shadow": True, "bg_color": "red"}, - }, - {"name": "google-auto-tagging", "minConfidence": 80, "maxTags": 10}, - ], - tags=["tag1", "tag2"], - custom_coordinates="10,10,100,100", - custom_metadata={"test": 11}, - ), - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": [ - { - "confidence": 99.39, - "name": "Corridor", - "source": "aws-auto-tagging", - }, - { - "confidence": 97.59, - "name": "Floor", - "source": "aws-auto-tagging", - }, - ], - "createdAt": "2022-07-21T10:31:22.529Z", - "customCoordinates": "10,10,100,100", - "customMetadata": {"test": 11}, - "embeddedMetadata": { - "DateCreated": "2022-07-21T10:35:34.497Z", - "DateTimeCreated": "2022-07-21T10:35:34.500Z", - "XResolution": 1, - "YResolution": 1, - }, - "extensionStatus": { - "google-auto-tagging": "success", - "remove-bg": "pending", - }, - "fileId": "fake_123", - "filePath": "/default-image.jpg", - "fileType": "image", - "hasAlpha": False, - "height": 1000, - "isPrivateFile": False, - "mime": "image/jpeg", - "name": "default-image.jpg", - "size": 184425, - "tags": ["tag1", "tag2"], - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/default-image.jpg", - "type": "file", - "updatedAt": "2022-07-21T10:37:11.848Z", - "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg", - "versionInfo": {"id": "versionId", "name": "Version 2"}, - "width": 1000, - }, - } - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("fake_123", resp.file_id) - self.assertEqual( - "http://test.com/v1/files/fake_123/details/", responses.calls[0].request.url - ) - - @responses.activate - def test_update_file_publish_status_succeeds_(self): - """ - Tests if update file publish status succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/details/".format(URL.API_BASE_URL, self.file_id) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - responses.add( - responses.PATCH, - url, - body="""{ - "type": "file", - "name": "default-image.jpg", - "createdAt": "2022-07-21T10:31:22.529Z", - "updatedAt": "2022-07-21T10:37:11.848Z", - "fileId": "fake_123", - "tags": ["tag1", "tag2"], - "AITags": [{ - "name": "Corridor", - "confidence": 99.39, - "source": "aws-auto-tagging" - }, { - "name": "Floor", - "confidence": 97.59, - "source": "aws-auto-tagging" - }], - "versionInfo": { - "id": "versionId", - "name": "Version 2" - }, - "embeddedMetadata": { - "XResolution": 1, - "YResolution": 1, - "DateCreated": "2022-07-21T10:35:34.497Z", - "DateTimeCreated": "2022-07-21T10:35:34.500Z" - }, - "customCoordinates": "10,10,100,100", - "customMetadata": { - "test": 11 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/default-image.jpg", - "fileType": "image", - "filePath": "/default-image.jpg", - "height": 1000, - "width": 1000, - "size": 184425, - "hasAlpha": false, - "mime": "image/jpeg", - "extensionStatus": { - "remove-bg": "pending", - "google-auto-tagging": "success" - } - }""", - headers=headers, - ) - - request_body = json.dumps( - json.loads( - """{ - "publish": { - "isPublished": true, - "includeFileVersions": true - } - }""" - ) - ) - resp = self.client.update_file_details( - file_id=self.file_id, - options=UpdateFileRequestOptions( - publish={ - "isPublished": True, - "includeFileVersions": True - } - ), - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": [ - { - "confidence": 99.39, - "name": "Corridor", - "source": "aws-auto-tagging", - }, - { - "confidence": 97.59, - "name": "Floor", - "source": "aws-auto-tagging", - }, - ], - "createdAt": "2022-07-21T10:31:22.529Z", - "customCoordinates": "10,10,100,100", - "customMetadata": {"test": 11}, - "embeddedMetadata": { - "DateCreated": "2022-07-21T10:35:34.497Z", - "DateTimeCreated": "2022-07-21T10:35:34.500Z", - "XResolution": 1, - "YResolution": 1, - }, - "extensionStatus": { - "google-auto-tagging": "success", - "remove-bg": "pending", - }, - "fileId": "fake_123", - "filePath": "/default-image.jpg", - "fileType": "image", - "hasAlpha": False, - "height": 1000, - "isPrivateFile": False, - "mime": "image/jpeg", - "name": "default-image.jpg", - "size": 184425, - "tags": ["tag1", "tag2"], - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/default-image.jpg", - "type": "file", - "updatedAt": "2022-07-21T10:37:11.848Z", - "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg", - "versionInfo": {"id": "versionId", "name": "Version 2"}, - "width": 1000, - }, - } - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("fake_123", resp.file_id) - self.assertEqual( - "http://test.com/v1/files/fake_123/details/", responses.calls[0].request.url - ) - - @responses.activate - def test_update_file_details_fails_with_404_exception(self) -> None: - """Test update file details raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/details/".format(URL.API_BASE_URL, self.file_id) - try: - responses.add( - responses.PATCH, - url, - status=404, - body="""{"message": "The requested file does not exist.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.update_file_details( - file_id=self.file_id, - options=UpdateFileRequestOptions( - remove_ai_tags=["ai-tag1", "ai-tag2"], - webhook_url="url", - extensions=[ - { - "name": "remove-bg", - "options": {"add_shadow": True, "bg_color": "red"}, - }, - { - "name": "google-auto-tagging", - "minConfidence": 80, - "maxTags": 10, - }, - ], - tags=["tag1", "tag2"], - custom_coordinates="10,10,100,100", - custom_metadata={"test": 11}, - ), - ) - self.assertRaises(UnknownException) - except UnknownException as e: - self.assertEqual("The requested file does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - -class TestGetFileVersions(ClientTestCase): - """ - TestGetFileVersions class used to get file versions and it's details - """ - - file_id = "fake_123" - - version_id = "fake_version_123" - - valid_options = {"tags": ["tag1", "tag2"], "custom_coordinates": "10,10,100,100"} - - @responses.activate - def test_get_file_versions_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions".format(URL.API_BASE_URL, self.file_id) - try: - responses.add( - responses.GET, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.get_file_versions(self.file_id) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_get_file_versions_succeeds_with_id(self): - """ - Tests if get file versions succeeds with file id - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions".format(URL.API_BASE_URL, self.file_id) - - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - responses.add( - responses.GET, - url, - body="""[{ - "type": "file", - "name": "new_car.jpg", - "createdAt": "2022-06-15T11:34:36.294Z", - "updatedAt": "2022-07-04T10:15:50.067Z", - "fileId": "fake_123", - "tags": ["Tag_1", "Tag_2", "Tag_3"], - "AITags": [{ - "name": "Clothing", - "confidence": 98.77, - "source": "google-auto-tagging" - }, { - "name": "Smile", - "confidence": 95.31, - "source": "google-auto-tagging" - }, { - "name": "Shoe", - "confidence": 95.2, - "source": "google-auto-tagging" - }], - "versionInfo": { - "id": "versionId", - "name": "Version 4" - }, - "embeddedMetadata": { - "DateCreated": "2022-07-04T10:15:50.066Z", - "DateTimeCreated": "2022-07-04T10:15:50.066Z" - }, - "customCoordinates": "", - "customMetadata": { - "test100": 10, - "test10": 11 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg", - "fileType": "image", - "filePath": "/new_car.jpg", - "height": 354, - "width": 236, - "size": 7390, - "hasAlpha": false, - "mime": "image/jpeg" - }, { - "type": "file-version", - "name": "new_car.jpg", - "createdAt": "2022-07-04T10:15:49.698Z", - "updatedAt": "2022-07-04T10:15:49.734Z", - "fileId": "fileId", - "tags": ["Tag_1", "Tag_2", "Tag_3"], - "AITags": [{ - "name": "Clothing", - "confidence": 98.77, - "source": "google-auto-tagging" - }, { - "name": "Smile", - "confidence": 95.31, - "source": "google-auto-tagging" - }, { - "name": "Shoe", - "confidence": 95.2, - "source": "google-auto-tagging" - }, { - "name": "Street light", - "confidence": 91.05, - "source": "google-auto-tagging" - }], - "versionInfo": { - "id": "62c2bdd5872375c6b8f40fd4", - "name": "Version 1" - }, - "embeddedMetadata": { - "XResolution": 250, - "YResolution": 250, - "DateCreated": "2022-06-15T11:34:36.702Z", - "DateTimeCreated": "2022-06-15T11:34:36.702Z" - }, - "customCoordinates": "10,10,40,40", - "customMetadata": { - "test100": 10, - "test10": 11 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz", - "fileType": "image", - "filePath": "/new_car.jpg", - "height": 354, - "width": 236, - "size": 23023, - "hasAlpha": false, - "mime": "image/jpeg" - }]""", - headers=headers, - ) - resp = self.client.get_file_versions(self.file_id) - mock_response_metadata = { - "raw": [ - { - "type": "file", - "name": "new_car.jpg", - "createdAt": "2022-06-15T11:34:36.294Z", - "updatedAt": "2022-07-04T10:15:50.067Z", - "fileId": "fake_123", - "tags": ["Tag_1", "Tag_2", "Tag_3"], - "AITags": [ - { - "name": "Clothing", - "confidence": 98.77, - "source": "google-auto-tagging", - }, - { - "name": "Smile", - "confidence": 95.31, - "source": "google-auto-tagging", - }, - { - "name": "Shoe", - "confidence": 95.2, - "source": "google-auto-tagging", - }, - ], - "versionInfo": {"id": "versionId", "name": "Version 4"}, - "embeddedMetadata": { - "DateCreated": "2022-07-04T10:15:50.066Z", - "DateTimeCreated": "2022-07-04T10:15:50.066Z", - }, - "customCoordinates": "", - "customMetadata": {"test100": 10, "test10": 11}, - "isPrivateFile": False, - "url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg", - "fileType": "image", - "filePath": "/new_car.jpg", - "height": 354, - "width": 236, - "size": 7390, - "hasAlpha": False, - "mime": "image/jpeg", - }, - { - "type": "file-version", - "name": "new_car.jpg", - "createdAt": "2022-07-04T10:15:49.698Z", - "updatedAt": "2022-07-04T10:15:49.734Z", - "fileId": "fileId", - "tags": ["Tag_1", "Tag_2", "Tag_3"], - "AITags": [ - { - "name": "Clothing", - "confidence": 98.77, - "source": "google-auto-tagging", - }, - { - "name": "Smile", - "confidence": 95.31, - "source": "google-auto-tagging", - }, - { - "name": "Shoe", - "confidence": 95.2, - "source": "google-auto-tagging", - }, - { - "name": "Street light", - "confidence": 91.05, - "source": "google-auto-tagging", - }, - ], - "versionInfo": { - "id": "62c2bdd5872375c6b8f40fd4", - "name": "Version 1", - }, - "embeddedMetadata": { - "XResolution": 250, - "YResolution": 250, - "DateCreated": "2022-06-15T11:34:36.702Z", - "DateTimeCreated": "2022-06-15T11:34:36.702Z", - }, - "customCoordinates": "10,10,40,40", - "customMetadata": {"test100": 10, "test10": 11}, - "isPrivateFile": False, - "url": "https://ik.imagekit.io/your_imagekit_id/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version=dlkUlhiJ7I8OTejhKG38GZJBrsvDBcnz", - "fileType": "image", - "filePath": "/new_car.jpg", - "height": 354, - "width": 236, - "size": 23023, - "hasAlpha": False, - "mime": "image/jpeg", - }, - ], - "http_status_code": 200, - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("fake_123", resp.list[0].file_id) - self.assertEqual("fileId", resp.list[1].file_id) - self.assertEqual( - "http://test.com/v1/files/fake_123/versions", responses.calls[0].request.url - ) - - @responses.activate - def test_get_file_versions_fails_with_404_exception(self) -> None: - """Test get file versions raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions".format(URL.API_BASE_URL, self.file_id) - try: - responses.add( - responses.GET, - url, - status=404, - body="""{"message": "The requested asset does not exist.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.get_file_versions(self.file_id) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested asset does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_get_file_version_details_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - try: - responses.add( - responses.GET, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.get_file_version_details(self.file_id, self.version_id) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_get_file_version_details_succeeds_with_id(self): - """ - Tests if get file version details succeeds with file id - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - responses.add( - responses.GET, - url, - body="""{ - "type": "file-version", - "name": "new_car.jpg", - "createdAt": "2022-06-27T09:24:25.251Z", - "updatedAt": "2022-06-27T12:11:11.247Z", - "fileId": "fake_123", - "tags": ["tagg", "tagg1"], - "AITags": "", - "versionInfo": { - "id": "fake_version_123", - "name": "Version 1" - }, - "embeddedMetadata": { - "XResolution": 250, - "YResolution": 250, - "DateCreated": "2022-06-15T11:34:36.702Z", - "DateTimeCreated": "2022-06-15T11:34:36.702Z" - }, - "customCoordinates": "10,10,20,20", - "customMetadata": { - "test100": 10 - }, - "isPrivateFile": false, - "url": "https://ik.imagekit.io/your-imagekit-id/new_car.jpg?ik-obj-version=hzBNRjaJhZYg.JNu75L2nMDfhjJP4tJH", - "thumbnail": "https://ik.imagekit.io/your-imagekit-id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version=hzBNRjaJhZYg.JNu75L2nMDfhjJP4tJH", - "fileType": "image", - "filePath": "/new_car.jpg", - "height": 354, - "width": 236, - "size": 23023, - "hasAlpha": false, - "mime": "image/jpeg" - }""", - headers=headers, - ) - resp = self.client.get_file_version_details(self.file_id, self.version_id) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": "", - "createdAt": "2022-06-27T09:24:25.251Z", - "customCoordinates": "10,10,20,20", - "customMetadata": {"test100": 10}, - "embeddedMetadata": { - "DateCreated": "2022-06-15T11:34:36.702Z", - "DateTimeCreated": "2022-06-15T11:34:36.702Z", - "XResolution": 250, - "YResolution": 250, - }, - "fileId": "fake_123", - "filePath": "/new_car.jpg", - "fileType": "image", - "hasAlpha": False, - "height": 354, - "isPrivateFile": False, - "mime": "image/jpeg", - "name": "new_car.jpg", - "size": 23023, - "tags": ["tagg", "tagg1"], - "thumbnail": "https://ik.imagekit.io/your-imagekit-id/tr:n-ik_ml_thumbnail/new_car.jpg?ik-obj-version=hzBNRjaJhZYg.JNu75L2nMDfhjJP4tJH", - "type": "file-version", - "updatedAt": "2022-06-27T12:11:11.247Z", - "url": "https://ik.imagekit.io/your-imagekit-id/new_car.jpg?ik-obj-version=hzBNRjaJhZYg.JNu75L2nMDfhjJP4tJH", - "versionInfo": {"id": "fake_version_123", "name": "Version 1"}, - "width": 236, - }, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("fake_123", resp.file_id) - self.assertEqual("fake_version_123", resp.version_info.id) - self.assertEqual( - "http://test.com/v1/files/fake_123/versions/fake_version_123", - responses.calls[0].request.url, - ) - - @responses.activate - def test_get_file_version_details_fails_with_404_exception(self) -> None: - """Test get file version details raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - try: - responses.add( - responses.GET, - url, - status=404, - body="""{"message": "The requested asset does not exist.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.get_file_version_details(self.file_id, self.version_id) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested asset does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_get_file_version_details_fails_with_400_exception(self) -> None: - """Test get file version details raises 400 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - try: - responses.add( - responses.GET, - url, - status=400, - body="""{"message": "Your request contains invalid fileId parameter.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.get_file_version_details(self.file_id, self.version_id) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "Your request contains invalid fileId parameter.", e.message - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - -class TestDeleteFileVersion(ClientTestCase): - version_id = "fake_123_version_id" - file_id = "fax_abx1223" - - @responses.activate - def test_delete_file_version_fails_with_404_exception(self) -> None: - """Test delete_file_version raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - try: - responses.add( - responses.DELETE, - url, - status=404, - body="""{"message": "The requested file version does not exist.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.delete_file_version(self.file_id, self.version_id) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested file version does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_delete_file_version_succeeds(self) -> None: - """Test delete_file_version succeeds with file and version Id""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add(responses.DELETE, url, status=204, headers=headers, body="{}") - resp = self.client.delete_file_version(self.file_id, self.version_id) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 204, - "raw": None, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/fax_abx1223/versions/fake_123_version_id", - responses.calls[0].request.url, - ) - - -class TestCopyFile(ClientTestCase): - source_file_path = "/source_file.jpg" - - destination_path = "/destination_path" - - @responses.activate - def test_copy_file_fails_with_404(self) -> None: - """Test copy_file raises 404""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/copy".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=404, - headers=headers, - body="""{ - "message": "No file found with filePath /source_file.jpg", - "help": "For support kindly contact us at support@imagekit.io .", - "reason": "SOURCE_FILE_MISSING" - }""", - ) - try: - self.client.copy_file( - options=CopyFileRequestOptions( - source_file_path=self.source_file_path, - destination_path=self.destination_path, - include_file_versions=False, - ) - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("No file found with filePath /source_file.jpg", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_copy_file_succeeds(self) -> None: - """Test copy_file succeeds""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/copy".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add(responses.POST, url, status=204, headers=headers, body="{}") - - resp = self.client.copy_file( - options=CopyFileRequestOptions( - source_file_path=self.source_file_path, - destination_path=self.destination_path, - include_file_versions=True, - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 204, - "raw": None, - } - - request_body = json.dumps( - json.loads( - """{ - "sourceFilePath": "/source_file.jpg", - "destinationPath": "/destination_path", - "includeFileVersions": true - }""" - ) - ) - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/copy", responses.calls[0].request.url - ) - - @responses.activate - def test_copy_file_succeeds_without_include_file_versions(self) -> None: - """Test copy_file succeeds""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/copy".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add(responses.POST, url, status=204, headers=headers, body="{}") - - resp = self.client.copy_file( - options=CopyFileRequestOptions( - source_file_path=self.source_file_path, - destination_path=self.destination_path, - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 204, - "raw": None, - } - - request_body = json.dumps( - json.loads( - """{ - "sourceFilePath": "/source_file.jpg", - "destinationPath": "/destination_path" - }""" - ) - ) - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/copy", responses.calls[0].request.url - ) - - -class TestMoveFile(ClientTestCase): - source_file_path = "/source_file.jpg" - - destination_path = "/destination_path" - - @responses.activate - def test_move_file_fails_with_404(self) -> None: - """Test move_file raises 404""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/move".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.POST, - url, - status=404, - headers=headers, - body="""{ - "message": "No file found with filePath /source_file.jpg", - "help": "For support kindly contact us at support@imagekit.io .", - "reason": "SOURCE_FILE_MISSING" - }""", - ) - try: - self.client.move_file( - options=MoveFileRequestOptions( - source_file_path=self.source_file_path, - destination_path=self.destination_path, - ) - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("No file found with filePath /source_file.jpg", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_move_file_succeeds(self) -> None: - """Test move_file succeeds""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/move".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add(responses.POST, url, status=204, headers=headers, body="{}") - - resp = self.client.move_file( - options=MoveFileRequestOptions( - source_file_path=self.source_file_path, - destination_path=self.destination_path, - ) - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 204, - "raw": None, - } - - request_body = json.dumps( - json.loads( - """{ - "sourceFilePath": "/source_file.jpg", - "destinationPath": "/destination_path" - }""" - ) - ) - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/move", responses.calls[0].request.url - ) - - -class TestRenameFile(ClientTestCase): - file_path = "/file_path.jpg" - - new_file_name = "new_file.jpg" - - @responses.activate - def test_rename_file_fails_with_409(self) -> None: - """Test rename_file raises 409""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/rename".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - try: - responses.add( - responses.PUT, - url, - status=409, - headers=headers, - body="""{ - "message": "File with name testing-binary.jpg already exists at the same location.", - "help": "For support kindly contact us at support@imagekit.io .", - "reason": "FILE_ALREADY_EXISTS" - }""", - ) - self.client.rename_file( - options=RenameFileRequestOptions( - file_path=self.file_path, new_file_name=self.new_file_name - ) - ) - self.assertRaises(ConflictException) - except ConflictException as e: - self.assertEqual( - "File with name testing-binary.jpg already exists at the same location.", - e.message, - ) - self.assertEqual(409, e.response_metadata.http_status_code) - self.assertEqual("FILE_ALREADY_EXISTS", e.response_metadata.raw["reason"]) - - @responses.activate - def test_rename_file_succeeds_with_purge_cache_false(self) -> None: - """Test rename_file succeeds with Purge cache""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/rename".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.PUT, - url, - headers=headers, - body="{}", - ) - resp = self.client.rename_file( - options=RenameFileRequestOptions( - file_path=self.file_path, - new_file_name=self.new_file_name, - purge_cache=False, - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": {}, - } - - request_body = json.dumps( - json.loads( - """{ - "filePath": "/file_path.jpg", - "newFileName": "new_file.jpg", - "purgeCache": false - }""" - ) - ) - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(None, resp.purge_request_id) - self.assertEqual( - "http://test.com/v1/files/rename", responses.calls[0].request.url - ) - - @responses.activate - def test_rename_file_succeeds_with_purge_cache(self) -> None: - """Test rename_file succeeds with Purge cache""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/rename".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.PUT, - url, - headers=headers, - body='{"purgeRequestId": "62de3e986f68334a5a3339fb"}', - ) - resp = self.client.rename_file( - options=RenameFileRequestOptions( - file_path=self.file_path, - new_file_name=self.new_file_name, - purge_cache=True, - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": {"purgeRequestId": "62de3e986f68334a5a3339fb"}, - } - - request_body = json.dumps( - json.loads( - """{ - "filePath": "/file_path.jpg", - "newFileName": "new_file.jpg", - "purgeCache": true - }""" - ) - ) - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("62de3e986f68334a5a3339fb", resp.purge_request_id) - self.assertEqual( - "http://test.com/v1/files/rename", responses.calls[0].request.url - ) - - @responses.activate - def test_rename_file_succeeds(self) -> None: - """Test rename_file succeeds""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/rename".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add(responses.PUT, url, headers=headers, body="{}") - resp = self.client.rename_file( - options=RenameFileRequestOptions( - file_path=self.file_path, new_file_name=self.new_file_name - ) - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": {}, - } - - request_body = json.dumps( - json.loads( - """{ - "filePath": "/file_path.jpg", - "newFileName": "new_file.jpg" - }""" - ) - ) - - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual(None, resp.purge_request_id) - self.assertEqual( - "http://test.com/v1/files/rename", responses.calls[0].request.url - ) - - -class TestRestoreFileVersion(ClientTestCase): - version_id = "fake_123_version_id" - file_id = "fax_abx1223" - - @responses.activate - def test_restore_file_version_fails_with_404_exception(self) -> None: - """Test restore_file_version raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}/restore".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - try: - responses.add( - responses.PUT, - url, - status=404, - body="""{"message": "The requested file version does not exist.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.restore_file_version(self.file_id, self.version_id) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested file version does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - - @responses.activate - def test_restore_file_version_succeeds(self) -> None: - """Test restore_file_version succeeds with file and version Id""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/versions/{}/restore".format( - URL.API_BASE_URL, self.file_id, self.version_id - ) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.PUT, - url, - headers=headers, - body="""{ - "fileId": "fileId", - "type": "file", - "name": "file1.jpg", - "filePath": "/images/file.jpg", - "tags": ["t-shirt", "round-neck", "sale2019"], - "AITags": [ - { - "confidence": 90.12, - "source": "google-auto-tagging" - }], - "versionInfo": { - "id": "versionId", - "name": "Version 2" - }, - "isPrivateFile": false, - "customCoordinates": "", - "url": "https://ik.imagekit.io/your_imagekit_id/images/products/file1.jpg", - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-media_library_thumbnail/images/products/file1.jpg", - "fileType": "image", - "hasAlpha": false, - "height": 100, - "isPrivateFile": false, - "mime": "image/jpeg", - "name": "file1.jpg", - "size": 100, - "hasAlpha": false, - "customMetadata": { - "brand": "Nike", - "color": "red" - }, - "createdAt": "2019-08-24T06:14:41.313Z", - "updatedAt": "2019-09-24T06:14:41.313Z" - }""", - ) - resp = self.client.restore_file_version(self.file_id, self.version_id) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "http_status_code": 200, - "raw": { - "AITags": [{"confidence": 90.12, "source": "google-auto-tagging"}], - "createdAt": "2019-08-24T06:14:41.313Z", - "customCoordinates": "", - "customMetadata": {"brand": "Nike", "color": "red"}, - "fileId": "fileId", - "filePath": "/images/file.jpg", - "fileType": "image", - "hasAlpha": False, - "height": 100, - "isPrivateFile": False, - "mime": "image/jpeg", - "name": "file1.jpg", - "size": 100, - "tags": ["t-shirt", "round-neck", "sale2019"], - "thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-media_library_thumbnail/images/products/file1.jpg", - "type": "file", - "updatedAt": "2019-09-24T06:14:41.313Z", - "url": "https://ik.imagekit.io/your_imagekit_id/images/products/file1.jpg", - "versionInfo": {"id": "versionId", "name": "Version 2"}, - }, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("fileId", resp.file_id) - self.assertEqual("versionId", resp.version_info.id) - self.assertEqual( - "http://test.com/v1/files/fax_abx1223/versions/fake_123_version_id/restore", - responses.calls[0].request.url, - ) - - @responses.activate() - def test_get_metadata_with_non_breaking_changes_in_response(self): - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/{}/metadata".format(URL.API_BASE_URL, self.file_id) - headers = {"Content-Type": "application/json"} - headers.update(create_headers_for_test()) - responses.add( - responses.GET, - url, - headers=headers, - body="""{ - "height": 176, - "width": 287, - "size": 15869, - "format": "jpg", - "hasColorProfile": false, - "quality": 0, - "density": 72, - "hasTransparency": false, - "exif":{ - "gps":{ - "GPSVersionId":"1.2", - "latitude":1235.124151355, - "longitude":12315.326236 - }, - "thumbnail": - { - "compression":12, - "YResolution":1, - "XResolution":1, - "resolutionUnit":"DPI", - "thumbnailOffset":12, - "thumbnailLength":12, - "overallResolution":1 - }, - "exif": { - "exposureTime":10, - "FNumber":1, - "exposureProgram":null, - "ISO":"2001", - "exifVersion":1.2, - "dateTimeOriginal":null, - "createDate":null, - "shutterSpeedValue":122, - "apertureValue":12, - "exposureCompensation":12, - "meteringMode":null, - "flash":"white", - "focalLength":null, - "subSecTime":null, - "subSecTimeOriginal":null, - "subSecTimeDigitized":null, - "flashpixVersion":null, - "colorSpace":null, - "exifImageWidth":null, - "exifImageHeight":null, - "interopOffset":null, - "focalPlaneXResolution":null, - "focalPlaneYResolution":null, - "focalPlaneResolutionUnit":null, - "customRendered":null, - "exposureMode":null, - "whiteBalance":null, - "sceneCaptureType":null, - "cameraModel":"Canon" - }, - "image":{ - "make":null, - "model":null, - "orientation":null, - "XResolution":null, - "YResolution":null, - "resolutionUnit":null, - "software":null, - "modifyDate":null, - "YCbCrPositioning":null, - "exifOffset":null, - "gpsInfo":"navic", - "cropped":true - }, - "interoperability":{ - "interopVersion":1.1, - "interopIndex":1.2, - "interopRandom":132 - } - } - } - """, - - ) - - metadataExif = self.client.get_metadata(self.file_id) - - self.assertEqual(metadataExif.exif.interoperability.interop_index,1.2) - self.assertEqual(metadataExif.exif.interoperability.interop_random,132) - self.assertEqual(metadataExif.exif.image.gps_info,"navic") - self.assertEqual(metadataExif.exif.image.cropped,True) - self.assertEqual(metadataExif.exif.gps.gps_version_id,["1",".","2"]) - self.assertEqual(metadataExif.exif.gps.longitude,12315.326236) - self.assertEqual(metadataExif.exif.exif.exposure_time,10) - self.assertEqual(metadataExif.exif.exif.camera_model,"Canon") - self.assertEqual(metadataExif.exif.thumbnail.x_resolution,1) - self.assertEqual(metadataExif.exif.thumbnail.overall_resolution,1) - \ No newline at end of file diff --git a/tests/test_folder_ops.py b/tests/test_folder_ops.py deleted file mode 100644 index 5a5255b..0000000 --- a/tests/test_folder_ops.py +++ /dev/null @@ -1,577 +0,0 @@ -import json - -import responses - -from imagekitio import ImageKit -from imagekitio.constants.url import URL -from imagekitio.exceptions.BadRequestException import BadRequestException -from imagekitio.exceptions.ForbiddenException import ForbiddenException -from imagekitio.exceptions.InternalServerException import InternalServerException -from imagekitio.exceptions.NotFoundException import NotFoundException -from imagekitio.exceptions.UnknownException import UnknownException -from imagekitio.models.CopyFolderRequestOptions import CopyFolderRequestOptions -from imagekitio.models.CreateFolderRequestOptions import CreateFolderRequestOptions -from imagekitio.models.DeleteFolderRequestOptions import DeleteFolderRequestOptions -from imagekitio.models.MoveFolderRequestOptions import MoveFolderRequestOptions -from imagekitio.utils.formatter import camel_dict_to_snake_dict -from tests.helpers import ( - ClientTestCase, - create_headers_for_test, -) - -imagekit_obj = ImageKit( - private_key="private_fake:", - public_key="public_fake123:", - url_endpoint="fake.com", -) - - -class TestFolders(ClientTestCase): - """ - TestFolders class used to test create and Delete folders - """ - - @responses.activate - def test_create_folder_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/folder".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.create_folder( - options=CreateFolderRequestOptions( - folder_name="folder_name", parent_folder_path="/test" - ) - ) - self.assertRaises(ForbiddenException) - except UnknownException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(e.response_metadata.http_status_code, 403) - - @responses.activate - def test_create_folder_succeeds(self): - """ - Tests if create_folder succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/folder".format(URL.API_BASE_URL) - headers = create_headers_for_test() - responses.add(responses.POST, url, status=201, body="{}", headers=headers) - resp = self.client.create_folder( - options=CreateFolderRequestOptions( - folder_name="folder_name", parent_folder_path="/test" - ) - ) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 201, - "raw": {}, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("http://test.com/v1/folder", responses.calls[0].request.url) - self.assertEqual( - '{"folderName": "folder_name", "parentFolderPath": "/test"}', - responses.calls[0].request.body, - ) - - @responses.activate - def test_create_folder_fails_with_400(self): - """ - Tests if create folder fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/folder".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=400, - body="""{"message": "folderName parameter cannot have a slash.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.create_folder( - options=CreateFolderRequestOptions( - folder_name="folder_name", parent_folder_path="/test" - ) - ) - self.assertRaises(BadRequestException) - except UnknownException as e: - self.assertEqual(e.message, "folderName parameter cannot have a slash.") - self.assertEqual(e.response_metadata.http_status_code, 400) - - @responses.activate - def test_delete_folder_fails_with_400(self): - """ - Tests if Delete folder fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/folder".format(URL.API_BASE_URL) - try: - responses.add( - responses.DELETE, - url, - status=404, - body="""{ - "message": "No folder found with folderPath test", - "help": "For support kindly contact us at support@imagekit.io .", - "reason": "FOLDER_NOT_FOUND" - }""", - ) - self.client.delete_folder( - options=DeleteFolderRequestOptions(folder_path="/test") - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("No folder found with folderPath test", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - self.assertEqual("FOLDER_NOT_FOUND", e.response_metadata.raw["reason"]) - - @responses.activate - def test_delete_folder_succeeds(self): - """ - Tests if Delete folder succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/folder".format(URL.API_BASE_URL) - responses.add( - responses.DELETE, - url, - status=204, - body="{}", - ) - resp = self.client.delete_folder( - options=DeleteFolderRequestOptions(folder_path="/folderName") - ) - mock_response_metadata = { - "raw": None, - "httpStatusCode": 204, - "headers": {"Content-Type": "text/plain"}, - } - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("http://test.com/v1/folder", responses.calls[0].request.url) - self.assertEqual('{"folderPath": "/folderName"}', responses.calls[0].request.body) - - -class TestCopyFolder(ClientTestCase): - """ - TestCopyFolder class used to test copy folder - """ - - @responses.activate - def test_copy_folder_fails_with_400(self): - """ - Tests if Copy folder fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/copyFolder".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=400, - body="""{ - "message": "sourceFolderPath and destinationPath cannot be same.", - "help": "For support kindly contact us at support@imagekit.io ." - }""", - ) - self.client.copy_folder( - options=CopyFolderRequestOptions( - source_folder_path="/test", - destination_path="/test", - include_file_versions=False, - ) - ) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "sourceFolderPath and destinationPath cannot be same.", e.message - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - @responses.activate - def test_copy_folder_fails_with_404(self): - """ - Tests if Copy folder fails with 404 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/copyFolder".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=404, - body="""{ - "message": "No files & folder found at sourceFolderPath /test", - "help": "For support kindly contact us at support@imagekit.io .", - "reason": "NO_FILES_FOLDER" - }""", - ) - self.client.copy_folder( - options=CopyFolderRequestOptions( - source_folder_path="/test", - destination_path="/test1", - include_file_versions=False, - ) - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual( - "No files & folder found at sourceFolderPath /test", e.message - ) - self.assertEqual(404, e.response_metadata.http_status_code) - self.assertEqual("NO_FILES_FOLDER", e.response_metadata.raw["reason"]) - - @responses.activate - def test_copy_folder_succeeds(self): - """ - Tests if Copy folder succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/copyFolder".format(URL.API_BASE_URL) - responses.add( - responses.POST, - url, - body='{"jobId": "62de84fb1b02a58936cc740c"}', - ) - resp = self.client.copy_folder( - options=CopyFolderRequestOptions( - source_folder_path="/test", - destination_path="/test1", - include_file_versions=True, - ) - ) - mock_response_metadata = { - "headers": {"Content-Type": "text/plain"}, - "httpStatusCode": 200, - "raw": {"jobId": "62de84fb1b02a58936cc740c"}, - } - request_body = json.dumps( - json.loads( - """{ - "sourceFolderPath": "/test", - "destinationPath": "/test1", - "includeFileVersions": true - }""" - ) - ) - self.assertEqual("62de84fb1b02a58936cc740c", resp.job_id) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/bulkJobs/copyFolder", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_copy_folder_succeeds_with_include_file_versions_false(self): - """ - Tests if Copy folder succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/copyFolder".format(URL.API_BASE_URL) - responses.add( - responses.POST, - url, - body='{"jobId": "62de84fb1b02a58936cc740c"}', - ) - resp = self.client.copy_folder( - options=CopyFolderRequestOptions( - source_folder_path="/test", - destination_path="/test1", - include_file_versions=False, - ) - ) - mock_response_metadata = { - "headers": {"Content-Type": "text/plain"}, - "httpStatusCode": 200, - "raw": {"jobId": "62de84fb1b02a58936cc740c"}, - } - request_body = json.dumps( - json.loads( - """{ - "sourceFolderPath": "/test", - "destinationPath": "/test1", - "includeFileVersions": false - }""" - ) - ) - self.assertEqual("62de84fb1b02a58936cc740c", resp.job_id) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/bulkJobs/copyFolder", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - @responses.activate - def test_copy_folder_succeeds_without_include_file_versions(self): - """ - Tests if Copy folder succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/copyFolder".format(URL.API_BASE_URL) - responses.add( - responses.POST, - url, - body='{"jobId": "62de84fb1b02a58936cc740c"}', - ) - resp = self.client.copy_folder( - options=CopyFolderRequestOptions( - source_folder_path="/test", - destination_path="/test1", - ) - ) - mock_response_metadata = { - "headers": {"Content-Type": "text/plain"}, - "httpStatusCode": 200, - "raw": {"jobId": "62de84fb1b02a58936cc740c"}, - } - request_body = json.dumps( - json.loads( - """{ - "sourceFolderPath": "/test", - "destinationPath": "/test1" - }""" - ) - ) - self.assertEqual("62de84fb1b02a58936cc740c", resp.job_id) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/bulkJobs/copyFolder", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - -class TestMoveFolder(ClientTestCase): - """ - TestMoveFolder class used to test move folder - """ - - @responses.activate - def test_move_folder_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/moveFolder".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.move_folder( - options=MoveFolderRequestOptions( - source_folder_path="/test", destination_path="/test1" - ) - ) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_move_folder_fails_with_400(self): - """ - Tests if Move folder fails with 400 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/moveFolder".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=400, - body="""{ - "message": "sourceFolderPath and destinationPath cannot be same.", - "help": "For support kindly contact us at support@imagekit.io ." - }""", - ) - self.client.move_folder( - options=MoveFolderRequestOptions( - source_folder_path="/test", destination_path="/test" - ) - ) - self.assertRaises(BadRequestException) - except BadRequestException as e: - self.assertEqual( - "sourceFolderPath and destinationPath cannot be same.", e.message - ) - self.assertEqual(400, e.response_metadata.http_status_code) - - @responses.activate - def test_move_folder_fails_with_404(self): - """ - Tests if Move folder fails with 404 - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/moveFolder".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=404, - body="""{ - "message": "No files & folder found at sourceFolderPath /test", - "help": "For support kindly contact us at support@imagekit.io .", - "reason": "NO_FILES_FOLDER" - }""", - ) - self.client.move_folder( - options=MoveFolderRequestOptions( - source_folder_path="/test", destination_path="/test1" - ) - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual( - "No files & folder found at sourceFolderPath /test", e.message - ) - self.assertEqual(404, e.response_metadata.http_status_code) - self.assertEqual("NO_FILES_FOLDER", e.response_metadata.raw["reason"]) - - @responses.activate - def test_move_folder_succeeds(self): - """ - Tests if Move folder succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/moveFolder".format(URL.API_BASE_URL) - responses.add( - responses.POST, - url, - body='{"jobId": "62de84fb1b02a58936cc740c"}', - ) - resp = self.client.move_folder( - options=MoveFolderRequestOptions( - source_folder_path="/test", destination_path="/test1" - ) - ) - mock_response_metadata = { - "headers": {"Content-Type": "text/plain"}, - "httpStatusCode": 200, - "raw": {"jobId": "62de84fb1b02a58936cc740c"}, - } - request_body = json.dumps( - json.loads( - """{ - "sourceFolderPath": "/test", - "destinationPath": "/test1" - }""" - ) - ) - self.assertEqual("62de84fb1b02a58936cc740c", resp.job_id) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/bulkJobs/moveFolder", responses.calls[0].request.url - ) - self.assertEqual(request_body, responses.calls[0].request.body) - - -class TestGetBulkJobStatus(ClientTestCase): - """ - TestGetBulkJobStatus class used to get bulk job status - """ - - job_id = "mock_job_id" - - @responses.activate - def test_get_bulk_job_status_fails_with_500(self): - """ - Tests if get_bulk_job_status succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/{}".format(URL.API_BASE_URL, self.job_id) - try: - responses.add( - responses.GET, - url, - status=500, - body="""{"message": "We have experienced an internal error while processing your request.", - "help": "For support kindly contact us at support@imagekit.io ."}""", - ) - self.client.get_bulk_job_status(self.job_id) - self.assertRaises(InternalServerException) - except InternalServerException as e: - self.assertEqual( - "We have experienced an internal error while processing your request.", - e.message, - ) - self.assertEqual(500, e.response_metadata.http_status_code) - - @responses.activate - def test_get_bulk_job_status_succeeds(self): - """ - Tests if get_bulk_job_status succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/bulkJobs/{}".format(URL.API_BASE_URL, self.job_id) - headers = create_headers_for_test() - responses.add( - responses.GET, - url, - body="""{ - "jobId": "mock_job_id", - "type": "COPY_FOLDER", - "status": "Completed" - }""", - headers=headers, - ) - resp = self.client.get_bulk_job_status(self.job_id) - - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain", - "Accept-Encoding": "gzip, deflate", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": { - "jobId": "mock_job_id", - "status": "Completed", - "type": "COPY_FOLDER", - }, - } - - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual("mock_job_id", resp.job_id) - self.assertEqual("Completed", resp.status) - self.assertEqual("COPY_FOLDER", resp.type) - self.assertEqual( - "http://test.com/v1/bulkJobs/mock_job_id", responses.calls[0].request.url - ) diff --git a/tests/test_generate_url.py b/tests/test_generate_url.py deleted file mode 100644 index 29e18ff..0000000 --- a/tests/test_generate_url.py +++ /dev/null @@ -1,512 +0,0 @@ -import unittest - -from imagekitio.client import ImageKit -from imagekitio.constants.defaults import Default -from imagekitio.url import Url - -class TestGenerateURL(unittest.TestCase): - def setUp(self) -> None: - self.client = ImageKit( - private_key="private_key_test", - public_key="public_key_test", - url_endpoint="https://test-domain.com/test-endpoint", - ) - def test_generate_url_with_path(self): - options = { - "path": "/default-image.jpg", - "transformation": [{"height": "300", "width": "400"}], - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/tr:h-300,w-400/default-image.jpg", - ) - def test_generate_url_with_path_with_ik_attachment(self): - options = { - "path": "/default-image.jpg", - "transformation": [{"height": "300", "width": "400"}], - "query_parameters": { - "ik-attachment":True - }, - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/tr:h-300,w-400/default-image.jpg?ik-attachment=true", - ) - - def test_generate_url_With_path_with_transformation_raw(self): - options = { - "path": "/default-image.jpg", - "transformation": [{"raw":"f-auto","height": "300", "width": "400"}], - - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/tr:f-auto,h-300,w-400/default-image.jpg", - ) - - def test_overriding_url_endpoint_generation_consists_new_url(self): - """ - Overriding urlEndpoint parameter. Passing a urlEndpoint value which is - different from what I've used during SDK initialization and see if the url - returned is using this new parameter - """ - options = { - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/new/endpoint/", - "transformation": [{"height": "300", "width": "400"}], - } - - url = self.client.url(options) - self.assertEqual( - url, "https://ik.imagekit.io/new/endpoint/tr:h-300,w-400/default-image.jpg" - ) - - def test_generate_url_query_parameters(self): - options = { - "path": "/default-image.jpg", - "query_parameters": {"param1": "value1", "param2": "value2"}, - "transformation": [{"height": "300", "width": "400"}], - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/tr:h-300,w-400/default-image.jpg?param1=value1¶m2=value2", - ) - - def test_generate_url_with_src(self): - options = { - "src": "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg", - "transformation": [ - { - "height": "300", - "width": "400", - "format": "jpg", - "progressive": "true", - "effect_contrast": "1", - "raw": "ar-4-3,q-40", - }, - {"rotation": 90}, - ], - } - url = self.client.url(options) - self.assertEqual( - url, - "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?tr=h-300%2Cw-400%2Cf-jpg%2Cpr-true%2Ce-contrast-1" - "%2Car-4-3%2Cq-40%3Art-90", - ) - - def test_generate_url_with_src_with_query_params_double(self): - options = { - "src": "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?queryparam1=value1", - "query_parameters": {"param1": "value1"}, - "transformation": [ - { - "height": "300", - "width": "400", - "format": "jpg", - "progressive": "true", - "effect_contrast": "1", - }, - {"rotation": 90}, - ], - } - url = self.client.url(options) - # @TODO - adjust value of param1=value1 in test case but it should be there - self.assertEqual( - url, - "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?queryparam1=value1¶m1=value1&tr=h-300%2Cw-400" - "%2Cf-jpg%2Cpr-true%2Ce-contrast-1%3Art-90", - ) - - def test_generate_url_with_path_and_signed(self): - options = { - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{"height": "300", "width": "400"}], - "signed": True, - } - - url = self.client.url(options) - self.assertIsNot(url, "") - self.assertIn(options["url_endpoint"], url) - self.assertIn("300", url) - self.assertIn("300", url) - - self.assertNotIn("&&", url) - self.assertNotIn("??", url) - - url = self.client.url(options) - self.assertEqual(url.split("default-image.jpg")[1][:1], "?") - self.assertNotEqual(url.split("default-image.jpg")[0][-2:], "//") - - def test_generate_url_with_path_and_signed_in_proper_form(self): - """ - Check path param url generation doesn't contain double slash - """ - options = { - "path": "/test-signed-url.jpg", - "signed": True, - "transformation": [{"width": 100}], - } - - url = self.client.url(options) - self.assertIn(Default.SIGNATURE_PARAMETER.value, url) - - def test_generate_url_signed_without_expiry_does_not_have_timestamp_parameter(self): - """ - Check query params does not contain timestamp parameter if expire_seconds isn't specified. - """ - options = { - "path": "/test-signed-url.jpg", - "signed": True, - "transformation": [{"width": 100}], - } - - url = self.client.url(options) - self.assertNotIn(Default.TIMESTAMP_PARAMETER.value, url) - - def test_url_with_new_transformation_returns_as_it_is(self): - options = { - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{"height": "300", "fake_xxxx": "400"}], - "transformation_position": "query", - } - - url = self.client.url(options) - self.assertIn("fake_xxxx", url) - self.assertEqual( - url, - "https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=h-300%2Cfake_xxxx-400", - ) - - def test_query_url_generation_transformation_as_query_and_transformations_in_url( - self, - ): - options = { - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{"height": "300"}], - "transformation_position": "query", - } - - url = self.client.url(options) - self.assertEqual( - url, - "https://ik.imagekit.io/your_imagekit_id/endpoint/default-image.jpg?tr=h-300", - ) - - def test_generate_url_with_chained_transformations(self): - options = { - "src": "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg", - "transformation": [ - { - "height": "300", - "width": "400", - "format": "jpg", - "progressive": "true", - "effect_contrast": "1", - }, - {"rotation": 90}, - ], - } - url = self.client.url(options) - self.assertEqual( - url, - "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?tr=h-300%2Cw-400%2Cf-jpg%2Cpr-true%2Ce-contrast-1" - "%3Art-90", - ) - - def test_url_check_query_param_are_added_correctly(self): - options = { - "path": "/default-image.jpg?client=123&user=5", - "transformation": [{"height": "300", "width": "400"}], - "transformation_position": "query", - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/default-image.jpg?client=123&user=5&tr=h-300%2Cw-400", - ) - - def test_generate_url_with_src_query_parameters_merge_correctly(self): - options = { - "src": "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?client=123&ab=c", - "transformation": [ - { - "height": "300", - "width": "400", - "format": "jpg", - "progressive": "true", - "effect_contrast": "1", - }, - {"rotation": 90}, - ], - } - url = self.client.url(options) - self.assertEqual( - url, - "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?client=123&ab=c&tr=h-300%2Cw-400%2Cf-jpg%2Cpr-true" - "%2Ce-contrast-1%3Art-90", - ) - - def test_generate_url_with_src_and_transformation_position_path(self): - options = { - "src": "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg", - "transformation": [ - { - "height": "300", - "width": "400", - "format": "jpg", - "progressive": "true", - "effect_contrast": "1", - }, - {"rotation": 90}, - ], - "transformation_position": "path", - } - url = self.client.url(options) - self.assertEqual( - url, - "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg?tr=h-300%2Cw-400%2Cf-jpg%2Cpr-true%2Ce-contrast-1%3Art-90", - ) - - def test_url_with_invalid_trans_pos(self): - options = { - "path": "/default-image.jpg", - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{"height": "300", "width": "400"}], - "signed": True, - "transformation_position": "fake", - } - self.assertRaises((KeyError, ValueError), self.client.url, options) - - def test_url_without_path_and_src(self): - options = { - "url_endpoint": "https://ik.imagekit.io/your_imagekit_id/endpoint/", - "transformation": [{"height": "300", "width": "400"}], - "signed": True, - } - self.assertEqual(self.client.url(options), "") - - def test_url_contains_slash_if_transformation_position_is_path(self): - options = { - "path": "/default-image.jpg", - "transformation": [ - { - "height": "300", - "width": "400", - "format": "jpg", - "progressive": "true", - "effect_sharpen": "-", - "effect_contrast": "1", - }, - {"rotation": 90}, - ], - "transformation_position": "path", - } - url = self.client.url(options) - self.assertEqual(url.split("tr:h-300")[0][-1], "/") - self.assertNotEqual(url.split("default-image.jpg")[0][-2:], "//") - - def test_url_signed_with_expire_in_seconds(self): - options = { - "path": "/default-image.jpg", - "transformation": [ - { - "width": "400", - }, - ], - "signed": True, - "expire_seconds": 100, - } - url = self.client.url(options) - self.assertIn("ik-t", url) - - def test_url_signed_with_diacritic_in_filename(self): - url = "https://test-domain.com/test-endpoint/test_é_path_alt.jpg" - encodedUrl = Url.encode_string_if_required(url) - self.assertEqual( - encodedUrl, - "https://test-domain.com/test-endpoint/test_%C3%A9_path_alt.jpg", - ) - signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999) - options = { - "path": "/test_é_path_alt.jpg", - "signed": True, - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/test_é_path_alt.jpg?ik-s="+signature, - ) - - def test_url_signed_with_diacritic_in_filename_and_path(self): - url = "https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg" - encodedUrl = Url.encode_string_if_required(url) - self.assertEqual( - encodedUrl, - "https://test-domain.com/test-endpoint/a%C3%A9b/test_%C3%A9_path_alt.jpg", - ) - signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999) - options = { - "path": "/aéb/test_é_path_alt.jpg", - "signed": True, - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg?ik-s="+signature, - ) - - def test_url_signed_with_diacritic_in_filename_path_transforamtion_in_path(self): - url = "https://test-domain.com/test-endpoint/tr:l-text,i-Imagekité,fs-50,l-end/aéb/test_é_path_alt.jpg" - encodedUrl = Url.encode_string_if_required(url) - self.assertEqual( - encodedUrl, - "https://test-domain.com/test-endpoint/tr:l-text,i-Imagekit%C3%A9,fs-50,l-end/a%C3%A9b/test_%C3%A9_path_alt.jpg", - ) - signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999) - options = { - "path": "/aéb/test_é_path_alt.jpg", - "transformation": [ - { - "raw": "l-text,i-Imagekité,fs-50,l-end" - }, - ], - "signed": True, - "transformation_position": "path" - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/tr:l-text,i-Imagekité,fs-50,l-end/aéb/test_é_path_alt.jpg?ik-s="+signature, - ) - - def test_url_signed_with_diacritic_in_filename_path_transforamtion_in_query(self): - url = "https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg?tr=l-text%2Ci-Imagekit%C3%A9%2Cfs-50%2Cl-end" - encodedUrl = Url.encode_string_if_required(url) - self.assertEqual( - encodedUrl, - "https://test-domain.com/test-endpoint/a%C3%A9b/test_%C3%A9_path_alt.jpg?tr=l-text%2Ci-Imagekit%C3%A9%2Cfs-50%2Cl-end", - ) - signature = Url.get_signature("private_key_test", url, "https://test-domain.com/test-endpoint", 9999999999) - options = { - "path": "/aéb/test_é_path_alt.jpg", - "transformation": [ - { - "raw": "l-text,i-Imagekité,fs-50,l-end" - }, - ], - "signed": True, - "transformation_position": "query" - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/aéb/test_é_path_alt.jpg?tr=l-text%2Ci-Imagekit%C3%A9%2Cfs-50%2Cl-end&ik-s="+signature, - ) - - def test_generate_url_with_path_and_src_uses_path(self): - """ - In case when both path and src fields are provided, the `path` should be preferred - """ - options = { - "path": "/default-image.jpg", - "src": "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg", - "transformation": [{"height": "300", "width": "400"}], - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/tr:h-300,w-400/default-image.jpg", - ) - - def test_generate_url_with_all_params(self): - """ - In case where all transformation parameters are passed - """ - options = { - "path": "/test_path.jpg", - "src": "https://ik.imagekit.io/ldt7znpgpjs/test_YhNhoRxWt.jpg", - "transformation": [ - { - "height": 300, - "width": 400, - "aspect_ratio": "4-3", - "quality": 40, - "crop": "force", - "crop_mode": "extract", - "focus": "left", - "format": "jpeg", - "radius": 50, - "bg": "A94D34", - "border": "5-A94D34", - "rotation": 90, - "blur": 10, - "named": "some_name", - "progressive": "true", - "lossless": "true", - "trim": 5, - "metadata": "true", - "color_profile": "true", - "default_image": "folder/file.jpg/", # trailing slash case - "dpr": 3, - "effect_sharpen": 10, - "effect_usm": "2-2-0.8-0.024", - "effect_contrast": "true", - "effect_gray": "true", - "effect_shadow": "bl-15_st-40_x-10_y-N5", - "effect_gradient": "from-red_to-white", - "original": True, # Boolean handling - "raw": "w-200,h-200", - } - ], - } - url = self.client.url(options) - self.assertEqual( - url, - "https://test-domain.com/test-endpoint/tr:h-300,w-400,ar-4-3,q-40,c-force,cm-extract,fo-left,f-jpeg,r-50," - "bg-A94D34,b-5-A94D34,rt-90,bl-10,n-some_name,pr-true,lo-true,t-5,md-true,cp-true,di-folder@@file.jpg,dpr-3,e-sharpen-10,e-usm-2-2-0.8-0.024," - "e-contrast-true,e-grayscale-true,e-shadow-bl-15_st-40_x-10_y-N5,e-gradient-from-red_to-white,orig-true,w-200,h-200/test_path.jpg", - ) - - def test_get_signature_with_100_expire_seconds(self): - url = "https://test-domain.com/test-endpoint/tr:w-100/test-signed-url.png" - signature = self.client.url_obj.get_signature( - "private_key_test", url, "https://test-domain.com/test-endpoint/", 100 - ) - self.assertEqual(signature, "5e5037a31a7121cbe2964e220b4338cc6e1ba66d") - - def test_get_signature_without_expire_seconds(self): - url = "https://test-domain.com/test-endpoint/tr:w-100/test-signed-url.png" - signature = self.client.url_obj.get_signature( - "private_key_test", url, "https://test-domain.com/test-endpoint/", 0 - ) - self.assertEqual(signature, "41b3075c40bc84147eb71b8b49ae7fbf349d0f00") - - def test_get_signature_without_expire_seconds_without_slash(self): - url = "https://test-domain.com/test-endpoint/tr:w-100/test-signed-url.png" - signature = self.client.url_obj.get_signature( - "private_key_test", url, "https://test-domain.com/test-endpoint", 0 - ) - self.assertEqual(signature, "41b3075c40bc84147eb71b8b49ae7fbf349d0f00") - - def test_generate_url_without_transforms(self): - options = {"path": "/coffee.jpg", "signed": False, "expire_seconds": 10} - - url = self.client.url(options) - self.assertEqual(url, "https://test-domain.com/test-endpoint/coffee.jpg") - - def test_generate_url_without_transforms_src(self): - options = { - "src": "https://test-domain.com/test-endpoint/coffee.jpg", - "signed": False, - "expire_seconds": 10, - } - - url = self.client.url(options) - self.assertEqual(url, "https://test-domain.com/test-endpoint/coffee.jpg") diff --git a/tests/test_models.py b/tests/test_models.py new file mode 100644 index 0000000..5203983 --- /dev/null +++ b/tests/test_models.py @@ -0,0 +1,963 @@ +import json +from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast +from datetime import datetime, timezone +from typing_extensions import Literal, Annotated, TypeAliasType + +import pytest +import pydantic +from pydantic import Field + +from imagekit._utils import PropertyInfo +from imagekit._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from imagekit._models import BaseModel, construct_type + + +class BasicModel(BaseModel): + foo: str + + +@pytest.mark.parametrize("value", ["hello", 1], ids=["correct type", "mismatched"]) +def test_basic(value: object) -> None: + m = BasicModel.construct(foo=value) + assert m.foo == value + + +def test_directly_nested_model() -> None: + class NestedModel(BaseModel): + nested: BasicModel + + m = NestedModel.construct(nested={"foo": "Foo!"}) + assert m.nested.foo == "Foo!" + + # mismatched types + m = NestedModel.construct(nested="hello!") + assert cast(Any, m.nested) == "hello!" + + +def test_optional_nested_model() -> None: + class NestedModel(BaseModel): + nested: Optional[BasicModel] + + m1 = NestedModel.construct(nested=None) + assert m1.nested is None + + m2 = NestedModel.construct(nested={"foo": "bar"}) + assert m2.nested is not None + assert m2.nested.foo == "bar" + + # mismatched types + m3 = NestedModel.construct(nested={"foo"}) + assert isinstance(cast(Any, m3.nested), set) + assert cast(Any, m3.nested) == {"foo"} + + +def test_list_nested_model() -> None: + class NestedModel(BaseModel): + nested: List[BasicModel] + + m = NestedModel.construct(nested=[{"foo": "bar"}, {"foo": "2"}]) + assert m.nested is not None + assert isinstance(m.nested, list) + assert len(m.nested) == 2 + assert m.nested[0].foo == "bar" + assert m.nested[1].foo == "2" + + # mismatched types + m = NestedModel.construct(nested=True) + assert cast(Any, m.nested) is True + + m = NestedModel.construct(nested=[False]) + assert cast(Any, m.nested) == [False] + + +def test_optional_list_nested_model() -> None: + class NestedModel(BaseModel): + nested: Optional[List[BasicModel]] + + m1 = NestedModel.construct(nested=[{"foo": "bar"}, {"foo": "2"}]) + assert m1.nested is not None + assert isinstance(m1.nested, list) + assert len(m1.nested) == 2 + assert m1.nested[0].foo == "bar" + assert m1.nested[1].foo == "2" + + m2 = NestedModel.construct(nested=None) + assert m2.nested is None + + # mismatched types + m3 = NestedModel.construct(nested={1}) + assert cast(Any, m3.nested) == {1} + + m4 = NestedModel.construct(nested=[False]) + assert cast(Any, m4.nested) == [False] + + +def test_list_optional_items_nested_model() -> None: + class NestedModel(BaseModel): + nested: List[Optional[BasicModel]] + + m = NestedModel.construct(nested=[None, {"foo": "bar"}]) + assert m.nested is not None + assert isinstance(m.nested, list) + assert len(m.nested) == 2 + assert m.nested[0] is None + assert m.nested[1] is not None + assert m.nested[1].foo == "bar" + + # mismatched types + m3 = NestedModel.construct(nested="foo") + assert cast(Any, m3.nested) == "foo" + + m4 = NestedModel.construct(nested=[False]) + assert cast(Any, m4.nested) == [False] + + +def test_list_mismatched_type() -> None: + class NestedModel(BaseModel): + nested: List[str] + + m = NestedModel.construct(nested=False) + assert cast(Any, m.nested) is False + + +def test_raw_dictionary() -> None: + class NestedModel(BaseModel): + nested: Dict[str, str] + + m = NestedModel.construct(nested={"hello": "world"}) + assert m.nested == {"hello": "world"} + + # mismatched types + m = NestedModel.construct(nested=False) + assert cast(Any, m.nested) is False + + +def test_nested_dictionary_model() -> None: + class NestedModel(BaseModel): + nested: Dict[str, BasicModel] + + m = NestedModel.construct(nested={"hello": {"foo": "bar"}}) + assert isinstance(m.nested, dict) + assert m.nested["hello"].foo == "bar" + + # mismatched types + m = NestedModel.construct(nested={"hello": False}) + assert cast(Any, m.nested["hello"]) is False + + +def test_unknown_fields() -> None: + m1 = BasicModel.construct(foo="foo", unknown=1) + assert m1.foo == "foo" + assert cast(Any, m1).unknown == 1 + + m2 = BasicModel.construct(foo="foo", unknown={"foo_bar": True}) + assert m2.foo == "foo" + assert cast(Any, m2).unknown == {"foo_bar": True} + + assert model_dump(m2) == {"foo": "foo", "unknown": {"foo_bar": True}} + + +def test_strict_validation_unknown_fields() -> None: + class Model(BaseModel): + foo: str + + model = parse_obj(Model, dict(foo="hello!", user="Robert")) + assert model.foo == "hello!" + assert cast(Any, model).user == "Robert" + + assert model_dump(model) == {"foo": "hello!", "user": "Robert"} + + +def test_aliases() -> None: + class Model(BaseModel): + my_field: int = Field(alias="myField") + + m = Model.construct(myField=1) + assert m.my_field == 1 + + # mismatched types + m = Model.construct(myField={"hello": False}) + assert cast(Any, m.my_field) == {"hello": False} + + +def test_repr() -> None: + model = BasicModel(foo="bar") + assert str(model) == "BasicModel(foo='bar')" + assert repr(model) == "BasicModel(foo='bar')" + + +def test_repr_nested_model() -> None: + class Child(BaseModel): + name: str + age: int + + class Parent(BaseModel): + name: str + child: Child + + model = Parent(name="Robert", child=Child(name="Foo", age=5)) + assert str(model) == "Parent(name='Robert', child=Child(name='Foo', age=5))" + assert repr(model) == "Parent(name='Robert', child=Child(name='Foo', age=5))" + + +def test_optional_list() -> None: + class Submodel(BaseModel): + name: str + + class Model(BaseModel): + items: Optional[List[Submodel]] + + m = Model.construct(items=None) + assert m.items is None + + m = Model.construct(items=[]) + assert m.items == [] + + m = Model.construct(items=[{"name": "Robert"}]) + assert m.items is not None + assert len(m.items) == 1 + assert m.items[0].name == "Robert" + + +def test_nested_union_of_models() -> None: + class Submodel1(BaseModel): + bar: bool + + class Submodel2(BaseModel): + thing: str + + class Model(BaseModel): + foo: Union[Submodel1, Submodel2] + + m = Model.construct(foo={"thing": "hello"}) + assert isinstance(m.foo, Submodel2) + assert m.foo.thing == "hello" + + +def test_nested_union_of_mixed_types() -> None: + class Submodel1(BaseModel): + bar: bool + + class Model(BaseModel): + foo: Union[Submodel1, Literal[True], Literal["CARD_HOLDER"]] + + m = Model.construct(foo=True) + assert m.foo is True + + m = Model.construct(foo="CARD_HOLDER") + assert m.foo == "CARD_HOLDER" + + m = Model.construct(foo={"bar": False}) + assert isinstance(m.foo, Submodel1) + assert m.foo.bar is False + + +def test_nested_union_multiple_variants() -> None: + class Submodel1(BaseModel): + bar: bool + + class Submodel2(BaseModel): + thing: str + + class Submodel3(BaseModel): + foo: int + + class Model(BaseModel): + foo: Union[Submodel1, Submodel2, None, Submodel3] + + m = Model.construct(foo={"thing": "hello"}) + assert isinstance(m.foo, Submodel2) + assert m.foo.thing == "hello" + + m = Model.construct(foo=None) + assert m.foo is None + + m = Model.construct() + assert m.foo is None + + m = Model.construct(foo={"foo": "1"}) + assert isinstance(m.foo, Submodel3) + assert m.foo.foo == 1 + + +def test_nested_union_invalid_data() -> None: + class Submodel1(BaseModel): + level: int + + class Submodel2(BaseModel): + name: str + + class Model(BaseModel): + foo: Union[Submodel1, Submodel2] + + m = Model.construct(foo=True) + assert cast(bool, m.foo) is True + + m = Model.construct(foo={"name": 3}) + if PYDANTIC_V2: + assert isinstance(m.foo, Submodel1) + assert m.foo.name == 3 # type: ignore + else: + assert isinstance(m.foo, Submodel2) + assert m.foo.name == "3" + + +def test_list_of_unions() -> None: + class Submodel1(BaseModel): + level: int + + class Submodel2(BaseModel): + name: str + + class Model(BaseModel): + items: List[Union[Submodel1, Submodel2]] + + m = Model.construct(items=[{"level": 1}, {"name": "Robert"}]) + assert len(m.items) == 2 + assert isinstance(m.items[0], Submodel1) + assert m.items[0].level == 1 + assert isinstance(m.items[1], Submodel2) + assert m.items[1].name == "Robert" + + m = Model.construct(items=[{"level": -1}, 156]) + assert len(m.items) == 2 + assert isinstance(m.items[0], Submodel1) + assert m.items[0].level == -1 + assert cast(Any, m.items[1]) == 156 + + +def test_union_of_lists() -> None: + class SubModel1(BaseModel): + level: int + + class SubModel2(BaseModel): + name: str + + class Model(BaseModel): + items: Union[List[SubModel1], List[SubModel2]] + + # with one valid entry + m = Model.construct(items=[{"name": "Robert"}]) + assert len(m.items) == 1 + assert isinstance(m.items[0], SubModel2) + assert m.items[0].name == "Robert" + + # with two entries pointing to different types + m = Model.construct(items=[{"level": 1}, {"name": "Robert"}]) + assert len(m.items) == 2 + assert isinstance(m.items[0], SubModel1) + assert m.items[0].level == 1 + assert isinstance(m.items[1], SubModel1) + assert cast(Any, m.items[1]).name == "Robert" + + # with two entries pointing to *completely* different types + m = Model.construct(items=[{"level": -1}, 156]) + assert len(m.items) == 2 + assert isinstance(m.items[0], SubModel1) + assert m.items[0].level == -1 + assert cast(Any, m.items[1]) == 156 + + +def test_dict_of_union() -> None: + class SubModel1(BaseModel): + name: str + + class SubModel2(BaseModel): + foo: str + + class Model(BaseModel): + data: Dict[str, Union[SubModel1, SubModel2]] + + m = Model.construct(data={"hello": {"name": "there"}, "foo": {"foo": "bar"}}) + assert len(list(m.data.keys())) == 2 + assert isinstance(m.data["hello"], SubModel1) + assert m.data["hello"].name == "there" + assert isinstance(m.data["foo"], SubModel2) + assert m.data["foo"].foo == "bar" + + # TODO: test mismatched type + + +def test_double_nested_union() -> None: + class SubModel1(BaseModel): + name: str + + class SubModel2(BaseModel): + bar: str + + class Model(BaseModel): + data: Dict[str, List[Union[SubModel1, SubModel2]]] + + m = Model.construct(data={"foo": [{"bar": "baz"}, {"name": "Robert"}]}) + assert len(m.data["foo"]) == 2 + + entry1 = m.data["foo"][0] + assert isinstance(entry1, SubModel2) + assert entry1.bar == "baz" + + entry2 = m.data["foo"][1] + assert isinstance(entry2, SubModel1) + assert entry2.name == "Robert" + + # TODO: test mismatched type + + +def test_union_of_dict() -> None: + class SubModel1(BaseModel): + name: str + + class SubModel2(BaseModel): + foo: str + + class Model(BaseModel): + data: Union[Dict[str, SubModel1], Dict[str, SubModel2]] + + m = Model.construct(data={"hello": {"name": "there"}, "foo": {"foo": "bar"}}) + assert len(list(m.data.keys())) == 2 + assert isinstance(m.data["hello"], SubModel1) + assert m.data["hello"].name == "there" + assert isinstance(m.data["foo"], SubModel1) + assert cast(Any, m.data["foo"]).foo == "bar" + + +def test_iso8601_datetime() -> None: + class Model(BaseModel): + created_at: datetime + + expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) + + if PYDANTIC_V2: + expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' + else: + expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' + + model = Model.construct(created_at="2019-12-27T18:11:19.117Z") + assert model.created_at == expected + assert model_json(model) == expected_json + + model = parse_obj(Model, dict(created_at="2019-12-27T18:11:19.117Z")) + assert model.created_at == expected + assert model_json(model) == expected_json + + +def test_does_not_coerce_int() -> None: + class Model(BaseModel): + bar: int + + assert Model.construct(bar=1).bar == 1 + assert Model.construct(bar=10.9).bar == 10.9 + assert Model.construct(bar="19").bar == "19" # type: ignore[comparison-overlap] + assert Model.construct(bar=False).bar is False + + +def test_int_to_float_safe_conversion() -> None: + class Model(BaseModel): + float_field: float + + m = Model.construct(float_field=10) + assert m.float_field == 10.0 + assert isinstance(m.float_field, float) + + m = Model.construct(float_field=10.12) + assert m.float_field == 10.12 + assert isinstance(m.float_field, float) + + # number too big + m = Model.construct(float_field=2**53 + 1) + assert m.float_field == 2**53 + 1 + assert isinstance(m.float_field, int) + + +def test_deprecated_alias() -> None: + class Model(BaseModel): + resource_id: str = Field(alias="model_id") + + @property + def model_id(self) -> str: + return self.resource_id + + m = Model.construct(model_id="id") + assert m.model_id == "id" + assert m.resource_id == "id" + assert m.resource_id is m.model_id + + m = parse_obj(Model, {"model_id": "id"}) + assert m.model_id == "id" + assert m.resource_id == "id" + assert m.resource_id is m.model_id + + +def test_omitted_fields() -> None: + class Model(BaseModel): + resource_id: Optional[str] = None + + m = Model.construct() + assert m.resource_id is None + assert "resource_id" not in m.model_fields_set + + m = Model.construct(resource_id=None) + assert m.resource_id is None + assert "resource_id" in m.model_fields_set + + m = Model.construct(resource_id="foo") + assert m.resource_id == "foo" + assert "resource_id" in m.model_fields_set + + +def test_to_dict() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert m.to_dict() == {"FOO": "hello"} + assert m.to_dict(use_api_names=False) == {"foo": "hello"} + + m2 = Model() + assert m2.to_dict() == {} + assert m2.to_dict(exclude_unset=False) == {"FOO": None} + assert m2.to_dict(exclude_unset=False, exclude_none=True) == {} + assert m2.to_dict(exclude_unset=False, exclude_defaults=True) == {} + + m3 = Model(FOO=None) + assert m3.to_dict() == {"FOO": None} + assert m3.to_dict(exclude_none=True) == {} + assert m3.to_dict(exclude_defaults=True) == {} + + class Model2(BaseModel): + created_at: datetime + + time_str = "2024-03-21T11:39:01.275859" + m4 = Model2.construct(created_at=time_str) + assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} + assert m4.to_dict(mode="json") == {"created_at": time_str} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_dict(warnings=False) + + +def test_forwards_compat_model_dump_method() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert m.model_dump() == {"foo": "hello"} + assert m.model_dump(include={"bar"}) == {} + assert m.model_dump(exclude={"foo"}) == {} + assert m.model_dump(by_alias=True) == {"FOO": "hello"} + + m2 = Model() + assert m2.model_dump() == {"foo": None} + assert m2.model_dump(exclude_unset=True) == {} + assert m2.model_dump(exclude_none=True) == {} + assert m2.model_dump(exclude_defaults=True) == {} + + m3 = Model(FOO=None) + assert m3.model_dump() == {"foo": None} + assert m3.model_dump(exclude_none=True) == {} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): + m.model_dump(round_trip=True) + + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.model_dump(warnings=False) + + +def test_compat_method_no_error_for_warnings() -> None: + class Model(BaseModel): + foo: Optional[str] + + m = Model(foo="hello") + assert isinstance(model_dump(m, warnings=False), dict) + + +def test_to_json() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert json.loads(m.to_json()) == {"FOO": "hello"} + assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} + + if PYDANTIC_V2: + assert m.to_json(indent=None) == '{"FOO":"hello"}' + else: + assert m.to_json(indent=None) == '{"FOO": "hello"}' + + m2 = Model() + assert json.loads(m2.to_json()) == {} + assert json.loads(m2.to_json(exclude_unset=False)) == {"FOO": None} + assert json.loads(m2.to_json(exclude_unset=False, exclude_none=True)) == {} + assert json.loads(m2.to_json(exclude_unset=False, exclude_defaults=True)) == {} + + m3 = Model(FOO=None) + assert json.loads(m3.to_json()) == {"FOO": None} + assert json.loads(m3.to_json(exclude_none=True)) == {} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_json(warnings=False) + + +def test_forwards_compat_model_dump_json_method() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert json.loads(m.model_dump_json()) == {"foo": "hello"} + assert json.loads(m.model_dump_json(include={"bar"})) == {} + assert json.loads(m.model_dump_json(include={"foo"})) == {"foo": "hello"} + assert json.loads(m.model_dump_json(by_alias=True)) == {"FOO": "hello"} + + assert m.model_dump_json(indent=2) == '{\n "foo": "hello"\n}' + + m2 = Model() + assert json.loads(m2.model_dump_json()) == {"foo": None} + assert json.loads(m2.model_dump_json(exclude_unset=True)) == {} + assert json.loads(m2.model_dump_json(exclude_none=True)) == {} + assert json.loads(m2.model_dump_json(exclude_defaults=True)) == {} + + m3 = Model(FOO=None) + assert json.loads(m3.model_dump_json()) == {"foo": None} + assert json.loads(m3.model_dump_json(exclude_none=True)) == {} + + if not PYDANTIC_V2: + with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): + m.model_dump_json(round_trip=True) + + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.model_dump_json(warnings=False) + + +def test_type_compat() -> None: + # our model type can be assigned to Pydantic's model type + + def takes_pydantic(model: pydantic.BaseModel) -> None: # noqa: ARG001 + ... + + class OurModel(BaseModel): + foo: Optional[str] = None + + takes_pydantic(OurModel()) + + +def test_annotated_types() -> None: + class Model(BaseModel): + value: str + + m = construct_type( + value={"value": "foo"}, + type_=cast(Any, Annotated[Model, "random metadata"]), + ) + assert isinstance(m, Model) + assert m.value == "foo" + + +def test_discriminated_unions_invalid_data() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + m = construct_type( + value={"type": "b", "data": "foo"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + m = construct_type( + value={"type": "a", "data": 100}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, A) + assert m.type == "a" + if PYDANTIC_V2: + assert m.data == 100 # type: ignore[comparison-overlap] + else: + # pydantic v1 automatically converts inputs to strings + # if the expected type is a str + assert m.data == "100" + + +def test_discriminated_unions_unknown_variant() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + m = construct_type( + value={"type": "c", "data": None, "new_thing": "bar"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + + # just chooses the first variant + assert isinstance(m, A) + assert m.type == "c" # type: ignore[comparison-overlap] + assert m.data == None # type: ignore[unreachable] + assert m.new_thing == "bar" + + +def test_discriminated_unions_invalid_data_nested_unions() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + class C(BaseModel): + type: Literal["c"] + + data: bool + + m = construct_type( + value={"type": "b", "data": "foo"}, + type_=cast(Any, Annotated[Union[Union[A, B], C], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + m = construct_type( + value={"type": "c", "data": "foo"}, + type_=cast(Any, Annotated[Union[Union[A, B], C], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, C) + assert m.type == "c" + assert m.data == "foo" # type: ignore[comparison-overlap] + + +def test_discriminated_unions_with_aliases_invalid_data() -> None: + class A(BaseModel): + foo_type: Literal["a"] = Field(alias="type") + + data: str + + class B(BaseModel): + foo_type: Literal["b"] = Field(alias="type") + + data: int + + m = construct_type( + value={"type": "b", "data": "foo"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="foo_type")]), + ) + assert isinstance(m, B) + assert m.foo_type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + m = construct_type( + value={"type": "a", "data": 100}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="foo_type")]), + ) + assert isinstance(m, A) + assert m.foo_type == "a" + if PYDANTIC_V2: + assert m.data == 100 # type: ignore[comparison-overlap] + else: + # pydantic v1 automatically converts inputs to strings + # if the expected type is a str + assert m.data == "100" + + +def test_discriminated_unions_overlapping_discriminators_invalid_data() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["a"] + + data: int + + m = construct_type( + value={"type": "a", "data": "foo"}, + type_=cast(Any, Annotated[Union[A, B], PropertyInfo(discriminator="type")]), + ) + assert isinstance(m, B) + assert m.type == "a" + assert m.data == "foo" # type: ignore[comparison-overlap] + + +def test_discriminated_unions_invalid_data_uses_cache() -> None: + class A(BaseModel): + type: Literal["a"] + + data: str + + class B(BaseModel): + type: Literal["b"] + + data: int + + UnionType = cast(Any, Union[A, B]) + + assert not hasattr(UnionType, "__discriminator__") + + m = construct_type( + value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + discriminator = UnionType.__discriminator__ + assert discriminator is not None + + m = construct_type( + value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) + ) + assert isinstance(m, B) + assert m.type == "b" + assert m.data == "foo" # type: ignore[comparison-overlap] + + # if the discriminator details object stays the same between invocations then + # we hit the cache + assert UnionType.__discriminator__ is discriminator + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +def test_type_alias_type() -> None: + Alias = TypeAliasType("Alias", str) # pyright: ignore + + class Model(BaseModel): + alias: Alias + union: Union[int, Alias] + + m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.alias, str) + assert m.alias == "foo" + assert isinstance(m.union, str) + assert m.union == "bar" + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +def test_field_named_cls() -> None: + class Model(BaseModel): + cls: str + + m = construct_type(value={"cls": "foo"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.cls, str) + + +def test_discriminated_union_case() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["b"] + + data: List[Union[A, object]] + + class ModelA(BaseModel): + type: Literal["modelA"] + + data: int + + class ModelB(BaseModel): + type: Literal["modelB"] + + required: str + + data: Union[A, B] + + # when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required` + m = construct_type( + value={"type": "modelB", "data": {"type": "a", "data": True}}, + type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]), + ) + + assert isinstance(m, ModelB) + + +def test_nested_discriminated_union() -> None: + class InnerType1(BaseModel): + type: Literal["type_1"] + + class InnerModel(BaseModel): + inner_value: str + + class InnerType2(BaseModel): + type: Literal["type_2"] + some_inner_model: InnerModel + + class Type1(BaseModel): + base_type: Literal["base_type_1"] + value: Annotated[ + Union[ + InnerType1, + InnerType2, + ], + PropertyInfo(discriminator="type"), + ] + + class Type2(BaseModel): + base_type: Literal["base_type_2"] + + T = Annotated[ + Union[ + Type1, + Type2, + ], + PropertyInfo(discriminator="base_type"), + ] + + model = construct_type( + type_=T, + value={ + "base_type": "base_type_1", + "value": { + "type": "type_2", + }, + }, + ) + assert isinstance(model, Type1) + assert isinstance(model.value, InnerType2) + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +def test_extra_properties() -> None: + class Item(BaseModel): + prop: int + + class Model(BaseModel): + __pydantic_extra__: Dict[str, Item] = Field(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + other: str + + if TYPE_CHECKING: + + def __getattr__(self, attr: str) -> Item: ... + + model = construct_type( + type_=Model, + value={ + "a": {"prop": 1}, + "other": "foo", + }, + ) + assert isinstance(model, Model) + assert model.a.prop == 1 + assert isinstance(model.a, Item) + assert model.other == "foo" diff --git a/tests/test_models_results.py b/tests/test_models_results.py deleted file mode 100644 index 0b242ff..0000000 --- a/tests/test_models_results.py +++ /dev/null @@ -1,257 +0,0 @@ -import unittest - -from imagekitio.utils.utils import convert_to_response_object -from imagekitio.models.results.UploadFileResult import UploadFileResult -from imagekitio.models.results.EmbeddedMetadata import EmbeddedMetadata -from imagekitio.models.results.ResponseMetadata import ResponseMetadata -from imagekitio.models.results.VersionInfo import VersionInfo -from imagekitio.models.results.TagsResult import TagsResult -from imagekitio.models.results.MetadataExifThumbnail import MetadataExifThumbnail -from imagekitio.models.results.MetadataExifImage import MetadataExifImage -from imagekitio.models.results.MetadataExifGPS import MetadataExifGPS -from imagekitio.models.results.MetadataExifExif import MetadataExifExif -from imagekitio.models.results.MetadataExif import MetadataExif -from imagekitio.models.results.GetMetadataResult import GetMetadataResult -from imagekitio.models.results.GetBulkJobStatusResult import GetBulkJobStatusResult -from imagekitio.models.results.FolderResult import FolderResult -from imagekitio.models.results.FileResultWithResponseMetadata import FileResultWithResponseMetadata -from imagekitio.models.results.FileResult import FileResult -from imagekitio.models.results.CustomMetadataFieldsResult import CustomMetadataFieldsResult -from imagekitio.models.results.CustomMetadataFieldsResultWithResponseMetadata import CustomMetadataFieldsResultWithResponseMetadata -from imagekitio.models.results.CustomMetadataSchema import CustomMetadataSchema -from imagekitio.models.results.BulkDeleteFileResult import BulkDeleteFileResult -from imagekitio.models.results.AITags import AITags -from imagekitio.models.results.MetadataExifInteroperability import MetadataExifInteroperability - - -from requests.models import Response - -import responses - - -gps = { - "GPSVersionId":"1.2" -} -thumbnail ={ - "compression":12, - "YResolution":1, - "XResolution":1, - "resolutionUnit":"DPI", - "thumbnailOffset":12, - "thumbnailLength":12, -} -interoperability = { - "interopVersion":1.1, - "interopIndex":1.2 -} -image = { - "make":None, - "model":None, - "orientation":None, - "XResolution":None, - "YResolution":None, - "resolutionUnit":None, - "software":None, - "modifyDate":None, - "YCbCrPositioning":None, - "exifOffset":None, - "gpsInfo":None, -} -exif = { - "exposureTime":10, - "FNumber":1, - "exposureProgram":None, - "ISO":"2001", - "exifVersion":1.2, - "dateTimeOriginal":None, - "createDate":None, - "shutterSpeedValue":122, - "apertureValue":12, - "exposureCompensation":12, - "meteringMode":None, - "flash":"white", - "focalLength":None, - "subSecTime":None, - "subSecTimeOriginal":None, - "subSecTimeDigitized":None, - "flashpixVersion":None, - "colorSpace":None, - "exifImageWidth":None, - "exifImageHeight":None, - "interopOffset":None, - "focalPlaneXResolution":None, - "focalPlaneYResolution":None, - "focalPlaneResolutionUnit":None, - "customRendered":None, - "exposureMode":None, - "whiteBalance":None, - "sceneCaptureType":None, -} -class TestModelsResults(unittest.TestCase): - - @responses.activate() - def test_models_results_embedded_metadata_with_variable_attributes(self): - withVariableAttributes = EmbeddedMetadata(12,12,dpi=14) - - self.assertEqual(withVariableAttributes.x_resolution,12) - self.assertEqual(withVariableAttributes.y_resolution,12) - self.assertEqual(withVariableAttributes.date_created,None) - self.assertEqual(withVariableAttributes.date_time_created,None) - self.assertEqual(withVariableAttributes.dpi,14) - self.assertEqual(withVariableAttributes.make,None) - - def test_models_results_response_metadata_with_variable_attributes(self): - meta = ResponseMetadata(None,200,None,message="Successfully Done") - - self.assertEqual(meta.raw,None) - self.assertEqual(meta.http_status_code,200) - self.assertEqual(meta.headers,None) - self.assertEqual(meta.message,"Successfully Done") - self.assertEqual(meta.a,None) - - def test_models_results_version_info_with_variable_attributes(self): - vi = VersionInfo(123,"0.1.12",description="Testing Purpose") - - self.assertEqual(vi.id,123) - self.assertEqual(vi.name,"0.1.12") - self.assertEqual(vi.description,"Testing Purpose") - self.assertEqual(vi.random,None) - - def test_models_results_tags_result_with_variable_attributes(self): - tr = TagsResult(successfully_updated_file_ids=None,random1="123") - - self.assertEqual(tr.successfully_updated_file_ids,None) - self.assertEqual(tr.random1,"123") - self.assertEqual(tr.random2,None) - - def test_models_results_metadata_exif_thumbnail_with_variable_attributes(self): - met = MetadataExifThumbnail(None,12,12,None,1,200,name="Thumbnail1",) - - self.assertEqual(met.compression,None) - self.assertEqual(met.x_resolution,12) - self.assertEqual(met.y_resolution,12) - self.assertEqual(met.resolution_unit,None) - self.assertEqual(met.thumbnail_offset,1) - self.assertEqual(met.thumbnail_length,200) - self.assertEqual(met.name,"Thumbnail1") - self.assertEqual(met.random,None) - - - def test_models_results_metadata_exif_image_with_variable_attributes(self): - mei = MetadataExifImage(software="picasso",name="Image1") - - self.assertEqual(mei.software,"picasso") - self.assertEqual(mei.name,"Image1") - self.assertEqual(mei.random,None) - - def test_models_results_metadata_exif_gps_with_variable_attributes(self): - meg = MetadataExifGPS("0.1",longitude="12124.4124",latitude="121523.12312") - - self.assertEqual(meg.gps_version_id,["0",".","1"]) - self.assertEqual(meg.longitude,"12124.4124") - self.assertEqual(meg.latitude,"121523.12312") - self.assertEqual(meg.random,None) - - def test_models_results_metadata_exif_exif_with_variable_attributes(self): - mee = MetadataExifExif(12,shutter_speed_value=120,camera_model="canon x") - - self.assertEqual(mee.exposure_time,12) - self.assertEqual(mee.shutter_speed_value,120) - self.assertEqual(mee.camera_model,"canon x") - self.assertEqual(mee.random,None) - - def test_models_results_metadata_exif_with_variable_attributes(self): - me = MetadataExif(gps=MetadataExifGPS("0.9"),name="exif") - - self.assertEqual(me.gps.gps_version_id,["0",".","9"]) - self.assertEqual(me.name,"exif") - self.assertEqual(me.random,None) - - def test_models_results_get_metadata_result_with_variable_attributes(self): - getMetadataResult = GetMetadataResult(height=100,width=100,device="canon") - - self.assertEqual(getMetadataResult.width,100) - self.assertEqual(getMetadataResult.height,100) - self.assertEqual(getMetadataResult.device,"canon") - self.assertEqual(getMetadataResult.random,None) - - def test_models_results_get_bulk_job_status_result_with_variable_attributes(self): - getBulkJobStatusResult = GetBulkJobStatusResult(job_id="123",type="jpg",status="active",num_job=2) - - self.assertEqual(getBulkJobStatusResult.job_id,"123") - self.assertEqual(getBulkJobStatusResult.type,"jpg") - self.assertEqual(getBulkJobStatusResult.status,"active") - self.assertEqual(getBulkJobStatusResult.num_job,2) - self.assertEqual(getBulkJobStatusResult.random,None) - - def test_folder_results_folder_result_with_variable_attributes(self): - folderResult = FolderResult("123",address="/abc/home") - - self.assertEqual(folderResult.job_id,"123") - self.assertEqual(folderResult.address,"/abc/home") - self.assertEqual(folderResult.random,None) - - def test_file_result_with_response_metadata_with_variable_attributes(self): - fileResultWithResponseMetadata = FileResultWithResponseMetadata("jpg",name="abc",file_health="healthy") - self.assertEqual(fileResultWithResponseMetadata.type,"jpg") - self.assertEqual(fileResultWithResponseMetadata.name,"abc") - self.assertEqual(fileResultWithResponseMetadata.file_health,"healthy") - self.assertEqual(fileResultWithResponseMetadata.random,None) - - def test_file_result_with_variable_attributes(self): - fileResult = FileResult("jpg",name="abc",file_health="healthy") - - self.assertEqual(fileResult.type,"jpg") - self.assertEqual(fileResult.name,"abc") - self.assertEqual(fileResult.file_health,"healthy") - self.assertEqual(fileResult.random,None) - - def test_custom_metadata_scheme_with_variable_attributes(self): - customMetadataSchema = CustomMetadataSchema("jpg",max_length=1000,name="abc") - - self.assertEqual(customMetadataSchema.max_length,1000) - self.assertEqual(customMetadataSchema.type,"jpg") - self.assertEqual(customMetadataSchema.name,"abc") - self.assertEqual(customMetadataSchema.random,None) - - def test_custom_metadata_fields_result_with_response_metadata_with_variable_attributes(self): - customMetadataFieldsResultWithResponseMetadata = CustomMetadataFieldsResultWithResponseMetadata(id="1234",label="123",num_fields=5) - - self.assertEqual(customMetadataFieldsResultWithResponseMetadata.id,"1234") - self.assertEqual(customMetadataFieldsResultWithResponseMetadata.label,"123") - self.assertEqual(customMetadataFieldsResultWithResponseMetadata.num_fields,5) - self.assertEqual(customMetadataFieldsResultWithResponseMetadata.random,None) - - def test_custom_metadata_fields_result_with_variable_attributes(self): - customMetadataFieldsResult = CustomMetadataFieldsResult(id="1234",label="123",num_fields=5) - - self.assertEqual(customMetadataFieldsResult.id,"1234") - self.assertEqual(customMetadataFieldsResult.label,"123") - self.assertEqual(customMetadataFieldsResult.num_fields,5) - self.assertEqual(customMetadataFieldsResult.random,None) - - def test_bulk_delete_file_result_with_variable_attributes(self): - bulkDeleteFileResult = BulkDeleteFileResult(successfully_deleted_file_ids=["1","2","232"],num_files_deleted=3) - - self.assertEqual(bulkDeleteFileResult.successfully_deleted_file_ids,["1","2","232"]) - self.assertEqual(bulkDeleteFileResult.num_files_deleted,3) - self.assertEqual(bulkDeleteFileResult.random,None) - - def test_ai_tags_with_variable_attributes(self): - aITags = AITags("abc",confidence="0.96",model="KNN") - - self.assertEqual(aITags.name,"abc") - self.assertEqual(aITags.confidence,"0.96") - self.assertEqual(aITags.random,None) - - def test_metadata_exif_interoperability_with_variable_attributes(self): - metadataExifInteroperability = MetadataExifInteroperability(1,"0.4.3",ri = 3) - - self.assertEqual(metadataExifInteroperability.interop_index,1) - self.assertEqual(metadataExifInteroperability.interop_version,"0.4.3") - self.assertEqual(metadataExifInteroperability.ri,3) - self.assertEqual(metadataExifInteroperability.random,None) - - - - \ No newline at end of file diff --git a/tests/test_qs.py b/tests/test_qs.py new file mode 100644 index 0000000..4e08d86 --- /dev/null +++ b/tests/test_qs.py @@ -0,0 +1,78 @@ +from typing import Any, cast +from functools import partial +from urllib.parse import unquote + +import pytest + +from imagekit._qs import Querystring, stringify + + +def test_empty() -> None: + assert stringify({}) == "" + assert stringify({"a": {}}) == "" + assert stringify({"a": {"b": {"c": {}}}}) == "" + + +def test_basic() -> None: + assert stringify({"a": 1}) == "a=1" + assert stringify({"a": "b"}) == "a=b" + assert stringify({"a": True}) == "a=true" + assert stringify({"a": False}) == "a=false" + assert stringify({"a": 1.23456}) == "a=1.23456" + assert stringify({"a": None}) == "" + + +@pytest.mark.parametrize("method", ["class", "function"]) +def test_nested_dotted(method: str) -> None: + if method == "class": + serialise = Querystring(nested_format="dots").stringify + else: + serialise = partial(stringify, nested_format="dots") + + assert unquote(serialise({"a": {"b": "c"}})) == "a.b=c" + assert unquote(serialise({"a": {"b": "c", "d": "e", "f": "g"}})) == "a.b=c&a.d=e&a.f=g" + assert unquote(serialise({"a": {"b": {"c": {"d": "e"}}}})) == "a.b.c.d=e" + assert unquote(serialise({"a": {"b": True}})) == "a.b=true" + + +def test_nested_brackets() -> None: + assert unquote(stringify({"a": {"b": "c"}})) == "a[b]=c" + assert unquote(stringify({"a": {"b": "c", "d": "e", "f": "g"}})) == "a[b]=c&a[d]=e&a[f]=g" + assert unquote(stringify({"a": {"b": {"c": {"d": "e"}}}})) == "a[b][c][d]=e" + assert unquote(stringify({"a": {"b": True}})) == "a[b]=true" + + +@pytest.mark.parametrize("method", ["class", "function"]) +def test_array_comma(method: str) -> None: + if method == "class": + serialise = Querystring(array_format="comma").stringify + else: + serialise = partial(stringify, array_format="comma") + + assert unquote(serialise({"in": ["foo", "bar"]})) == "in=foo,bar" + assert unquote(serialise({"a": {"b": [True, False]}})) == "a[b]=true,false" + assert unquote(serialise({"a": {"b": [True, False, None, True]}})) == "a[b]=true,false,true" + + +def test_array_repeat() -> None: + assert unquote(stringify({"in": ["foo", "bar"]})) == "in=foo&in=bar" + assert unquote(stringify({"a": {"b": [True, False]}})) == "a[b]=true&a[b]=false" + assert unquote(stringify({"a": {"b": [True, False, None, True]}})) == "a[b]=true&a[b]=false&a[b]=true" + assert unquote(stringify({"in": ["foo", {"b": {"c": ["d", "e"]}}]})) == "in=foo&in[b][c]=d&in[b][c]=e" + + +@pytest.mark.parametrize("method", ["class", "function"]) +def test_array_brackets(method: str) -> None: + if method == "class": + serialise = Querystring(array_format="brackets").stringify + else: + serialise = partial(stringify, array_format="brackets") + + assert unquote(serialise({"in": ["foo", "bar"]})) == "in[]=foo&in[]=bar" + assert unquote(serialise({"a": {"b": [True, False]}})) == "a[b][]=true&a[b][]=false" + assert unquote(serialise({"a": {"b": [True, False, None, True]}})) == "a[b][]=true&a[b][]=false&a[b][]=true" + + +def test_unknown_array_format() -> None: + with pytest.raises(NotImplementedError, match="Unknown array_format value: foo, choose from comma, repeat"): + stringify({"a": ["foo", "bar"]}, array_format=cast(Any, "foo")) diff --git a/tests/test_required_args.py b/tests/test_required_args.py new file mode 100644 index 0000000..e066b2a --- /dev/null +++ b/tests/test_required_args.py @@ -0,0 +1,111 @@ +from __future__ import annotations + +import pytest + +from imagekit._utils import required_args + + +def test_too_many_positional_params() -> None: + @required_args(["a"]) + def foo(a: str | None = None) -> str | None: + return a + + with pytest.raises(TypeError, match=r"foo\(\) takes 1 argument\(s\) but 2 were given"): + foo("a", "b") # type: ignore + + +def test_positional_param() -> None: + @required_args(["a"]) + def foo(a: str | None = None) -> str | None: + return a + + assert foo("a") == "a" + assert foo(None) is None + assert foo(a="b") == "b" + + with pytest.raises(TypeError, match="Missing required argument: 'a'"): + foo() + + +def test_keyword_only_param() -> None: + @required_args(["a"]) + def foo(*, a: str | None = None) -> str | None: + return a + + assert foo(a="a") == "a" + assert foo(a=None) is None + assert foo(a="b") == "b" + + with pytest.raises(TypeError, match="Missing required argument: 'a'"): + foo() + + +def test_multiple_params() -> None: + @required_args(["a", "b", "c"]) + def foo(a: str = "", *, b: str = "", c: str = "") -> str | None: + return f"{a} {b} {c}" + + assert foo(a="a", b="b", c="c") == "a b c" + + error_message = r"Missing required arguments.*" + + with pytest.raises(TypeError, match=error_message): + foo() + + with pytest.raises(TypeError, match=error_message): + foo(a="a") + + with pytest.raises(TypeError, match=error_message): + foo(b="b") + + with pytest.raises(TypeError, match=error_message): + foo(c="c") + + with pytest.raises(TypeError, match=r"Missing required argument: 'a'"): + foo(b="a", c="c") + + with pytest.raises(TypeError, match=r"Missing required argument: 'b'"): + foo("a", c="c") + + +def test_multiple_variants() -> None: + @required_args(["a"], ["b"]) + def foo(*, a: str | None = None, b: str | None = None) -> str | None: + return a if a is not None else b + + assert foo(a="foo") == "foo" + assert foo(b="bar") == "bar" + assert foo(a=None) is None + assert foo(b=None) is None + + # TODO: this error message could probably be improved + with pytest.raises( + TypeError, + match=r"Missing required arguments; Expected either \('a'\) or \('b'\) arguments to be given", + ): + foo() + + +def test_multiple_params_multiple_variants() -> None: + @required_args(["a", "b"], ["c"]) + def foo(*, a: str | None = None, b: str | None = None, c: str | None = None) -> str | None: + if a is not None: + return a + if b is not None: + return b + return c + + error_message = r"Missing required arguments; Expected either \('a' and 'b'\) or \('c'\) arguments to be given" + + with pytest.raises(TypeError, match=error_message): + foo(a="foo") + + with pytest.raises(TypeError, match=error_message): + foo(b="bar") + + with pytest.raises(TypeError, match=error_message): + foo() + + assert foo(a=None, b="bar") == "bar" + assert foo(c=None) is None + assert foo(c="foo") == "foo" diff --git a/tests/test_response.py b/tests/test_response.py new file mode 100644 index 0000000..0a41606 --- /dev/null +++ b/tests/test_response.py @@ -0,0 +1,277 @@ +import json +from typing import Any, List, Union, cast +from typing_extensions import Annotated + +import httpx +import pytest +import pydantic + +from imagekit import ImageKit, BaseModel, AsyncImageKit +from imagekit._response import ( + APIResponse, + BaseAPIResponse, + AsyncAPIResponse, + BinaryAPIResponse, + AsyncBinaryAPIResponse, + extract_response_type, +) +from imagekit._streaming import Stream +from imagekit._base_client import FinalRequestOptions + + +class ConcreteBaseAPIResponse(APIResponse[bytes]): ... + + +class ConcreteAPIResponse(APIResponse[List[str]]): ... + + +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... + + +def test_extract_response_type_direct_classes() -> None: + assert extract_response_type(BaseAPIResponse[str]) == str + assert extract_response_type(APIResponse[str]) == str + assert extract_response_type(AsyncAPIResponse[str]) == str + + +def test_extract_response_type_direct_class_missing_type_arg() -> None: + with pytest.raises( + RuntimeError, + match="Expected type to have a type argument at index 0 but it did not", + ): + extract_response_type(AsyncAPIResponse) + + +def test_extract_response_type_concrete_subclasses() -> None: + assert extract_response_type(ConcreteBaseAPIResponse) == bytes + assert extract_response_type(ConcreteAPIResponse) == List[str] + assert extract_response_type(ConcreteAsyncAPIResponse) == httpx.Response + + +def test_extract_response_type_binary_response() -> None: + assert extract_response_type(BinaryAPIResponse) == bytes + assert extract_response_type(AsyncBinaryAPIResponse) == bytes + + +class PydanticModel(pydantic.BaseModel): ... + + +def test_response_parse_mismatched_basemodel(client: ImageKit) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo"), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + with pytest.raises( + TypeError, + match="Pydantic models must subclass our base model type, e.g. `from imagekit import BaseModel`", + ): + response.parse(to=PydanticModel) + + +@pytest.mark.asyncio +async def test_async_response_parse_mismatched_basemodel(async_client: AsyncImageKit) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo"), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + with pytest.raises( + TypeError, + match="Pydantic models must subclass our base model type, e.g. `from imagekit import BaseModel`", + ): + await response.parse(to=PydanticModel) + + +def test_response_parse_custom_stream(client: ImageKit) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo"), + client=client, + stream=True, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + stream = response.parse(to=Stream[int]) + assert stream._cast_to == int + + +@pytest.mark.asyncio +async def test_async_response_parse_custom_stream(async_client: AsyncImageKit) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo"), + client=async_client, + stream=True, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + stream = await response.parse(to=Stream[int]) + assert stream._cast_to == int + + +class CustomModel(BaseModel): + foo: str + bar: int + + +def test_response_parse_custom_model(client: ImageKit) -> None: + response = APIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=CustomModel) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +@pytest.mark.asyncio +async def test_async_response_parse_custom_model(async_client: AsyncImageKit) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=CustomModel) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +def test_response_parse_annotated_type(client: ImageKit) -> None: + response = APIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse( + to=cast("type[CustomModel]", Annotated[CustomModel, "random metadata"]), + ) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +async def test_async_response_parse_annotated_type(async_client: AsyncImageKit) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse( + to=cast("type[CustomModel]", Annotated[CustomModel, "random metadata"]), + ) + assert obj.foo == "hello!" + assert obj.bar == 2 + + +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +def test_response_parse_bool(client: ImageKit, content: str, expected: bool) -> None: + response = APIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = response.parse(to=bool) + assert result is expected + + +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +async def test_async_response_parse_bool(client: AsyncImageKit, content: str, expected: bool) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = await response.parse(to=bool) + assert result is expected + + +class OtherModel(BaseModel): + a: str + + +@pytest.mark.parametrize("client", [False], indirect=True) # loose validation +def test_response_parse_expect_model_union_non_json_content(client: ImageKit) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("async_client", [False], indirect=True) # loose validation +async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncImageKit) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" diff --git a/tests/test_streaming.py b/tests/test_streaming.py new file mode 100644 index 0000000..fa1795d --- /dev/null +++ b/tests/test_streaming.py @@ -0,0 +1,248 @@ +from __future__ import annotations + +from typing import Iterator, AsyncIterator + +import httpx +import pytest + +from imagekit import ImageKit, AsyncImageKit +from imagekit._streaming import Stream, AsyncStream, ServerSentEvent + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_basic(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b"event: completion\n" + yield b'data: {"foo":true}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "completion" + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_missing_event(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"foo":true}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_event_missing_data(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.data == "" + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" + yield b"event: completion\n" + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.data == "" + + sse = await iter_next(iterator) + assert sse.event == "completion" + assert sse.data == "" + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events_with_data(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo":true}\n' + yield b"\n" + yield b"event: completion\n" + yield b'data: {"bar":false}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + + sse = await iter_next(iterator) + assert sse.event == "completion" + assert sse.json() == {"bar": False} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines_with_empty_line(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: \n" + yield b"data:\n" + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + assert sse.data == '{\n"foo":\n\n\ntrue}' + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_json_escaped_double_new_line(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo": "my long\\n\\ncontent"}' + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": "my long\n\ncontent"} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines(sync: bool, client: ImageKit, async_client: AsyncImageKit) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_special_new_line_character( + sync: bool, + client: ImageKit, + async_client: AsyncImageKit, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":" culpa"}\n' + yield b"\n" + yield b'data: {"content":" \xe2\x80\xa8"}\n' + yield b"\n" + yield b'data: {"content":"foo"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " culpa"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " 
"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "foo"} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multi_byte_character_multiple_chunks( + sync: bool, + client: ImageKit, + async_client: AsyncImageKit, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":"' + # bytes taken from the string 'известни' and arbitrarily split + # so that some multi-byte characters span multiple chunks + yield b"\xd0" + yield b"\xb8\xd0\xb7\xd0" + yield b"\xb2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbd\xd0\xb8" + yield b'"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "известни"} + + +async def to_aiter(iter: Iterator[bytes]) -> AsyncIterator[bytes]: + for chunk in iter: + yield chunk + + +async def iter_next(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> ServerSentEvent: + if isinstance(iter, AsyncIterator): + return await iter.__anext__() + + return next(iter) + + +async def assert_empty_iter(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> None: + with pytest.raises((StopAsyncIteration, RuntimeError)): + await iter_next(iter) + + +def make_event_iterator( + content: Iterator[bytes], + *, + sync: bool, + client: ImageKit, + async_client: AsyncImageKit, +) -> Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]: + if sync: + return Stream(cast_to=object, client=client, response=httpx.Response(200, content=content))._iter_events() + + return AsyncStream( + cast_to=object, client=async_client, response=httpx.Response(200, content=to_aiter(content)) + )._iter_events() diff --git a/tests/test_tags_ops.py b/tests/test_tags_ops.py deleted file mode 100644 index b2816a1..0000000 --- a/tests/test_tags_ops.py +++ /dev/null @@ -1,334 +0,0 @@ -import json -import os - -import responses - -from imagekitio.client import ImageKit -from imagekitio.constants.url import URL -from imagekitio.exceptions.ForbiddenException import ForbiddenException -from imagekitio.exceptions.NotFoundException import NotFoundException -from imagekitio.utils.formatter import camel_dict_to_snake_dict -from tests.helpers import ( - ClientTestCase, - get_auth_headers_for_test, -) - -imagekit_obj = ImageKit( - private_key="private_fake:", - public_key="public_fake123:", - url_endpoint="fake.com", -) - - -class TestTags(ClientTestCase): - """ - TestTags class used to test Add and Remove methods - """ - - filename = "test" - - file_id = "fake_123" - - @responses.activate - def test_add_tags_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/addTags".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.add_tags( - file_ids=[self.file_id], tags=["add-tag-1", "add-tag-2"] - ) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_add_tags_succeeds(self): - """ - Tests if add tags succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/addTags".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - responses.add( - responses.POST, - url, - body='{"successfullyUpdatedFileIds": ["fake_123"]}', - headers=headers, - ) - - resp = self.client.add_tags( - file_ids=[self.file_id], tags=["add-tag-1", "add-tag-2"] - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": {"successfullyUpdatedFileIds": ["fake_123"]}, - } - request_body = json.dumps( - json.loads( - """{ - "fileIds": ["fake_123"], - "tags": ["add-tag-1", "add-tag-2"] - }""" - ) - ) - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual(["fake_123"], resp.successfully_updated_file_ids) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/addTags", responses.calls[0].request.url - ) - - @responses.activate - def test_add_tags_fails_with_404_exception(self) -> None: - """Test add tags raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/addTags".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - try: - responses.add( - responses.POST, - url, - status=404, - body="""{ - "message": "The requested file(s) does not exist.", - "help": "For support kindly contact us at support@imagekit.io .", - "missingFileIds": ["fake_123"] - }""", - headers=headers, - ) - self.client.add_tags( - file_ids=[self.file_id], tags=["add-tag-1", "add-tag-2"] - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested file(s) does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - self.assertEqual(["fake_123"], e.response_metadata.raw["missingFileIds"]) - - @responses.activate - def test_remove_tags_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/removeTags".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.remove_tags( - file_ids=[self.file_id], tags=["remove-tag-1", "remove-tag-2"] - ) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual("Your account cannot be authenticated.", e.message) - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_remove_tags_succeeds(self): - """ - Tests if remove tags succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/removeTags".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - responses.add( - responses.POST, - url, - body='{"successfullyUpdatedFileIds": ["fake_123"]}', - headers=headers, - ) - - resp = self.client.remove_tags( - file_ids=[self.file_id], tags=["remove-tag-1", "remove-tag-2"] - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": {"successfullyUpdatedFileIds": ["fake_123"]}, - } - request_body = json.dumps( - json.loads( - """{ - "fileIds": ["fake_123"], - "tags": ["remove-tag-1", "remove-tag-2"] - }""" - ) - ) - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual(["fake_123"], resp.successfully_updated_file_ids) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/removeTags", responses.calls[0].request.url - ) - - @responses.activate - def test_remove_tags_fails_with_404_exception(self) -> None: - """Test remove tags raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/removeTags".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - try: - responses.add( - responses.POST, - url, - status=404, - body="""{ - "message": "The requested file(s) does not exist.", - "help": "For support kindly contact us at support@imagekit.io .", - "missingFileIds": ["fake_123"] - }""", - headers=headers, - ) - self.client.remove_tags( - file_ids=[self.file_id], tags=["remove-tag-1", "remove-tag-2"] - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested file(s) does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - self.assertEqual(["fake_123"], e.response_metadata.raw["missingFileIds"]) - - -class TestAITags(ClientTestCase): - """ - TestAITags class used to test Remove AITags method - """ - - image = os.path.join( - os.path.dirname(os.path.realpath(__file__)), "dummy_data/image.png" - ) - filename = "test" - - file_id = "fake_123" - - @responses.activate - def test_remove_ai_tags_fails_on_unauthenticated_request(self): - """ - Tests if the unauthenticated request restricted - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/removeAITags".format(URL.API_BASE_URL) - try: - responses.add( - responses.POST, - url, - status=403, - body="""{'message': 'Your account cannot be authenticated.' - , 'help': 'For support kindly contact us at support@imagekit.io .'}""", - ) - self.client.remove_ai_tags( - file_ids=[self.file_id], ai_tags=["remove-ai-tag1", "remove-ai-tag2"] - ) - self.assertRaises(ForbiddenException) - except ForbiddenException as e: - self.assertEqual(e.message, "Your account cannot be authenticated.") - self.assertEqual(403, e.response_metadata.http_status_code) - - @responses.activate - def test_remove_ai_tags_succeeds(self): - """ - Tests if Remove AI tags succeeds - """ - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/removeAITags".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - responses.add( - responses.POST, - url, - body='{"successfullyUpdatedFileIds": ["fake_123"]}', - headers=headers, - ) - - resp = self.client.remove_ai_tags( - file_ids=[self.file_id], ai_tags=["remove-ai-tag-1", "remove-ai-tag-2"] - ) - mock_response_metadata = { - "headers": { - "Content-Type": "text/plain, application/json", - "Authorization": "Basic ZmFrZTEyMjo=", - }, - "httpStatusCode": 200, - "raw": {"successfullyUpdatedFileIds": ["fake_123"]}, - } - request_body = json.dumps( - json.loads( - """{ - "fileIds": ["fake_123"], - "AITags": ["remove-ai-tag-1", "remove-ai-tag-2"] - }""" - ) - ) - self.assertEqual(request_body, responses.calls[0].request.body) - self.assertEqual(["fake_123"], resp.successfully_updated_file_ids) - self.assertEqual( - camel_dict_to_snake_dict(mock_response_metadata), - resp.response_metadata.__dict__, - ) - self.assertEqual( - "http://test.com/v1/files/removeAITags", responses.calls[0].request.url - ) - - @responses.activate - def test_remove_ai_tags_fails_with_404_exception(self) -> None: - """Test Remove AI tags raises 404 error""" - - URL.API_BASE_URL = "http://test.com" - url = "{}/v1/files/removeAITags".format(URL.API_BASE_URL) - headers = {"Content-Type": "application/json"} - headers.update(get_auth_headers_for_test()) - try: - responses.add( - responses.POST, - url, - status=404, - body="""{ - "message": "The requested file(s) does not exist.", - "help": "For support kindly contact us at support@imagekit.io .", - "missingFileIds": ["fake_123"] - }""", - headers=headers, - ) - self.client.remove_ai_tags( - file_ids=[self.file_id], ai_tags=["remove-ai-tag-1", "remove-ai-tag-2"] - ) - self.assertRaises(NotFoundException) - except NotFoundException as e: - self.assertEqual("The requested file(s) does not exist.", e.message) - self.assertEqual(404, e.response_metadata.http_status_code) - self.assertEqual(["fake_123"], e.response_metadata.raw["missingFileIds"]) diff --git a/tests/test_transform.py b/tests/test_transform.py new file mode 100644 index 0000000..0d9defb --- /dev/null +++ b/tests/test_transform.py @@ -0,0 +1,453 @@ +from __future__ import annotations + +import io +import pathlib +from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast +from datetime import date, datetime +from typing_extensions import Required, Annotated, TypedDict + +import pytest + +from imagekit._types import NOT_GIVEN, Base64FileInput +from imagekit._utils import ( + PropertyInfo, + transform as _transform, + parse_datetime, + async_transform as _async_transform, +) +from imagekit._compat import PYDANTIC_V2 +from imagekit._models import BaseModel + +_T = TypeVar("_T") + +SAMPLE_FILE_PATH = pathlib.Path(__file__).parent.joinpath("sample_file.txt") + + +async def transform( + data: _T, + expected_type: object, + use_async: bool, +) -> _T: + if use_async: + return await _async_transform(data, expected_type=expected_type) + + return _transform(data, expected_type=expected_type) + + +parametrize = pytest.mark.parametrize("use_async", [False, True], ids=["sync", "async"]) + + +class Foo1(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +@parametrize +@pytest.mark.asyncio +async def test_top_level_alias(use_async: bool) -> None: + assert await transform({"foo_bar": "hello"}, expected_type=Foo1, use_async=use_async) == {"fooBar": "hello"} + + +class Foo2(TypedDict): + bar: Bar2 + + +class Bar2(TypedDict): + this_thing: Annotated[int, PropertyInfo(alias="this__thing")] + baz: Annotated[Baz2, PropertyInfo(alias="Baz")] + + +class Baz2(TypedDict): + my_baz: Annotated[str, PropertyInfo(alias="myBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_recursive_typeddict(use_async: bool) -> None: + assert await transform({"bar": {"this_thing": 1}}, Foo2, use_async) == {"bar": {"this__thing": 1}} + assert await transform({"bar": {"baz": {"my_baz": "foo"}}}, Foo2, use_async) == {"bar": {"Baz": {"myBaz": "foo"}}} + + +class Foo3(TypedDict): + things: List[Bar3] + + +class Bar3(TypedDict): + my_field: Annotated[str, PropertyInfo(alias="myField")] + + +@parametrize +@pytest.mark.asyncio +async def test_list_of_typeddict(use_async: bool) -> None: + result = await transform({"things": [{"my_field": "foo"}, {"my_field": "foo2"}]}, Foo3, use_async) + assert result == {"things": [{"myField": "foo"}, {"myField": "foo2"}]} + + +class Foo4(TypedDict): + foo: Union[Bar4, Baz4] + + +class Bar4(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +class Baz4(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_union_of_typeddict(use_async: bool) -> None: + assert await transform({"foo": {"foo_bar": "bar"}}, Foo4, use_async) == {"foo": {"fooBar": "bar"}} + assert await transform({"foo": {"foo_baz": "baz"}}, Foo4, use_async) == {"foo": {"fooBaz": "baz"}} + assert await transform({"foo": {"foo_baz": "baz", "foo_bar": "bar"}}, Foo4, use_async) == { + "foo": {"fooBaz": "baz", "fooBar": "bar"} + } + + +class Foo5(TypedDict): + foo: Annotated[Union[Bar4, List[Baz4]], PropertyInfo(alias="FOO")] + + +class Bar5(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +class Baz5(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_union_of_list(use_async: bool) -> None: + assert await transform({"foo": {"foo_bar": "bar"}}, Foo5, use_async) == {"FOO": {"fooBar": "bar"}} + assert await transform( + { + "foo": [ + {"foo_baz": "baz"}, + {"foo_baz": "baz"}, + ] + }, + Foo5, + use_async, + ) == {"FOO": [{"fooBaz": "baz"}, {"fooBaz": "baz"}]} + + +class Foo6(TypedDict): + bar: Annotated[str, PropertyInfo(alias="Bar")] + + +@parametrize +@pytest.mark.asyncio +async def test_includes_unknown_keys(use_async: bool) -> None: + assert await transform({"bar": "bar", "baz_": {"FOO": 1}}, Foo6, use_async) == { + "Bar": "bar", + "baz_": {"FOO": 1}, + } + + +class Foo7(TypedDict): + bar: Annotated[List[Bar7], PropertyInfo(alias="bAr")] + foo: Bar7 + + +class Bar7(TypedDict): + foo: str + + +@parametrize +@pytest.mark.asyncio +async def test_ignores_invalid_input(use_async: bool) -> None: + assert await transform({"bar": ""}, Foo7, use_async) == {"bAr": ""} + assert await transform({"foo": ""}, Foo7, use_async) == {"foo": ""} + + +class DatetimeDict(TypedDict, total=False): + foo: Annotated[datetime, PropertyInfo(format="iso8601")] + + bar: Annotated[Optional[datetime], PropertyInfo(format="iso8601")] + + required: Required[Annotated[Optional[datetime], PropertyInfo(format="iso8601")]] + + list_: Required[Annotated[Optional[List[datetime]], PropertyInfo(format="iso8601")]] + + union: Annotated[Union[int, datetime], PropertyInfo(format="iso8601")] + + +class DateDict(TypedDict, total=False): + foo: Annotated[date, PropertyInfo(format="iso8601")] + + +class DatetimeModel(BaseModel): + foo: datetime + + +class DateModel(BaseModel): + foo: Optional[date] + + +@parametrize +@pytest.mark.asyncio +async def test_iso8601_format(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + tz = "Z" if PYDANTIC_V2 else "+00:00" + assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] + + dt = dt.replace(tzinfo=None) + assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + + assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore + assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { + "foo": "2023-02-23" + } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_optional_iso8601_format(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + assert await transform({"bar": dt}, DatetimeDict, use_async) == {"bar": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] + + assert await transform({"bar": None}, DatetimeDict, use_async) == {"bar": None} + + +@parametrize +@pytest.mark.asyncio +async def test_required_iso8601_format(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + assert await transform({"required": dt}, DatetimeDict, use_async) == { + "required": "2023-02-23T14:16:36.337692+00:00" + } # type: ignore[comparison-overlap] + + assert await transform({"required": None}, DatetimeDict, use_async) == {"required": None} + + +@parametrize +@pytest.mark.asyncio +async def test_union_datetime(use_async: bool) -> None: + dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + assert await transform({"union": dt}, DatetimeDict, use_async) == { # type: ignore[comparison-overlap] + "union": "2023-02-23T14:16:36.337692+00:00" + } + + assert await transform({"union": "foo"}, DatetimeDict, use_async) == {"union": "foo"} + + +@parametrize +@pytest.mark.asyncio +async def test_nested_list_iso6801_format(use_async: bool) -> None: + dt1 = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + dt2 = parse_datetime("2022-01-15T06:34:23Z") + assert await transform({"list_": [dt1, dt2]}, DatetimeDict, use_async) == { # type: ignore[comparison-overlap] + "list_": ["2023-02-23T14:16:36.337692+00:00", "2022-01-15T06:34:23+00:00"] + } + + +@parametrize +@pytest.mark.asyncio +async def test_datetime_custom_format(use_async: bool) -> None: + dt = parse_datetime("2022-01-15T06:34:23Z") + + result = await transform(dt, Annotated[datetime, PropertyInfo(format="custom", format_template="%H")], use_async) + assert result == "06" # type: ignore[comparison-overlap] + + +class DateDictWithRequiredAlias(TypedDict, total=False): + required_prop: Required[Annotated[date, PropertyInfo(format="iso8601", alias="prop")]] + + +@parametrize +@pytest.mark.asyncio +async def test_datetime_with_alias(use_async: bool) -> None: + assert await transform({"required_prop": None}, DateDictWithRequiredAlias, use_async) == {"prop": None} # type: ignore[comparison-overlap] + assert await transform( + {"required_prop": date.fromisoformat("2023-02-23")}, DateDictWithRequiredAlias, use_async + ) == {"prop": "2023-02-23"} # type: ignore[comparison-overlap] + + +class MyModel(BaseModel): + foo: str + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_model_to_dictionary(use_async: bool) -> None: + assert cast(Any, await transform(MyModel(foo="hi!"), Any, use_async)) == {"foo": "hi!"} + assert cast(Any, await transform(MyModel.construct(foo="hi!"), Any, use_async)) == {"foo": "hi!"} + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_empty_model(use_async: bool) -> None: + assert cast(Any, await transform(MyModel.construct(), Any, use_async)) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_unknown_field(use_async: bool) -> None: + assert cast(Any, await transform(MyModel.construct(my_untyped_field=True), Any, use_async)) == { + "my_untyped_field": True + } + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_mismatched_types(use_async: bool) -> None: + model = MyModel.construct(foo=True) + if PYDANTIC_V2: + with pytest.warns(UserWarning): + params = await transform(model, Any, use_async) + else: + params = await transform(model, Any, use_async) + assert cast(Any, params) == {"foo": True} + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_mismatched_object_type(use_async: bool) -> None: + model = MyModel.construct(foo=MyModel.construct(hello="world")) + if PYDANTIC_V2: + with pytest.warns(UserWarning): + params = await transform(model, Any, use_async) + else: + params = await transform(model, Any, use_async) + assert cast(Any, params) == {"foo": {"hello": "world"}} + + +class ModelNestedObjects(BaseModel): + nested: MyModel + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_nested_objects(use_async: bool) -> None: + model = ModelNestedObjects.construct(nested={"foo": "stainless"}) + assert isinstance(model.nested, MyModel) + assert cast(Any, await transform(model, Any, use_async)) == {"nested": {"foo": "stainless"}} + + +class ModelWithDefaultField(BaseModel): + foo: str + with_none_default: Union[str, None] = None + with_str_default: str = "foo" + + +@parametrize +@pytest.mark.asyncio +async def test_pydantic_default_field(use_async: bool) -> None: + # should be excluded when defaults are used + model = ModelWithDefaultField.construct() + assert model.with_none_default is None + assert model.with_str_default == "foo" + assert cast(Any, await transform(model, Any, use_async)) == {} + + # should be included when the default value is explicitly given + model = ModelWithDefaultField.construct(with_none_default=None, with_str_default="foo") + assert model.with_none_default is None + assert model.with_str_default == "foo" + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": None, "with_str_default": "foo"} + + # should be included when a non-default value is explicitly given + model = ModelWithDefaultField.construct(with_none_default="bar", with_str_default="baz") + assert model.with_none_default == "bar" + assert model.with_str_default == "baz" + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": "bar", "with_str_default": "baz"} + + +class TypedDictIterableUnion(TypedDict): + foo: Annotated[Union[Bar8, Iterable[Baz8]], PropertyInfo(alias="FOO")] + + +class Bar8(TypedDict): + foo_bar: Annotated[str, PropertyInfo(alias="fooBar")] + + +class Baz8(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + +@parametrize +@pytest.mark.asyncio +async def test_iterable_of_dictionaries(use_async: bool) -> None: + assert await transform({"foo": [{"foo_baz": "bar"}]}, TypedDictIterableUnion, use_async) == { + "FOO": [{"fooBaz": "bar"}] + } + assert cast(Any, await transform({"foo": ({"foo_baz": "bar"},)}, TypedDictIterableUnion, use_async)) == { + "FOO": [{"fooBaz": "bar"}] + } + + def my_iter() -> Iterable[Baz8]: + yield {"foo_baz": "hello"} + yield {"foo_baz": "world"} + + assert await transform({"foo": my_iter()}, TypedDictIterableUnion, use_async) == { + "FOO": [{"fooBaz": "hello"}, {"fooBaz": "world"}] + } + + +@parametrize +@pytest.mark.asyncio +async def test_dictionary_items(use_async: bool) -> None: + class DictItems(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} + + +class TypedDictIterableUnionStr(TypedDict): + foo: Annotated[Union[str, Iterable[Baz8]], PropertyInfo(alias="FOO")] + + +@parametrize +@pytest.mark.asyncio +async def test_iterable_union_str(use_async: bool) -> None: + assert await transform({"foo": "bar"}, TypedDictIterableUnionStr, use_async) == {"FOO": "bar"} + assert cast(Any, await transform(iter([{"foo_baz": "bar"}]), Union[str, Iterable[Baz8]], use_async)) == [ + {"fooBaz": "bar"} + ] + + +class TypedDictBase64Input(TypedDict): + foo: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + + +@parametrize +@pytest.mark.asyncio +async def test_base64_file_input(use_async: bool) -> None: + # strings are left as-is + assert await transform({"foo": "bar"}, TypedDictBase64Input, use_async) == {"foo": "bar"} + + # pathlib.Path is automatically converted to base64 + assert await transform({"foo": SAMPLE_FILE_PATH}, TypedDictBase64Input, use_async) == { + "foo": "SGVsbG8sIHdvcmxkIQo=" + } # type: ignore[comparison-overlap] + + # io instances are automatically converted to base64 + assert await transform({"foo": io.StringIO("Hello, world!")}, TypedDictBase64Input, use_async) == { + "foo": "SGVsbG8sIHdvcmxkIQ==" + } # type: ignore[comparison-overlap] + assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { + "foo": "SGVsbG8sIHdvcmxkIQ==" + } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_transform_skipping(use_async: bool) -> None: + # lists of ints are left as-is + data = [1, 2, 3] + assert await transform(data, List[int], use_async) is data + + # iterables of ints are converted to a list + data = iter([1, 2, 3]) + assert await transform(data, Iterable[int], use_async) == [1, 2, 3] + + +@parametrize +@pytest.mark.asyncio +async def test_strips_notgiven(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py new file mode 100644 index 0000000..f6fec33 --- /dev/null +++ b/tests/test_utils/test_proxy.py @@ -0,0 +1,34 @@ +import operator +from typing import Any +from typing_extensions import override + +from imagekit._utils import LazyProxy + + +class RecursiveLazyProxy(LazyProxy[Any]): + @override + def __load__(self) -> Any: + return self + + def __call__(self, *_args: Any, **_kwds: Any) -> Any: + raise RuntimeError("This should never be called!") + + +def test_recursive_proxy() -> None: + proxy = RecursiveLazyProxy() + assert repr(proxy) == "RecursiveLazyProxy" + assert str(proxy) == "RecursiveLazyProxy" + assert dir(proxy) == [] + assert type(proxy).__name__ == "RecursiveLazyProxy" + assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy" + + +def test_isinstance_does_not_error() -> None: + class AlwaysErrorProxy(LazyProxy[Any]): + @override + def __load__(self) -> Any: + raise RuntimeError("Mocking missing dependency") + + proxy = AlwaysErrorProxy() + assert not isinstance(proxy, dict) + assert isinstance(proxy, LazyProxy) diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py new file mode 100644 index 0000000..3d41f5d --- /dev/null +++ b/tests/test_utils/test_typing.py @@ -0,0 +1,73 @@ +from __future__ import annotations + +from typing import Generic, TypeVar, cast + +from imagekit._utils import extract_type_var_from_base + +_T = TypeVar("_T") +_T2 = TypeVar("_T2") +_T3 = TypeVar("_T3") + + +class BaseGeneric(Generic[_T]): ... + + +class SubclassGeneric(BaseGeneric[_T]): ... + + +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... + + +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... + + +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... + + +def test_extract_type_var() -> None: + assert ( + extract_type_var_from_base( + BaseGeneric[int], + index=0, + generic_bases=cast("tuple[type, ...]", (BaseGeneric,)), + ) + == int + ) + + +def test_extract_type_var_generic_subclass() -> None: + assert ( + extract_type_var_from_base( + SubclassGeneric[int], + index=0, + generic_bases=cast("tuple[type, ...]", (BaseGeneric,)), + ) + == int + ) + + +def test_extract_type_var_multiple() -> None: + typ = BaseGenericMultipleTypeArgs[int, str, None] + + generic_bases = cast("tuple[type, ...]", (BaseGenericMultipleTypeArgs,)) + assert extract_type_var_from_base(typ, index=0, generic_bases=generic_bases) == int + assert extract_type_var_from_base(typ, index=1, generic_bases=generic_bases) == str + assert extract_type_var_from_base(typ, index=2, generic_bases=generic_bases) == type(None) + + +def test_extract_type_var_generic_subclass_multiple() -> None: + typ = SubclassGenericMultipleTypeArgs[int, str, None] + + generic_bases = cast("tuple[type, ...]", (BaseGenericMultipleTypeArgs,)) + assert extract_type_var_from_base(typ, index=0, generic_bases=generic_bases) == int + assert extract_type_var_from_base(typ, index=1, generic_bases=generic_bases) == str + assert extract_type_var_from_base(typ, index=2, generic_bases=generic_bases) == type(None) + + +def test_extract_type_var_generic_subclass_different_ordering_multiple() -> None: + typ = SubclassDifferentOrderGenericMultipleTypeArgs[int, str, None] + + generic_bases = cast("tuple[type, ...]", (BaseGenericMultipleTypeArgs,)) + assert extract_type_var_from_base(typ, index=0, generic_bases=generic_bases) == int + assert extract_type_var_from_base(typ, index=1, generic_bases=generic_bases) == str + assert extract_type_var_from_base(typ, index=2, generic_bases=generic_bases) == type(None) diff --git a/tests/test_utils_calculation.py b/tests/test_utils_calculation.py deleted file mode 100644 index 9c77311..0000000 --- a/tests/test_utils_calculation.py +++ /dev/null @@ -1,18 +0,0 @@ -import unittest -from imagekitio.client import ImageKit -from imagekitio.utils.calculation import get_authenticated_params - - -class TestUtilCalculation(unittest.TestCase): - def test_get_authenticated_params(self): - """Test authenticated_params returning proper value - :return: param dict - """ - result = get_authenticated_params( - token="your_token", expire="1582269249", private_key="private_key_test" - ) - self.assertEqual(result["token"], "your_token") - self.assertEqual(result["expire"], "1582269249") - self.assertEqual( - result["signature"], "e71bcd6031016b060d349d212e23e85c791decdd" - ) diff --git a/tests/test_utils_formatter.py b/tests/test_utils_formatter.py deleted file mode 100644 index 355a11d..0000000 --- a/tests/test_utils_formatter.py +++ /dev/null @@ -1,21 +0,0 @@ -import unittest - -from imagekitio.utils.formatter import camel_to_snake, request_formatter - - -class TestFormatterClass(unittest.TestCase): - """ - TestFormatterClass tests if functions on formatter is working properly - """ - - def test_camel_to_snake(self) -> None: - """ - Test if CamelCase to snake_case is being converted - properly by camel_to_snake utility function - """ - self.assertEqual("abc", camel_to_snake("abc")) - self.assertEqual("_abc", camel_to_snake("_abc")) - self.assertEqual("", camel_to_snake("")) - self.assertEqual("my_name", camel_to_snake("myName")) - self.assertEqual("my_name_", camel_to_snake("myName_")) - self.assertEqual("url_endpoint", camel_to_snake("urlEndpoint")) diff --git a/tests/test_utils_utils.py b/tests/test_utils_utils.py deleted file mode 100644 index b2c6563..0000000 --- a/tests/test_utils_utils.py +++ /dev/null @@ -1,48 +0,0 @@ -import unittest - -from imagekitio.utils.utils import convert_to_response_object -from imagekitio.models.results.UploadFileResult import UploadFileResult - -from requests.models import Response - -import responses - -class TestUtilsUtils(unittest.TestCase): - - - @responses.activate() - def test_convert_to_response_object(self): - response = Response() - response.status_code = 200 - response._content = b'{"fileId":"abc123","name":"file.jpg","size":812557,"versionInfo":{"id":"abc123","name":"Version 1"},"filePath":"/file.jpg","url":"http://test.com","fileType":"image","height":398,"width":1000,"thumbnailUrl":"https://test.com","AITags":null,"embeddedMetadata":{"XResolution":1,"YResolution":1,"DateCreated":"2023-06-22T09:06:21.151Z","DateTimeCreated":"2023-06-22T09:06:21.151Z"}}' - u = convert_to_response_object(response,UploadFileResult) - expectedUploadFileResponse = {'file_id': 'abc123', 'name': 'file.jpg', 'size': 812557, 'version_info': {'id': 'abc123', 'name': 'Version 1'}, 'file_path': '/file.jpg', 'url': 'http://test.com', 'file_type': 'image', 'height': 398, 'width': 1000, 'thumbnail_url': 'https://test.com', 'ai_tags': None, 'embedded_metadata': {'x_resolution': 1, 'y_resolution': 1, 'date_created': '2023-06-22T09:06:21.151Z', 'date_time_created': '2023-06-22T09:06:21.151Z'}} - expectedUploadFileResult = UploadFileResult(**expectedUploadFileResponse) - - self.assertEqual(u.file_id,expectedUploadFileResult.file_id) - self.assertEqual(u.name,expectedUploadFileResult.name) - self.assertEqual(u.url,expectedUploadFileResult.url) - self.assertEqual(u.thumbnail_url,expectedUploadFileResult.thumbnail_url) - self.assertEqual(u.height,expectedUploadFileResult.height) - self.assertEqual(u.width,expectedUploadFileResult.width) - self.assertEqual(u.size,expectedUploadFileResult.size) - self.assertEqual(u.file_path,expectedUploadFileResult.file_path) - self.assertEqual(u.tags,expectedUploadFileResult.tags) - - for tag1,tag2 in zip(u.ai_tags,expectedUploadFileResult.ai_tags): - self.assertEqual(tag1.confidence,tag2.confidence) - self.assertEqual(tag1.name,tag2.name) - self.assertEqual(tag1.source,tag2.source) - - self.assertEqual(u.version_info.id,expectedUploadFileResult.version_info.id) - self.assertEqual(u.version_info.name,expectedUploadFileResult.version_info.name) - self.assertEqual(u.is_private_file,expectedUploadFileResult.is_private_file) - self.assertEqual(u.custom_coordinates,expectedUploadFileResult.custom_coordinates) - self.assertEqual(u.custom_metadata,expectedUploadFileResult.custom_metadata) - self.assertEqual(u.embedded_metadata.x_resolution,expectedUploadFileResult.embedded_metadata.x_resolution) - self.assertEqual(u.embedded_metadata.y_resolution,expectedUploadFileResult.embedded_metadata.y_resolution) - self.assertEqual(u.embedded_metadata.date_time_created,expectedUploadFileResult.embedded_metadata.date_time_created) - self.assertEqual(u.embedded_metadata.date_created,expectedUploadFileResult.embedded_metadata.date_created) - self.assertEqual(u.extension_status,expectedUploadFileResult.extension_status) - self.assertEqual(u.file_type,expectedUploadFileResult.file_type) - self.assertEqual(u.orientation,expectedUploadFileResult.orientation) diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 0000000..eed9080 --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,167 @@ +from __future__ import annotations + +import os +import inspect +import traceback +import contextlib +from typing import Any, TypeVar, Iterator, Sequence, cast +from datetime import date, datetime +from typing_extensions import Literal, get_args, get_origin, assert_type + +from imagekit._types import Omit, NoneType +from imagekit._utils import ( + is_dict, + is_list, + is_list_type, + is_union_type, + extract_type_arg, + is_sequence_type, + is_annotated_type, + is_type_alias_type, +) +from imagekit._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from imagekit._models import BaseModel + +BaseModelT = TypeVar("BaseModelT", bound=BaseModel) + + +def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: list[str]) -> bool: + for name, field in get_model_fields(model).items(): + field_value = getattr(value, name) + if PYDANTIC_V2: + allow_none = False + else: + # in v1 nullability was structured differently + # https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields + allow_none = getattr(field, "allow_none", False) + + assert_matches_type( + field_outer_type(field), + field_value, + path=[*path, name], + allow_none=allow_none, + ) + + return True + + +# Note: the `path` argument is only used to improve error messages when `--showlocals` is used +def assert_matches_type( + type_: Any, + value: object, + *, + path: list[str], + allow_none: bool = False, +) -> None: + if is_type_alias_type(type_): + type_ = type_.__value__ + + # unwrap `Annotated[T, ...]` -> `T` + if is_annotated_type(type_): + type_ = extract_type_arg(type_, 0) + + if allow_none and value is None: + return + + if type_ is None or type_ is NoneType: + assert value is None + return + + origin = get_origin(type_) or type_ + + if is_list_type(type_): + return _assert_list_type(type_, value) + + if is_sequence_type(type_): + assert isinstance(value, Sequence) + inner_type = get_args(type_)[0] + for entry in value: # type: ignore + assert_type(inner_type, entry) # type: ignore + return + + if origin == str: + assert isinstance(value, str) + elif origin == int: + assert isinstance(value, int) + elif origin == bool: + assert isinstance(value, bool) + elif origin == float: + assert isinstance(value, float) + elif origin == bytes: + assert isinstance(value, bytes) + elif origin == datetime: + assert isinstance(value, datetime) + elif origin == date: + assert isinstance(value, date) + elif origin == object: + # nothing to do here, the expected type is unknown + pass + elif origin == Literal: + assert value in get_args(type_) + elif origin == dict: + assert is_dict(value) + + args = get_args(type_) + key_type = args[0] + items_type = args[1] + + for key, item in value.items(): + assert_matches_type(key_type, key, path=[*path, ""]) + assert_matches_type(items_type, item, path=[*path, ""]) + elif is_union_type(type_): + variants = get_args(type_) + + try: + none_index = variants.index(type(None)) + except ValueError: + pass + else: + # special case Optional[T] for better error messages + if len(variants) == 2: + if value is None: + # valid + return + + return assert_matches_type(type_=variants[not none_index], value=value, path=path) + + for i, variant in enumerate(variants): + try: + assert_matches_type(variant, value, path=[*path, f"variant {i}"]) + return + except AssertionError: + traceback.print_exc() + continue + + raise AssertionError("Did not match any variants") + elif issubclass(origin, BaseModel): + assert isinstance(value, type_) + assert assert_matches_model(type_, cast(Any, value), path=path) + elif inspect.isclass(origin) and origin.__name__ == "HttpxBinaryResponseContent": + assert value.__class__.__name__ == "HttpxBinaryResponseContent" + else: + assert None, f"Unhandled field type: {type_}" + + +def _assert_list_type(type_: type[object], value: object) -> None: + assert is_list(value) + + inner_type = get_args(type_)[0] + for entry in value: + assert_type(inner_type, entry) # type: ignore + + +@contextlib.contextmanager +def update_env(**new_env: str | Omit) -> Iterator[None]: + old = os.environ.copy() + + try: + for name, value in new_env.items(): + if isinstance(value, Omit): + os.environ.pop(name, None) + else: + os.environ[name] = value + + yield None + finally: + os.environ.clear() + os.environ.update(old) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index b67c350..0000000 --- a/tox.ini +++ /dev/null @@ -1,10 +0,0 @@ -[tox] -envlist = py36, py37, py38, py39, py310 -skipsdist = True - -[testenv] -passenv = * -deps = -rrequirements/test.txt -commands = - coverage run --append -m unittest discover tests - coverage report