diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6822a2b..245226b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -28,8 +28,8 @@ jobs:
pip install dist/pixelbin-*.tar.gz
- - name: Run tests
+ - name: Run test
run: |
coverage run -m pytest tests/pixelbin_test.py
coverage report
- coverage html
\ No newline at end of file
+ coverage html
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 537d02c..2cfd6b3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,49 +1,54 @@
+## 4.3.0
+
+- Introduces PixelBin's Prediction APIs that offer a suite of AI-powered image editing tools designed to streamline your media workflow.
+- Added a wrapper around the Prediction API allowing developers to easily create, track, and manage prediction jobs.
+
## 4.2.0
-- Added [upload](./README.md#upload) method.
-- Removed support for signature generation for APIs.
+- Added [upload](./README.md#upload) method.
+- Removed support for signature generation for APIs.
# 4.1.0
-- Fixed parameters for `getPresets` method.
-- Added support for using a proxy with the Pixelbin SDK by setting the `trust_env` option to `True` in the `httpClientOptions` object of `PixelbinConfig`.
-- When `trust_env` is set to `True`, the SDK will trust the environment settings for proxy configuration or the `~/.netrc` file if present.
+- Fixed parameters for `getPresets` method.
+- Added support for using a proxy with the Pixelbin SDK by setting the `trust_env` option to `True` in the `httpClientOptions` object of `PixelbinConfig`.
+- When `trust_env` is set to `True`, the SDK will trust the environment settings for proxy configuration or the `~/.netrc` file if present.
# 4.0.0
-- **Breaking Change:** Function signature of `sign_url` in `security.py` has been updated. The argument `token_id` has been replaced with `access_key`. Access key for a token can be found by going to console.pixelbin.io > `Settings` > `Tokens` > Click on any Token > `Access Key`.
+- **Breaking Change:** Function signature of `sign_url` in `security.py` has been updated. The argument `token_id` has been replaced with `access_key`. Access key for a token can be found by going to console.pixelbin.io > `Settings` > `Tokens` > Click on any Token > `Access Key`.
# 3.2.0
-- Added method for generating V2 Signed Multipart Upload Urls `createSignedUrlV2`
+- Added method for generating V2 Signed Multipart Upload Urls `createSignedUrlV2`
# 3.1.1
-- Fixed regex for Custom Domain URLs
+- Fixed regex for Custom Domain URLs
# 3.1.0
-- Added support for generating signed Custom Domain and PixelBin CDN urls
+- Added support for generating signed Custom Domain and PixelBin CDN urls
# 3.0.0
-- Fixed bugs parsing `dpr` & `f_auto` in `obj_to_url` & `url_to_obj`
-- Added support for parsing Custom Domains in `obj_to_url` and `url_to_obj`
-- Improved support for worker urls in `obj_to_url` and `url_to_obj`
+- Fixed bugs parsing `dpr` & `f_auto` in `obj_to_url` & `url_to_obj`
+- Added support for parsing Custom Domains in `obj_to_url` and `url_to_obj`
+- Improved support for worker urls in `obj_to_url` and `url_to_obj`
# 2.2.0
-- Added a method for obtaining the context of a file via url.
+- Added a method for obtaining the context of a file via url.
# 2.1.1
-- Removed unused model
-- Rewritten test suite to improve test reliability
+- Removed unused model
+- Rewritten test suite to improve test reliability
# 2.1.0
-- Fixed `tags` being stringified inadvertently. If you are experiencing validation errors around `tags` in previous versions, you should upgrade your SDKs.
+- Fixed `tags` being stringified inadvertently. If you are experiencing validation errors around `tags` in previous versions, you should upgrade your SDKs.
# 2.0.0
-- method for getting org details has changed from `getAppByToken` => `getAppOrgDetails`
+- method for getting org details has changed from `getAppByToken` => `getAppOrgDetails`
diff --git a/MIGRATION.md b/MIGRATION.md
index 5323203..6a21ed4 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -6,37 +6,37 @@
1. **Updated Function Signature in `security.py`**
- The arguments for `sign_url` function has been updated. The `token_id` parameter has been replaced with `access_key`.
+ The arguments for `sign_url` function has been updated. The `token_id` parameter has been replaced with `access_key`.
- **Previous Method (v3.1.x and above):**
+ **Previous Method (v3.1.x and above):**
- ```python
- from pixelbin.utils.security import sign_url
+ ```python
+ from pixelbin.utils.security import sign_url
- signed_url = sign_url(
- url="https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
- expiry_seconds=20,
- token_id=42,
- token="dummy-token",
- );
- ```
+ signed_url = sign_url(
+ url="https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
+ expiry_seconds=20,
+ token_id=42,
+ token="dummy-token",
+ );
+ ```
- **New Method (v4.x.x):**
+ **New Method (v4.x.x):**
- ```python
- from pixelbin.utils.security import sign_url
+ ```python
+ from pixelbin.utils.security import sign_url
- signed_url = sign_url(
- url="https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
- expiry_seconds=20,
- access_key="6227274d-92c9-4b74-bef8-2528542516d8",
- token="dummy-token",
- );
- ```
+ signed_url = sign_url(
+ url="https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
+ expiry_seconds=20,
+ access_key="6227274d-92c9-4b74-bef8-2528542516d8",
+ token="dummy-token",
+ );
+ ```
- **How to Find Your Access Key:**
+ **How to Find Your Access Key:**
- - Go to `console.pixelbin.io`
- - Navigate to `Settings` > `Tokens`
- - Click on any Token
- - Find the `Access Key` in the token details
+ - Go to `console.pixelbin.io`
+ - Navigate to `Settings` > `Tokens`
+ - Click on any Token
+ - Find the `Access Key` in the token details
diff --git a/README.md b/README.md
index afe9f90..6782a7b 100644
--- a/README.md
+++ b/README.md
@@ -12,39 +12,483 @@ Getting started with Pixelbin Backend SDK for Python
pip install pixelbin
```
----
+______________________________________________________________________
-### Usage
-
-#### Quick Example
+### Initialize client
```python
-import asyncio
-
from pixelbin import PixelbinClient, PixelbinConfig
-# create client with your API_TOKEN
+# Create a config with you API_TOKEN
config = PixelbinConfig({
"domain": "https://api.pixelbin.io",
"apiSecret": "API_TOKEN",
})
# Create a pixelbin instance
-pixelbin:PixelbinClient = PixelbinClient(config=config)
+pixelbin = PixelbinClient(config=config)
+```
-# Sync method call
-try:
- result = pixelbin.assets.listFiles()
- print(result)
-except Exception as e:
- print(e)
+Note: You will need an API token to authenticate your requests. Follow the Pixelbin Create Token guide to generate one: [Create Token](https://www.pixelbin.io/docs/tokens/create-token/).
-# Async method call
-try:
- result = asyncio.get_event_loop().run_until_complete(pixelbin.assets.listFilesAsync())
- print(result)
-except Exception as e:
- print(e)
+## Predictions API
+
+PixelBin's Prediction APIs offer a suite of smart, AI-powered image editing tools designed to streamline your media workflow. These APIs enable you to transform, organize, and enhance images seamlessly within your application or system.
+
+This SDK offers a convenient wrapper around the Prediction API, allowing developers to easily create, track, and manage prediction jobs using async/await. It simplifies image upload, processing, and retrieval within Python applications.
+
+For a broader overview, see the official docs: [Prediction APIs](https://www.pixelbin.io/docs/explore/).
+
+### create
+
+Initiate a prediction job using the prediction model name (for example, `erase_bg`) and input fields as per the model's input schema. Optionally pass a `webhook` URL to receive async notifications.
+
+| Argument | Type | Required | Description |
+| --------- | ------ | -------- | ---------------------------------------------------- |
+| `name` | `str` | yes | Name of the prediction model, e.g. `erase_bg`. |
+| `input` | `dict` | yes | Input fields as per the model input schema. |
+| `webhook` | `str` | no | Optional webhook URL to receive async notifications. |
+
+```python
+from pixelbin import PixelbinClient, PixelbinConfig
+import asyncio
+
+pixelbin = PixelbinClient(config=PixelbinConfig({
+ "domain": "https://api.pixelbin.io",
+ "apiSecret": "API_TOKEN",
+}))
+
+# Sync:
+job = pixelbin.predictions.create(
+ name="erase_bg",
+ input={
+ # Provide files as bytes or file-like streams; URLs are also accepted as strings
+ "image": open("/path/to/image.jpeg", "rb").read(),
+ "industry_type": "general",
+ "quality_type": "original",
+ "shadow": "false",
+ "refine": "true",
+ },
+ webhook="https://example.com/webhook",
+)
+# job["_id"] can be used to check status
+
+# Async:
+async def run():
+ job_async = await pixelbin.predictions.createAsync(
+ name="erase_bg",
+ input={
+ "image": open("/path/to/image.jpeg", "rb").read(),
+ "industry_type": "general",
+ "quality_type": "original",
+ "shadow": "false",
+ "refine": "true",
+ },
+ webhook="https://example.com/webhook",
+ )
+ print(job_async["_id"])
+
+asyncio.get_event_loop().run_until_complete(run())
+```
+
+#### Returns
+
+`dict`
+
+On Creation:
+
+| Property | Description | Example |
+| ----------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
+| `input` (dict) | Model input | `{ "image": "https://delivery.pixelbin.io/predictions/inputs/erase/bg/0198f54a-cc84-7ccc-b31f-18dd0a5b0f01/image/0.jpeg", ... }` |
+| `status` (str) | Current job status | `ACCEPTED` |
+| `urls.get` (str) | URL to fetch job details | `https://api.pixelbin.io/service/platform/transformation/v1.0/predictions/erase--bg--0198f54a-cc84-7ccc-b31f-18dd0a5b0f01` |
+| `orgId` (int) | Organization id | `402162` |
+| `retention` (str) | Output retention period | `30d` |
+| `createdAt` (str) | Job creation timestamp (ISO 8601) | `2025-08-29T10:06:16.708Z` |
+| `_id` (str) | Prediction request id | `erase--bg--0198f54a-cc84-7ccc-b31f-18dd0a5b0f01` |
+
+On Error:
+
+| Property | Description | Example |
+| ----------------- | ----------------- | -------------------------------------------------- |
+| `message` (str) | Error message | `Usage Limit Exceeded` |
+| `status` (int) | HTTP status code | `403` |
+| `errorCode` (str) | Error code | `JR-1000` |
+| `exception` (str) | Exception name | `UsageBlockedError` |
+| `info` (str) | Help link | `https://fynd.engineering/erasebg/docs/error/1000` |
+
+### get
+
+Fetch the prediction by request ID (job.\_id).
+
+| Argument | Type | Required | Description |
+| ------------ | ----- | -------- | ---------------------------------------------------------- |
+| `request_id` | `str` | yes | Prediction request ID returned by `create` (`job["_id"]`). |
+
+```python
+# Sync:
+details = pixelbin.predictions.get(job["_id"]) # string only
+if details.get("status") == "SUCCESS":
+ print(details.get("output"))
+
+# Async:
+import asyncio
+
+async def run():
+ details_async = await pixelbin.predictions.getAsync(job["_id"])
+ if details_async.get("status") == "SUCCESS":
+ print(details_async.get("output"))
+
+asyncio.get_event_loop().run_until_complete(run())
+```
+
+#### Returns
+
+`dict`
+
+On Success:
+
+| Property | Description | Example |
+| ----------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
+| `input` (dict) | Model input | `{ "image": "https://delivery.pixelbin.io/predictions/inputs/erase/bg/0198f54a-cc84-7ccc-b31f-18dd0a5b0f01/image/0.jpeg", ... }` |
+| `status` (str) | Final job status | `SUCCESS` |
+| `urls.get` (str) | URL to fetch job details | `https://api.pixelbin.io/service/platform/transformation/v1.0/predictions/erase--bg--0198f54a-cc84-7ccc-b31f-18dd0a5b0f01` |
+| `orgId` (int) | Organization id | `402162` |
+| `retention` (str) | Output retention period | `30d` |
+| `createdAt` (str) | Job creation timestamp (ISO 8601) | `2025-08-29T10:06:16.708Z` |
+| `_id` (str) | Prediction request id | `erase--bg--0198f54a-cc84-7ccc-b31f-18dd0a5b0f01` |
+| `consumedCredits` (int) | Credits consumed | `1` |
+| `output` (list[str]) | Result URLs | `["https://delivery.pixelbin.io/predictions/outputs/30d/erase/bg/0198f54a-cc84-7ccc-b31f-18dd0a5b0f01/result_0.png"]` |
+
+On Failure:
+
+| Property | Description | Example |
+| ----------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
+| `input` (dict) | Model input | `{ "industry_type": "general", "quality_type": "original", "shadow": False, "refine": True }` |
+| `status` (str) | Final job status | `FAILURE` |
+| `urls.get` (str) | URL to fetch job details | `https://api.pixelbin.io/service/platform/transformation/v1.0/predictions/erase--bg--0198f54b-8d2e-7ccc-b31f-2a2f33cb7365` |
+| `orgId` (int) | Organization id | `402162` |
+| `retention` (str) | Output retention period | `30d` |
+| `createdAt` (str) | Job creation timestamp (ISO 8601) | `2025-08-29T10:07:06.030Z` |
+| `_id` (str) | Prediction request id | `erase--bg--0198f54b-8d2e-7ccc-b31f-2a2f33cb7365` |
+| `error` (str) | Error message | `image not found` |
+
+### wait
+
+Wait until the prediction completes.
+
+| Argument | Type | Required | Description |
+| ------------ | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `request_id` | `str` | yes | Prediction request ID to poll until status is `SUCCESS` or `FAILURE`. |
+| `options` | `dict` | no | Polling options: `maxAttempts` (int, default 150, range 1-150), `retryFactor` (float, default 1, range 1-3), `retryInterval` (seconds, float, default 4.0, range 1-60). |
+
+```python
+# Sync:
+result = pixelbin.predictions.wait(job["_id"]) # string only
+
+result_quick = pixelbin.predictions.wait(job["_id"], {
+ "maxAttempts": 30,
+ "retryFactor": 1,
+ "retryInterval": 1.0,
+})
+
+print(result.get("status")) # Prediction status
+print(result.get("output")) # Prediction output
+
+# Async:
+import asyncio
+
+async def run():
+ result_async = await pixelbin.predictions.waitAsync(job["_id"], {
+ "maxAttempts": 30,
+ "retryFactor": 1,
+ "retryInterval": 1.0,
+ })
+ print(result_async.get("status"), result_async.get("output"))
+
+asyncio.get_event_loop().run_until_complete(run())
+```
+
+#### Returns
+
+`dict`
+
+Same as `get` above. `wait` resolves to the final prediction object (either SUCCESS or FAILURE).
+
+### create_and_wait
+
+Create a prediction and wait until it completes. Returns the final result.
+
+| Argument | Type | Required | Description |
+| --------- | ------ | -------- | -------------------------------------------------------------- |
+| `name` | `str` | yes | Prediction name in `plugin_operation` format, e.g. `erase_bg`. |
+| `input` | `dict` | yes | Input fields as per the model input schema. |
+| `webhook` | `str` | no | Optional webhook URL. |
+| `options` | `dict` | no | Same options as in `wait`. |
+
+```python
+# Sync:
+result = pixelbin.predictions.create_and_wait(
+ name="erase_bg",
+ input={"image": open("/path/to/image.jpeg", "rb").read()},
+ options={"maxAttempts": 60, "retryFactor": 1, "retryInterval": 2.0},
+)
+
+# Async:
+import asyncio
+
+async def run():
+ result_async = await pixelbin.predictions.create_and_waitAsync(
+ name="erase_bg",
+ input={"image": open("/path/to/image.jpeg", "rb").read()},
+ options={"maxAttempts": 60, "retryFactor": 1, "retryInterval": 2.0},
+ )
+ print(result_async.get("status"))
+
+asyncio.get_event_loop().run_until_complete(run())
+```
+
+#### Returns
+
+`dict`
+
+Same as `get` above. `create_and_wait` resolves to the final prediction object (either SUCCESS or FAILURE).
+
+### list
+
+Fetch the list of available prediction models.
+
+```python
+# Sync:
+items = pixelbin.predictions.list()
+print(len(items) if isinstance(items, list) else 0)
+
+# Async:
+import asyncio
+
+async def run():
+ items_async = await pixelbin.predictions.listAsync()
+ print(len(items_async) if isinstance(items_async, list) else 0)
+
+asyncio.get_event_loop().run_until_complete(run())
+```
+
+#### Returns
+
+`list[dict]`
+
+Each item:
+
+| Property | Description | Example |
+| ------------------- | ----------------------------------------- | --------------------------- |
+| `name` (str) | Unique identifier of the prediction model | `erase_bg` |
+| `displayName` (str) | Human readable name of the model | `Erase Background` |
+| `description` (str) | Short model description | `Removes image background.` |
+
+### get_schema
+
+Fetch the input schema for a specific prediction model by its name.
+
+| Argument | Type | Required | Description |
+| -------- | ----- | -------- | --------------------------------- |
+| `name` | `str` | yes | Prediction name, e.g. `erase_bg`. |
+
+```python
+# Sync:
+schema = pixelbin.predictions.get_schema("erase_bg")
+print(schema.get("name") if isinstance(schema, dict) else None)
+
+# Async:
+import asyncio
+
+async def run():
+ schema_async = await pixelbin.predictions.get_schemaAsync("erase_bg")
+ print(schema_async.get("name") if isinstance(schema_async, dict) else None)
+
+asyncio.get_event_loop().run_until_complete(run())
+```
+
+#### Returns
+
+`dict`
+
+| Property | Description | Example |
+| ------------------- | ---------------------------------------------- | --------------------------- |
+| `name` (str) | Model name | `erase_bg` |
+| `displayName` (str) | Human readable name | `Erase Background` |
+| `description` (str) | Model description | `Removes image background.` |
+| `input` (dict) | JSON Schema for model inputs (varies by model) | `{ ... }` |
+
+Fields inside `input.image` (varies by model):
+
+| Property | Description | Example |
+| ----------------------------------- | ------------------------------------------------ | ---------------------------------- |
+| `oneOf` (list) | Supported input types (e.g., URL or file upload) | `[ ... ]` |
+| `supportedContentTypes` (list[str]) | Supported MIME types | `["image/png", "image/jpeg", ...]` |
+| `imageValidation.maxWidth` (int) | Max image width in pixels | `10000` |
+| `imageValidation.maxHeight` (int) | Max image height in pixels | `10000` |
+| `imageValidation.maxSize` (int) | Max image size in bytes | `26214400` |
+
+## Examples
+
+### 1. Implementation using `create`, `get` and `wait` method
+
+Sync version:
+
+```python
+from pixelbin import PixelbinClient, PixelbinConfig
+
+def generate_image():
+ pixelbin = PixelbinClient(
+ config=PixelbinConfig({
+ "domain": "https://api.pixelbin.io",
+ "apiSecret": os.getenv("PIXELBIN_API_TOKEN") or "API_TOKEN",
+ })
+ )
+
+ try:
+ # 1) Create prediction
+ job = pixelbin.predictions.create(
+ name="erase_bg",
+ input={
+ "image": "https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
+ "industry_type": "general",
+ "quality_type": "original",
+ "shadow": False,
+ "refine": True,
+ },
+ # webhook="https://example.com/webhook", # optional
+ )
+ print("Created:", job.get("_id"), job.get("status"))
+
+ # 2) get job details
+ details = pixelbin.predictions.get(job["_id"]) # string only
+ print("Details:", details.get("status"))
+
+ # 3) Wait for completion
+ result = pixelbin.predictions.wait(job["_id"]) # string only
+ print("Final:", result.get("status"), result.get("output"))
+ except Exception as err:
+ print("Error:", err)
+
+if __name__ == "__main__":
+ import os
+ generate_image()
+```
+
+Async version:
+
+```python
+import asyncio
+from pixelbin import PixelbinClient, PixelbinConfig
+
+async def generate_image_async():
+ pixelbin = PixelbinClient(
+ config=PixelbinConfig({
+ "domain": "https://api.pixelbin.io",
+ "apiSecret": os.getenv("PIXELBIN_API_TOKEN") or "API_TOKEN",
+ })
+ )
+
+ try:
+ # 1) Create prediction (async)
+ job = await pixelbin.predictions.createAsync(
+ name="erase_bg",
+ input={
+ "image": "https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
+ "industry_type": "general",
+ "quality_type": "original",
+ "shadow": False,
+ "refine": True,
+ },
+ # webhook="https://example.com/webhook", # optional
+ )
+ print("Created:", job.get("_id"), job.get("status"))
+
+ # 2) get job details (async)
+ details = await pixelbin.predictions.getAsync(job["_id"]) # string only
+ print("Details:", details.get("status"))
+
+ # 3) Wait for completion (async)
+ result = await pixelbin.predictions.waitAsync(job["_id"]) # string only
+ print("Final:", result.get("status"), result.get("output"))
+ except Exception as err:
+ print("Error:", err)
+
+if __name__ == "__main__":
+ import os
+ asyncio.get_event_loop().run_until_complete(generate_image_async())
+```
+
+### 2. Implementation with `create_and_wait` method
+
+Sync version:
+
+```python
+from pixelbin import PixelbinClient, PixelbinConfig
+
+def generate_image():
+ pixelbin = PixelbinClient(
+ config=PixelbinConfig({
+ "domain": "https://api.pixelbin.io",
+ "apiSecret": os.getenv("PIXELBIN_API_TOKEN") or "API_TOKEN",
+ })
+ )
+
+ try:
+ result = pixelbin.predictions.create_and_wait(
+ name="erase_bg",
+ input={
+ "image": "https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
+ "industry_type": "general",
+ "quality_type": "original",
+ "shadow": False,
+ "refine": True,
+ },
+ # webhook="https://example.com/webhook", # optional
+ )
+ print(result) # { status, output, ... }
+ except Exception as error:
+ print("Error:", error)
+
+if __name__ == "__main__":
+ import os
+ generate_image()
+```
+
+Async version:
+
+```python
+import asyncio
+from pixelbin import PixelbinClient, PixelbinConfig
+
+async def generate_image_async():
+ pixelbin = PixelbinClient(
+ config=PixelbinConfig({
+ "domain": "https://api.pixelbin.io",
+ "apiSecret": os.getenv("PIXELBIN_API_TOKEN") or "API_TOKEN",
+ })
+ )
+
+ try:
+ result = await pixelbin.predictions.create_and_waitAsync(
+ name="erase_bg",
+ input={
+ "image": "https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg",
+ "industry_type": "general",
+ "quality_type": "original",
+ "shadow": False,
+ "refine": True,
+ },
+ # webhook="https://example.com/webhook", # optional
+ )
+ print(result) # { status, output, ... }
+ except Exception as error:
+ print("Error:", error)
+
+if __name__ == "__main__":
+ import os
+ asyncio.get_event_loop().run_until_complete(generate_image_async())
```
## Uploader
@@ -55,47 +499,47 @@ Uploads a file to PixelBin with greater control over the upload process.
#### Arguments
-| Argument | Type | Required | Description |
+| Argument | Type | Required | Description |
| ------------------- | ----------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `file` | `bytes` or `io.BufferedIOBase` | yes | The file to be uploaded. |
-| `name` | `str` | no | Name of the file. |
-| `path` | `str` | no | Path of the containing folder. |
-| `format` | `str` | no | Format of the file. |
-| `access` | [AccessEnum](./documentation/platform/ASSETS.md#accessenum) | no | Access level of the asset, can be either `'public-read'` or `'private'`. |
-| `tags` | `list[str]` | no | Tags associated with the file. |
-| `metadata` | `dict` | no | Metadata associated with the file. |
-| `overwrite` | `bool` | no | Overwrite flag. If set to `True`, will overwrite any file that exists with the same path, name, and type. Defaults to `False`. |
-| `filenameOverride` | `bool` | no | If set to `True`, will add unique characters to the name if an asset with the given name already exists. If the overwrite flag is set to `True`, preference will be given to the overwrite flag. If both are set to `False`, an error will be raised. |
-| `expiry` | `int` | no | Expiry time in seconds for the underlying signed URL. Defaults to 3000 seconds. |
-| `uploadOptions` | `dict` | no | Additional options for fine-tuning the upload process. Default: `{ chunk_size: 10 * 1024 * 1024, max_retries: 2, concurrency: 3, exponential_factor: 2 }`. |
-| `chunkSize` | `int` | no | Size of each chunk to upload. Default is 10 megabytes. |
-| `maxRetries` | `int` | no | Maximum number of retries if an upload fails. Default is 2 retries. |
-| `concurrency` | `int` | no | Number of concurrent chunk upload tasks. Default is 3 concurrent chunk uploads. |
-| `exponentialFactor` | `int` | no | The exponential factor for retry delay. Default is 2. |
+| `file` | `bytes` or `io.BufferedIOBase` | yes | The file to be uploaded. |
+| `name` | `str` | no | Name of the file. |
+| `path` | `str` | no | Path of the containing folder. |
+| `format` | `str` | no | Format of the file. |
+| `access` | [AccessEnum](./documentation/platform/ASSETS.md#accessenum) | no | Access level of the asset, can be either `'public-read'` or `'private'`. |
+| `tags` | `list[str]` | no | Tags associated with the file. |
+| `metadata` | `dict` | no | Metadata associated with the file. |
+| `overwrite` | `bool` | no | Overwrite flag. If set to `True`, will overwrite any file that exists with the same path, name, and type. Defaults to `False`. |
+| `filenameOverride` | `bool` | no | If set to `True`, will add unique characters to the name if an asset with the given name already exists. If the overwrite flag is set to `True`, preference will be given to the overwrite flag. If both are set to `False`, an error will be raised. |
+| `expiry` | `int` | no | Expiry time in seconds for the underlying signed URL. Defaults to 3000 seconds. |
+| `uploadOptions` | `dict` | no | Additional options for fine-tuning the upload process. Default: `{ chunk_size: 10 * 1024 * 1024, max_retries: 2, concurrency: 3, exponential_factor: 2 }`. |
+| `chunkSize` | `int` | no | Size of each chunk to upload. Default is 10 megabytes. |
+| `maxRetries` | `int` | no | Maximum number of retries if an upload fails. Default is 2 retries. |
+| `concurrency` | `int` | no | Number of concurrent chunk upload tasks. Default is 3 concurrent chunk uploads. |
+| `exponentialFactor` | `int` | no | The exponential factor for retry delay. Default is 2. |
#### Returns
`dict`: On success, returns a dictionary containing the details of the uploaded file.
-| Property | Description | Example |
+| Property | Description | Example |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `orgId` | Organization ID | `5320086` |
-| `type` | Type of the uploaded entity | `file` |
-| `name` | Name of the file | `testfile.jpeg` |
-| `path` | Path of the containing folder | `/path/to/image.jpeg` |
-| `fileId` | ID of the file | `testfile.jpeg` |
-| `access` | Access level of the asset, can be `public-read` or `private` | `public-read` |
-| `tags` | Tags associated with the file | `["tag1", "tag2"]` |
-| `metadata` | Metadata associated with the file | `{"source":"", "publicUploadId":""}` |
-| `format` | File format | `jpeg` |
-| `assetType` | Type of asset | `image` |
-| `size` | File size (in bytes) | `37394` |
-| `width` | File width (in pixels) | `720` |
-| `height` | File height (in pixels) | `450` |
-| `context` | File metadata and additional context | `{"steps":[],"req":{"headers":{},"query":{}},"meta":{"format":"png","size":195337,"width":812,"height":500,"space":"srgb","channels":4,"depth":"uchar","density":144,"isProgressive":false,"resolutionUnit":"inch","hasProfile":true,"hasAlpha":true,"extension":"jpeg","contentType":"image/png","assetType":"image","isImageAsset":true,"isAudioAsset":false,"isVideoAsset":false,"isRawAsset":false,"isTransformationSupported":true}}` |
-| `isOriginal` | Flag indicating if the file is original | `true` |
-| `_id` | Record ID | `a0b0b19a-d526-4xc07-ae51-0xxxxxx` |
-| `url` | URL of the uploaded file | `https://cdn.pixelbin.io/v2/user-e26cf3/original/testfile.jpeg` |
+| `orgId` | Organization ID | `5320086` |
+| `type` | Type of the uploaded entity | `file` |
+| `name` | Name of the file | `testfile.jpeg` |
+| `path` | Path of the containing folder | `/path/to/image.jpeg` |
+| `fileId` | ID of the file | `testfile.jpeg` |
+| `access` | Access level of the asset, can be `public-read` or `private` | `public-read` |
+| `tags` | Tags associated with the file | `["tag1", "tag2"]` |
+| `metadata` | Metadata associated with the file | `{"source":"", "publicUploadId":""}` |
+| `format` | File format | `jpeg` |
+| `assetType` | Type of asset | `image` |
+| `size` | File size (in bytes) | `37394` |
+| `width` | File width (in pixels) | `720` |
+| `height` | File height (in pixels) | `450` |
+| `context` | File metadata and additional context | `{"steps":[],"req":{"headers":{},"query":{}},"meta":{"format":"png","size":195337,"width":812,"height":500,"space":"srgb","channels":4,"depth":"uchar","density":144,"isProgressive":false,"resolutionUnit":"inch","hasProfile":true,"hasAlpha":true,"extension":"jpeg","contentType":"image/png","assetType":"image","isImageAsset":true,"isAudioAsset":false,"isVideoAsset":false,"isRawAsset":false,"isTransformationSupported":true}}` |
+| `isOriginal` | Flag indicating if the file is original | `true` |
+| `_id` | Record ID | `a0b0b19a-d526-4xc07-ae51-0xxxxxx` |
+| `url` | URL of the uploaded file | `https://cdn.pixelbin.io/v2/user-e26cf3/original/testfile.jpeg` |
#### Example Usage
@@ -247,12 +691,12 @@ except Exception as e:
Generate a signed PixelBin url
-| Parameter | Description | Example |
+| Parameter | Description | Example |
| ---------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------ |
-| `url` (string) | A valid Pixelbin URL to be signed | `https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg` |
-| `expiry_seconds` (int) | Number of seconds the signed URL should be valid for | `20` |
-| `access_key` (string) | Access key of the token used for signing | `6227274d-92c9-4b74-bef8-2528542516d8` |
-| `token` (string) | Value of the token used for signing | `dummy-token` |
+| `url` (string) | A valid Pixelbin URL to be signed | `https://cdn.pixelbin.io/v2/dummy-cloudname/original/__playground/playground-default.jpeg` |
+| `expiry_seconds` (int) | Number of seconds the signed URL should be valid for | `20` |
+| `access_key` (string) | Access key of the token used for signing | `6227274d-92c9-4b74-bef8-2528542516d8` |
+| `token` (string) | Value of the token used for signing | `dummy-token` |
Example:
@@ -292,26 +736,26 @@ Pixelbin provides url utilities to construct and deconstruct Pixelbin urls.
Deconstruct a pixelbin url
-| parameter | description | example |
+| parameter | description | example |
| ----------------------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
-| `url` (string) | A valid Pixelbin URL | `https://cdn.pixelbin.io/v2/your-cloud-name/z-slug/t.resize(h:100,w:200)~t.flip()/path/to/image.jpeg` |
-| `opts` (Object) | Options for the conversion | Default: `{ isCustomDomain: False }` |
+| `url` (string) | A valid Pixelbin URL | `https://cdn.pixelbin.io/v2/your-cloud-name/z-slug/t.resize(h:100,w:200)~t.flip()/path/to/image.jpeg` |
+| `opts` (Object) | Options for the conversion | Default: `{ isCustomDomain: False }` |
| `opts.is_custom_domain` | Indicates if the URL belongs to a custom domain (default: `False`) |
**Returns**:
-| Property | Description | Example |
+| Property | Description | Example |
| ------------------------- | ---------------------------------------------------- | ------------------------------------- |
-| `baseURL` (string) | Base path of the URL | `https://cdn.pixelbin.io` |
-| `filePath` (string) | Path to the file on Pixelbin storage | `/path/to/image.jpeg` |
-| `version` (string) | Version of the URL | `v2` |
-| `cloudName` (string) | Cloud name from the URL | `your-cloud-name` |
-| `transformations` (array) | A list of transformation objects | `[{ "plugin": "t", "name": "flip" }]` |
-| `zone` (string) | Zone slug from the URL | `z-slug` |
-| `pattern` (string) | Transformation pattern extracted from the URL | `t.resize(h:100,w:200)~t.flip()` |
-| `worker` (boolean) | Indicates if the URL is a URL Translation Worker URL | `False` |
-| `workerPath` (string) | Input path to a URL Translation Worker | `resize:w200,h400/folder/image.jpeg` |
-| `options` (Object) | Query parameters added, such as "dpr" and "f_auto" | `{ dpr: 2.5, f_auto: True}` |
+| `baseURL` (string) | Base path of the URL | `https://cdn.pixelbin.io` |
+| `filePath` (string) | Path to the file on Pixelbin storage | `/path/to/image.jpeg` |
+| `version` (string) | Version of the URL | `v2` |
+| `cloudName` (string) | Cloud name from the URL | `your-cloud-name` |
+| `transformations` (array) | A list of transformation objects | `[{ "plugin": "t", "name": "flip" }]` |
+| `zone` (string) | Zone slug from the URL | `z-slug` |
+| `pattern` (string) | Transformation pattern extracted from the URL | `t.resize(h:100,w:200)~t.flip()` |
+| `worker` (boolean) | Indicates if the URL is a URL Translation Worker URL | `False` |
+| `workerPath` (string) | Input path to a URL Translation Worker | `resize:w200,h400/folder/image.jpeg` |
+| `options` (Object) | Query parameters added, such as "dpr" and "f_auto" | `{ dpr: 2.5, f_auto: True}` |
Example:
@@ -415,18 +859,18 @@ obj = url_to_obj(workerUrl)
Converts the extracted url obj to a Pixelbin url.
-| Property | Description | Example |
+| Property | Description | Example |
| -------------------------- | ---------------------------------------------------- | ------------------------------------- |
-| `cloudName` (string) | The cloudname extracted from the URL | `your-cloud-name` |
-| `zone` (string) | 6 character zone slug | `z-slug` |
-| `version` (string) | CDN API version | `v2` |
-| `transformations` (array) | Extracted transformations from the URL | `[{ "plugin": "t", "name": "flip" }]` |
-| `filePath` (string) | Path to the file on Pixelbin storage | `/path/to/image.jpeg` |
-| `baseUrl` (string) | Base URL | `https://cdn.pixelbin.io/` |
-| `isCustomDomain` (boolean) | Indicates if the URL is for a custom domain | `False` |
-| `worker` (boolean) | Indicates if the URL is a URL Translation Worker URL | `False` |
-| `workerPath` (string) | Input path to a URL Translation Worker | `resize:w200,h400/folder/image.jpeg` |
-| `options` (Object) | Query parameters added, such as "dpr" and "f_auto" | `{ "dpr": 2.0, "f_auto": True }` |
+| `cloudName` (string) | The cloudname extracted from the URL | `your-cloud-name` |
+| `zone` (string) | 6 character zone slug | `z-slug` |
+| `version` (string) | CDN API version | `v2` |
+| `transformations` (array) | Extracted transformations from the URL | `[{ "plugin": "t", "name": "flip" }]` |
+| `filePath` (string) | Path to the file on Pixelbin storage | `/path/to/image.jpeg` |
+| `baseUrl` (string) | Base URL | `https://cdn.pixelbin.io/` |
+| `isCustomDomain` (boolean) | Indicates if the URL is for a custom domain | `False` |
+| `worker` (boolean) | Indicates if the URL is a URL Translation Worker URL | `False` |
+| `workerPath` (string) | Input path to a URL Translation Worker | `resize:w200,h400/folder/image.jpeg` |
+| `options` (Object) | Query parameters added, such as "dpr" and "f_auto" | `{ "dpr": "2.0", "f_auto": True }` |
```python
from pixelbin.utils.url import obj_to_url
@@ -567,4 +1011,4 @@ except Exception as e:
## Documentation
-- [API docs](documentation/platform/README.md)
+- [API docs](documentation/platform/README.md)
diff --git a/documentation/platform/ASSETS.md b/documentation/platform/ASSETS.md
index 34c4469..b608099 100644
--- a/documentation/platform/ASSETS.md
+++ b/documentation/platform/ASSETS.md
@@ -1,43 +1,54 @@
+
+
+
+
##### [Back to Pixelbin API docs](./README.md)
## Assets Methods
-
Asset Uploader Service
+* [addCredentials](#addcredentials)
+* [updateCredentials](#updatecredentials)
+* [deleteCredentials](#deletecredentials)
+* [getFileById](#getfilebyid)
+* [getFileByFileId](#getfilebyfileid)
+* [updateFile](#updatefile)
+* [deleteFile](#deletefile)
+* [deleteFiles](#deletefiles)
+* [createFolder](#createfolder)
+* [getFolderDetails](#getfolderdetails)
+* [updateFolder](#updatefolder)
+* [deleteFolder](#deletefolder)
+* [getFolderAncestors](#getfolderancestors)
+* [listFiles](#listfiles)
+* [listFilesPaginator](#listfilespaginator)
+* [getDefaultAssetForPlayground](#getdefaultassetforplayground)
+* [getModules](#getmodules)
+* [getModule](#getmodule)
+* [addPreset](#addpreset)
+* [getPresets](#getpresets)
+* [updatePreset](#updatepreset)
+* [deletePreset](#deletepreset)
+* [getPreset](#getpreset)
+* [fileUpload](#fileupload)
+* [urlUpload](#urlupload)
+* [createSignedUrl](#createsignedurl)
+* [createSignedUrlV2](#createsignedurlv2)
-- [addCredentials](#addcredentials)
-- [updateCredentials](#updatecredentials)
-- [deleteCredentials](#deletecredentials)
-- [getFileById](#getfilebyid)
-- [getFileByFileId](#getfilebyfileid)
-- [updateFile](#updatefile)
-- [deleteFile](#deletefile)
-- [deleteFiles](#deletefiles)
-- [createFolder](#createfolder)
-- [getFolderDetails](#getfolderdetails)
-- [updateFolder](#updatefolder)
-- [deleteFolder](#deletefolder)
-- [getFolderAncestors](#getfolderancestors)
-- [listFiles](#listfiles)
-- [listFilesPaginator](#listfilespaginator)
-- [getDefaultAssetForPlayground](#getdefaultassetforplayground)
-- [getModules](#getmodules)
-- [getModule](#getmodule)
-- [addPreset](#addpreset)
-- [getPresets](#getpresets)
-- [updatePreset](#updatepreset)
-- [deletePreset](#deletepreset)
-- [getPreset](#getpreset)
-- [fileUpload](#fileupload)
-- [urlUpload](#urlupload)
-- [createSignedUrl](#createsignedurl)
-- [createSignedUrlV2](#createsignedurlv2)
## Methods with example and description
+
+
+
+
### addCredentials
**Summary**: Add credentials for a transformation module.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -52,7 +63,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
result = pixelbin.assets.addCredentials(
- credentials={"region":"ap-south-1","accessKeyId":"123456789ABC","secretAccessKey":"DUMMY1234567890"},
+ credentials={"region":"ap-south-1","accessKeyId":"123456789ABC","secretAccessKey":"DUMMY1234567890"},
pluginId="awsRek")
# use result
except Exception as e:
@@ -61,7 +72,7 @@ except Exception as e:
# Async method call
try:
result = asyncio.run(pixelbin.assets.addCredentialsAsync(
- credentials={"region":"ap-south-1","accessKeyId":"123456789ABC","secretAccessKey":"DUMMY1234567890"},
+ credentials={"region":"ap-south-1","accessKeyId":"123456789ABC","secretAccessKey":"DUMMY1234567890"},
pluginId="awsRek"))
# use result
except Exception as e:
@@ -69,38 +80,65 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ----------- | ---- | -------- | ----------------------------------------------------------- |
-| credentials | Any | yes | Credentials of the plugin |
-| pluginId | str | yes | Unique identifier for the plugin this credential belongs to |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| credentials| Any| yes | Credentials of the plugin |
+| pluginId| str| yes | Unique identifier for the plugin this credential belongs to |
+
+
Add a transformation modules's credentials for an organization.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[AddCredentialsResponse](#addcredentialsresponse)
Success
+
+
+
Example:
```json
{
- "_id": "123ee789-7ae8-4336-b9bd-e4f33c049002",
- "createdAt": "2022-10-04T09:52:09.545Z",
- "updatedAt": "2022-10-04T09:52:09.545Z",
- "orgId": 23,
- "pluginId": "awsRek"
+ "_id": "123ee789-7ae8-4336-b9bd-e4f33c049002",
+ "createdAt": "2022-10-04T09:52:09.545Z",
+ "updatedAt": "2022-10-04T09:52:09.545Z",
+ "orgId": 23,
+ "pluginId": "awsRek"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### updateCredentials
**Summary**: Update credentials of a transformation module.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -114,7 +152,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.updateCredentials(
+ result = pixelbin.assets.updateCredentials(
pluginId="awsRek",
credentials={"region":"ap-south-1","accessKeyId":"123456789ABC","secretAccessKey":"DUMMY1234567890"})
# use result
@@ -123,7 +161,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.updateCredentialsAsync(
+ result = asyncio.run(pixelbin.assets.updateCredentialsAsync(
pluginId="awsRek",
credentials={"region":"ap-south-1","accessKeyId":"123456789ABC","secretAccessKey":"DUMMY1234567890"}))
# use result
@@ -132,38 +170,65 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ----------- | ---- | -------- | ---------------------------------------------------- |
-| pluginId | str | yes | ID of the plugin whose credentials are being updated |
-| credentials | Any | yes | Credentials of the plugin |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| pluginId | str | yes | ID of the plugin whose credentials are being updated |
+| credentials| Any| yes | Credentials of the plugin |
+
+
Update credentials of a transformation module, for an organization.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[AddCredentialsResponse](#addcredentialsresponse)
Success
+
+
+
Example:
```json
{
- "_id": "123ee789-7ae8-4336-b9bd-e4f33c049002",
- "createdAt": "2022-10-04T09:52:09.545Z",
- "updatedAt": "2022-10-04T09:52:09.545Z",
- "orgId": 23,
- "pluginId": "awsRek"
+ "_id": "123ee789-7ae8-4336-b9bd-e4f33c049002",
+ "createdAt": "2022-10-04T09:52:09.545Z",
+ "updatedAt": "2022-10-04T09:52:09.545Z",
+ "orgId": 23,
+ "pluginId": "awsRek"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### deleteCredentials
**Summary**: Delete credentials of a transformation module.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -177,7 +242,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.deleteCredentials(
+ result = pixelbin.assets.deleteCredentials(
pluginId="awsRek")
# use result
except Exception as e:
@@ -185,7 +250,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.deleteCredentialsAsync(
+ result = asyncio.run(pixelbin.assets.deleteCredentialsAsync(
pluginId="awsRek"))
# use result
except Exception as e:
@@ -193,36 +258,63 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ---------------------------------------------------- |
-| pluginId | str | yes | ID of the plugin whose credentials are being deleted |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| pluginId | str | yes | ID of the plugin whose credentials are being deleted |
+
+
Delete credentials of a transformation module, for an organization.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[AddCredentialsResponse](#addcredentialsresponse)
Success
+
+
+
Example:
```json
{
- "_id": "123ee789-7ae8-4336-b9bd-e4f33c049002",
- "createdAt": "2022-10-04T09:52:09.545Z",
- "updatedAt": "2022-10-04T09:52:09.545Z",
- "orgId": 23,
- "pluginId": "awsRek"
+ "_id": "123ee789-7ae8-4336-b9bd-e4f33c049002",
+ "createdAt": "2022-10-04T09:52:09.545Z",
+ "updatedAt": "2022-10-04T09:52:09.545Z",
+ "orgId": 23,
+ "pluginId": "awsRek"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getFileById
-**Summary**: Get file details with \_id
+**Summary**: Get file details with _id
+
+
+
+
```python
import asyncio
@@ -237,7 +329,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.getFileById(
+ result = pixelbin.assets.getFileById(
_id="c9138153-94ea-4dbe-bea9-65d43dba85ae")
# use result
except Exception as e:
@@ -245,7 +337,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.getFileByIdAsync(
+ result = asyncio.run(pixelbin.assets.getFileByIdAsync(
_id="c9138153-94ea-4dbe-bea9-65d43dba85ae"))
# use result
except Exception as e:
@@ -253,43 +345,74 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ------------ |
-| \_id | str | yes | \_id of File |
-_Returned Response:_
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| id | str | yes | _id of File |
+
+
+
+
+
+*Returned Response:*
+
+
+
[FilesResponse](#filesresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "asset",
- "path": "dir",
- "fileId": "dir/asset",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "isActive": true,
- "tags": ["tag1", "tag2"],
- "metadata": {
- "key": "value"
- },
- "url": "https://domain.com/filename.jpeg"
+ "_id": "dummy-uuid",
+ "name": "asset",
+ "path": "dir",
+ "fileId": "dir/asset",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "isActive": true,
+ "tags": [
+ "tag1",
+ "tag2"
+ ],
+ "metadata": {
+ "key": "value"
+ },
+ "url": "https://domain.com/filename.jpeg"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getFileByFileId
**Summary**: Get file details with fileId
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -303,7 +426,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.getFileByFileId(
+ result = pixelbin.assets.getFileByFileId(
fileId="path/to/file/name")
# use result
except Exception as e:
@@ -311,7 +434,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.getFileByFileIdAsync(
+ result = asyncio.run(pixelbin.assets.getFileByFileIdAsync(
fileId="path/to/file/name"))
# use result
except Exception as e:
@@ -319,43 +442,74 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ---------------------------------------- |
-| fileId | str | yes | Combination of `path` and `name` of file |
-_Returned Response:_
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| fileId | str | yes | Combination of `path` and `name` of file |
+
+
+
+
+
+*Returned Response:*
+
+
+
[FilesResponse](#filesresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "asset",
- "path": "dir",
- "fileId": "dir/asset",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "isActive": true,
- "tags": ["tag1", "tag2"],
- "metadata": {
- "key": "value"
- },
- "url": "https://domain.com/filename.jpeg"
+ "_id": "dummy-uuid",
+ "name": "asset",
+ "path": "dir",
+ "fileId": "dir/asset",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "isActive": true,
+ "tags": [
+ "tag1",
+ "tag2"
+ ],
+ "metadata": {
+ "key": "value"
+ },
+ "url": "https://domain.com/filename.jpeg"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### updateFile
**Summary**: Update file details
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -369,13 +523,13 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.updateFile(
+ result = pixelbin.assets.updateFile(
fileId="path/to/file/name",
- name="asset",
- path="dir",
- access="private",
- isActive=False,
- tags=["tag1","tag2"],
+ name="asset",
+ path="dir",
+ access="private",
+ isActive=False,
+ tags=["tag1","tag2"],
metadata={"key":"value"})
# use result
except Exception as e:
@@ -383,13 +537,13 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.updateFileAsync(
+ result = asyncio.run(pixelbin.assets.updateFileAsync(
fileId="path/to/file/name",
- name="asset",
- path="dir",
- access="private",
- isActive=False,
- tags=["tag1","tag2"],
+ name="asset",
+ path="dir",
+ access="private",
+ isActive=False,
+ tags=["tag1","tag2"],
metadata={"key":"value"}))
# use result
except Exception as e:
@@ -397,49 +551,80 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---------- | -------- | --------------------------------------------------------------- |
-| fileId | str | yes | Combination of `path` and `name` |
-| name | str | no | Name of the file |
-| path | str | no | Path of the file |
-| access | AccessEnum | no | Access level of asset, can be either `public-read` or `private` |
-| isActive | bool | no | Whether the file is active |
-| tags | List[str] | no | Tags associated with the file |
-| metadata | Any | no | Metadata associated with the file |
-_Returned Response:_
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| fileId | str | yes | Combination of `path` and `name` |
+| name| str| no | Name of the file |
+| path| str| no | Path of the file |
+| access| AccessEnum| no | Access level of asset, can be either `public-read` or `private` |
+| isActive| bool| no | Whether the file is active |
+| tags| List[str]| no | Tags associated with the file |
+| metadata| Any| no | Metadata associated with the file |
+
+
+
+
+
+*Returned Response:*
+
+
+
[FilesResponse](#filesresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "asset",
- "path": "dir",
- "fileId": "dir/asset",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "isActive": true,
- "tags": ["tag1", "tag2"],
- "metadata": {
- "key": "value"
- },
- "url": "https://domain.com/filename.jpeg"
+ "_id": "dummy-uuid",
+ "name": "asset",
+ "path": "dir",
+ "fileId": "dir/asset",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "isActive": true,
+ "tags": [
+ "tag1",
+ "tag2"
+ ],
+ "metadata": {
+ "key": "value"
+ },
+ "url": "https://domain.com/filename.jpeg"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### deleteFile
**Summary**: Delete file
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -453,7 +638,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.deleteFile(
+ result = pixelbin.assets.deleteFile(
fileId="path/to/file/name")
# use result
except Exception as e:
@@ -461,7 +646,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.deleteFileAsync(
+ result = asyncio.run(pixelbin.assets.deleteFileAsync(
fileId="path/to/file/name"))
# use result
except Exception as e:
@@ -469,57 +654,88 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | -------------------------------- |
-| fileId | str | yes | Combination of `path` and `name` |
-_Returned Response:_
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| fileId | str | yes | Combination of `path` and `name` |
+
+
+
+
+
+*Returned Response:*
+
+
+
[FilesResponse](#filesresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "asset",
- "path": "dir",
- "fileId": "dir/asset",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "isActive": true,
- "tags": ["tag1", "tag2"],
- "metadata": {
- "key": "value"
- },
- "url": "https://domain.com/filename.jpeg"
+ "_id": "dummy-uuid",
+ "name": "asset",
+ "path": "dir",
+ "fileId": "dir/asset",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "isActive": true,
+ "tags": [
+ "tag1",
+ "tag2"
+ ],
+ "metadata": {
+ "key": "value"
+ },
+ "url": "https://domain.com/filename.jpeg"
}
```
-
-### deleteFiles
-**Summary**: Delete multiple files
-```python
-import asyncio
-from pixelbin import PixelbinClient, PixelbinConfig
-config = PixelbinConfig({
- "domain": "https://api.pixelbin.io",
- "apiSecret": "API_SECRECT_TOKEN",
-})
-pixelbin:PixelbinClient = PixelbinClient(config=config)
-# Sync method call
-try:
- result = pixelbin.assets.deleteFiles(
+
+
+
+
+
+
+### deleteFiles
+
+**Summary**: Delete multiple files
+
+
+
+
+
+```python
+import asyncio
+from pixelbin import PixelbinClient, PixelbinConfig
+
+config = PixelbinConfig({
+ "domain": "https://api.pixelbin.io",
+ "apiSecret": "API_SECRECT_TOKEN",
+})
+
+pixelbin:PixelbinClient = PixelbinClient(config=config)
+
+# Sync method call
+try:
+ result = pixelbin.assets.deleteFiles(
ids=["_id_1","_id_2","_id_3"])
# use result
except Exception as e:
@@ -535,45 +751,76 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | --------- | -------- | ----------------------------- |
-| ids | List[str] | yes | Array of file \_ids to delete |
-_Returned Response:_
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| ids| List[str]| yes | Array of file _ids to delete |
+
+
+
+
+
+*Returned Response:*
+
+
+
[List[FilesResponse]](#filesresponse)
Success
+
+
+
Example:
```json
[
- {
- "_id": "dummy-uuid",
- "name": "asset",
- "path": "dir",
- "fileId": "dir/asset",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "isActive": true,
- "tags": ["tag1", "tag2"],
- "metadata": {
- "key": "value"
- },
- "url": "https://domain.com/filename.jpeg"
- }
+ {
+ "_id": "dummy-uuid",
+ "name": "asset",
+ "path": "dir",
+ "fileId": "dir/asset",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "isActive": true,
+ "tags": [
+ "tag1",
+ "tag2"
+ ],
+ "metadata": {
+ "key": "value"
+ },
+ "url": "https://domain.com/filename.jpeg"
+ }
]
```
-
+
+
+
+
+
+
+
+
+
+
+
### createFolder
**Summary**: Create folder
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -588,7 +835,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
result = pixelbin.assets.createFolder(
- name="subDir",
+ name="subDir",
path="dir")
# use result
except Exception as e:
@@ -597,7 +844,7 @@ except Exception as e:
# Async method call
try:
result = asyncio.run(pixelbin.assets.createFolderAsync(
- name="subDir",
+ name="subDir",
path="dir"))
# use result
except Exception as e:
@@ -605,37 +852,64 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ------------------ |
-| name | str | yes | Name of the folder |
-| path | str | no | Path of the folder |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| name| str| yes | Name of the folder |
+| path| str| no | Path of the folder |
+
+
Create a new folder at the specified path. Also creates the ancestors if they do not exist.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[FoldersResponse](#foldersresponse)
Success - List of all created folders
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "subDir",
- "path": "dir",
- "isActive": true
+ "_id": "dummy-uuid",
+ "name": "subDir",
+ "path": "dir",
+ "isActive": true
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getFolderDetails
**Summary**: Get folder details
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -649,8 +923,8 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.getFolderDetails(
- path="dir1/dir2",
+ result = pixelbin.assets.getFolderDetails(
+ path="dir1/dir2",
name="dir")
# use result
except Exception as e:
@@ -658,8 +932,8 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.getFolderDetailsAsync(
- path="dir1/dir2",
+ result = asyncio.run(pixelbin.assets.getFolderDetailsAsync(
+ path="dir1/dir2",
name="dir"))
# use result
except Exception as e:
@@ -667,48 +941,75 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ----------- |
-| path | str | no | Folder path |
-| name | str | no | Folder name |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| path | str | no | Folder path |
+| name | str | no | Folder name |
+
+
Get folder details
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[exploreItem](#exploreitem)
Success
+
+
+
Example:
```json
[
- {
- "_id": "dummy-uuid",
- "createdAt": "2022-10-05T10:43:04.117Z",
- "updatedAt": "2022-10-05T10:43:04.117Z",
- "name": "asset2",
- "type": "file",
- "path": "dir",
- "fileId": "dir/asset2",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "metadata": {},
- "height": 100,
- "width": 100
- }
+ {
+ "_id": "dummy-uuid",
+ "createdAt": "2022-10-05T10:43:04.117Z",
+ "updatedAt": "2022-10-05T10:43:04.117Z",
+ "name": "asset2",
+ "type": "file",
+ "path": "dir",
+ "fileId": "dir/asset2",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "metadata": {},
+ "height": 100,
+ "width": 100
+ }
]
```
-
+
+
+
+
+
+
+
+
+
+
+
### updateFolder
**Summary**: Update folder details
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -722,7 +1023,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.updateFolder(
+ result = pixelbin.assets.updateFolder(
folderId="path/to/folder/name",
isActive=False)
# use result
@@ -731,7 +1032,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.updateFolderAsync(
+ result = asyncio.run(pixelbin.assets.updateFolderAsync(
folderId="path/to/folder/name",
isActive=False))
# use result
@@ -740,39 +1041,66 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | -------------------------------- |
-| folderId | str | yes | combination of `path` and `name` |
-| isActive | bool | no | whether the folder is active |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| folderId | str | yes | combination of `path` and `name` |
+| isActive| bool| no | whether the folder is active |
+
+
Update folder details. Eg: Soft delete it
by making `isActive` as `false`.
We currently do not support updating folder name or path.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[FoldersResponse](#foldersresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "subDir",
- "path": "dir",
- "isActive": true
+ "_id": "dummy-uuid",
+ "name": "subDir",
+ "path": "dir",
+ "isActive": true
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### deleteFolder
**Summary**: Delete folder
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -786,7 +1114,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.deleteFolder(
+ result = pixelbin.assets.deleteFolder(
_id="c9138153-94ea-4dbe-bea9-65d43dba85ae")
# use result
except Exception as e:
@@ -794,7 +1122,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.deleteFolderAsync(
+ result = asyncio.run(pixelbin.assets.deleteFolderAsync(
_id="c9138153-94ea-4dbe-bea9-65d43dba85ae"))
# use result
except Exception as e:
@@ -802,36 +1130,63 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ---------------------------- |
-| \_id | str | yes | \_id of folder to be deleted |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| id | str | yes | _id of folder to be deleted |
+
+
Delete folder and all its children permanently.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[FoldersResponse](#foldersresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "subDir",
- "path": "dir",
- "isActive": true
+ "_id": "dummy-uuid",
+ "name": "subDir",
+ "path": "dir",
+ "isActive": true
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getFolderAncestors
**Summary**: Get all ancestors of a folder
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -845,7 +1200,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.getFolderAncestors(
+ result = pixelbin.assets.getFolderAncestors(
_id="c9138153-94ea-4dbe-bea9-65d43dba85ae")
# use result
except Exception as e:
@@ -853,7 +1208,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.getFolderAncestorsAsync(
+ result = asyncio.run(pixelbin.assets.getFolderAncestorsAsync(
_id="c9138153-94ea-4dbe-bea9-65d43dba85ae"))
# use result
except Exception as e:
@@ -861,52 +1216,79 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ------------------ |
-| \_id | str | yes | \_id of the folder |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| id | str | yes | _id of the folder |
+
+
Get all ancestors of a folder, using the folder ID.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[GetAncestorsResponse](#getancestorsresponse)
Success
+
+
+
Example:
```json
{
- "folder": {
- "_id": "dummy-uuid",
- "name": "subDir",
- "path": "dir1/dir2",
- "isActive": true
+ "folder": {
+ "_id": "dummy-uuid",
+ "name": "subDir",
+ "path": "dir1/dir2",
+ "isActive": true
+ },
+ "ancestors": [
+ {
+ "_id": "dummy-uuid-2",
+ "name": "dir1",
+ "path": "",
+ "isActive": true
},
- "ancestors": [
- {
- "_id": "dummy-uuid-2",
- "name": "dir1",
- "path": "",
- "isActive": true
- },
- {
- "_id": "dummy-uuid-2",
- "name": "dir2",
- "path": "dir1",
- "isActive": true
- }
- ]
+ {
+ "_id": "dummy-uuid-2",
+ "name": "dir2",
+ "path": "dir1",
+ "isActive": true
+ }
+ ]
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### listFiles
**Summary**: List and search files and folders.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -920,15 +1302,15 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.listFiles(
- name="cat",
- path="cat-photos",
- format="jpeg",
- tags=["cats","animals"],
- onlyFiles="false",
- onlyFolders="false",
- pageNo=1,
- pageSize=10,
+ result = pixelbin.assets.listFiles(
+ name="cat",
+ path="cat-photos",
+ format="jpeg",
+ tags=["cats","animals"],
+ onlyFiles="false",
+ onlyFolders="false",
+ pageNo=1,
+ pageSize=10,
sort="name")
# use result
except Exception as e:
@@ -936,15 +1318,15 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.listFilesAsync(
- name="cat",
- path="cat-photos",
- format="jpeg",
- tags=["cats","animals"],
- onlyFiles="false",
- onlyFolders="false",
- pageNo=1,
- pageSize=10,
+ result = asyncio.run(pixelbin.assets.listFilesAsync(
+ name="cat",
+ path="cat-photos",
+ format="jpeg",
+ tags=["cats","animals"],
+ onlyFiles="false",
+ onlyFolders="false",
+ pageNo=1,
+ pageSize=10,
sort="name"))
# use result
except Exception as e:
@@ -952,73 +1334,100 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ----------- | --------- | -------- | ---------------------------------------------------------------------------- |
-| name | str | no | Find items with matching name |
-| path | str | no | Find items with matching path |
-| format | str | no | Find items with matching format |
-| tags | List[str] | no | Find items containing these tags |
-| onlyFiles | bool | no | If true will fetch only files |
-| onlyFolders | bool | no | If true will fetch only folders |
-| pageNo | int | no | Page No. |
-| pageSize | int | no | Page Size |
-| sort | str | no | Key to sort results by. A "-" suffix will sort results in descending orders. |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| name | str | no | Find items with matching name |
+| path | str | no | Find items with matching path |
+| format | str | no | Find items with matching format |
+| tags | List[str] | no | Find items containing these tags |
+| onlyFiles | bool | no | If true will fetch only files |
+| onlyFolders | bool | no | If true will fetch only folders |
+| pageNo | int | no | Page No. |
+| pageSize | int | no | Page Size |
+| sort | str | no | Key to sort results by. A "-" suffix will sort results in descending orders. |
+
+
List all files and folders in root folder. Search for files if name is provided. If path is provided, search in the specified path.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[ListFilesResponse](#listfilesresponse)
Success
+
+
+
Example:
```json
{
- "items": [
- {
- "_id": "dummy-uuid",
- "name": "dir",
- "type": "folder"
- },
- {
- "_id": "dummy-uuid",
- "name": "asset2",
- "type": "file",
- "path": "dir",
- "fileId": "dir/asset2",
- "format": "jpeg",
- "size": 1000,
- "access": "private"
- },
- {
- "_id": "dummy-uuid",
- "name": "asset1",
- "type": "file",
- "path": "dir",
- "fileId": "dir/asset1",
- "format": "jpeg",
- "size": 1000,
- "access": "private"
- }
- ],
- "page": {
- "type": "number",
- "size": 4,
- "current": 1,
- "hasNext": false
+ "items": [
+ {
+ "_id": "dummy-uuid",
+ "name": "dir",
+ "type": "folder"
+ },
+ {
+ "_id": "dummy-uuid",
+ "name": "asset2",
+ "type": "file",
+ "path": "dir",
+ "fileId": "dir/asset2",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private"
+ },
+ {
+ "_id": "dummy-uuid",
+ "name": "asset1",
+ "type": "file",
+ "path": "dir",
+ "fileId": "dir/asset1",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private"
}
+ ],
+ "page": {
+ "type": "number",
+ "size": 4,
+ "current": 1,
+ "hasNext": false
+ }
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getDefaultAssetForPlayground
**Summary**: Get default asset for playground
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1046,47 +1455,72 @@ except Exception as e:
```
+
+
+
+
+
Get default asset for playground
-_Returned Response:_
+*Returned Response:*
+
+
+
[UploadResponse](#uploadresponse)
Success
+
+
+
Example:
```json
{
- "isActive": true,
- "orgId": "1",
- "type": "file",
- "name": "abc.jpeg",
- "path": "/xyz",
- "fileId": "xyz/abc.jpeg",
- "format": "jpeg",
- "size": 100,
- "tags": null,
- "metadata": null,
- "access": "public-read",
- "width": null,
- "height": null,
- "meta": {},
- "context": null,
- "assetType": null,
- "isOriginal": true,
- "_id": "35675e3a-5dd8-4b19-a611-1cb64e676c5e",
- "url": "https://cdn.pixelbin.io/v2/dummy-cloudname/original/xyz/abc.jpeg"
+ "isActive": true,
+ "orgId": "1",
+ "type": "file",
+ "name": "abc.jpeg",
+ "path": "/xyz",
+ "fileId": "xyz/abc.jpeg",
+ "format": "jpeg",
+ "size": 100,
+ "tags": null,
+ "metadata": null,
+ "access": "public-read",
+ "width": null,
+ "height": null,
+ "meta": {},
+ "context": null,
+ "assetType": null,
+ "isOriginal": true,
+ "_id": "35675e3a-5dd8-4b19-a611-1cb64e676c5e",
+ "url": "https://cdn.pixelbin.io/v2/dummy-cloudname/original/xyz/abc.jpeg"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getModules
**Summary**: Get all transformation modules
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1114,70 +1548,99 @@ except Exception as e:
```
+
+
+
+
+
Get all transformation modules.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[TransformationModulesResponse](#transformationmodulesresponse)
Success
+
+
+
Example:
```json
{
- "delimiters": {
- "operationSeparator": "~",
- "parameterSeparator": ":"
- },
- "plugins": {
- "erase": {
- "identifier": "erase",
- "name": "EraseBG",
- "description": "EraseBG Background Removal Module",
- "credentials": {
- "required": false
- },
- "operations": [
- {
- "params": {
- "name": "Industry Type",
- "type": "enum",
- "enum": ["general", "ecommerce"],
- "default": "general",
- "identifier": "i",
- "title": "Industry type"
- },
- "displayName": "Remove background of an image",
- "method": "bg",
- "description": "Remove the background of any image"
- }
- ],
- "enabled": true
- }
- },
- "presets": [
+ "delimiters": {
+ "operationSeparator": "~",
+ "parameterSeparator": ":"
+ },
+ "plugins": {
+ "erase": {
+ "identifier": "erase",
+ "name": "EraseBG",
+ "description": "EraseBG Background Removal Module",
+ "credentials": {
+ "required": false
+ },
+ "operations": [
{
- "_id": "dummy-id",
- "createdAt": "2022-02-14T10:06:17.803Z",
- "updatedAt": "2022-02-14T10:06:17.803Z",
- "isActive": true,
- "orgId": "265",
- "presetName": "compressor",
- "transformation": "t.compress(q:95)",
- "archived": false
+ "params": {
+ "name": "Industry Type",
+ "type": "enum",
+ "enum": [
+ "general",
+ "ecommerce"
+ ],
+ "default": "general",
+ "identifier": "i",
+ "title": "Industry type"
+ },
+ "displayName": "Remove background of an image",
+ "method": "bg",
+ "description": "Remove the background of any image"
}
- ]
+ ],
+ "enabled": true
+ }
+ },
+ "presets": [
+ {
+ "_id": "dummy-id",
+ "createdAt": "2022-02-14T10:06:17.803Z",
+ "updatedAt": "2022-02-14T10:06:17.803Z",
+ "isActive": true,
+ "orgId": "265",
+ "presetName": "compressor",
+ "transformation": "t.compress(q:95)",
+ "archived": false
+ }
+ ]
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getModule
**Summary**: Get Transformation Module by module identifier
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1191,7 +1654,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.getModule(
+ result = pixelbin.assets.getModule(
identifier="t")
# use result
except Exception as e:
@@ -1199,7 +1662,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.getModuleAsync(
+ result = asyncio.run(pixelbin.assets.getModuleAsync(
identifier="t"))
# use result
except Exception as e:
@@ -1207,54 +1670,84 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------- | ---- | -------- | ----------------------------------- |
-| identifier | str | yes | identifier of Transformation Module |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| identifier | str | yes | identifier of Transformation Module |
+
+
Get Transformation Module by module identifier
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[TransformationModuleResponse](#transformationmoduleresponse)
Success
+
+
+
Example:
```json
{
- "identifier": "erase",
- "name": "EraseBG",
- "description": "EraseBG Background Removal Module",
- "credentials": {
- "required": false
- },
- "operations": [
- {
- "params": {
- "name": "Industry Type",
- "type": "enum",
- "enum": ["general", "ecommerce"],
- "default": "general",
- "identifier": "i",
- "title": "Industry type"
- },
- "displayName": "Remove background of an image",
- "method": "bg",
- "description": "Remove the background of any image"
- }
- ],
- "enabled": true
+ "identifier": "erase",
+ "name": "EraseBG",
+ "description": "EraseBG Background Removal Module",
+ "credentials": {
+ "required": false
+ },
+ "operations": [
+ {
+ "params": {
+ "name": "Industry Type",
+ "type": "enum",
+ "enum": [
+ "general",
+ "ecommerce"
+ ],
+ "default": "general",
+ "identifier": "i",
+ "title": "Industry type"
+ },
+ "displayName": "Remove background of an image",
+ "method": "bg",
+ "description": "Remove the background of any image"
+ }
+ ],
+ "enabled": true
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### addPreset
**Summary**: Add a preset.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1269,8 +1762,8 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
result = pixelbin.assets.addPreset(
- presetName="pre-set_1",
- transformation="t.resize(w:$w,h:$h)~t.extract()",
+ presetName="pre-set_1",
+ transformation="t.resize(w:$w,h:$h)~t.extract()",
params={"w":{"type":"integer","default":200},"h":{"type":"integer","default":400}})
# use result
except Exception as e:
@@ -1279,8 +1772,8 @@ except Exception as e:
# Async method call
try:
result = asyncio.run(pixelbin.assets.addPresetAsync(
- presetName="pre-set_1",
- transformation="t.resize(w:$w,h:$h)~t.extract()",
+ presetName="pre-set_1",
+ transformation="t.resize(w:$w,h:$h)~t.extract()",
params={"w":{"type":"integer","default":200},"h":{"type":"integer","default":400}}))
# use result
except Exception as e:
@@ -1288,52 +1781,79 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------------- | ---- | -------- | ---------------------------------------------- |
-| presetName | str | yes | Name of the preset |
-| transformation | str | yes | A chain of transformations, separated by `~` |
-| params | Any | no | Parameters object for transformation variables |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| presetName| str| yes | Name of the preset |
+| transformation| str| yes | A chain of transformations, separated by `~` |
+| params| Any| no | Parameters object for transformation variables |
+
+
Add a preset for an organization.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[AddPresetResponse](#addpresetresponse)
Success
+
+
+
Example:
```json
{
- "orgId": 23,
- "presetName": "pre-set_1",
- "transformation": "t.resize(w:$w,h:$h)~t.extract()",
- "params": {
- "w": {
- "type": "integer",
- "default": 200
- },
- "h": {
- "type": "integer",
- "default": 400
- }
+ "orgId": 23,
+ "presetName": "pre-set_1",
+ "transformation": "t.resize(w:$w,h:$h)~t.extract()",
+ "params": {
+ "w": {
+ "type": "integer",
+ "default": 200
},
- "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
- "createdAt": "2024-03-21T10:35:47.822Z",
- "updatedAt": "2024-03-21T10:35:47.822Z",
- "isActive": true,
- "archived": false
+ "h": {
+ "type": "integer",
+ "default": 400
+ }
+ },
+ "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
+ "createdAt": "2024-03-21T10:35:47.822Z",
+ "updatedAt": "2024-03-21T10:35:47.822Z",
+ "isActive": true,
+ "archived": false
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getPresets
**Summary**: Get presets for an organization
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1347,12 +1867,12 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.getPresets(
- pageNo=1,
- pageSize=5,
- name="t_0",
- transformation="t.resize(a:0)",
- archived="false",
+ result = pixelbin.assets.getPresets(
+ pageNo=1,
+ pageSize=5,
+ name="t_0",
+ transformation="t.resize(a:0)",
+ archived="false",
sort=["updatedAt"])
# use result
except Exception as e:
@@ -1360,12 +1880,12 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.getPresetsAsync(
- pageNo=1,
- pageSize=5,
- name="t_0",
- transformation="t.resize(a:0)",
- archived="false",
+ result = asyncio.run(pixelbin.assets.getPresetsAsync(
+ pageNo=1,
+ pageSize=5,
+ name="t_0",
+ transformation="t.resize(a:0)",
+ archived="false",
sort=["updatedAt"]))
# use result
except Exception as e:
@@ -1373,68 +1893,94 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------------- | --------- | -------- | ----------------------------------------------- |
-| pageNo | int | no | Page number |
-| pageSize | int | no | Page size |
-| name | str | no | Preset name |
-| transformation | str | no | Transformation applied |
-| archived | bool | no | Indicates whether the preset is archived or not |
-| sort | List[str] | no | Sort the results by a specific key |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| pageNo | int | no | Page number |
+| pageSize | int | no | Page size |
+| name | str | no | Preset name |
+| transformation | str | no | Transformation applied |
+| archived | bool | no | Indicates whether the preset is archived or not |
+| sort | List[str] | no | Sort the results by a specific key |
+
+
Retrieve presets for a specific organization.
-_Returned Response:_
+*Returned Response:*
+
+
+
[GetPresetsResponse](#getpresetsresponse)
Success
+
+
+
Example:
```json
{
- "items": [
- {
- "_id": "f1ae2fc0-a931-4cef-bd1a-3644dad5ae9b",
- "createdAt": "2024-03-21T10:45:06.623Z",
- "updatedAt": "2024-03-21T10:45:06.623Z",
- "isActive": true,
- "orgId": 23,
- "presetName": "t_0",
- "transformation": "t.resize(a:0)",
- "archived": false,
- "params": {}
- },
- {
- "_id": "b40a03f1-7fa5-42b1-8cc6-ffe84c9e6629",
- "createdAt": "2024-03-21T10:45:06.637Z",
- "updatedAt": "2024-03-21T10:45:06.637Z",
- "isActive": true,
- "orgId": 23,
- "presetName": "t_1",
- "transformation": "t.resize(a:1)",
- "archived": false,
- "params": {}
- }
- ],
- "page": {
- "type": "number",
- "size": 2,
- "current": 1,
- "hasNext": true,
- "itemTotal": 10
+ "items": [
+ {
+ "_id": "f1ae2fc0-a931-4cef-bd1a-3644dad5ae9b",
+ "createdAt": "2024-03-21T10:45:06.623Z",
+ "updatedAt": "2024-03-21T10:45:06.623Z",
+ "isActive": true,
+ "orgId": 23,
+ "presetName": "t_0",
+ "transformation": "t.resize(a:0)",
+ "archived": false,
+ "params": {}
+ },
+ {
+ "_id": "b40a03f1-7fa5-42b1-8cc6-ffe84c9e6629",
+ "createdAt": "2024-03-21T10:45:06.637Z",
+ "updatedAt": "2024-03-21T10:45:06.637Z",
+ "isActive": true,
+ "orgId": 23,
+ "presetName": "t_1",
+ "transformation": "t.resize(a:1)",
+ "archived": false,
+ "params": {}
}
+ ],
+ "page": {
+ "type": "number",
+ "size": 2,
+ "current": 1,
+ "hasNext": true,
+ "itemTotal": 10
+ }
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### updatePreset
**Summary**: Update a preset.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1448,7 +1994,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.updatePreset(
+ result = pixelbin.assets.updatePreset(
presetName="p1",
archived=True)
# use result
@@ -1457,7 +2003,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.updatePresetAsync(
+ result = asyncio.run(pixelbin.assets.updatePresetAsync(
presetName="p1",
archived=True))
# use result
@@ -1466,51 +2012,78 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------- | ---- | -------- | ----------------------------------------- |
-| presetName | str | yes | Name of the preset to be updated |
-| archived | bool | yes | Indicates if the preset has been archived |
-Update a preset of an organization.
-_Returned Response:_
-[AddPresetResponse](#addpresetresponse)
-Success
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| presetName | str | yes | Name of the preset to be updated |
+| archived| bool| yes | Indicates if the preset has been archived |
+
+
+
+Update a preset of an organization.
+
+
+*Returned Response:*
+
+
+
+
+[AddPresetResponse](#addpresetresponse)
+
+Success
+
+
+
+
+
+ Example:
+
+```json
+{
+ "orgId": 23,
+ "presetName": "pre-set_1",
+ "transformation": "t.resize(w:$w,h:$h)~t.extract()",
+ "params": {
+ "w": {
+ "type": "integer",
+ "default": 200
+ },
+ "h": {
+ "type": "integer",
+ "default": 400
+ }
+ },
+ "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
+ "createdAt": "2024-03-21T10:35:47.822Z",
+ "updatedAt": "2024-03-21T10:35:47.822Z",
+ "isActive": true,
+ "archived": true
+}
+```
+
+
+
+
+
+
+
+
+
-
- Example:
-```json
-{
- "orgId": 23,
- "presetName": "pre-set_1",
- "transformation": "t.resize(w:$w,h:$h)~t.extract()",
- "params": {
- "w": {
- "type": "integer",
- "default": 200
- },
- "h": {
- "type": "integer",
- "default": 400
- }
- },
- "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
- "createdAt": "2024-03-21T10:35:47.822Z",
- "updatedAt": "2024-03-21T10:35:47.822Z",
- "isActive": true,
- "archived": true
-}
-```
-
### deletePreset
**Summary**: Delete a preset.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1524,7 +2097,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.deletePreset(
+ result = pixelbin.assets.deletePreset(
presetName="pre-set_1")
# use result
except Exception as e:
@@ -1532,7 +2105,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.deletePresetAsync(
+ result = asyncio.run(pixelbin.assets.deletePresetAsync(
presetName="pre-set_1"))
# use result
except Exception as e:
@@ -1540,50 +2113,77 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------- | ---- | -------- | -------------------------------- |
-| presetName | str | yes | Name of the preset to be deleted |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| presetName | str | yes | Name of the preset to be deleted |
+
+
Delete a preset of an organization.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[AddPresetResponse](#addpresetresponse)
Success
+
+
+
Example:
```json
{
- "orgId": 23,
- "presetName": "pre-set_1",
- "transformation": "t.resize(w:$w,h:$h)~t.extract()",
- "params": {
- "w": {
- "type": "integer",
- "default": 200
- },
- "h": {
- "type": "integer",
- "default": 400
- }
+ "orgId": 23,
+ "presetName": "pre-set_1",
+ "transformation": "t.resize(w:$w,h:$h)~t.extract()",
+ "params": {
+ "w": {
+ "type": "integer",
+ "default": 200
},
- "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
- "createdAt": "2024-03-21T10:35:47.822Z",
- "updatedAt": "2024-03-21T10:35:47.822Z",
- "isActive": true,
- "archived": false
+ "h": {
+ "type": "integer",
+ "default": 400
+ }
+ },
+ "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
+ "createdAt": "2024-03-21T10:35:47.822Z",
+ "updatedAt": "2024-03-21T10:35:47.822Z",
+ "isActive": true,
+ "archived": false
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### getPreset
**Summary**: Get a preset.
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1597,7 +2197,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.assets.getPreset(
+ result = pixelbin.assets.getPreset(
presetName="p1")
# use result
except Exception as e:
@@ -1605,7 +2205,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.assets.getPresetAsync(
+ result = asyncio.run(pixelbin.assets.getPresetAsync(
presetName="p1"))
# use result
except Exception as e:
@@ -1613,50 +2213,77 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------- | ---- | -------- | -------------------------------- |
-| presetName | str | yes | Name of the preset to be fetched |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| presetName | str | yes | Name of the preset to be fetched |
+
+
Get a preset of an organization.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[AddPresetResponse](#addpresetresponse)
Success
+
+
+
Example:
```json
{
- "orgId": 23,
- "presetName": "p1",
- "transformation": "t.resize(w:$w,h:$h)~t.extract()",
- "params": {
- "w": {
- "type": "integer",
- "default": 200
- },
- "h": {
- "type": "integer",
- "default": 400
- }
+ "orgId": 23,
+ "presetName": "p1",
+ "transformation": "t.resize(w:$w,h:$h)~t.extract()",
+ "params": {
+ "w": {
+ "type": "integer",
+ "default": 200
},
- "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
- "createdAt": "2024-03-21T10:35:47.822Z",
- "updatedAt": "2024-03-21T10:35:47.822Z",
- "isActive": true,
- "archived": false
+ "h": {
+ "type": "integer",
+ "default": 400
+ }
+ },
+ "_id": "821c6816-3cbb-40fd-8629-0098007fc949",
+ "createdAt": "2024-03-21T10:35:47.822Z",
+ "updatedAt": "2024-03-21T10:35:47.822Z",
+ "isActive": true,
+ "archived": false
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### fileUpload
**Summary**: Upload File
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1671,13 +2298,13 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
result = pixelbin.assets.fileUpload(
- file=open("your-file-path", "rb"),
- path="path/to/containing/folder",
- name="filename",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
+ file=open("your-file-path", "rb"),
+ path="path/to/containing/folder",
+ name="filename",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
filenameOverride=True)
# use result
except Exception as e:
@@ -1686,13 +2313,13 @@ except Exception as e:
# Async method call
try:
result = asyncio.run(pixelbin.assets.fileUploadAsync(
- file=open("your-file-path", "rb"),
- path="path/to/containing/folder",
- name="filename",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
+ file=open("your-file-path", "rb"),
+ path="path/to/containing/folder",
+ name="filename",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
filenameOverride=True))
# use result
except Exception as e:
@@ -1700,52 +2327,81 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------------- | ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| file | FileIO | yes | Asset file |
-| path | str | no | Path where you want to store the asset |
-| name | str | no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
-| access | AccessEnum | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Asset tags |
-| metadata | Any | no | Asset related metadata |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| file| FileIO| yes | Asset file |
+| path| str| no | Path where you want to store the asset |
+| name| str| no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
+| access| AccessEnum| no | Access level of asset, can be either `public-read` or `private` |
+| tags| List[str]| no | Asset tags |
+| metadata| Any| no | Asset related metadata |
+| overwrite| bool| no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+| filenameOverride| bool| no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
Upload File to Pixelbin
-_Returned Response:_
+*Returned Response:*
+
+
+
[UploadResponse](#uploadresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "asset",
- "path": "dir",
- "fileId": "dir/asset",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "isActive": true,
- "tags": ["tag1", "tag2"],
- "metadata": {
- "key": "value"
- },
- "url": "https://domain.com/filename.jpeg"
+ "_id": "dummy-uuid",
+ "name": "asset",
+ "path": "dir",
+ "fileId": "dir/asset",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "isActive": true,
+ "tags": [
+ "tag1",
+ "tag2"
+ ],
+ "metadata": {
+ "key": "value"
+ },
+ "url": "https://domain.com/filename.jpeg"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### urlUpload
**Summary**: Upload Asset with url
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1760,13 +2416,13 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
result = pixelbin.assets.urlUpload(
- url="www.dummy.com/image.png",
- path="path/to/containing/folder",
- name="filename",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
+ url="www.dummy.com/image.png",
+ path="path/to/containing/folder",
+ name="filename",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
filenameOverride=True)
# use result
except Exception as e:
@@ -1775,13 +2431,13 @@ except Exception as e:
# Async method call
try:
result = asyncio.run(pixelbin.assets.urlUploadAsync(
- url="www.dummy.com/image.png",
- path="path/to/containing/folder",
- name="filename",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
+ url="www.dummy.com/image.png",
+ path="path/to/containing/folder",
+ name="filename",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
filenameOverride=True))
# use result
except Exception as e:
@@ -1789,52 +2445,81 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------------- | ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| url | str | yes | Asset URL |
-| path | str | no | Path where you want to store the asset |
-| name | str | no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
-| access | AccessEnum | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Asset tags |
-| metadata | Any | no | Asset related metadata |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| url| str| yes | Asset URL |
+| path| str| no | Path where you want to store the asset |
+| name| str| no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
+| access| AccessEnum| no | Access level of asset, can be either `public-read` or `private` |
+| tags| List[str]| no | Asset tags |
+| metadata| Any| no | Asset related metadata |
+| overwrite| bool| no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+| filenameOverride| bool| no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
Upload Asset with url
-_Returned Response:_
+*Returned Response:*
+
+
+
[UploadResponse](#uploadresponse)
Success
+
+
+
Example:
```json
{
- "_id": "dummy-uuid",
- "name": "asset",
- "path": "dir",
- "fileId": "dir/asset",
- "format": "jpeg",
- "size": 1000,
- "access": "private",
- "isActive": true,
- "tags": ["tag1", "tag2"],
- "metadata": {
- "key": "value"
- },
- "url": "https://domain.com/filename.jpeg"
+ "_id": "dummy-uuid",
+ "name": "asset",
+ "path": "dir",
+ "fileId": "dir/asset",
+ "format": "jpeg",
+ "size": 1000,
+ "access": "private",
+ "isActive": true,
+ "tags": [
+ "tag1",
+ "tag2"
+ ],
+ "metadata": {
+ "key": "value"
+ },
+ "url": "https://domain.com/filename.jpeg"
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### createSignedUrl
**Summary**: S3 Signed URL upload
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1849,13 +2534,13 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
result = pixelbin.assets.createSignedUrl(
- name="filename",
- path="path/to/containing/folder",
- format="jpeg",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
+ name="filename",
+ path="path/to/containing/folder",
+ format="jpeg",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
filenameOverride=True)
# use result
except Exception as e:
@@ -1864,13 +2549,13 @@ except Exception as e:
# Async method call
try:
result = asyncio.run(pixelbin.assets.createSignedUrlAsync(
- name="filename",
- path="path/to/containing/folder",
- format="jpeg",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
+ name="filename",
+ path="path/to/containing/folder",
+ format="jpeg",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
filenameOverride=True))
# use result
except Exception as e:
@@ -1878,47 +2563,74 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------------- | ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| name | str | no | name of the file |
-| path | str | no | Path of the file |
-| format | str | no | Format of the file |
-| access | AccessEnum | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Tags associated with the file. |
-| metadata | Any | no | Metadata associated with the file. |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| name| str| no | name of the file |
+| path| str| no | Path of the file |
+| format| str| no | Format of the file |
+| access| AccessEnum| no | Access level of asset, can be either `public-read` or `private` |
+| tags| List[str]| no | Tags associated with the file. |
+| metadata| Any| no | Metadata associated with the file. |
+| overwrite| bool| no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+| filenameOverride| bool| no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
For the given asset details, a S3 signed URL will be generated,
which can be then used to upload your asset.
-_Returned Response:_
+
+*Returned Response:*
+
+
+
[SignedUploadResponse](#signeduploadresponse)
Success
+
+
+
Example:
```json
{
- "s3PresignedUrl": {
- "url": "https://domain.com/xyz",
- "fields": {
- "field1": "value",
- "field2": "value"
- }
+ "s3PresignedUrl": {
+ "url": "https://domain.com/xyz",
+ "fields": {
+ "field1": "value",
+ "field2": "value"
}
+ }
}
```
-
+
+
+
+
+
+
+
+
+
+
+
### createSignedUrlV2
**Summary**: Signed multipart upload
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -1933,14 +2645,14 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
result = pixelbin.assets.createSignedUrlV2(
- name="filename",
- path="path/to/containing/folder",
- format="jpeg",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
- filenameOverride=True,
+ name="filename",
+ path="path/to/containing/folder",
+ format="jpeg",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
+ filenameOverride=True,
expiry=3000)
# use result
except Exception as e:
@@ -1949,14 +2661,14 @@ except Exception as e:
# Async method call
try:
result = asyncio.run(pixelbin.assets.createSignedUrlV2Async(
- name="filename",
- path="path/to/containing/folder",
- format="jpeg",
- access="public-read",
- tags=["tag1","tag2"],
- metadata={},
- overwrite=False,
- filenameOverride=True,
+ name="filename",
+ path="path/to/containing/folder",
+ format="jpeg",
+ access="public-read",
+ tags=["tag1","tag2"],
+ metadata={},
+ overwrite=False,
+ filenameOverride=True,
expiry=3000))
# use result
except Exception as e:
@@ -1964,342 +2676,466 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| ---------------- | ---------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| name | str | no | name of the file |
-| path | str | no | Path of containing folder. |
-| format | str | no | Format of the file |
-| access | AccessEnum | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Tags associated with the file. |
-| metadata | Any | no | Metadata associated with the file. |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
-| expiry | int | no | Expiry time in seconds for the signed URL. Defaults to 3000 seconds. |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| name| str| no | name of the file |
+| path| str| no | Path of containing folder. |
+| format| str| no | Format of the file |
+| access| AccessEnum| no | Access level of asset, can be either `public-read` or `private` |
+| tags| List[str]| no | Tags associated with the file. |
+| metadata| Any| no | Metadata associated with the file. |
+| overwrite| bool| no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+| filenameOverride| bool| no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+| expiry| int| no | Expiry time in seconds for the signed URL. Defaults to 3000 seconds. |
+
+
For the given asset details, a presigned URL will be generated, which can be then used to upload your asset in chunks via multipart upload.
-_Returned Response:_
+*Returned Response:*
+
+
+
[SignedUploadV2Response](#signeduploadv2response)
Success
+
+
+
Example:
```json
{
- "presignedUrl": {
- "url": "https://api.pixelbin.io/service/public/assets/v1.0/signed-multipart?pbs=8b49e6cdd446be379aa4396e1a&pbe=1700600070390&pbt=92661&pbo=143209&pbu=5fe187e8-8649-4546-9a28-ff551839e0f5",
- "fields": {
- "x-pixb-meta-assetdata": "{\"orgId\":1,\"type\":\"file\",\"name\":\"filename.jpeg\",\"path\":\"\",\"fileId\":\"filename.jpeg\",\"format\":\"jpeg\",\"s3Bucket\":\"erase-erase-erasebg-assets\",\"s3Key\":\"uploads/floral-sun-9617c8/original/a34f1d3-28bf-489c-9aff-cc549ac9e003.jpeg\",\"access\":\"public-read\",\"tags\":[],\"metadata\":{\"source\":\"signedUrl\",\"publicUploadId\":\"5fe187e8-8649-4546-9a28-ff551839e0f5\"},\"overwrite\":false,\"filenameOverride\":false}"
- }
+ "presignedUrl": {
+ "url": "https://api.pixelbin.io/service/public/assets/v1.0/signed-multipart?pbs=8b49e6cdd446be379aa4396e1a&pbe=1700600070390&pbt=92661&pbo=143209&pbu=5fe187e8-8649-4546-9a28-ff551839e0f5",
+ "fields": {
+ "x-pixb-meta-assetdata": "{\"orgId\":1,\"type\":\"file\",\"name\":\"filename.jpeg\",\"path\":\"\",\"fileId\":\"filename.jpeg\",\"format\":\"jpeg\",\"s3Bucket\":\"erase-erase-erasebg-assets\",\"s3Key\":\"uploads/floral-sun-9617c8/original/a34f1d3-28bf-489c-9aff-cc549ac9e003.jpeg\",\"access\":\"public-read\",\"tags\":[],\"metadata\":{\"source\":\"signedUrl\",\"publicUploadId\":\"5fe187e8-8649-4546-9a28-ff551839e0f5\"},\"overwrite\":false,\"filenameOverride\":false}"
}
+ }
}
```
-
+
+
+
+
+
+
+
+
+
### Schemas
-#### folderItem
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ------------------------------------ |
-| \_id | str | no | Id of the folder item |
-| orgId | int | no | Organization Id |
-| name | str | no | Name of the folder item |
-| path | str | no | Path of the folder item |
-| type | str | no | Type of the item. `file` or `folder` |
-
-#### exploreItem
-
-| Properties | Type | Nullable | Description |
-| ---------- | ------------------------- | -------- | --------------------------------------------------------------- |
-| \_id | str | no | id of the exploreItem |
-| orgId | int | no | Organization Id |
-| name | str | no | name of the item |
-| type | str | no | Type of item whether `file` or `folder` |
-| path | str | no | Path of the folder item |
-| fileId | str | no | FileId associated with the item. `path`+`name` |
-| format | str | no | Format of the file |
-| size | int | no | Size of the file in bytes |
-| access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
-| s3Bucket | str | no | Bucket Name |
-| s3Key | str | no | s3 path of file |
-
-#### page
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ----------------------------- |
-| type | str | yes | Type of page |
-| size | int | yes | Number of items on the page |
-| current | int | yes | Current page number. |
-| hasNext | bool | yes | Whether the next page exists. |
-| itemTotal | int | yes | Total number of items. |
-
-#### exploreResponse
-
-| Properties | Type | Nullable | Description |
-| ---------- | ----------------- | -------- | ---------------------------- |
-| items | List[exploreItem] | yes | exploreItems in current page |
-| page | [page](#page) | yes | page details |
-
-#### ListFilesResponse
-
-| Properties | Type | Nullable | Description |
-| ---------- | ----------------- | -------- | ---------------------------- |
-| items | List[exploreItem] | no | exploreItems in current page |
-| page | [page](#page) | no | page details |
-
-#### FileUploadRequest
-
-| Properties | Type | Nullable | Description |
-| ---------------- | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| file | FileIO | yes | Asset file |
-| path | str | no | Path where you want to store the asset |
-| name | str | no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
-| access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Asset tags |
-| metadata | Any | no | Asset related metadata |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
-
-#### UrlUploadRequest
-
-| Properties | Type | Nullable | Description |
-| ---------------- | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| url | str | yes | Asset URL |
-| path | str | no | Path where you want to store the asset |
-| name | str | no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
-| access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Asset tags |
-| metadata | Any | no | Asset related metadata |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
-
-#### UploadResponse
-
-| Properties | Type | Nullable | Description |
-| ---------- | ------------------------- | -------- | ----------------------------------------------------------- |
-| \_id | str | yes | \_id of the item |
-| fileId | str | yes | FileId associated with the item. path+name |
-| name | str | yes | name of the item |
-| path | str | yes | path to the parent folder |
-| format | str | yes | format of the file |
-| size | int | yes | size of file in bytes |
-| access | [AccessEnum](#accessenum) | yes | Access level of asset, can be either public-read or private |
-| tags | List[str] | no | tags associated with the item |
-| metadata | Any | no | metadata associated with the item |
-| url | str | no | url of the item |
-| thumbnail | str | no | url of item thumbnail |
-
-#### SignedUploadRequest
-
-| Properties | Type | Nullable | Description |
-| ---------------- | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| name | str | no | name of the file |
-| path | str | no | Path of the file |
-| format | str | no | Format of the file |
-| access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Tags associated with the file. |
-| metadata | Any | no | Metadata associated with the file. |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
-
-#### SignedUploadResponse
-
-| Properties | Type | Nullable | Description |
-| -------------- | ----------------------------- | -------- | -------------------------------------------- |
-| s3PresignedUrl | [PresignedUrl](#presignedurl) | yes | `signedDetails` for upload with frontend sdk |
-| |
-
-#### PresignedUrl
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ------------------------------------------- |
-| url | str | no | `presigned url` for upload |
-| |
-| fields | Any | no | signed fields to be sent along with request |
-
-#### FilesResponse
-
-| Properties | Type | Nullable | Description |
-| ---------- | ------------------------- | -------- | -------------------------------------------------------------- |
-| \_id | str | yes | \_id of the file |
-| name | str | yes | name of the file |
-| path | str | yes | path to the parent folder of the file |
-| fileId | str | yes | FileId associated with the item. `path`+`name` |
-| format | str | yes | format of the file |
-| size | int | yes | size of the file in bytes |
-| access | [AccessEnum](#accessenum) | yes | Access level of file, can be either `public-read` or `private` |
-| isActive | bool | yes | Whether the file is active |
-| tags | List[str] | no | Tags associated with the file |
-| metadata | Any | no | Metadata associated with the file |
-| url | str | no | url of the file |
-| thumbnail | str | no | url of the thumbnail of the file |
-
-#### UpdateFileRequest
-
-| Properties | Type | Nullable | Description |
-| ---------- | ------------------------- | -------- | --------------------------------------------------------------- |
-| name | str | no | Name of the file |
-| path | str | no | Path of the file |
-| access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
-| isActive | bool | no | Whether the file is active |
-| tags | List[str] | no | Tags associated with the file |
-| metadata | Any | no | Metadata associated with the file |
-
-#### FoldersResponse
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | --------------------------------------- |
-| \_id | str | yes | \_id of the folder |
-| name | str | yes | name of the folder |
-| path | str | yes | path to the parent folder of the folder |
-| isActive | bool | yes | whether the folder is active |
-
-#### CreateFolderRequest
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ------------------ |
-| name | str | yes | Name of the folder |
-| path | str | no | Path of the folder |
-
-#### UpdateFolderRequest
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ---------------------------- |
-| isActive | bool | no | whether the folder is active |
-
-#### DeleteMultipleFilesRequest
-
-| Properties | Type | Nullable | Description |
-| ---------- | --------- | -------- | ----------------------------- |
-| ids | List[str] | yes | Array of file \_ids to delete |
-
-#### Delimiter
-
-| Properties | Type | Nullable | Description |
-| ------------------ | ---- | -------- | ------------------------------------------------------------------------ |
-| operationSeparator | str | no | separator to separate operations in the url pattern |
-| parameterSeparator | str | no | separator to separate parameters used with operations in the url pattern |
-
-#### AddCredentialsRequest
-
-| Properties | Type | Nullable | Description |
-| ----------- | ---- | -------- | ----------------------------------------------------------- |
-| credentials | Any | yes | Credentials of the plugin |
-| pluginId | str | yes | Unique identifier for the plugin this credential belongs to |
-
-#### UpdateCredentialsRequest
-
-| Properties | Type | Nullable | Description |
-| ----------- | ---- | -------- | ------------------------- |
-| credentials | Any | yes | Credentials of the plugin |
-
-#### AddCredentialsResponse
-
-| Properties | Type | Nullable | Description |
-| ----------- | ---- | -------- | ----------- |
-| credentials | Any | no | |
-
-#### GetAncestorsResponse
-
-| Properties | Type | Nullable | Description |
-| ---------- | ------------------------- | -------- | ----------- |
-| folder | [folderItem](#folderitem) | no | |
-| ancestors | List[FoldersResponse] | no | |
-
-#### AddPresetRequest
-
-| Properties | Type | Nullable | Description |
-| -------------- | ---- | -------- | ---------------------------------------------- |
-| presetName | str | yes | Name of the preset |
-| transformation | str | yes | A chain of transformations, separated by `~` |
-| params | Any | no | Parameters object for transformation variables |
-
-#### AddPresetResponse
-
-| Properties | Type | Nullable | Description |
-| -------------- | ---- | -------- | ---------------------------------------------- |
-| presetName | str | no | Name of the preset |
-| transformation | str | no | A chain of transformations, separated by `~` |
-| params | Any | no | Parameters object for transformation variables |
-| archived | bool | no | Indicates if the preset has been archived |
-| orgId | int | no | Organization Id |
-| isActive | bool | no | Indicates if the preset is active |
-| createdAt | str | no | Preset creation ISO timestamp |
-| updatedAt | str | no | Preset update ISO timestamp |
-
-#### UpdatePresetRequest
+
+
+ #### folderItem
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | _id | str | no | Id of the folder item |
+ | orgId | int | no | Organization Id |
+ | name | str | no | Name of the folder item |
+ | path | str | no | Path of the folder item |
+ | type | str | no | Type of the item. `file` or `folder` |
+
+
+
+
+ #### exploreItem
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | _id | str | no | id of the exploreItem |
+ | orgId | int | no | Organization Id |
+ | name | str | no | name of the item |
+ | type | str | no | Type of item whether `file` or `folder` |
+ | path | str | no | Path of the folder item |
+ | fileId | str | no | FileId associated with the item. `path`+`name` |
+ | format | str | no | Format of the file |
+ | size | int | no | Size of the file in bytes |
+ | access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
+ | s3Bucket | str | no | Bucket Name |
+ | s3Key | str | no | s3 path of file |
+
+
+
+
+ #### page
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | type | str | yes | Type of page |
+ | size | int | yes | Number of items on the page |
+ | current | int | yes | Current page number. |
+ | hasNext | bool | yes | Whether the next page exists. |
+ | itemTotal | int | yes | Total number of items. |
+
+
+
+
+ #### exploreResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | items | List[exploreItem] | yes | exploreItems in current page |
+ | page | [page](#page) | yes | page details |
+
+
+
+
+ #### ListFilesResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | items | List[exploreItem] | no | exploreItems in current page |
+ | page | [page](#page) | no | page details |
+
+
+
+
+ #### FileUploadRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | file | FileIO | yes | Asset file |
+ | path | str | no | Path where you want to store the asset |
+ | name | str | no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
+ | access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
+ | tags | List[str] | no | Asset tags |
+ | metadata | Any | no | Asset related metadata |
+ | overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+ | filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
+
+
+ #### UrlUploadRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | url | str | yes | Asset URL |
+ | path | str | no | Path where you want to store the asset |
+ | name | str | no | Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe |
+ | access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
+ | tags | List[str] | no | Asset tags |
+ | metadata | Any | no | Asset related metadata |
+ | overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+ | filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
+
+
+ #### UploadResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | _id | str | yes | _id of the item |
+ | fileId | str | yes | FileId associated with the item. path+name |
+ | name | str | yes | name of the item |
+ | path | str | yes | path to the parent folder |
+ | format | str | yes | format of the file |
+ | size | int | yes | size of file in bytes |
+ | access | [AccessEnum](#accessenum) | yes | Access level of asset, can be either public-read or private |
+ | tags | List[str] | no | tags associated with the item |
+ | metadata | Any | no | metadata associated with the item |
+ | url | str | no | url of the item |
+ | thumbnail | str | no | url of item thumbnail |
+
+
+
+
+ #### SignedUploadRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | name | str | no | name of the file |
+ | path | str | no | Path of the file |
+ | format | str | no | Format of the file |
+ | access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
+ | tags | List[str] | no | Tags associated with the file. |
+ | metadata | Any | no | Metadata associated with the file. |
+ | overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+ | filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+
+
+
+
+ #### SignedUploadResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | s3PresignedUrl | [PresignedUrl](#presignedurl) | yes | `signedDetails` for upload with frontend sdk
+ |
+
+
+
+
+ #### PresignedUrl
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | url | str | no | `presigned url` for upload
+ |
+ | fields | Any | no | signed fields to be sent along with request |
+
+
+
+
+ #### FilesResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | _id | str | yes | _id of the file |
+ | name | str | yes | name of the file |
+ | path | str | yes | path to the parent folder of the file |
+ | fileId | str | yes | FileId associated with the item. `path`+`name` |
+ | format | str | yes | format of the file |
+ | size | int | yes | size of the file in bytes |
+ | access | [AccessEnum](#accessenum) | yes | Access level of file, can be either `public-read` or `private` |
+ | isActive | bool | yes | Whether the file is active |
+ | tags | List[str] | no | Tags associated with the file |
+ | metadata | Any | no | Metadata associated with the file |
+ | url | str | no | url of the file |
+ | thumbnail | str | no | url of the thumbnail of the file |
+
+
+
+
+ #### UpdateFileRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | name | str | no | Name of the file |
+ | path | str | no | Path of the file |
+ | access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
+ | isActive | bool | no | Whether the file is active |
+ | tags | List[str] | no | Tags associated with the file |
+ | metadata | Any | no | Metadata associated with the file |
+
+
+
+
+ #### FoldersResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | _id | str | yes | _id of the folder |
+ | name | str | yes | name of the folder |
+ | path | str | yes | path to the parent folder of the folder |
+ | isActive | bool | yes | whether the folder is active |
+
+
+
+
+ #### CreateFolderRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | name | str | yes | Name of the folder |
+ | path | str | no | Path of the folder |
+
+
+
+
+ #### UpdateFolderRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | isActive | bool | no | whether the folder is active |
+
+
+
+
+ #### DeleteMultipleFilesRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | ids | List[str] | yes | Array of file _ids to delete |
+
+
+
+
+ #### Delimiter
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | operationSeparator | str | no | separator to separate operations in the url pattern |
+ | parameterSeparator | str | no | separator to separate parameters used with operations in the url pattern |
+
+
+
+
+ #### AddCredentialsRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | credentials | Any | yes | Credentials of the plugin |
+ | pluginId | str | yes | Unique identifier for the plugin this credential belongs to |
+
+
+
+
+ #### UpdateCredentialsRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | credentials | Any | yes | Credentials of the plugin |
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ----------------------------------------- |
-| archived | bool | yes | Indicates if the preset has been archived |
-#### GetPresetsResponse
+
+
+ #### AddCredentialsResponse
-| Properties | Type | Nullable | Description |
-| ---------- | ----------------------- | -------- | ------------ |
-| items | List[AddPresetResponse] | yes | |
-| page | [page](#page) | yes | page details |
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | credentials | Any | no | |
-#### TransformationModuleResponse
-| Properties | Type | Nullable | Description |
-| ----------- | --------- | -------- | ----------------------------------------------- |
-| identifier | str | no | identifier for the plugin type |
-| name | str | no | name of the plugin |
-| description | str | no | description of the plugin |
-| credentials | Any | no | credentials, if any, associated with the plugin |
-| operations | List[Any] | no | supported operations in the plugin |
-| enabled | bool | no | whether the plugin is enabled |
+
+
+ #### GetAncestorsResponse
-#### TransformationModulesResponse
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | folder | [folderItem](#folderitem) | no | |
+ | ancestors | List[FoldersResponse] | no | |
-| Properties | Type | Nullable | Description |
-| ---------- | ----------------------- | -------- | --------------------------------------------------- |
-| delimiters | [Delimiter](#delimiter) | no | Delimiter for parsing plugin schema |
-| plugins | Any | no | Transformations currently supported by the pixelbin |
-| presets | List[Any] | no | List of saved presets |
-#### SignedUploadRequestV2
+
+
+ #### AddPresetRequest
-| Properties | Type | Nullable | Description |
-| ---------------- | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| name | str | no | name of the file |
-| path | str | no | Path of containing folder. |
-| format | str | no | Format of the file |
-| access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
-| tags | List[str] | no | Tags associated with the file. |
-| metadata | Any | no | Metadata associated with the file. |
-| overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
-| filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
-| expiry | int | no | Expiry time in seconds for the signed URL. Defaults to 3000 seconds. |
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | presetName | str | yes | Name of the preset |
+ | transformation | str | yes | A chain of transformations, separated by `~` |
+ | params | Any | no | Parameters object for transformation variables |
-#### SignedUploadV2Response
-| Properties | Type | Nullable | Description |
-| ------------ | --------------------------------- | -------- | ------------------------------------------- |
-| presignedUrl | [PresignedUrlV2](#presignedurlv2) | yes | Presigned URL for uploading asset in chunks |
+
+
+ #### AddPresetResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | presetName | str | no | Name of the preset |
+ | transformation | str | no | A chain of transformations, separated by `~` |
+ | params | Any | no | Parameters object for transformation variables |
+ | archived | bool | no | Indicates if the preset has been archived |
+ | orgId | int | no | Organization Id |
+ | isActive | bool | no | Indicates if the preset is active |
+ | createdAt | str | no | Preset creation ISO timestamp |
+ | updatedAt | str | no | Preset update ISO timestamp |
+
+
+
+
+ #### UpdatePresetRequest
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | archived | bool | yes | Indicates if the preset has been archived |
+
+
+
+
+ #### GetPresetsResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | items | List[AddPresetResponse] | yes | |
+ | page | [page](#page) | yes | page details |
+
+
+
+
+ #### TransformationModuleResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | identifier | str | no | identifier for the plugin type |
+ | name | str | no | name of the plugin |
+ | description | str | no | description of the plugin |
+ | credentials | Any | no | credentials, if any, associated with the plugin |
+ | operations | List[Any] | no | supported operations in the plugin |
+ | enabled | bool | no | whether the plugin is enabled |
+
+
+
+
+ #### TransformationModulesResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | delimiters | [Delimiter](#delimiter) | no | Delimiter for parsing plugin schema |
+ | plugins | Any | no | Transformations currently supported by the pixelbin |
+ | presets | List[Any] | no | List of saved presets |
+
+
+
+
+ #### SignedUploadRequestV2
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | name | str | no | name of the file |
+ | path | str | no | Path of containing folder. |
+ | format | str | no | Format of the file |
+ | access | [AccessEnum](#accessenum) | no | Access level of asset, can be either `public-read` or `private` |
+ | tags | List[str] | no | Tags associated with the file. |
+ | metadata | Any | no | Metadata associated with the file. |
+ | overwrite | bool | no | Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. |
+ | filenameOverride | bool | no | If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. |
+ | expiry | int | no | Expiry time in seconds for the signed URL. Defaults to 3000 seconds. |
+
+
+
+
+ #### SignedUploadV2Response
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | presignedUrl | [PresignedUrlV2](#presignedurlv2) | yes | Presigned URL for uploading asset in chunks |
+
+
+
+
+ #### PresignedUrlV2
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | url | str | no | Presigned URL for uploading asset in chunks |
+ | fields | Any | no | signed fields to be sent along with request |
+
-#### PresignedUrlV2
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ------------------------------------------- |
-| url | str | no | Presigned URL for uploading asset in chunks |
-| fields | Any | no | signed fields to be sent along with request |
### Enums
-#### [AccessEnum](#AccessEnum)
-Type : string
-| Name | Value | Description |
-| ----------- | ----------- | ----------- |
-| public-read | public-read | public-read |
-| private | private | private |
+
+
+ #### [AccessEnum](#AccessEnum)
+ Type : string
+
+ | Name | Value | Description |
+ | ---- | ----- | ----------- |
+ | public-read | public-read | public-read |
+ | private | private | private |
---
+
+
+
+
+
+
diff --git a/documentation/platform/ORGANIZATION.md b/documentation/platform/ORGANIZATION.md
index 5ce9dbb..92203e4 100644
--- a/documentation/platform/ORGANIZATION.md
+++ b/documentation/platform/ORGANIZATION.md
@@ -1,17 +1,28 @@
+
+
+
+
##### [Back to Pixelbin API docs](./README.md)
## Organization Methods
-
Organization Service
+* [getAppOrgDetails](#getapporgdetails)
-- [getAppOrgDetails](#getapporgdetails)
## Methods with example and description
+
+
+
+
### getAppOrgDetails
**Summary**: Get App Details
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -39,78 +50,115 @@ except Exception as e:
```
+
+
+
+
+
Get App and org details
-_Returned Response:_
+*Returned Response:*
+
+
+
[AppOrgDetails](#apporgdetails)
Success. Returns a JSON object as shown below. Refer `AppOrgDetails` for more details.
+
+
+
Example:
```json
{
- "app": {
- "_id": 123,
- "orgId": 12,
- "name": "Desktop Client App",
- "permissions": ["read", "read_write"],
- "active": false,
- "createdAt": "2021-07-15T07:47:00Z",
- "updatedAt": "2021-07-15T07:47:00Z"
- },
- "org": {
- "_id": 12,
- "name": "org_1",
- "cloudName": "testcloudname",
- "accountType": "individual",
- "industry": "Ecommerce",
- "strength": "1",
- "active": "false"
- }
+ "app": {
+ "_id": 123,
+ "orgId": 12,
+ "name": "Desktop Client App",
+ "permissions": [
+ "read",
+ "read_write"
+ ],
+ "active": false,
+ "createdAt": "2021-07-15T07:47:00Z",
+ "updatedAt": "2021-07-15T07:47:00Z"
+ },
+ "org": {
+ "_id": 12,
+ "name": "org_1",
+ "cloudName": "testcloudname",
+ "accountType": "individual",
+ "industry": "Ecommerce",
+ "strength": "1",
+ "active": "false"
+ }
}
```
-
+
+
+
+
+
+
+
+
+
### Schemas
-#### OrganizationDetailSchema
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | -------------------------------------------------- |
-| \_id | int | no | Id of the organization |
-| name | str | no | Organization Name |
-| cloudName | str | no | Unique cloud name associated with the organization |
-| ownerId | str | no | User Id of the organization owner |
-| active | bool | no | Whether the organization is active |
-| createdAt | str | no | Timestamp when the organization was created |
-| updatedAt | str | no | Timestamp when the organization was last updated |
-
-#### AppSchema
-
-| Properties | Type | Nullable | Description |
-| ----------- | --------- | -------- | --------------------------------------- |
-| \_id | int | no | App id |
-| orgId | int | no | Organization id the app belongs to |
-| name | str | no | Name of the app |
-| token | str | no | api token for the app |
-| permissions | List[str] | no | Permissions applied on the app |
-| active | bool | no | Whether the app is active |
-| createdAt | str | no | Timestamp when the app was created |
-| updatedAt | str | no | Timestamp when the app was last updated |
-
-#### AppOrgDetails
-
-| Properties | Type | Nullable | Description |
-| ---------- | ----------------------------------------------------- | -------- | ----------- |
-| app | [AppSchema](#appschema) | no | |
-| org | [OrganizationDetailSchema](#organizationdetailschema) | no | |
-
-#### ErrorSchema
-
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ----------- |
-| message | str | no | |
+
+
+ #### OrganizationDetailSchema
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | _id | int | no | Id of the organization |
+ | name | str | no | Organization Name |
+ | cloudName | str | no | Unique cloud name associated with the organization |
+ | ownerId | str | no | User Id of the organization owner |
+ | active | bool | no | Whether the organization is active |
+ | createdAt | str | no | Timestamp when the organization was created |
+ | updatedAt | str | no | Timestamp when the organization was last updated |
+
+
+
+
+ #### AppSchema
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | _id | int | no | App id |
+ | orgId | int | no | Organization id the app belongs to |
+ | name | str | no | Name of the app |
+ | token | str | no | api token for the app |
+ | permissions | List[str] | no | Permissions applied on the app |
+ | active | bool | no | Whether the app is active |
+ | createdAt | str | no | Timestamp when the app was created |
+ | updatedAt | str | no | Timestamp when the app was last updated |
+
+
+
+
+ #### AppOrgDetails
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | app | [AppSchema](#appschema) | no | |
+ | org | [OrganizationDetailSchema](#organizationdetailschema) | no | |
+
+
+
+
+ #### ErrorSchema
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | message | str | no | |
+
+
+
+
diff --git a/documentation/platform/README.md b/documentation/platform/README.md
index 08a8b83..6732425 100644
--- a/documentation/platform/README.md
+++ b/documentation/platform/README.md
@@ -2,6 +2,7 @@
# Pixelbin API Documentaion
-- [Assets](ASSETS.md) - Asset Uploader Service
-- [Organization](ORGANIZATION.md) - Organization Service
-- [Transformation](TRANSFORMATION.md) - Image Transformation Service
+
+* [Assets](ASSETS.md) - Asset Uploader Service
+* [Organization](ORGANIZATION.md) - Organization Service
+* [Transformation](TRANSFORMATION.md) - Image Transformation Service
\ No newline at end of file
diff --git a/documentation/platform/TRANSFORMATION.md b/documentation/platform/TRANSFORMATION.md
index b59f0a4..8c75311 100644
--- a/documentation/platform/TRANSFORMATION.md
+++ b/documentation/platform/TRANSFORMATION.md
@@ -1,17 +1,28 @@
+
+
+
+
##### [Back to Pixelbin API docs](./README.md)
## Transformation Methods
-
Image Transformation Service
+* [getTransformationContext](#gettransformationcontext)
-- [getTransformationContext](#gettransformationcontext)
## Methods with example and description
+
+
+
+
### getTransformationContext
**Summary**: Get transformation context
+
+
+
+
```python
import asyncio
from pixelbin import PixelbinClient, PixelbinConfig
@@ -25,7 +36,7 @@ pixelbin:PixelbinClient = PixelbinClient(config=config)
# Sync method call
try:
- result = pixelbin.transformation.getTransformationContext(
+ result = pixelbin.transformation.getTransformationContext(
url="/v2/fynd-eg/t.resize()/__playground/playground-default.jpeg")
# use result
except Exception as e:
@@ -33,7 +44,7 @@ except Exception as e:
# Async method call
try:
- result = asyncio.run(pixelbin.transformation.getTransformationContextAsync(
+ result = asyncio.run(pixelbin.transformation.getTransformationContextAsync(
url="/v2/fynd-eg/t.resize()/__playground/playground-default.jpeg"))
# use result
except Exception as e:
@@ -41,87 +52,114 @@ except Exception as e:
```
-| Argument | Type | Required | Description |
-| -------- | ---- | -------- | ---------------------------- |
-| url | str | no | CDN URL with transformation. |
+
+
+
+
+| Argument | Type | Required | Description |
+| --------- | ----- | -------- | ----------- |
+| url | str | no | CDN URL with transformation. |
+
+
Get transformation context
-_Returned Response:_
+*Returned Response:*
+
+
+
[GetTransformationContextSuccessResponse](#gettransformationcontextsuccessresponse)
Success
+
+
+
Examples:
+
GetTransformationContextSuccessResponse
```json
{
- "value": {
- "context": {
- "steps": [
- {
- "name": "blur",
- "operation": "Basic",
- "identifier": "t",
- "data": {},
- "metadata": null,
- "format": "jpeg",
- "size": 58650,
- "width": 1140,
- "height": 760,
- "space": "srgb",
- "channels": 3,
- "depth": "uchar",
- "density": 72,
- "chromaSubsampling": "4:2:0",
- "isProgressive": false,
- "resolutionUnit": "inch",
- "hasProfile": false,
- "hasAlpha": false,
- "orientation": 1
- }
- ],
- "metadata": {
- "width": 1140,
- "height": 760,
- "channels": 3,
- "extension": "jpeg",
- "format": "jpeg",
- "contentType": "image/jpeg",
- "size": 62667,
- "assetType": "image",
- "isImageAsset": true,
- "isAudioAsset": false,
- "isVideoAsset": false,
- "isRawAsset": false
- },
- "headers": {
- "host": "api.pixelbin.io",
- "x-real-ip": "0.0.0.0",
- "origin": "https://console.pixelbin.io",
- "accept": "application/json, text/plain, */*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "en-US,en;q=0.9"
- },
- "params": {}
+ "value": {
+ "context": {
+ "steps": [
+ {
+ "name": "blur",
+ "operation": "Basic",
+ "identifier": "t",
+ "data": {},
+ "metadata": null,
+ "format": "jpeg",
+ "size": 58650,
+ "width": 1140,
+ "height": 760,
+ "space": "srgb",
+ "channels": 3,
+ "depth": "uchar",
+ "density": 72,
+ "chromaSubsampling": "4:2:0",
+ "isProgressive": false,
+ "resolutionUnit": "inch",
+ "hasProfile": false,
+ "hasAlpha": false,
+ "orientation": 1
}
+ ],
+ "metadata": {
+ "width": 1140,
+ "height": 760,
+ "channels": 3,
+ "extension": "jpeg",
+ "format": "jpeg",
+ "contentType": "image/jpeg",
+ "size": 62667,
+ "assetType": "image",
+ "isImageAsset": true,
+ "isAudioAsset": false,
+ "isVideoAsset": false,
+ "isRawAsset": false
+ },
+ "headers": {
+ "host": "api.pixelbin.io",
+ "x-real-ip": "0.0.0.0",
+ "origin": "https://console.pixelbin.io",
+ "accept": "application/json, text/plain, */*",
+ "accept-encoding": "gzip, deflate, br",
+ "accept-language": "en-US,en;q=0.9"
+ },
+ "params": {}
}
+ }
}
```
-
+
+
+
+
+
+
+
+
+
### Schemas
-#### GetTransformationContextSuccessResponse
+
+
+ #### GetTransformationContextSuccessResponse
+
+ | Properties | Type | Nullable | Description |
+ | ---------- | ---- | -------- | ----------- |
+ | context | Any | no | |
+
+
+
-| Properties | Type | Nullable | Description |
-| ---------- | ---- | -------- | ----------- |
-| context | Any | no | |
diff --git a/pixelbin/__init__.py b/pixelbin/__init__.py
index 253fced..25e860e 100644
--- a/pixelbin/__init__.py
+++ b/pixelbin/__init__.py
@@ -1,4 +1,4 @@
from pixelbin.platform.PixelbinConfig import PixelbinConfig
from pixelbin.platform.PixelbinClient import PixelbinClient
-__all__ = ["PixelbinClient", "PixelbinConfig"]
\ No newline at end of file
+__all__ = ["PixelbinClient", "PixelbinConfig"]
diff --git a/pixelbin/common/aiohttp_helper.py b/pixelbin/common/aiohttp_helper.py
index 18cd143..2eaab45 100644
--- a/pixelbin/common/aiohttp_helper.py
+++ b/pixelbin/common/aiohttp_helper.py
@@ -63,9 +63,9 @@ async def __make_request(
response["headers"] = dict(resp.headers)
response["cookies"] = dict(resp.cookies)
try:
- response["content"] = (
- await resp.content.read()
- ) # resp.content is a StreamReader
+ response[
+ "content"
+ ] = await resp.content.read() # resp.content is a StreamReader
response["text"] = response["content"].decode() # converting to str
except UnicodeDecodeError as err:
response["error_message"] = (
@@ -100,12 +100,34 @@ async def request(
:param - timeout_allowed : timeout for request in seconds : Type - int
"""
if data:
- if "file" in data.keys():
+ # Determine if multipart form-data is needed. This is true when any value is
+ # a file-like object or bytes/bytearray, or when explicit 'file' key exists.
+ needs_form = False
+ for _k, _v in data.items():
+ if _k == "file":
+ needs_form = True
+ break
+ if isinstance(_v, (bytes, bytearray)) or hasattr(_v, "read"):
+ needs_form = True
+ break
+ if isinstance(_v, list) and any(
+ isinstance(__e, (bytes, bytearray)) or hasattr(__e, "read")
+ for __e in _v
+ ):
+ needs_form = True
+ break
+
+ if needs_form:
form_data = self.__get_formdata()
for k, v in data.items():
if isinstance(v, list):
for ele in v:
- form_data.add_field(k, ele)
+ ele_val = (
+ ujson.dumps(ele, escape_forward_slashes=False)
+ if isinstance(ele, dict) or isinstance(ele, bool)
+ else ele
+ )
+ form_data.add_field(k, ele_val)
else:
value = (
ujson.dumps(v, escape_forward_slashes=False)
diff --git a/pixelbin/common/constants.py b/pixelbin/common/constants.py
index 7535e72..8c01ba5 100644
--- a/pixelbin/common/constants.py
+++ b/pixelbin/common/constants.py
@@ -1,6 +1,5 @@
"""Python pixelbin/common/constants.py."""
-
DEFAULT_DOMAIN = "https://api.pixelbin.io"
APPLICATION_MIN_TOKEN_LENGTH = 5
HTTP_TIMEOUT = 15
diff --git a/pixelbin/common/exceptions.py b/pixelbin/common/exceptions.py
index 43c286b..7948eee 100644
--- a/pixelbin/common/exceptions.py
+++ b/pixelbin/common/exceptions.py
@@ -1,11 +1,14 @@
class PixelbinInvalidCredentialError(Exception):
"""Invalid credential exception."""
+
def __init__(self, message="Invalid Credentials"):
"""Initialize function __init__."""
- super(PixelbinInvalidCredentialError, self).__init__(message)
+ super(PixelbinInvalidCredentialError, self).__init__(message)
+
class PixelbinServerResponseError(Exception):
"""Pixelbin Server Response Exception."""
+
def __init__(self, message="", status_code=None):
"""Initialize function __init__."""
super(PixelbinServerResponseError, self).__init__(message)
@@ -14,6 +17,7 @@ def __init__(self, message="", status_code=None):
class PixelbinInvalidUrlError(Exception):
"""Pixelbin Invalid Url Exception."""
+
def __init__(self, message=""):
"""Initialize function __init__."""
super(PixelbinInvalidUrlError, self).__init__(message)
@@ -21,6 +25,7 @@ def __init__(self, message=""):
class PixelbinIllegalArgumentError(Exception):
"""Pixelbin Illegal Argument Exception."""
+
def __init__(self, message=""):
"""Initialize function __init__."""
super(PixelbinIllegalArgumentError, self).__init__(message)
@@ -28,6 +33,7 @@ def __init__(self, message=""):
class PixelbinIllegalQueryParameterError(Exception):
"""Pixelbin Illegal Query Parameter Exception."""
+
def __init__(self, message=""):
"""Initialize function __init__."""
- super(PixelbinIllegalQueryParameterError, self).__init__(message)
\ No newline at end of file
+ super(PixelbinIllegalQueryParameterError, self).__init__(message)
diff --git a/pixelbin/common/utils.py b/pixelbin/common/utils.py
index 8be2fb8..c97ff5c 100644
--- a/pixelbin/common/utils.py
+++ b/pixelbin/common/utils.py
@@ -13,7 +13,7 @@
from typing import Callable, Any
-async def create_query_string(params : dict={}) -> str:
+async def create_query_string(params: dict = {}) -> str:
"""
summary : Creates query string
:param - params : query params : Type - dict
@@ -29,8 +29,16 @@ async def create_query_string(params : dict={}) -> str:
return query_string
-async def add_signature_to_headers(domain: str, method: str, url: str, query_string: str, headers: dict, body: Union[dict, str]="",
- exclude_headers=[], sign_query=False) -> Union[dict, str]:
+async def add_signature_to_headers(
+ domain: str,
+ method: str,
+ url: str,
+ query_string: str,
+ headers: dict,
+ body: Union[dict, str] = "",
+ exclude_headers=[],
+ sign_query=False,
+) -> Union[dict, str]:
"""
summary : returns headers with signature
:param - domain : url domain : Type - str
@@ -47,7 +55,9 @@ async def add_signature_to_headers(domain: str, method: str, url: str, query_str
if not sign_query:
headers["x-ebg-param"] = ebg_date
else:
- query_string += f"&x-ebg-param={ebg_date}" if query_string else f"?x-ebg-param={ebg_date}"
+ query_string += (
+ f"&x-ebg-param={ebg_date}" if query_string else f"?x-ebg-param={ebg_date}"
+ )
excluded_headers = {}
for header in exclude_headers:
excluded_headers[header] = headers.pop(header) if header in headers else None
@@ -56,18 +66,28 @@ async def add_signature_to_headers(domain: str, method: str, url: str, query_str
body_hex = hashlib.sha256("".encode()).hexdigest()
if body:
- body_hex = hashlib.sha256(ujson.dumps(body, escape_forward_slashes=False).replace(", ", ",").replace(": ", ":").encode()).hexdigest()
+ body_hex = hashlib.sha256(
+ ujson.dumps(body, escape_forward_slashes=False)
+ .replace(", ", ",")
+ .replace(": ", ":")
+ .encode()
+ ).hexdigest()
request_list = [
method.upper(),
url,
query_string,
headers_str,
";".join([h for h in headers.keys() if h == "host" or h.startswith("x-ebg-")]),
- body_hex
+ body_hex,
]
request_str = "\n".join(request_list)
- request_str = "\n".join([ebg_date, hashlib.sha256(request_str.encode()).hexdigest()])
- signature = "v1:" + hmac.new("1234567".encode(), request_str.encode(), hashlib.sha256).hexdigest()
+ request_str = "\n".join(
+ [ebg_date, hashlib.sha256(request_str.encode()).hexdigest()]
+ )
+ signature = (
+ "v1:"
+ + hmac.new("1234567".encode(), request_str.encode(), hashlib.sha256).hexdigest()
+ )
if not sign_query:
headers["x-ebg-signature"] = signature
else:
@@ -77,6 +97,7 @@ async def add_signature_to_headers(domain: str, method: str, url: str, query_str
headers[h_key] = h_value
return headers if not sign_query else query_string
+
def retry(
max_retries: int = 5,
base_delay: float = 1,
diff --git a/pixelbin/platform/OAuthClient.py b/pixelbin/platform/OAuthClient.py
index 6f6393b..3d3e783 100644
--- a/pixelbin/platform/OAuthClient.py
+++ b/pixelbin/platform/OAuthClient.py
@@ -1,14 +1,13 @@
"""OAuth Client."""
+
class OAuthClient:
def __init__(self, config):
self._conf = config
self.token = config.apiSecret
-
async def getAccessToken(self) -> str:
"""
summary : return access token
"""
return self.token
-
diff --git a/pixelbin/platform/PixelbinClient.py b/pixelbin/platform/PixelbinClient.py
index c6b119a..22cc08e 100644
--- a/pixelbin/platform/PixelbinClient.py
+++ b/pixelbin/platform/PixelbinClient.py
@@ -1,22 +1,21 @@
-
import asyncio
import ujson
from ..common.utils import retry
from ..common.aiohttp_helper import AiohttpHelper
-from ..common.exceptions import PixelbinServerResponseError, PixelbinIllegalArgumentError
+from ..common.exceptions import (
+ PixelbinServerResponseError,
+ PixelbinIllegalArgumentError,
+)
+from .Predictions import Predictions
from .PlatformAPIClient import APIClient
from .PixelbinConfig import PixelbinConfig
from io import FileIO, BufferedIOBase
from typing import List, Any, Union
-
from .enums import AccessEnum
-
-
-
from .models.AssetsValidator import AssetsValidator
from .models.OrganizationValidator import OrganizationValidator
from .models.TransformationValidator import TransformationValidator
@@ -28,67 +27,55 @@ class PixelbinClient:
def __init__(self, config: PixelbinConfig):
"""
summary: create instance of PixelbinClient
-
+
:param - config : instances of PixelbinConfig : Type - PixelbinConfig
"""
self.config = config
self.assets = Assets(config)
self.organization = Organization(config)
self.transformation = Transformation(config)
-
- self.uploader = Uploader(self.assets, config)
-
+ self.uploader = Uploader(self.assets, config)
+ self.predictions = Predictions(config)
class Assets:
def __init__(self, config):
self.config = config
-
-
-
-
-
async def addCredentialsAsync(
- self,
-
- credentials:Any=None,
- pluginId:str=None
- ) -> dict:
+ self, credentials: Any = None, pluginId: str = None
+ ) -> dict:
"""
summary: Add credentials for a transformation module.
description: Add a transformation modules's credentials for an organization.
-
+
:param - credentials : Credentials of the plugin : Type - Any
:param - pluginId : Unique identifier for the plugin this credential belongs to : Type - str
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.addCredentials()
schema.dump(schema.load(payload))
-
body = {}
-
+
if credentials is not None:
body["credentials"] = credentials
-
+
if pluginId is not None:
body["pluginId"] = pluginId
-
+
# Body validation
from .models.AddCredentialsRequest import AddCredentialsRequest
+
schema = AddCredentialsRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -96,76 +83,60 @@ async def addCredentialsAsync(
url=f"/service/platform/assets/v1.0/credentials",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def addCredentials(
- self,
-
- credentials:Any=None,
- pluginId:str=None
- ):
+ def addCredentials(self, credentials: Any = None, pluginId: str = None):
"""
summary: Add credentials for a transformation module.
description: Add a transformation modules's credentials for an organization.
-
+
:param - credentials : Credentials of the plugin : Type - Any
:param - pluginId : Unique identifier for the plugin this credential belongs to : Type - str
"""
return asyncio.get_event_loop().run_until_complete(
- self.addCredentialsAsync(
- credentials=credentials,
- pluginId=pluginId)
+ self.addCredentialsAsync(credentials=credentials, pluginId=pluginId)
)
-
-
-
-
-
async def updateCredentialsAsync(
- self,
-
- pluginId:str=None,
- credentials:Any=None
- ) -> dict:
+ self, pluginId: str = None, credentials: Any = None
+ ) -> dict:
"""
summary: Update credentials of a transformation module.
description: Update credentials of a transformation module, for an organization.
- :param - pluginId : ID of the plugin whose credentials are being updated: Type - str
-
+ :param - pluginId : ID of the plugin whose credentials are being updated: Type - str
+
:param - credentials : Credentials of the plugin : Type - Any
"""
payload = {}
-
+
if pluginId is not None:
payload["pluginId"] = pluginId
-
# Parameter validation
schema = AssetsValidator.updateCredentials()
schema.dump(schema.load(payload))
-
body = {}
-
+
if credentials is not None:
body["credentials"] = credentials
-
+
# Body validation
from .models.UpdateCredentialsRequest import UpdateCredentialsRequest
+
schema = UpdateCredentialsRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -173,64 +144,46 @@ async def updateCredentialsAsync(
url=f"/service/platform/assets/v1.0/credentials/{pluginId}",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def updateCredentials(
- self,
-
- pluginId:str=None,
- credentials:Any=None
- ):
+ def updateCredentials(self, pluginId: str = None, credentials: Any = None):
"""
summary: Update credentials of a transformation module.
description: Update credentials of a transformation module, for an organization.
- :param - pluginId : ID of the plugin whose credentials are being updated: Type - str
-
+ :param - pluginId : ID of the plugin whose credentials are being updated: Type - str
+
:param - credentials : Credentials of the plugin : Type - Any
"""
return asyncio.get_event_loop().run_until_complete(
- self.updateCredentialsAsync(
- pluginId=pluginId,
- credentials=credentials)
+ self.updateCredentialsAsync(pluginId=pluginId, credentials=credentials)
)
-
-
-
-
-
- async def deleteCredentialsAsync(
- self,
-
- pluginId:str=None
- ) -> dict:
+ async def deleteCredentialsAsync(self, pluginId: str = None) -> dict:
"""
summary: Delete credentials of a transformation module.
description: Delete credentials of a transformation module, for an organization.
- :param - pluginId : ID of the plugin whose credentials are being deleted: Type - str
-
+ :param - pluginId : ID of the plugin whose credentials are being deleted: Type - str
+
"""
payload = {}
-
+
if pluginId is not None:
payload["pluginId"] = pluginId
-
# Parameter validation
schema = AssetsValidator.deleteCredentials()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -238,60 +191,44 @@ async def deleteCredentialsAsync(
url=f"/service/platform/assets/v1.0/credentials/{pluginId}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def deleteCredentials(
- self,
-
- pluginId:str=None
- ):
+ def deleteCredentials(self, pluginId: str = None):
"""
summary: Delete credentials of a transformation module.
description: Delete credentials of a transformation module, for an organization.
- :param - pluginId : ID of the plugin whose credentials are being deleted: Type - str
-
+ :param - pluginId : ID of the plugin whose credentials are being deleted: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.deleteCredentialsAsync(
- pluginId=pluginId)
+ self.deleteCredentialsAsync(pluginId=pluginId)
)
-
-
-
-
-
- async def getFileByIdAsync(
- self,
-
- _id:str=None
- ) -> dict:
+ async def getFileByIdAsync(self, _id: str = None) -> dict:
"""
summary: Get file details with _id
- description:
- :param - _id : _id of File: Type - str
-
+ description:
+ :param - id : _id of File: Type - str
+
"""
payload = {}
-
+
if _id is not None:
payload["_id"] = _id
-
# Parameter validation
schema = AssetsValidator.getFileById()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -299,59 +236,43 @@ async def getFileByIdAsync(
url=f"/service/platform/assets/v1.0/files/id/{_id}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def getFileById(
- self,
-
- _id:str=None
- ):
+ def getFileById(self, _id: str = None):
"""
summary: Get file details with _id
- description:
- :param - _id : _id of File: Type - str
-
+ description:
+ :param - id : _id of File: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.getFileByIdAsync(
- _id=_id)
+ self.getFileByIdAsync(_id=_id)
)
-
-
-
-
-
- async def getFileByFileIdAsync(
- self,
-
- fileId:str=None
- ) -> dict:
+ async def getFileByFileIdAsync(self, fileId: str = None) -> dict:
"""
summary: Get file details with fileId
- description:
- :param - fileId : Combination of `path` and `name` of file: Type - str
-
+ description:
+ :param - fileId : Combination of `path` and `name` of file: Type - str
+
"""
payload = {}
-
+
if fileId is not None:
payload["fileId"] = fileId
-
# Parameter validation
schema = AssetsValidator.getFileByFileId()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -359,49 +280,40 @@ async def getFileByFileIdAsync(
url=f"/service/platform/assets/v1.0/files/{fileId}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def getFileByFileId(
- self,
-
- fileId:str=None
- ):
+ def getFileByFileId(self, fileId: str = None):
"""
summary: Get file details with fileId
- description:
- :param - fileId : Combination of `path` and `name` of file: Type - str
-
+ description:
+ :param - fileId : Combination of `path` and `name` of file: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.getFileByFileIdAsync(
- fileId=fileId)
+ self.getFileByFileIdAsync(fileId=fileId)
)
-
-
-
-
-
async def updateFileAsync(
- self,
-
- fileId:str=None,
- name:str=None,
- path:str=None,
- access:AccessEnum=None,
- isActive:bool=None,
- tags:List[str]=None,
- metadata:Any=None
- ) -> dict:
+ self,
+ fileId: str = None,
+ name: str = None,
+ path: str = None,
+ access: AccessEnum = None,
+ isActive: bool = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ ) -> dict:
"""
summary: Update file details
- description:
- :param - fileId : Combination of `path` and `name`: Type - str
-
+ description:
+ :param - fileId : Combination of `path` and `name`: Type - str
+
:param - name : Name of the file : Type - str
:param - path : Path of the file : Type - str
:param - access : Access level of asset, can be either `public-read` or `private` : Type - AccessEnum
@@ -411,44 +323,41 @@ async def updateFileAsync(
"""
payload = {}
-
+
if fileId is not None:
payload["fileId"] = fileId
-
# Parameter validation
schema = AssetsValidator.updateFile()
schema.dump(schema.load(payload))
-
body = {}
-
+
if name is not None:
body["name"] = name
-
+
if path is not None:
body["path"] = path
-
+
if access is not None:
body["access"] = access
-
+
if isActive is not None:
body["isActive"] = isActive
-
+
if tags is not None:
body["tags"] = tags
-
+
if metadata is not None:
body["metadata"] = metadata
-
+
# Body validation
from .models.UpdateFileRequest import UpdateFileRequest
+
schema = UpdateFileRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -456,28 +365,29 @@ async def updateFileAsync(
url=f"/service/platform/assets/v1.0/files/{fileId}",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def updateFile(
- self,
-
- fileId:str=None,
- name:str=None,
- path:str=None,
- access:AccessEnum=None,
- isActive:bool=None,
- tags:List[str]=None,
- metadata:Any=None
- ):
+ self,
+ fileId: str = None,
+ name: str = None,
+ path: str = None,
+ access: AccessEnum = None,
+ isActive: bool = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ ):
"""
summary: Update file details
- description:
- :param - fileId : Combination of `path` and `name`: Type - str
-
+ description:
+ :param - fileId : Combination of `path` and `name`: Type - str
+
:param - name : Name of the file : Type - str
:param - path : Path of the file : Type - str
:param - access : Access level of asset, can be either `public-read` or `private` : Type - AccessEnum
@@ -488,45 +398,33 @@ def updateFile(
return asyncio.get_event_loop().run_until_complete(
self.updateFileAsync(
fileId=fileId,
- name=name,
- path=path,
- access=access,
- isActive=isActive,
- tags=tags,
- metadata=metadata)
+ name=name,
+ path=path,
+ access=access,
+ isActive=isActive,
+ tags=tags,
+ metadata=metadata,
+ )
)
-
-
-
-
-
- async def deleteFileAsync(
- self,
-
- fileId:str=None
- ) -> dict:
+ async def deleteFileAsync(self, fileId: str = None) -> dict:
"""
summary: Delete file
- description:
- :param - fileId : Combination of `path` and `name`: Type - str
-
+ description:
+ :param - fileId : Combination of `path` and `name`: Type - str
+
"""
payload = {}
-
+
if fileId is not None:
payload["fileId"] = fileId
-
# Parameter validation
schema = AssetsValidator.deleteFile()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -534,66 +432,51 @@ async def deleteFileAsync(
url=f"/service/platform/assets/v1.0/files/{fileId}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def deleteFile(
- self,
-
- fileId:str=None
- ):
+ def deleteFile(self, fileId: str = None):
"""
summary: Delete file
- description:
- :param - fileId : Combination of `path` and `name`: Type - str
-
+ description:
+ :param - fileId : Combination of `path` and `name`: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.deleteFileAsync(
- fileId=fileId)
+ self.deleteFileAsync(fileId=fileId)
)
-
-
-
-
-
- async def deleteFilesAsync(
- self,
-
- ids:List[str]=None
- ) -> dict:
+ async def deleteFilesAsync(self, ids: List[str] = None) -> dict:
"""
summary: Delete multiple files
- description:
-
+ description:
+
:param - ids : Array of file _ids to delete : Type - List[str]
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.deleteFiles()
schema.dump(schema.load(payload))
-
body = {}
-
+
if ids is not None:
body["ids"] = ids
-
+
# Body validation
from .models.DeleteMultipleFilesRequest import DeleteMultipleFilesRequest
+
schema = DeleteMultipleFilesRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -601,72 +484,56 @@ async def deleteFilesAsync(
url=f"/service/platform/assets/v1.0/files/delete",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def deleteFiles(
- self,
-
- ids:List[str]=None
- ):
+ def deleteFiles(self, ids: List[str] = None):
"""
summary: Delete multiple files
- description:
-
+ description:
+
:param - ids : Array of file _ids to delete : Type - List[str]
"""
return asyncio.get_event_loop().run_until_complete(
- self.deleteFilesAsync(
- ids=ids)
+ self.deleteFilesAsync(ids=ids)
)
-
-
-
-
-
- async def createFolderAsync(
- self,
-
- name:str=None,
- path:str=None
- ) -> dict:
+ async def createFolderAsync(self, name: str = None, path: str = None) -> dict:
"""
summary: Create folder
description: Create a new folder at the specified path. Also creates the ancestors if they do not exist.
-
+
:param - name : Name of the folder : Type - str
:param - path : Path of the folder : Type - str
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.createFolder()
schema.dump(schema.load(payload))
-
body = {}
-
+
if name is not None:
body["name"] = name
-
+
if path is not None:
body["path"] = path
-
+
# Body validation
from .models.CreateFolderRequest import CreateFolderRequest
+
schema = CreateFolderRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -674,75 +541,56 @@ async def createFolderAsync(
url=f"/service/platform/assets/v1.0/folders",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def createFolder(
- self,
-
- name:str=None,
- path:str=None
- ):
+ def createFolder(self, name: str = None, path: str = None):
"""
summary: Create folder
description: Create a new folder at the specified path. Also creates the ancestors if they do not exist.
-
+
:param - name : Name of the folder : Type - str
:param - path : Path of the folder : Type - str
"""
return asyncio.get_event_loop().run_until_complete(
- self.createFolderAsync(
- name=name,
- path=path)
+ self.createFolderAsync(name=name, path=path)
)
-
-
-
-
-
- async def getFolderDetailsAsync(
- self,
-
- path:str=None,
- name:str=None
- ) -> dict:
+ async def getFolderDetailsAsync(self, path: str = None, name: str = None) -> dict:
"""
summary: Get folder details
description: Get folder details
- :param - path : Folder path: Type - str
- :param - name : Folder name: Type - str
-
+ :param - path : Folder path: Type - str
+ :param - name : Folder name: Type - str
+
"""
payload = {}
-
+
if path is not None:
payload["path"] = path
-
+
if name is not None:
payload["name"] = name
-
# Parameter validation
schema = AssetsValidator.getFolderDetails()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
+
if path:
- query_params['path'] = path
-
+ query_params["path"] = path
+
if name:
- query_params['name'] = name
-
+ query_params["name"] = name
response = await APIClient.execute(
conf=self.config,
@@ -750,78 +598,62 @@ async def getFolderDetailsAsync(
url=f"/service/platform/assets/v1.0/folders",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def getFolderDetails(
- self,
-
- path:str=None,
- name:str=None
- ):
+ def getFolderDetails(self, path: str = None, name: str = None):
"""
summary: Get folder details
description: Get folder details
- :param - path : Folder path: Type - str
- :param - name : Folder name: Type - str
-
+ :param - path : Folder path: Type - str
+ :param - name : Folder name: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.getFolderDetailsAsync(
- path=path,
- name=name)
+ self.getFolderDetailsAsync(path=path, name=name)
)
-
-
-
-
-
async def updateFolderAsync(
- self,
-
- folderId:str=None,
- isActive:bool=None
- ) -> dict:
+ self, folderId: str = None, isActive: bool = None
+ ) -> dict:
"""
- summary: Update folder details
- description: Update folder details. Eg: Soft delete it
-by making `isActive` as `false`.
-We currently do not support updating folder name or path.
+ summary: Update folder details
+ description: Update folder details. Eg: Soft delete it
+ by making `isActive` as `false`.
+ We currently do not support updating folder name or path.
+
+ :param - folderId : combination of `path` and `name`: Type - str
- :param - folderId : combination of `path` and `name`: Type - str
-
- :param - isActive : whether the folder is active : Type - bool
+ :param - isActive : whether the folder is active : Type - bool
"""
payload = {}
-
+
if folderId is not None:
payload["folderId"] = folderId
-
# Parameter validation
schema = AssetsValidator.updateFolder()
schema.dump(schema.load(payload))
-
body = {}
-
+
if isActive is not None:
body["isActive"] = isActive
-
+
# Body validation
from .models.UpdateFolderRequest import UpdateFolderRequest
+
schema = UpdateFolderRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -829,66 +661,48 @@ async def updateFolderAsync(
url=f"/service/platform/assets/v1.0/folders/{folderId}",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def updateFolder(
- self,
-
- folderId:str=None,
- isActive:bool=None
- ):
+ def updateFolder(self, folderId: str = None, isActive: bool = None):
"""
- summary: Update folder details
- description: Update folder details. Eg: Soft delete it
-by making `isActive` as `false`.
-We currently do not support updating folder name or path.
+ summary: Update folder details
+ description: Update folder details. Eg: Soft delete it
+ by making `isActive` as `false`.
+ We currently do not support updating folder name or path.
+
+ :param - folderId : combination of `path` and `name`: Type - str
- :param - folderId : combination of `path` and `name`: Type - str
-
- :param - isActive : whether the folder is active : Type - bool
+ :param - isActive : whether the folder is active : Type - bool
"""
return asyncio.get_event_loop().run_until_complete(
- self.updateFolderAsync(
- folderId=folderId,
- isActive=isActive)
+ self.updateFolderAsync(folderId=folderId, isActive=isActive)
)
-
-
-
-
-
- async def deleteFolderAsync(
- self,
-
- _id:str=None
- ) -> dict:
+ async def deleteFolderAsync(self, _id: str = None) -> dict:
"""
summary: Delete folder
description: Delete folder and all its children permanently.
- :param - _id : _id of folder to be deleted: Type - str
-
+ :param - id : _id of folder to be deleted: Type - str
+
"""
payload = {}
-
+
if _id is not None:
payload["_id"] = _id
-
# Parameter validation
schema = AssetsValidator.deleteFolder()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -896,61 +710,45 @@ async def deleteFolderAsync(
url=f"/service/platform/assets/v1.0/folders/{_id}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def deleteFolder(
- self,
-
- _id:str=None
- ):
+ def deleteFolder(self, _id: str = None):
"""
summary: Delete folder
description: Delete folder and all its children permanently.
- :param - _id : _id of folder to be deleted: Type - str
-
+ :param - id : _id of folder to be deleted: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.deleteFolderAsync(
- _id=_id)
+ self.deleteFolderAsync(_id=_id)
)
-
-
-
-
-
- async def getFolderAncestorsAsync(
- self,
-
- _id:str=None
- ) -> dict:
+ async def getFolderAncestorsAsync(self, _id: str = None) -> dict:
"""
summary: Get all ancestors of a folder
description: Get all ancestors of a folder, using the folder ID.
- :param - _id : _id of the folder: Type - str
-
+ :param - id : _id of the folder: Type - str
+
"""
payload = {}
-
+
if _id is not None:
payload["_id"] = _id
-
# Parameter validation
schema = AssetsValidator.getFolderAncestors()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -958,129 +756,116 @@ async def getFolderAncestorsAsync(
url=f"/service/platform/assets/v1.0/folders/{_id}/ancestors",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def getFolderAncestors(
- self,
-
- _id:str=None
- ):
+ def getFolderAncestors(self, _id: str = None):
"""
summary: Get all ancestors of a folder
description: Get all ancestors of a folder, using the folder ID.
- :param - _id : _id of the folder: Type - str
-
+ :param - id : _id of the folder: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.getFolderAncestorsAsync(
- _id=_id)
+ self.getFolderAncestorsAsync(_id=_id)
)
-
-
-
-
-
async def listFilesAsync(
- self,
-
- name:str=None,
- path:str=None,
- format:str=None,
- tags:List[Any]=None,
- onlyFiles:bool=None,
- onlyFolders:bool=None,
- pageNo:int=None,
- pageSize:int=None,
- sort:str=None
- ) -> dict:
- """
- summary: List and search files and folders.
- description: List all files and folders in root folder. Search for files if name is provided. If path is provided, search in the specified path.
-
- :param - name : Find items with matching name: Type - str
- :param - path : Find items with matching path: Type - str
- :param - format : Find items with matching format: Type - str
- :param - tags : Find items containing these tags: Type - List[str]
- :param - onlyFiles : If true will fetch only files: Type - bool
- :param - onlyFolders : If true will fetch only folders: Type - bool
- :param - pageNo : Page No.: Type - int
- :param - pageSize : Page Size: Type - int
- :param - sort : Key to sort results by. A "-" suffix will sort results in descending orders.
-: Type - str
-
+ self,
+ name: str = None,
+ path: str = None,
+ format: str = None,
+ tags: List[Any] = None,
+ onlyFiles: bool = None,
+ onlyFolders: bool = None,
+ pageNo: int = None,
+ pageSize: int = None,
+ sort: str = None,
+ ) -> dict:
+ """
+ summary: List and search files and folders.
+ description: List all files and folders in root folder. Search for files if name is provided. If path is provided, search in the specified path.
+
+ :param - name : Find items with matching name: Type - str
+ :param - path : Find items with matching path: Type - str
+ :param - format : Find items with matching format: Type - str
+ :param - tags : Find items containing these tags: Type - List[str]
+ :param - onlyFiles : If true will fetch only files: Type - bool
+ :param - onlyFolders : If true will fetch only folders: Type - bool
+ :param - pageNo : Page No.: Type - int
+ :param - pageSize : Page Size: Type - int
+ :param - sort : Key to sort results by. A "-" suffix will sort results in descending orders.
+ : Type - str
+
"""
payload = {}
-
+
if name is not None:
payload["name"] = name
-
+
if path is not None:
payload["path"] = path
-
+
if format is not None:
payload["format"] = format
-
+
if tags is not None:
payload["tags"] = tags
-
+
if onlyFiles is not None:
payload["onlyFiles"] = onlyFiles
-
+
if onlyFolders is not None:
payload["onlyFolders"] = onlyFolders
-
+
if pageNo is not None:
payload["pageNo"] = pageNo
-
+
if pageSize is not None:
payload["pageSize"] = pageSize
-
+
if sort is not None:
payload["sort"] = sort
-
# Parameter validation
schema = AssetsValidator.listFiles()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
+
if name:
- query_params['name'] = name
-
+ query_params["name"] = name
+
if path:
- query_params['path'] = path
-
+ query_params["path"] = path
+
if format:
- query_params['format'] = format
-
+ query_params["format"] = format
+
if tags:
- query_params['tags'] = tags
-
+ query_params["tags"] = tags
+
if onlyFiles:
- query_params['onlyFiles'] = onlyFiles
-
+ query_params["onlyFiles"] = onlyFiles
+
if onlyFolders:
- query_params['onlyFolders'] = onlyFolders
-
+ query_params["onlyFolders"] = onlyFolders
+
if pageNo:
- query_params['pageNo'] = pageNo
-
+ query_params["pageNo"] = pageNo
+
if pageSize:
- query_params['pageSize'] = pageSize
-
+ query_params["pageSize"] = pageSize
+
if sort:
- query_params['sort'] = sort
-
+ query_params["sort"] = sort
response = await APIClient.execute(
conf=self.config,
@@ -1088,80 +873,72 @@ async def listFilesAsync(
url=f"/service/platform/assets/v1.0/listFiles",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def listFiles(
- self,
-
- name:str=None,
- path:str=None,
- format:str=None,
- tags:List[Any]=None,
- onlyFiles:bool=None,
- onlyFolders:bool=None,
- pageNo:int=None,
- pageSize:int=None,
- sort:str=None
- ):
- """
- summary: List and search files and folders.
- description: List all files and folders in root folder. Search for files if name is provided. If path is provided, search in the specified path.
-
- :param - name : Find items with matching name: Type - str
- :param - path : Find items with matching path: Type - str
- :param - format : Find items with matching format: Type - str
- :param - tags : Find items containing these tags: Type - List[str]
- :param - onlyFiles : If true will fetch only files: Type - bool
- :param - onlyFolders : If true will fetch only folders: Type - bool
- :param - pageNo : Page No.: Type - int
- :param - pageSize : Page Size: Type - int
- :param - sort : Key to sort results by. A "-" suffix will sort results in descending orders.
-: Type - str
-
+ self,
+ name: str = None,
+ path: str = None,
+ format: str = None,
+ tags: List[Any] = None,
+ onlyFiles: bool = None,
+ onlyFolders: bool = None,
+ pageNo: int = None,
+ pageSize: int = None,
+ sort: str = None,
+ ):
+ """
+ summary: List and search files and folders.
+ description: List all files and folders in root folder. Search for files if name is provided. If path is provided, search in the specified path.
+
+ :param - name : Find items with matching name: Type - str
+ :param - path : Find items with matching path: Type - str
+ :param - format : Find items with matching format: Type - str
+ :param - tags : Find items containing these tags: Type - List[str]
+ :param - onlyFiles : If true will fetch only files: Type - bool
+ :param - onlyFolders : If true will fetch only folders: Type - bool
+ :param - pageNo : Page No.: Type - int
+ :param - pageSize : Page Size: Type - int
+ :param - sort : Key to sort results by. A "-" suffix will sort results in descending orders.
+ : Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
self.listFilesAsync(
- name=name,
- path=path,
- format=format,
- tags=tags,
- onlyFiles=onlyFiles,
- onlyFolders=onlyFolders,
- pageNo=pageNo,
- pageSize=pageSize,
- sort=sort)
+ name=name,
+ path=path,
+ format=format,
+ tags=tags,
+ onlyFiles=onlyFiles,
+ onlyFolders=onlyFolders,
+ pageNo=pageNo,
+ pageSize=pageSize,
+ sort=sort,
+ )
)
-
-
-
-
-
async def getDefaultAssetForPlaygroundAsync(
- self,
-
- ) -> dict:
+ self,
+ ) -> dict:
"""
summary: Get default asset for playground
description: Get default asset for playground
-
+
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.getDefaultAssetForPlayground()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1169,52 +946,43 @@ async def getDefaultAssetForPlaygroundAsync(
url=f"/service/platform/assets/v1.0/playground/default",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def getDefaultAssetForPlayground(
- self,
-
- ):
+ self,
+ ):
"""
summary: Get default asset for playground
description: Get default asset for playground
-
+
"""
return asyncio.get_event_loop().run_until_complete(
self.getDefaultAssetForPlaygroundAsync()
)
-
-
-
-
-
async def getModulesAsync(
- self,
-
- ) -> dict:
+ self,
+ ) -> dict:
"""
summary: Get all transformation modules
description: Get all transformation modules.
-
+
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.getModules()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1222,58 +990,44 @@ async def getModulesAsync(
url=f"/service/platform/assets/v1.0/playground/plugins",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def getModules(
- self,
-
- ):
+ self,
+ ):
"""
summary: Get all transformation modules
description: Get all transformation modules.
-
- """
- return asyncio.get_event_loop().run_until_complete(
- self.getModulesAsync()
- )
-
-
-
+ """
+ return asyncio.get_event_loop().run_until_complete(self.getModulesAsync())
-
- async def getModuleAsync(
- self,
-
- identifier:str=None
- ) -> dict:
+ async def getModuleAsync(self, identifier: str = None) -> dict:
"""
summary: Get Transformation Module by module identifier
description: Get Transformation Module by module identifier
- :param - identifier : identifier of Transformation Module: Type - str
-
+ :param - identifier : identifier of Transformation Module: Type - str
+
"""
payload = {}
-
+
if identifier is not None:
payload["identifier"] = identifier
-
# Parameter validation
schema = AssetsValidator.getModule()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1281,78 +1035,63 @@ async def getModuleAsync(
url=f"/service/platform/assets/v1.0/playground/plugins/{identifier}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def getModule(
- self,
-
- identifier:str=None
- ):
+ def getModule(self, identifier: str = None):
"""
summary: Get Transformation Module by module identifier
description: Get Transformation Module by module identifier
- :param - identifier : identifier of Transformation Module: Type - str
-
+ :param - identifier : identifier of Transformation Module: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.getModuleAsync(
- identifier=identifier)
+ self.getModuleAsync(identifier=identifier)
)
-
-
-
-
-
async def addPresetAsync(
- self,
-
- presetName:str=None,
- transformation:str=None,
- params:Any=None
- ) -> dict:
+ self, presetName: str = None, transformation: str = None, params: Any = None
+ ) -> dict:
"""
summary: Add a preset.
description: Add a preset for an organization.
-
+
:param - presetName : Name of the preset : Type - str
:param - transformation : A chain of transformations, separated by `~` : Type - str
:param - params : Parameters object for transformation variables : Type - Any
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.addPreset()
schema.dump(schema.load(payload))
-
body = {}
-
+
if presetName is not None:
body["presetName"] = presetName
-
+
if transformation is not None:
body["transformation"] = transformation
-
+
if params is not None:
body["params"] = params
-
+
# Body validation
from .models.AddPresetRequest import AddPresetRequest
+
schema = AddPresetRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1360,109 +1099,96 @@ async def addPresetAsync(
url=f"/service/platform/assets/v1.0/presets",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def addPreset(
- self,
-
- presetName:str=None,
- transformation:str=None,
- params:Any=None
- ):
+ self, presetName: str = None, transformation: str = None, params: Any = None
+ ):
"""
summary: Add a preset.
description: Add a preset for an organization.
-
+
:param - presetName : Name of the preset : Type - str
:param - transformation : A chain of transformations, separated by `~` : Type - str
:param - params : Parameters object for transformation variables : Type - Any
"""
return asyncio.get_event_loop().run_until_complete(
self.addPresetAsync(
- presetName=presetName,
- transformation=transformation,
- params=params)
+ presetName=presetName, transformation=transformation, params=params
+ )
)
-
-
-
-
-
async def getPresetsAsync(
- self,
-
- pageNo:int=None,
- pageSize:int=None,
- name:str=None,
- transformation:str=None,
- archived:bool=None,
- sort:List[Any]=None
- ) -> dict:
+ self,
+ pageNo: int = None,
+ pageSize: int = None,
+ name: str = None,
+ transformation: str = None,
+ archived: bool = None,
+ sort: List[Any] = None,
+ ) -> dict:
"""
summary: Get presets for an organization
description: Retrieve presets for a specific organization.
- :param - pageNo : Page number: Type - int
- :param - pageSize : Page size: Type - int
- :param - name : Preset name: Type - str
- :param - transformation : Transformation applied: Type - str
- :param - archived : Indicates whether the preset is archived or not: Type - bool
- :param - sort : Sort the results by a specific key: Type - List[str]
-
+ :param - pageNo : Page number: Type - int
+ :param - pageSize : Page size: Type - int
+ :param - name : Preset name: Type - str
+ :param - transformation : Transformation applied: Type - str
+ :param - archived : Indicates whether the preset is archived or not: Type - bool
+ :param - sort : Sort the results by a specific key: Type - List[str]
+
"""
payload = {}
-
+
if pageNo is not None:
payload["pageNo"] = pageNo
-
+
if pageSize is not None:
payload["pageSize"] = pageSize
-
+
if name is not None:
payload["name"] = name
-
+
if transformation is not None:
payload["transformation"] = transformation
-
+
if archived is not None:
payload["archived"] = archived
-
+
if sort is not None:
payload["sort"] = sort
-
# Parameter validation
schema = AssetsValidator.getPresets()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
+
if pageNo:
- query_params['pageNo'] = pageNo
-
+ query_params["pageNo"] = pageNo
+
if pageSize:
- query_params['pageSize'] = pageSize
-
+ query_params["pageSize"] = pageSize
+
if name:
- query_params['name'] = name
-
+ query_params["name"] = name
+
if transformation:
- query_params['transformation'] = transformation
-
+ query_params["transformation"] = transformation
+
if archived:
- query_params['archived'] = archived
-
+ query_params["archived"] = archived
+
if sort:
- query_params['sort'] = sort
-
+ query_params["sort"] = sort
response = await APIClient.execute(
conf=self.config,
@@ -1470,87 +1196,78 @@ async def getPresetsAsync(
url=f"/service/platform/assets/v1.0/presets",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def getPresets(
- self,
-
- pageNo:int=None,
- pageSize:int=None,
- name:str=None,
- transformation:str=None,
- archived:bool=None,
- sort:List[Any]=None
- ):
+ self,
+ pageNo: int = None,
+ pageSize: int = None,
+ name: str = None,
+ transformation: str = None,
+ archived: bool = None,
+ sort: List[Any] = None,
+ ):
"""
summary: Get presets for an organization
description: Retrieve presets for a specific organization.
- :param - pageNo : Page number: Type - int
- :param - pageSize : Page size: Type - int
- :param - name : Preset name: Type - str
- :param - transformation : Transformation applied: Type - str
- :param - archived : Indicates whether the preset is archived or not: Type - bool
- :param - sort : Sort the results by a specific key: Type - List[str]
-
+ :param - pageNo : Page number: Type - int
+ :param - pageSize : Page size: Type - int
+ :param - name : Preset name: Type - str
+ :param - transformation : Transformation applied: Type - str
+ :param - archived : Indicates whether the preset is archived or not: Type - bool
+ :param - sort : Sort the results by a specific key: Type - List[str]
+
"""
return asyncio.get_event_loop().run_until_complete(
self.getPresetsAsync(
- pageNo=pageNo,
- pageSize=pageSize,
- name=name,
- transformation=transformation,
- archived=archived,
- sort=sort)
+ pageNo=pageNo,
+ pageSize=pageSize,
+ name=name,
+ transformation=transformation,
+ archived=archived,
+ sort=sort,
+ )
)
-
-
-
-
-
async def updatePresetAsync(
- self,
-
- presetName:str=None,
- archived:bool=None
- ) -> dict:
+ self, presetName: str = None, archived: bool = None
+ ) -> dict:
"""
summary: Update a preset.
description: Update a preset of an organization.
- :param - presetName : Name of the preset to be updated: Type - str
-
+ :param - presetName : Name of the preset to be updated: Type - str
+
:param - archived : Indicates if the preset has been archived : Type - bool
"""
payload = {}
-
+
if presetName is not None:
payload["presetName"] = presetName
-
# Parameter validation
schema = AssetsValidator.updatePreset()
schema.dump(schema.load(payload))
-
body = {}
-
+
if archived is not None:
body["archived"] = archived
-
+
# Body validation
from .models.UpdatePresetRequest import UpdatePresetRequest
+
schema = UpdatePresetRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1558,64 +1275,46 @@ async def updatePresetAsync(
url=f"/service/platform/assets/v1.0/presets/{presetName}",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def updatePreset(
- self,
-
- presetName:str=None,
- archived:bool=None
- ):
+ def updatePreset(self, presetName: str = None, archived: bool = None):
"""
summary: Update a preset.
description: Update a preset of an organization.
- :param - presetName : Name of the preset to be updated: Type - str
-
+ :param - presetName : Name of the preset to be updated: Type - str
+
:param - archived : Indicates if the preset has been archived : Type - bool
"""
return asyncio.get_event_loop().run_until_complete(
- self.updatePresetAsync(
- presetName=presetName,
- archived=archived)
+ self.updatePresetAsync(presetName=presetName, archived=archived)
)
-
-
-
-
-
- async def deletePresetAsync(
- self,
-
- presetName:str=None
- ) -> dict:
+ async def deletePresetAsync(self, presetName: str = None) -> dict:
"""
summary: Delete a preset.
description: Delete a preset of an organization.
- :param - presetName : Name of the preset to be deleted: Type - str
-
+ :param - presetName : Name of the preset to be deleted: Type - str
+
"""
payload = {}
-
+
if presetName is not None:
payload["presetName"] = presetName
-
# Parameter validation
schema = AssetsValidator.deletePreset()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1623,61 +1322,45 @@ async def deletePresetAsync(
url=f"/service/platform/assets/v1.0/presets/{presetName}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def deletePreset(
- self,
-
- presetName:str=None
- ):
+ def deletePreset(self, presetName: str = None):
"""
summary: Delete a preset.
description: Delete a preset of an organization.
- :param - presetName : Name of the preset to be deleted: Type - str
-
+ :param - presetName : Name of the preset to be deleted: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.deletePresetAsync(
- presetName=presetName)
+ self.deletePresetAsync(presetName=presetName)
)
-
-
-
-
-
- async def getPresetAsync(
- self,
-
- presetName:str=None
- ) -> dict:
+ async def getPresetAsync(self, presetName: str = None) -> dict:
"""
summary: Get a preset.
description: Get a preset of an organization.
- :param - presetName : Name of the preset to be fetched: Type - str
-
+ :param - presetName : Name of the preset to be fetched: Type - str
+
"""
payload = {}
-
+
if presetName is not None:
payload["presetName"] = presetName
-
# Parameter validation
schema = AssetsValidator.getPreset()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1685,50 +1368,41 @@ async def getPresetAsync(
url=f"/service/platform/assets/v1.0/presets/{presetName}",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def getPreset(
- self,
-
- presetName:str=None
- ):
+ def getPreset(self, presetName: str = None):
"""
summary: Get a preset.
description: Get a preset of an organization.
- :param - presetName : Name of the preset to be fetched: Type - str
-
+ :param - presetName : Name of the preset to be fetched: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.getPresetAsync(
- presetName=presetName)
+ self.getPresetAsync(presetName=presetName)
)
-
-
-
-
-
async def fileUploadAsync(
- self,
-
- file:FileIO=None,
- path:str=None,
- name:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None
- ) -> dict:
+ self,
+ file: FileIO = None,
+ path: str = None,
+ name: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ ) -> dict:
"""
summary: Upload File
description: Upload File to Pixelbin
-
+
:param - file : Asset file : Type - FileIO
:param - path : Path where you want to store the asset : Type - str
:param - name : Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe : Type - str
@@ -1740,47 +1414,44 @@ async def fileUploadAsync(
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.fileUpload()
schema.dump(schema.load(payload))
-
body = {}
-
+
if file is not None:
body["file"] = file
-
+
if path is not None:
body["path"] = path
-
+
if name is not None:
body["name"] = name
-
+
if access is not None:
body["access"] = access
-
+
if tags is not None:
body["tags"] = tags
-
+
if metadata is not None:
body["metadata"] = metadata
-
+
if overwrite is not None:
body["overwrite"] = overwrite
-
+
if filenameOverride is not None:
body["filenameOverride"] = filenameOverride
-
+
# Body validation
from .models.FileUploadRequest import FileUploadRequest
+
schema = FileUploadRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1788,28 +1459,29 @@ async def fileUploadAsync(
url=f"/service/platform/assets/v1.0/upload/direct",
query=query_params,
body=body,
- contentType="multipart/form-data"
- )
+ contentType="multipart/form-data",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def fileUpload(
- self,
-
- file:FileIO=None,
- path:str=None,
- name:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None
- ):
+ self,
+ file: FileIO = None,
+ path: str = None,
+ name: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ ):
"""
summary: Upload File
description: Upload File to Pixelbin
-
+
:param - file : Asset file : Type - FileIO
:param - path : Path where you want to store the asset : Type - str
:param - name : Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe : Type - str
@@ -1821,37 +1493,32 @@ def fileUpload(
"""
return asyncio.get_event_loop().run_until_complete(
self.fileUploadAsync(
- file=file,
- path=path,
- name=name,
- access=access,
- tags=tags,
- metadata=metadata,
- overwrite=overwrite,
- filenameOverride=filenameOverride)
+ file=file,
+ path=path,
+ name=name,
+ access=access,
+ tags=tags,
+ metadata=metadata,
+ overwrite=overwrite,
+ filenameOverride=filenameOverride,
+ )
)
-
-
-
-
-
async def urlUploadAsync(
- self,
-
- url:str=None,
- path:str=None,
- name:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None
- ) -> dict:
+ self,
+ url: str = None,
+ path: str = None,
+ name: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ ) -> dict:
"""
summary: Upload Asset with url
description: Upload Asset with url
-
+
:param - url : Asset URL : Type - str
:param - path : Path where you want to store the asset : Type - str
:param - name : Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe : Type - str
@@ -1863,47 +1530,44 @@ async def urlUploadAsync(
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.urlUpload()
schema.dump(schema.load(payload))
-
body = {}
-
+
if url is not None:
body["url"] = url
-
+
if path is not None:
body["path"] = path
-
+
if name is not None:
body["name"] = name
-
+
if access is not None:
body["access"] = access
-
+
if tags is not None:
body["tags"] = tags
-
+
if metadata is not None:
body["metadata"] = metadata
-
+
if overwrite is not None:
body["overwrite"] = overwrite
-
+
if filenameOverride is not None:
body["filenameOverride"] = filenameOverride
-
+
# Body validation
from .models.UrlUploadRequest import UrlUploadRequest
+
schema = UrlUploadRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -1911,28 +1575,29 @@ async def urlUploadAsync(
url=f"/service/platform/assets/v1.0/upload/url",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def urlUpload(
- self,
-
- url:str=None,
- path:str=None,
- name:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None
- ):
+ self,
+ url: str = None,
+ path: str = None,
+ name: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ ):
"""
summary: Upload Asset with url
description: Upload Asset with url
-
+
:param - url : Asset URL : Type - str
:param - path : Path where you want to store the asset : Type - str
:param - name : Name of the asset, if not provided name of the file will be used. Note - The provided name will be slugified to make it URL safe : Type - str
@@ -1944,91 +1609,83 @@ def urlUpload(
"""
return asyncio.get_event_loop().run_until_complete(
self.urlUploadAsync(
- url=url,
- path=path,
- name=name,
- access=access,
- tags=tags,
- metadata=metadata,
- overwrite=overwrite,
- filenameOverride=filenameOverride)
+ url=url,
+ path=path,
+ name=name,
+ access=access,
+ tags=tags,
+ metadata=metadata,
+ overwrite=overwrite,
+ filenameOverride=filenameOverride,
+ )
)
-
-
-
-
-
async def createSignedUrlAsync(
- self,
-
- name:str=None,
- path:str=None,
- format:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None
- ) -> dict:
- """
- summary: S3 Signed URL upload
- description: For the given asset details, a S3 signed URL will be generated,
-which can be then used to upload your asset.
-
-
- :param - name : name of the file : Type - str
- :param - path : Path of the file : Type - str
- :param - format : Format of the file : Type - str
- :param - access : Access level of asset, can be either `public-read` or `private` : Type - AccessEnum
- :param - tags : Tags associated with the file. : Type - List[str]
- :param - metadata : Metadata associated with the file. : Type - Any
- :param - overwrite : Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. : Type - bool
- :param - filenameOverride : If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. : Type - bool
+ self,
+ name: str = None,
+ path: str = None,
+ format: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ ) -> dict:
+ """
+ summary: S3 Signed URL upload
+ description: For the given asset details, a S3 signed URL will be generated,
+ which can be then used to upload your asset.
+
+
+ :param - name : name of the file : Type - str
+ :param - path : Path of the file : Type - str
+ :param - format : Format of the file : Type - str
+ :param - access : Access level of asset, can be either `public-read` or `private` : Type - AccessEnum
+ :param - tags : Tags associated with the file. : Type - List[str]
+ :param - metadata : Metadata associated with the file. : Type - Any
+ :param - overwrite : Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. : Type - bool
+ :param - filenameOverride : If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. : Type - bool
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.createSignedUrl()
schema.dump(schema.load(payload))
-
body = {}
-
+
if name is not None:
body["name"] = name
-
+
if path is not None:
body["path"] = path
-
+
if format is not None:
body["format"] = format
-
+
if access is not None:
body["access"] = access
-
+
if tags is not None:
body["tags"] = tags
-
+
if metadata is not None:
body["metadata"] = metadata
-
+
if overwrite is not None:
body["overwrite"] = overwrite
-
+
if filenameOverride is not None:
body["filenameOverride"] = filenameOverride
-
+
# Body validation
from .models.SignedUploadRequest import SignedUploadRequest
+
schema = SignedUploadRequest()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -2036,73 +1693,69 @@ async def createSignedUrlAsync(
url=f"/service/platform/assets/v1.0/upload/signed-url",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def createSignedUrl(
- self,
-
- name:str=None,
- path:str=None,
- format:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None
- ):
- """
- summary: S3 Signed URL upload
- description: For the given asset details, a S3 signed URL will be generated,
-which can be then used to upload your asset.
-
-
- :param - name : name of the file : Type - str
- :param - path : Path of the file : Type - str
- :param - format : Format of the file : Type - str
- :param - access : Access level of asset, can be either `public-read` or `private` : Type - AccessEnum
- :param - tags : Tags associated with the file. : Type - List[str]
- :param - metadata : Metadata associated with the file. : Type - Any
- :param - overwrite : Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. : Type - bool
- :param - filenameOverride : If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. : Type - bool
+ self,
+ name: str = None,
+ path: str = None,
+ format: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ ):
+ """
+ summary: S3 Signed URL upload
+ description: For the given asset details, a S3 signed URL will be generated,
+ which can be then used to upload your asset.
+
+
+ :param - name : name of the file : Type - str
+ :param - path : Path of the file : Type - str
+ :param - format : Format of the file : Type - str
+ :param - access : Access level of asset, can be either `public-read` or `private` : Type - AccessEnum
+ :param - tags : Tags associated with the file. : Type - List[str]
+ :param - metadata : Metadata associated with the file. : Type - Any
+ :param - overwrite : Overwrite flag. If set to `true` will overwrite any file that exists with same path, name and type. Defaults to `false`. : Type - bool
+ :param - filenameOverride : If set to `true` will add unique characters to name if asset with given name already exists. If overwrite flag is set to `true`, preference will be given to overwrite flag. If both are set to `false` an error will be raised. : Type - bool
"""
return asyncio.get_event_loop().run_until_complete(
self.createSignedUrlAsync(
- name=name,
- path=path,
- format=format,
- access=access,
- tags=tags,
- metadata=metadata,
- overwrite=overwrite,
- filenameOverride=filenameOverride)
+ name=name,
+ path=path,
+ format=format,
+ access=access,
+ tags=tags,
+ metadata=metadata,
+ overwrite=overwrite,
+ filenameOverride=filenameOverride,
+ )
)
-
-
-
-
-
async def createSignedUrlV2Async(
- self,
-
- name:str=None,
- path:str=None,
- format:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None,
- expiry:int=None
- ) -> dict:
+ self,
+ name: str = None,
+ path: str = None,
+ format: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ expiry: int = None,
+ ) -> dict:
"""
summary: Signed multipart upload
description: For the given asset details, a presigned URL will be generated, which can be then used to upload your asset in chunks via multipart upload.
-
+
:param - name : name of the file : Type - str
:param - path : Path of containing folder. : Type - str
:param - format : Format of the file : Type - str
@@ -2115,50 +1768,47 @@ async def createSignedUrlV2Async(
"""
payload = {}
-
# Parameter validation
schema = AssetsValidator.createSignedUrlV2()
schema.dump(schema.load(payload))
-
body = {}
-
+
if name is not None:
body["name"] = name
-
+
if path is not None:
body["path"] = path
-
+
if format is not None:
body["format"] = format
-
+
if access is not None:
body["access"] = access
-
+
if tags is not None:
body["tags"] = tags
-
+
if metadata is not None:
body["metadata"] = metadata
-
+
if overwrite is not None:
body["overwrite"] = overwrite
-
+
if filenameOverride is not None:
body["filenameOverride"] = filenameOverride
-
+
if expiry is not None:
body["expiry"] = expiry
-
+
# Body validation
from .models.SignedUploadRequestV2 import SignedUploadRequestV2
+
schema = SignedUploadRequestV2()
schema.dump(schema.load(body))
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -2166,29 +1816,30 @@ async def createSignedUrlV2Async(
url=f"/service/platform/assets/v2.0/upload/signed-url",
query=query_params,
body=body,
- contentType="application/json"
- )
+ contentType="application/json",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def createSignedUrlV2(
- self,
-
- name:str=None,
- path:str=None,
- format:str=None,
- access:AccessEnum=None,
- tags:List[str]=None,
- metadata:Any=None,
- overwrite:bool=None,
- filenameOverride:bool=None,
- expiry:int=None
- ):
+ self,
+ name: str = None,
+ path: str = None,
+ format: str = None,
+ access: AccessEnum = None,
+ tags: List[str] = None,
+ metadata: Any = None,
+ overwrite: bool = None,
+ filenameOverride: bool = None,
+ expiry: int = None,
+ ):
"""
summary: Signed multipart upload
description: For the given asset details, a presigned URL will be generated, which can be then used to upload your asset in chunks via multipart upload.
-
+
:param - name : name of the file : Type - str
:param - path : Path of containing folder. : Type - str
:param - format : Format of the file : Type - str
@@ -2201,52 +1852,39 @@ def createSignedUrlV2(
"""
return asyncio.get_event_loop().run_until_complete(
self.createSignedUrlV2Async(
- name=name,
- path=path,
- format=format,
- access=access,
- tags=tags,
- metadata=metadata,
- overwrite=overwrite,
- filenameOverride=filenameOverride,
- expiry=expiry)
+ name=name,
+ path=path,
+ format=format,
+ access=access,
+ tags=tags,
+ metadata=metadata,
+ overwrite=overwrite,
+ filenameOverride=filenameOverride,
+ expiry=expiry,
+ )
)
-
-
-
-
class Organization:
def __init__(self, config):
self.config = config
-
-
-
-
-
async def getAppOrgDetailsAsync(
- self,
-
- ) -> dict:
+ self,
+ ) -> dict:
"""
summary: Get App Details
description: Get App and org details
-
+
"""
payload = {}
-
# Parameter validation
schema = OrganizationValidator.getAppOrgDetails()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
response = await APIClient.execute(
conf=self.config,
@@ -2254,68 +1892,50 @@ async def getAppOrgDetailsAsync(
url=f"/service/platform/organization/v1.0/apps/info",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
def getAppOrgDetails(
- self,
-
- ):
+ self,
+ ):
"""
summary: Get App Details
description: Get App and org details
-
- """
- return asyncio.get_event_loop().run_until_complete(
- self.getAppOrgDetailsAsync()
- )
-
-
-
+ """
+ return asyncio.get_event_loop().run_until_complete(self.getAppOrgDetailsAsync())
class Transformation:
def __init__(self, config):
self.config = config
-
-
-
-
-
-
- async def getTransformationContextAsync(
- self,
-
- url:str=None
- ) -> dict:
+
+ async def getTransformationContextAsync(self, url: str = None) -> dict:
"""
summary: Get transformation context
description: Get transformation context
- :param - url : CDN URL with transformation.: Type - str
-
+ :param - url : CDN URL with transformation.: Type - str
+
"""
payload = {}
-
+
if url is not None:
payload["url"] = url
-
# Parameter validation
schema = TransformationValidator.getTransformationContext()
schema.dump(schema.load(payload))
-
-
query_params = {}
-
+
if url:
- query_params['url'] = url
-
+ query_params["url"] = url
response = await APIClient.execute(
conf=self.config,
@@ -2323,31 +1943,25 @@ async def getTransformationContextAsync(
url=f"/service/platform/transformation/context",
query=query_params,
body=None,
- contentType=""
- )
+ contentType="",
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
- def getTransformationContext(
- self,
-
- url:str=None
- ):
+ def getTransformationContext(self, url: str = None):
"""
summary: Get transformation context
description: Get transformation context
- :param - url : CDN URL with transformation.: Type - str
-
+ :param - url : CDN URL with transformation.: Type - str
+
"""
return asyncio.get_event_loop().run_until_complete(
- self.getTransformationContextAsync(
- url=url)
+ self.getTransformationContextAsync(url=url)
)
-
-
-
class Uploader:
def __init__(self, assets: Assets, config: PixelbinConfig):
@@ -2398,26 +2012,36 @@ async def uploadAsync(
if chunk_size is None:
uploadOptions["chunkSize"] = 10 * 1024 * 1024 # Default to 10MB
elif not isinstance(chunk_size, int) or chunk_size <= 0:
- raise PixelbinIllegalArgumentError("Invalid chunkSize: Must be a positive integer.")
+ raise PixelbinIllegalArgumentError(
+ "Invalid chunkSize: Must be a positive integer."
+ )
max_retries = uploadOptions.get("maxRetries")
if max_retries is None:
uploadOptions["maxRetries"] = 2 # Default to 2 retries
elif not isinstance(max_retries, int) or max_retries < 0:
- raise PixelbinIllegalArgumentError("Invalid maxRetries: Must be a non-negative integer.")
+ raise PixelbinIllegalArgumentError(
+ "Invalid maxRetries: Must be a non-negative integer."
+ )
concurrency = uploadOptions.get("concurrency")
if concurrency is None:
uploadOptions["concurrency"] = 3 # Default to 3 concurrent uploads
elif not isinstance(concurrency, int) or concurrency <= 0:
- raise PixelbinIllegalArgumentError("Invalid concurrency: Must be a positive integer.")
+ raise PixelbinIllegalArgumentError(
+ "Invalid concurrency: Must be a positive integer."
+ )
exponential_factor = uploadOptions.get("exponentialFactor")
if exponential_factor is None:
- uploadOptions["exponentialFactor"] = 2 # Default to an exponential factor of 2
+ uploadOptions["exponentialFactor"] = (
+ 2 # Default to an exponential factor of 2
+ )
elif not isinstance(exponential_factor, (int, float)) or exponential_factor < 0:
- raise PixelbinIllegalArgumentError("Invalid exponentialFactor: Must be a positive number.")
-
+ raise PixelbinIllegalArgumentError(
+ "Invalid exponentialFactor: Must be a positive number."
+ )
+
signed_url_response = await self.assets.createSignedUrlV2Async(
name=name,
path=path,
@@ -2439,7 +2063,6 @@ async def uploadAsync(
async def _multipart_upload_async(
self, url: str, fields: dict, file: Union[bytes, FileIO], **options
) -> dict:
-
http_client_options = self.config.get_http_client_options()
trust_env = http_client_options["trust_env"]
@@ -2468,39 +2091,47 @@ async def upload_chunk(chunk: bytes, part_number: int) -> dict:
trust_env=trust_env,
)
if response["status_code"] != 204:
- raise PixelbinServerResponseError(str(response["content"]),response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return
- @retry(max_retries=max_retries, predicate=retriable_error, exp_factor=exponential_factor)
+ @retry(
+ max_retries=max_retries,
+ predicate=retriable_error,
+ exp_factor=exponential_factor,
+ )
async def complete_multipart_upload():
data = {
"parts": list(range(1, part_number)),
**fields,
}
response = await AiohttpHelper().request(
- method="post",
- url=url,
- data=data,
- headers={
- "Content-Type": "application/json",
- },
- params={},
- trust_env=trust_env,
- )
+ method="post",
+ url=url,
+ data=data,
+ headers={
+ "Content-Type": "application/json",
+ },
+ params={},
+ trust_env=trust_env,
+ )
if response["status_code"] != 200:
- raise PixelbinServerResponseError(str(response["content"]), response["status_code"])
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
return ujson.loads(response["content"])
part_number = 1
tasks = []
if isinstance(file, bytes):
for i in range(0, len(file), chunk_size):
- tasks.append(upload_chunk(file[i:i+chunk_size], part_number))
+ tasks.append(upload_chunk(file[i : i + chunk_size], part_number))
part_number += 1
if len(tasks) >= concurrency:
await asyncio.gather(*tasks)
tasks = []
- elif hasattr(file, 'read'):
+ elif hasattr(file, "read"):
while True:
chunk = file.read(chunk_size)
if not chunk:
@@ -2511,7 +2142,9 @@ async def complete_multipart_upload():
await asyncio.gather(*tasks)
tasks = []
else:
- raise TypeError("Unsupported file type. Expected bytes or a file-like object.")
+ raise TypeError(
+ "Unsupported file type. Expected bytes or a file-like object."
+ )
if tasks:
await asyncio.gather(*tasks)
@@ -2540,7 +2173,7 @@ def upload(
"""
summary: Upload assets
description: Upload assets to PixelBin
-
+
:param - file : File to be uploaded : Type - Union[bytes, io.BufferedIOBase]
:param - name : Name of the file : Type - str
:param - path : Path of containing folder. : Type - str
@@ -2559,6 +2192,16 @@ def upload(
"""
return asyncio.get_event_loop().run_until_complete(
self.uploadAsync(
- file, name, path, format, access, tags, metadata, overwrite, filenameOverride, expiry, uploadOptions
+ file,
+ name,
+ path,
+ format,
+ access,
+ tags,
+ metadata,
+ overwrite,
+ filenameOverride,
+ expiry,
+ uploadOptions,
)
- )
\ No newline at end of file
+ )
diff --git a/pixelbin/platform/PlatformAPIClient.py b/pixelbin/platform/PlatformAPIClient.py
index 5bc8f0c..2a11ce9 100644
--- a/pixelbin/platform/PlatformAPIClient.py
+++ b/pixelbin/platform/PlatformAPIClient.py
@@ -67,7 +67,7 @@ async def execute(
http_client_options = conf.get_http_client_options()
trust_env = http_client_options["trust_env"]
-
+
host = conf.domain.replace("https://", "").replace("http://", "")
headers["host"] = host
diff --git a/pixelbin/platform/Predictions.py b/pixelbin/platform/Predictions.py
new file mode 100644
index 0000000..31dab87
--- /dev/null
+++ b/pixelbin/platform/Predictions.py
@@ -0,0 +1,276 @@
+import asyncio
+import ujson
+import io
+from typing import Any, Dict, List, Optional
+
+from .PlatformAPIClient import APIClient
+from .PixelbinConfig import PixelbinConfig
+from ..common.exceptions import (
+ PixelbinIllegalArgumentError,
+ PixelbinServerResponseError,
+)
+
+
+class Predictions:
+ def __init__(self, config: PixelbinConfig):
+ self.config = config
+
+ async def createAsync(
+ self,
+ name: str,
+ input: Dict[str, Any] = None,
+ webhook: Optional[str] = None,
+ ) -> Dict[str, Any]:
+ if not isinstance(name, str) or not name:
+ raise PixelbinIllegalArgumentError("name (string) is required")
+
+ parts = name.split("_")
+ if len(parts) != 2 or not parts[0] or not parts[1]:
+ raise PixelbinIllegalArgumentError(
+ "name must be in 'plugin_operation' format, e.g. 'erase_bg'"
+ )
+ plugin, operation = parts[0], parts[1]
+
+ input = input or {}
+
+ body: Dict[str, Any] = {}
+ if webhook:
+ body["webhook"] = webhook
+
+ def is_url(value: str) -> bool:
+ return isinstance(value, str) and value.lower().startswith(
+ ("http://", "https://")
+ )
+
+ def wrap_file_like(val: Any, key: str) -> Any:
+ """Normalize bytes/streams or {value, filename} dict into file-like with .name for filename.
+ aiohttp infers filename from object's .name attribute when not explicitly provided.
+ """
+ # Support wrapper dict: { value: , filename?: str }
+ if isinstance(val, dict) and "value" in val:
+ payload = val.get("value")
+ filename = val.get("filename")
+ else:
+ payload = val
+ filename = None
+
+ # Bytes/bytearray -> BytesIO with name
+ if isinstance(payload, (bytes, bytearray)):
+ bio = io.BytesIO(payload)
+ try:
+ setattr(bio, "name", filename or f"{key}.jpg")
+ except Exception:
+ pass
+ return bio
+
+ # File-like object -> ensure it has a name
+ if hasattr(payload, "read"):
+ try:
+ has_name = hasattr(payload, "name") and isinstance(
+ getattr(payload, "name"), str
+ )
+ except Exception:
+ has_name = False
+ if not has_name:
+ try:
+ setattr(payload, "name", filename or f"{key}.jpg")
+ except Exception:
+ pass
+ return payload
+
+ # Other types unchanged
+ return val
+
+ def is_file_like(val: Any) -> bool:
+ if isinstance(val, (bytes, bytearray)):
+ return True
+ if hasattr(val, "read"):
+ return True
+ if isinstance(val, dict) and "value" in val:
+ inner = val.get("value")
+ return isinstance(inner, (bytes, bytearray)) or hasattr(inner, "read")
+ if isinstance(val, list):
+ return any(is_file_like(v) for v in val)
+ return False
+
+ has_binary = any(is_file_like(v) for v in (input or {}).values())
+
+ for key, value in input.items():
+ if value is None:
+ continue
+ field_name = f"input.{key}"
+ if isinstance(value, list):
+ processed_list: List[Any] = []
+ for v in value:
+ # For each element, wrap bytes/streams; JSON-encode plain dicts
+ if isinstance(v, dict) and "value" not in v:
+ processed_list.append(
+ ujson.dumps(v, escape_forward_slashes=False)
+ )
+ else:
+ processed_list.append(wrap_file_like(v, key))
+ body[field_name] = processed_list
+ elif isinstance(value, dict) and "value" not in value:
+ # Plain objects (non-file wrapper) -> JSON string
+ body[field_name] = ujson.dumps(value, escape_forward_slashes=False)
+ else:
+ # Bytes/streams and wrapper dicts -> ensure filename; primitives/urls sent as-is
+ body[field_name] = wrap_file_like(value, key)
+
+ content_type = "multipart/form-data" if has_binary else "application/json"
+
+ response = await APIClient.execute(
+ conf=self.config,
+ method="post",
+ url=f"/service/platform/transformation/v1.0/predictions/{plugin}/{operation}",
+ query={},
+ body=body,
+ contentType=content_type,
+ )
+ if response["status_code"] != 200:
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
+ return ujson.loads(response["content"])
+
+ def create(
+ self,
+ name: str,
+ input: Dict[str, Any] = None,
+ webhook: Optional[str] = None,
+ ) -> Dict[str, Any]:
+ return asyncio.get_event_loop().run_until_complete(
+ self.createAsync(name=name, input=input or {}, webhook=webhook)
+ )
+
+ async def getAsync(self, request_id: str) -> Dict[str, Any]:
+ if not isinstance(request_id, str) or not request_id:
+ raise PixelbinIllegalArgumentError("requestId (string) is required")
+ path = f"/service/platform/transformation/v1.0/predictions/{request_id}"
+ response = await APIClient.execute(
+ conf=self.config,
+ method="get",
+ url=path,
+ query={},
+ body=None,
+ contentType="",
+ )
+ if response["status_code"] != 200:
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
+ return ujson.loads(response["content"])
+
+ def get(self, request_id: str) -> Dict[str, Any]:
+ return asyncio.get_event_loop().run_until_complete(self.getAsync(request_id))
+
+ async def waitAsync(
+ self, request_id: str, options: Optional[Dict[str, Any]] = None
+ ) -> Dict[str, Any]:
+ if not request_id:
+ raise PixelbinIllegalArgumentError("requestId is required")
+ DEFAULT_MIN_TIMEOUT = 4.0 # seconds
+ DEFAULT_RETRIES = 150
+ DEFAULT_FACTOR = 1.0
+ opts = options or {}
+ # Parse and clamp options
+ raw_interval = (
+ float(opts.get("retryInterval"))
+ if isinstance(opts.get("retryInterval"), (int, float))
+ else DEFAULT_MIN_TIMEOUT
+ )
+ raw_attempts = (
+ int(opts.get("maxAttempts"))
+ if isinstance(opts.get("maxAttempts"), int)
+ else DEFAULT_RETRIES
+ )
+ raw_factor = (
+ float(opts.get("retryFactor"))
+ if isinstance(opts.get("retryFactor"), (int, float))
+ else DEFAULT_FACTOR
+ )
+
+ attempts = max(1, min(150, int(raw_attempts)))
+ factor = max(1.0, min(3.0, raw_factor))
+ interval = max(1.0, min(60.0, float(raw_interval)))
+
+ last_status: Dict[str, Any] = {}
+ for _ in range(attempts):
+ s = await self.getAsync(request_id)
+ last_status = s
+ if s and s.get("status") in ("SUCCESS", "FAILURE"):
+ return s
+ await asyncio.sleep(interval)
+ try:
+ interval = interval * factor
+ except Exception:
+ pass
+ return last_status
+
+ def wait(
+ self, request_id: str, options: Optional[Dict[str, Any]] = None
+ ) -> Dict[str, Any]:
+ return asyncio.get_event_loop().run_until_complete(
+ self.waitAsync(request_id, options)
+ )
+
+ async def create_and_waitAsync(
+ self,
+ name: str,
+ input: Dict[str, Any] = None,
+ webhook: Optional[str] = None,
+ options: Optional[Dict[str, Any]] = None,
+ ) -> Dict[str, Any]:
+ job = await self.createAsync(name=name, input=input or {}, webhook=webhook)
+ return await self.waitAsync(job["_id"], options)
+
+ def create_and_wait(
+ self,
+ name: str,
+ input: Dict[str, Any] = None,
+ webhook: Optional[str] = None,
+ options: Optional[Dict[str, Any]] = None,
+ ) -> Dict[str, Any]:
+ return asyncio.get_event_loop().run_until_complete(
+ self.create_and_waitAsync(
+ name=name, input=input or {}, webhook=webhook, options=options
+ )
+ )
+
+ async def listAsync(self) -> List[Dict[str, Any]]:
+ response = await APIClient.execute(
+ conf=self.config,
+ method="get",
+ url=f"/service/public/transformation/v1.0/predictions",
+ query={},
+ body={},
+ contentType="",
+ )
+ if response["status_code"] != 200:
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
+ return ujson.loads(response["content"])
+
+ def list(self) -> List[Dict[str, Any]]:
+ return asyncio.get_event_loop().run_until_complete(self.listAsync())
+
+ async def get_schemaAsync(self, name: str) -> Dict[str, Any]:
+ if not isinstance(name, str) or not name:
+ raise PixelbinIllegalArgumentError("name (string) is required")
+ response = await APIClient.execute(
+ conf=self.config,
+ method="get",
+ url=f"/service/public/transformation/v1.0/predictions/schema/{name}",
+ query={},
+ body={},
+ contentType="",
+ )
+ if response["status_code"] != 200:
+ raise PixelbinServerResponseError(
+ str(response["content"]), response["status_code"]
+ )
+ return ujson.loads(response["content"])
+
+ def get_schema(self, name: str) -> Dict[str, Any]:
+ return asyncio.get_event_loop().run_until_complete(self.get_schemaAsync(name))
diff --git a/pixelbin/platform/enums.py b/pixelbin/platform/enums.py
index e85bd77..d25cf99 100644
--- a/pixelbin/platform/enums.py
+++ b/pixelbin/platform/enums.py
@@ -3,19 +3,13 @@
from enum import Enum
-
class AccessEnum(Enum):
-
PUBLIC_READ = "public-read"
-
+
PRIVATE = "private"
-
+
@classmethod
async def is_valid(cls, value):
if value in cls._value2member_map_:
return None
raise Exception("Invalid AccessEnum type")
-
-
-
-
diff --git a/pixelbin/platform/models/AddCredentialsRequest.py b/pixelbin/platform/models/AddCredentialsRequest.py
index 8b1529c..c420ff9 100644
--- a/pixelbin/platform/models/AddCredentialsRequest.py
+++ b/pixelbin/platform/models/AddCredentialsRequest.py
@@ -6,16 +6,9 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
class AddCredentialsRequest(BaseSchema):
# Assets swagger.json
-
credentials = fields.Dict(required=False)
-
- pluginId = fields.Str(required=False)
-
+ pluginId = fields.Str(required=False)
diff --git a/pixelbin/platform/models/AddCredentialsResponse.py b/pixelbin/platform/models/AddCredentialsResponse.py
index 2d12552..7bc18de 100644
--- a/pixelbin/platform/models/AddCredentialsResponse.py
+++ b/pixelbin/platform/models/AddCredentialsResponse.py
@@ -6,12 +6,7 @@
from ..models.BaseSchema import BaseSchema
-
-
class AddCredentialsResponse(BaseSchema):
# Assets swagger.json
-
credentials = fields.Dict(required=False)
-
-
diff --git a/pixelbin/platform/models/AddPresetRequest.py b/pixelbin/platform/models/AddPresetRequest.py
index f448671..a06323e 100644
--- a/pixelbin/platform/models/AddPresetRequest.py
+++ b/pixelbin/platform/models/AddPresetRequest.py
@@ -6,20 +6,11 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
class AddPresetRequest(BaseSchema):
# Assets swagger.json
-
presetName = fields.Str(required=False)
-
+
transformation = fields.Str(required=False)
-
- params = fields.Dict(required=False)
-
+ params = fields.Dict(required=False)
diff --git a/pixelbin/platform/models/AddPresetResponse.py b/pixelbin/platform/models/AddPresetResponse.py
index afcc394..8b01f0a 100644
--- a/pixelbin/platform/models/AddPresetResponse.py
+++ b/pixelbin/platform/models/AddPresetResponse.py
@@ -6,40 +6,21 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class AddPresetResponse(BaseSchema):
# Assets swagger.json
-
presetName = fields.Str(required=False)
-
+
transformation = fields.Str(required=False)
-
+
params = fields.Dict(required=False)
-
+
archived = fields.Boolean(required=False)
-
+
orgId = fields.Int(required=False)
-
+
isActive = fields.Boolean(required=False)
-
+
createdAt = fields.Str(required=False)
-
- updatedAt = fields.Str(required=False)
-
+ updatedAt = fields.Str(required=False)
diff --git a/pixelbin/platform/models/AppOrgDetails.py b/pixelbin/platform/models/AppOrgDetails.py
index b4a6363..d065d9a 100644
--- a/pixelbin/platform/models/AppOrgDetails.py
+++ b/pixelbin/platform/models/AppOrgDetails.py
@@ -13,9 +13,6 @@
class AppOrgDetails(BaseSchema):
# Organization swagger.json
-
app = fields.Nested(AppSchema, required=False)
-
- org = fields.Nested(OrganizationDetailSchema, required=False)
-
+ org = fields.Nested(OrganizationDetailSchema, required=False)
diff --git a/pixelbin/platform/models/AppSchema.py b/pixelbin/platform/models/AppSchema.py
index ba6c29f..4f498e0 100644
--- a/pixelbin/platform/models/AppSchema.py
+++ b/pixelbin/platform/models/AppSchema.py
@@ -6,40 +6,21 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class AppSchema(BaseSchema):
# Organization swagger.json
-
_id = fields.Int(required=False)
-
+
orgId = fields.Int(required=False)
-
+
name = fields.Str(required=False)
-
+
token = fields.Str(required=False)
-
+
permissions = fields.List(fields.Str(required=False), required=False)
-
+
active = fields.Boolean(required=False)
-
+
createdAt = fields.Str(required=False)
-
- updatedAt = fields.Str(required=False)
-
+ updatedAt = fields.Str(required=False)
diff --git a/pixelbin/platform/models/AssetsValidator.py b/pixelbin/platform/models/AssetsValidator.py
index 5e58abf..0d585a4 100644
--- a/pixelbin/platform/models/AssetsValidator.py
+++ b/pixelbin/platform/models/AssetsValidator.py
@@ -5,153 +5,110 @@
from ..enums import *
from ..models.BaseSchema import BaseSchema
+
class AssetsValidator:
-
class addCredentials(BaseSchema):
-
- pass
-
+ pass
+
class updateCredentials(BaseSchema):
-
pluginId = fields.Str(required=False)
-
-
+
class deleteCredentials(BaseSchema):
-
pluginId = fields.Str(required=False)
-
-
+
class getFileById(BaseSchema):
-
_id = fields.Str(required=False)
-
-
+
class getFileByFileId(BaseSchema):
-
fileId = fields.Str(required=False)
-
-
+
class updateFile(BaseSchema):
-
fileId = fields.Str(required=False)
-
-
+
class deleteFile(BaseSchema):
-
fileId = fields.Str(required=False)
-
-
+
class deleteFiles(BaseSchema):
-
- pass
-
+ pass
+
class createFolder(BaseSchema):
-
- pass
-
+ pass
+
class getFolderDetails(BaseSchema):
-
path = fields.Str(required=False)
-
+
name = fields.Str(required=False)
-
-
+
class updateFolder(BaseSchema):
-
folderId = fields.Str(required=False)
-
-
+
class deleteFolder(BaseSchema):
-
_id = fields.Str(required=False)
-
-
+
class getFolderAncestors(BaseSchema):
-
_id = fields.Str(required=False)
-
-
+
class listFiles(BaseSchema):
-
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
+
format = fields.Str(required=False)
-
+
tags = fields.List(fields.Str(required=False), required=False)
-
+
onlyFiles = fields.Boolean(required=False)
-
+
onlyFolders = fields.Boolean(required=False)
-
+
pageNo = fields.Int(required=False)
-
+
pageSize = fields.Int(required=False)
-
+
sort = fields.Str(required=False)
-
-
+
class getDefaultAssetForPlayground(BaseSchema):
-
- pass
-
+ pass
+
class getModules(BaseSchema):
-
- pass
-
+ pass
+
class getModule(BaseSchema):
-
identifier = fields.Str(required=False)
-
-
+
class addPreset(BaseSchema):
-
- pass
-
+ pass
+
class getPresets(BaseSchema):
-
pageNo = fields.Int(required=False)
-
+
pageSize = fields.Int(required=False)
-
+
name = fields.Str(required=False)
-
+
transformation = fields.Str(required=False)
-
+
archived = fields.Boolean(required=False)
-
+
sort = fields.List(fields.Str(required=False), required=False)
-
-
+
class updatePreset(BaseSchema):
-
presetName = fields.Str(required=False)
-
-
+
class deletePreset(BaseSchema):
-
presetName = fields.Str(required=False)
-
-
+
class getPreset(BaseSchema):
-
presetName = fields.Str(required=False)
-
-
+
class fileUpload(BaseSchema):
-
- pass
-
+ pass
+
class urlUpload(BaseSchema):
-
- pass
-
+ pass
+
class createSignedUrl(BaseSchema):
-
- pass
-
+ pass
+
class createSignedUrlV2(BaseSchema):
-
- pass
-
\ No newline at end of file
+ pass
diff --git a/pixelbin/platform/models/BaseSchema.py b/pixelbin/platform/models/BaseSchema.py
index b22bff0..7573aa7 100644
--- a/pixelbin/platform/models/BaseSchema.py
+++ b/pixelbin/platform/models/BaseSchema.py
@@ -5,6 +5,8 @@
class BaseSchema(Schema):
"""Base Schema for marshmallow."""
+
class Meta:
"""Meta to not throw error on unknown keys."""
+
unknown = EXCLUDE
diff --git a/pixelbin/platform/models/CreateFolderRequest.py b/pixelbin/platform/models/CreateFolderRequest.py
index 76a04d2..de1ccdd 100644
--- a/pixelbin/platform/models/CreateFolderRequest.py
+++ b/pixelbin/platform/models/CreateFolderRequest.py
@@ -6,16 +6,9 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
class CreateFolderRequest(BaseSchema):
# Assets swagger.json
-
name = fields.Str(required=False)
-
- path = fields.Str(required=False)
-
+ path = fields.Str(required=False)
diff --git a/pixelbin/platform/models/DeleteMultipleFilesRequest.py b/pixelbin/platform/models/DeleteMultipleFilesRequest.py
index b48324c..7a8fab1 100644
--- a/pixelbin/platform/models/DeleteMultipleFilesRequest.py
+++ b/pixelbin/platform/models/DeleteMultipleFilesRequest.py
@@ -6,12 +6,7 @@
from ..models.BaseSchema import BaseSchema
-
-
class DeleteMultipleFilesRequest(BaseSchema):
# Assets swagger.json
-
ids = fields.List(fields.Str(required=False), required=False)
-
-
diff --git a/pixelbin/platform/models/Delimiter.py b/pixelbin/platform/models/Delimiter.py
index 7a52a29..34cb82f 100644
--- a/pixelbin/platform/models/Delimiter.py
+++ b/pixelbin/platform/models/Delimiter.py
@@ -6,16 +6,9 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
class Delimiter(BaseSchema):
# Assets swagger.json
-
operationSeparator = fields.Str(required=False)
-
- parameterSeparator = fields.Str(required=False)
-
+ parameterSeparator = fields.Str(required=False)
diff --git a/pixelbin/platform/models/ErrorSchema.py b/pixelbin/platform/models/ErrorSchema.py
index 6d8d501..ee48c06 100644
--- a/pixelbin/platform/models/ErrorSchema.py
+++ b/pixelbin/platform/models/ErrorSchema.py
@@ -6,12 +6,7 @@
from ..models.BaseSchema import BaseSchema
-
-
class ErrorSchema(BaseSchema):
# Organization swagger.json
-
message = fields.Str(required=False)
-
-
diff --git a/pixelbin/platform/models/FileUploadRequest.py b/pixelbin/platform/models/FileUploadRequest.py
index ef41a15..f6c442b 100644
--- a/pixelbin/platform/models/FileUploadRequest.py
+++ b/pixelbin/platform/models/FileUploadRequest.py
@@ -6,40 +6,24 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class FileUploadRequest(BaseSchema):
# Assets swagger.json
-
file = fields.Raw(required=False)
-
+
path = fields.Str(required=False)
-
+
name = fields.Str(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
tags = fields.List(fields.Str(required=False), required=False)
-
+
metadata = fields.Dict(required=False)
-
+
overwrite = fields.Boolean(required=False)
-
- filenameOverride = fields.Boolean(required=False)
-
+ filenameOverride = fields.Boolean(required=False)
diff --git a/pixelbin/platform/models/FilesResponse.py b/pixelbin/platform/models/FilesResponse.py
index a05673d..63ecaa1 100644
--- a/pixelbin/platform/models/FilesResponse.py
+++ b/pixelbin/platform/models/FilesResponse.py
@@ -6,56 +6,32 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class FilesResponse(BaseSchema):
# Assets swagger.json
-
_id = fields.Str(required=False)
-
+
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
+
fileId = fields.Str(required=False)
-
+
format = fields.Str(required=False)
-
+
size = fields.Int(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
isActive = fields.Boolean(required=False)
-
+
tags = fields.List(fields.Str(required=False), required=False)
-
+
metadata = fields.Dict(required=False)
-
+
url = fields.Str(required=False)
-
- thumbnail = fields.Str(required=False)
-
+ thumbnail = fields.Str(required=False)
diff --git a/pixelbin/platform/models/FoldersResponse.py b/pixelbin/platform/models/FoldersResponse.py
index 5384c39..ca4765f 100644
--- a/pixelbin/platform/models/FoldersResponse.py
+++ b/pixelbin/platform/models/FoldersResponse.py
@@ -6,24 +6,13 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
class FoldersResponse(BaseSchema):
# Assets swagger.json
-
_id = fields.Str(required=False)
-
+
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
- isActive = fields.Boolean(required=False)
-
+ isActive = fields.Boolean(required=False)
diff --git a/pixelbin/platform/models/GetAncestorsResponse.py b/pixelbin/platform/models/GetAncestorsResponse.py
index ac51c4b..4204494 100644
--- a/pixelbin/platform/models/GetAncestorsResponse.py
+++ b/pixelbin/platform/models/GetAncestorsResponse.py
@@ -13,9 +13,8 @@
class GetAncestorsResponse(BaseSchema):
# Assets swagger.json
-
folder = fields.Nested(folderItem, required=False)
-
- ancestors = fields.List(fields.Nested(FoldersResponse, required=False), required=False)
-
+ ancestors = fields.List(
+ fields.Nested(FoldersResponse, required=False), required=False
+ )
diff --git a/pixelbin/platform/models/GetPresetsResponse.py b/pixelbin/platform/models/GetPresetsResponse.py
index 4a6e9f7..b50e13a 100644
--- a/pixelbin/platform/models/GetPresetsResponse.py
+++ b/pixelbin/platform/models/GetPresetsResponse.py
@@ -13,9 +13,8 @@
class GetPresetsResponse(BaseSchema):
# Assets swagger.json
-
- items = fields.List(fields.Nested(AddPresetResponse, required=False), required=False)
-
- page = fields.Nested(page, required=False)
-
+ items = fields.List(
+ fields.Nested(AddPresetResponse, required=False), required=False
+ )
+ page = fields.Nested(page, required=False)
diff --git a/pixelbin/platform/models/GetTransformationContextSuccessResponse.py b/pixelbin/platform/models/GetTransformationContextSuccessResponse.py
index ebba611..4ca49b0 100644
--- a/pixelbin/platform/models/GetTransformationContextSuccessResponse.py
+++ b/pixelbin/platform/models/GetTransformationContextSuccessResponse.py
@@ -6,12 +6,7 @@
from ..models.BaseSchema import BaseSchema
-
-
class GetTransformationContextSuccessResponse(BaseSchema):
# Transformation swagger.json
-
context = fields.Dict(required=False)
-
-
diff --git a/pixelbin/platform/models/ListFilesResponse.py b/pixelbin/platform/models/ListFilesResponse.py
index 3ded0c2..ca4197a 100644
--- a/pixelbin/platform/models/ListFilesResponse.py
+++ b/pixelbin/platform/models/ListFilesResponse.py
@@ -13,9 +13,6 @@
class ListFilesResponse(BaseSchema):
# Assets swagger.json
-
items = fields.List(fields.Nested(exploreItem, required=False), required=False)
-
- page = fields.Nested(page, required=False)
-
+ page = fields.Nested(page, required=False)
diff --git a/pixelbin/platform/models/OrganizationDetailSchema.py b/pixelbin/platform/models/OrganizationDetailSchema.py
index 707c258..0146bbb 100644
--- a/pixelbin/platform/models/OrganizationDetailSchema.py
+++ b/pixelbin/platform/models/OrganizationDetailSchema.py
@@ -6,36 +6,19 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class OrganizationDetailSchema(BaseSchema):
# Organization swagger.json
-
_id = fields.Int(required=False)
-
+
name = fields.Str(required=False)
-
+
cloudName = fields.Str(required=False)
-
+
ownerId = fields.Str(required=False)
-
+
active = fields.Boolean(required=False)
-
+
createdAt = fields.Str(required=False)
-
- updatedAt = fields.Str(required=False)
-
+ updatedAt = fields.Str(required=False)
diff --git a/pixelbin/platform/models/OrganizationValidator.py b/pixelbin/platform/models/OrganizationValidator.py
index 64a33e3..228df5e 100644
--- a/pixelbin/platform/models/OrganizationValidator.py
+++ b/pixelbin/platform/models/OrganizationValidator.py
@@ -5,9 +5,7 @@
from ..enums import *
from ..models.BaseSchema import BaseSchema
+
class OrganizationValidator:
-
class getAppOrgDetails(BaseSchema):
-
- pass
-
\ No newline at end of file
+ pass
diff --git a/pixelbin/platform/models/PresignedUrl.py b/pixelbin/platform/models/PresignedUrl.py
index dedd35a..810b3e3 100644
--- a/pixelbin/platform/models/PresignedUrl.py
+++ b/pixelbin/platform/models/PresignedUrl.py
@@ -6,16 +6,9 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
class PresignedUrl(BaseSchema):
# Assets swagger.json
-
url = fields.Str(required=False)
-
- fields = fields.Dict(required=False)
-
+ fields = fields.Dict(required=False)
diff --git a/pixelbin/platform/models/PresignedUrlV2.py b/pixelbin/platform/models/PresignedUrlV2.py
index 222a33f..5fd8540 100644
--- a/pixelbin/platform/models/PresignedUrlV2.py
+++ b/pixelbin/platform/models/PresignedUrlV2.py
@@ -6,16 +6,9 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
class PresignedUrlV2(BaseSchema):
# Assets swagger.json
-
url = fields.Str(required=False)
-
- fields = fields.Dict(required=False)
-
+ fields = fields.Dict(required=False)
diff --git a/pixelbin/platform/models/SignedUploadRequest.py b/pixelbin/platform/models/SignedUploadRequest.py
index 78f26af..6722a28 100644
--- a/pixelbin/platform/models/SignedUploadRequest.py
+++ b/pixelbin/platform/models/SignedUploadRequest.py
@@ -6,40 +6,24 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class SignedUploadRequest(BaseSchema):
# Assets swagger.json
-
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
+
format = fields.Str(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
tags = fields.List(fields.Str(required=False), required=False)
-
+
metadata = fields.Dict(required=False)
-
+
overwrite = fields.Boolean(required=False)
-
- filenameOverride = fields.Boolean(required=False)
-
+ filenameOverride = fields.Boolean(required=False)
diff --git a/pixelbin/platform/models/SignedUploadRequestV2.py b/pixelbin/platform/models/SignedUploadRequestV2.py
index 81802ca..2e4b6fd 100644
--- a/pixelbin/platform/models/SignedUploadRequestV2.py
+++ b/pixelbin/platform/models/SignedUploadRequestV2.py
@@ -6,44 +6,26 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class SignedUploadRequestV2(BaseSchema):
# Assets swagger.json
-
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
+
format = fields.Str(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
tags = fields.List(fields.Str(required=False), required=False)
-
+
metadata = fields.Dict(required=False)
-
+
overwrite = fields.Boolean(required=False)
-
+
filenameOverride = fields.Boolean(required=False)
-
- expiry = fields.Int(required=False)
-
+ expiry = fields.Int(required=False)
diff --git a/pixelbin/platform/models/SignedUploadResponse.py b/pixelbin/platform/models/SignedUploadResponse.py
index 13f8523..b2d0c3f 100644
--- a/pixelbin/platform/models/SignedUploadResponse.py
+++ b/pixelbin/platform/models/SignedUploadResponse.py
@@ -11,7 +11,4 @@
class SignedUploadResponse(BaseSchema):
# Assets swagger.json
-
s3PresignedUrl = fields.Nested(PresignedUrl, required=False)
-
-
diff --git a/pixelbin/platform/models/SignedUploadV2Response.py b/pixelbin/platform/models/SignedUploadV2Response.py
index bee1c75..405327b 100644
--- a/pixelbin/platform/models/SignedUploadV2Response.py
+++ b/pixelbin/platform/models/SignedUploadV2Response.py
@@ -11,7 +11,4 @@
class SignedUploadV2Response(BaseSchema):
# Assets swagger.json
-
presignedUrl = fields.Nested(PresignedUrlV2, required=False)
-
-
diff --git a/pixelbin/platform/models/TransformationModuleResponse.py b/pixelbin/platform/models/TransformationModuleResponse.py
index 70eb215..b1f529f 100644
--- a/pixelbin/platform/models/TransformationModuleResponse.py
+++ b/pixelbin/platform/models/TransformationModuleResponse.py
@@ -6,32 +6,17 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
class TransformationModuleResponse(BaseSchema):
# Assets swagger.json
-
identifier = fields.Str(required=False)
-
+
name = fields.Str(required=False)
-
+
description = fields.Str(required=False)
-
+
credentials = fields.Dict(required=False)
-
+
operations = fields.List(fields.Raw(required=False), required=False)
-
- enabled = fields.Boolean(required=False)
-
+ enabled = fields.Boolean(required=False)
diff --git a/pixelbin/platform/models/TransformationModulesResponse.py b/pixelbin/platform/models/TransformationModulesResponse.py
index a7a77f9..f3f9137 100644
--- a/pixelbin/platform/models/TransformationModulesResponse.py
+++ b/pixelbin/platform/models/TransformationModulesResponse.py
@@ -8,18 +8,11 @@
from .Delimiter import Delimiter
-
-
-
-
class TransformationModulesResponse(BaseSchema):
# Assets swagger.json
-
delimiters = fields.Nested(Delimiter, required=False)
-
+
plugins = fields.Dict(required=False)
-
- presets = fields.List(fields.Raw(required=False), required=False)
-
+ presets = fields.List(fields.Raw(required=False), required=False)
diff --git a/pixelbin/platform/models/TransformationValidator.py b/pixelbin/platform/models/TransformationValidator.py
index 5d2cc97..2c676ef 100644
--- a/pixelbin/platform/models/TransformationValidator.py
+++ b/pixelbin/platform/models/TransformationValidator.py
@@ -5,10 +5,7 @@
from ..enums import *
from ..models.BaseSchema import BaseSchema
+
class TransformationValidator:
-
class getTransformationContext(BaseSchema):
-
url = fields.Str(required=False)
-
-
\ No newline at end of file
diff --git a/pixelbin/platform/models/UpdateCredentialsRequest.py b/pixelbin/platform/models/UpdateCredentialsRequest.py
index e4eca68..f7333f1 100644
--- a/pixelbin/platform/models/UpdateCredentialsRequest.py
+++ b/pixelbin/platform/models/UpdateCredentialsRequest.py
@@ -6,12 +6,7 @@
from ..models.BaseSchema import BaseSchema
-
-
class UpdateCredentialsRequest(BaseSchema):
# Assets swagger.json
-
credentials = fields.Dict(required=False)
-
-
diff --git a/pixelbin/platform/models/UpdateFileRequest.py b/pixelbin/platform/models/UpdateFileRequest.py
index 16d49c9..6b01a62 100644
--- a/pixelbin/platform/models/UpdateFileRequest.py
+++ b/pixelbin/platform/models/UpdateFileRequest.py
@@ -6,32 +6,20 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
class UpdateFileRequest(BaseSchema):
# Assets swagger.json
-
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
isActive = fields.Boolean(required=False)
-
+
tags = fields.List(fields.Str(required=False), required=False)
-
- metadata = fields.Dict(required=False)
-
+ metadata = fields.Dict(required=False)
diff --git a/pixelbin/platform/models/UpdateFolderRequest.py b/pixelbin/platform/models/UpdateFolderRequest.py
index fb2933d..b96ca07 100644
--- a/pixelbin/platform/models/UpdateFolderRequest.py
+++ b/pixelbin/platform/models/UpdateFolderRequest.py
@@ -6,12 +6,7 @@
from ..models.BaseSchema import BaseSchema
-
-
class UpdateFolderRequest(BaseSchema):
# Assets swagger.json
-
isActive = fields.Boolean(required=False)
-
-
diff --git a/pixelbin/platform/models/UpdatePresetRequest.py b/pixelbin/platform/models/UpdatePresetRequest.py
index 290269c..083b05e 100644
--- a/pixelbin/platform/models/UpdatePresetRequest.py
+++ b/pixelbin/platform/models/UpdatePresetRequest.py
@@ -6,12 +6,7 @@
from ..models.BaseSchema import BaseSchema
-
-
class UpdatePresetRequest(BaseSchema):
# Assets swagger.json
-
archived = fields.Boolean(required=False)
-
-
diff --git a/pixelbin/platform/models/UploadResponse.py b/pixelbin/platform/models/UploadResponse.py
index cfab9bf..91ddf43 100644
--- a/pixelbin/platform/models/UploadResponse.py
+++ b/pixelbin/platform/models/UploadResponse.py
@@ -6,52 +6,30 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class UploadResponse(BaseSchema):
# Assets swagger.json
-
_id = fields.Str(required=False)
-
+
fileId = fields.Str(required=False)
-
+
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
+
format = fields.Str(required=False)
-
+
size = fields.Int(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
tags = fields.List(fields.Str(required=False), required=False)
-
+
metadata = fields.Dict(required=False)
-
+
url = fields.Str(required=False)
-
- thumbnail = fields.Str(required=False)
-
+ thumbnail = fields.Str(required=False)
diff --git a/pixelbin/platform/models/UrlUploadRequest.py b/pixelbin/platform/models/UrlUploadRequest.py
index 9f3b746..340d507 100644
--- a/pixelbin/platform/models/UrlUploadRequest.py
+++ b/pixelbin/platform/models/UrlUploadRequest.py
@@ -6,40 +6,24 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class UrlUploadRequest(BaseSchema):
# Assets swagger.json
-
url = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
+
name = fields.Str(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
tags = fields.List(fields.Str(required=False), required=False)
-
+
metadata = fields.Dict(required=False)
-
+
overwrite = fields.Boolean(required=False)
-
- filenameOverride = fields.Boolean(required=False)
-
+ filenameOverride = fields.Boolean(required=False)
diff --git a/pixelbin/platform/models/__init__.py b/pixelbin/platform/models/__init__.py
index a806f27..42cec76 100644
--- a/pixelbin/platform/models/__init__.py
+++ b/pixelbin/platform/models/__init__.py
@@ -1,83 +1,80 @@
"""Platform Models."""
-
-
from .folderItem import folderItem
-
+
from .exploreItem import exploreItem
-
+
from .page import page
-
+
from .exploreResponse import exploreResponse
-
+
from .ListFilesResponse import ListFilesResponse
-
+
from .FileUploadRequest import FileUploadRequest
-
+
from .UrlUploadRequest import UrlUploadRequest
-
+
from .UploadResponse import UploadResponse
-
+
from .SignedUploadRequest import SignedUploadRequest
-
+
from .SignedUploadResponse import SignedUploadResponse
-
+
from .PresignedUrl import PresignedUrl
-
+
from .FilesResponse import FilesResponse
-
+
from .UpdateFileRequest import UpdateFileRequest
-
+
from .FoldersResponse import FoldersResponse
-
+
from .CreateFolderRequest import CreateFolderRequest
-
+
from .UpdateFolderRequest import UpdateFolderRequest
-
+
from .DeleteMultipleFilesRequest import DeleteMultipleFilesRequest
-
+
from .Delimiter import Delimiter
-
+
from .AddCredentialsRequest import AddCredentialsRequest
-
+
from .UpdateCredentialsRequest import UpdateCredentialsRequest
-
+
from .AddCredentialsResponse import AddCredentialsResponse
-
+
from .GetAncestorsResponse import GetAncestorsResponse
-
+
from .AddPresetRequest import AddPresetRequest
-
+
from .AddPresetResponse import AddPresetResponse
-
+
from .UpdatePresetRequest import UpdatePresetRequest
-
+
from .GetPresetsResponse import GetPresetsResponse
-
+
from .TransformationModuleResponse import TransformationModuleResponse
-
+
from .TransformationModulesResponse import TransformationModulesResponse
-
+
from .SignedUploadRequestV2 import SignedUploadRequestV2
-
+
from .SignedUploadV2Response import SignedUploadV2Response
-
+
from .PresignedUrlV2 import PresignedUrlV2
-
-
+
from .OrganizationDetailSchema import OrganizationDetailSchema
-
+
from .AppSchema import AppSchema
-
+
from .AppOrgDetails import AppOrgDetails
-
+
from .ErrorSchema import ErrorSchema
-
-
-from .GetTransformationContextSuccessResponse import GetTransformationContextSuccessResponse
-
+
+from .GetTransformationContextSuccessResponse import (
+ GetTransformationContextSuccessResponse,
+)
from .AssetsValidator import AssetsValidator
@@ -85,4 +82,3 @@
from .OrganizationValidator import OrganizationValidator
from .TransformationValidator import TransformationValidator
-
diff --git a/pixelbin/platform/models/exploreItem.py b/pixelbin/platform/models/exploreItem.py
index 2e388e7..c02fbd3 100644
--- a/pixelbin/platform/models/exploreItem.py
+++ b/pixelbin/platform/models/exploreItem.py
@@ -6,52 +6,30 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
class exploreItem(BaseSchema):
# Assets swagger.json
-
_id = fields.Str(required=False)
-
+
orgId = fields.Int(required=False)
-
+
name = fields.Str(required=False)
-
+
type = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
+
fileId = fields.Str(required=False)
-
+
format = fields.Str(required=False)
-
+
size = fields.Int(required=False)
-
- access = fields.Str(required=False, validate=OneOf([val.value for val in AccessEnum.__members__.values()]))
-
+
+ access = fields.Str(
+ required=False,
+ validate=OneOf([val.value for val in AccessEnum.__members__.values()]),
+ )
+
s3Bucket = fields.Str(required=False)
-
- s3Key = fields.Str(required=False)
-
+ s3Key = fields.Str(required=False)
diff --git a/pixelbin/platform/models/exploreResponse.py b/pixelbin/platform/models/exploreResponse.py
index c7f27fc..9dff9c1 100644
--- a/pixelbin/platform/models/exploreResponse.py
+++ b/pixelbin/platform/models/exploreResponse.py
@@ -13,9 +13,6 @@
class exploreResponse(BaseSchema):
# Assets swagger.json
-
items = fields.List(fields.Nested(exploreItem, required=False), required=False)
-
- page = fields.Nested(page, required=False)
-
+ page = fields.Nested(page, required=False)
diff --git a/pixelbin/platform/models/folderItem.py b/pixelbin/platform/models/folderItem.py
index 9e7b5af..d6e473f 100644
--- a/pixelbin/platform/models/folderItem.py
+++ b/pixelbin/platform/models/folderItem.py
@@ -6,28 +6,15 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
class folderItem(BaseSchema):
# Assets swagger.json
-
_id = fields.Str(required=False)
-
+
orgId = fields.Int(required=False)
-
+
name = fields.Str(required=False)
-
+
path = fields.Str(required=False)
-
- type = fields.Str(required=False)
-
+ type = fields.Str(required=False)
diff --git a/pixelbin/platform/models/page.py b/pixelbin/platform/models/page.py
index 8fb30a0..1343ff9 100644
--- a/pixelbin/platform/models/page.py
+++ b/pixelbin/platform/models/page.py
@@ -6,28 +6,15 @@
from ..models.BaseSchema import BaseSchema
-
-
-
-
-
-
-
-
-
-
class page(BaseSchema):
# Assets swagger.json
-
type = fields.Str(required=False)
-
+
size = fields.Int(required=False)
-
+
current = fields.Int(required=False)
-
+
hasNext = fields.Boolean(required=False)
-
- itemTotal = fields.Int(required=False)
-
+ itemTotal = fields.Int(required=False)
diff --git a/pyproject.toml b/pyproject.toml
index e7db686..33b8923 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pixelbin"
-version = "4.2.0"
+version = "4.3.0"
description = "Pixelbin SDK for Python"
authors = ["Pixelbin "]
license = "MIT"
diff --git a/sample.predictions.py b/sample.predictions.py
new file mode 100644
index 0000000..2eff7d8
--- /dev/null
+++ b/sample.predictions.py
@@ -0,0 +1,92 @@
+import os
+from pixelbin import PixelbinClient, PixelbinConfig
+
+
+def main():
+ # Minimal setup via environment variables
+ api_token = os.getenv("PIXELBIN_API_TOKEN") or "API_TOKEN"
+ domain = os.getenv("PIXELBIN_DOMAIN") or "https://api.pixelbin.io"
+ image_path = os.getenv("PREDICT_IMAGE_PATH") or "result.jpeg"
+ webhook = os.getenv("PREDICT_WEBHOOK") # optional
+ name = os.getenv("PREDICT_NAME") or "erase_bg"
+
+ if not api_token or api_token == "API_TOKEN":
+ print(
+ "Please set PIXELBIN_API_TOKEN or replace API_TOKEN in sample.predictions.py"
+ )
+ return
+
+ client = PixelbinClient(
+ config=PixelbinConfig(
+ {
+ "domain": domain,
+ "apiSecret": api_token,
+ }
+ )
+ )
+
+ try:
+ print("\n=== list predictions ===")
+ items = client.predictions.list()
+ print("total:", len(items) if isinstance(items, list) else 0)
+
+ print("\n=== get schema ===")
+ schema = client.predictions.get_schema(name)
+ print("schema name:", schema.get("name") if isinstance(schema, dict) else None)
+
+ print("\n=== create ===")
+ img_bytes = None
+ try:
+ with open(image_path, "rb") as f:
+ img_bytes = f.read()
+ except Exception:
+ pass
+
+ job = client.predictions.create(
+ name=name,
+ input={
+ **({"image": img_bytes} if img_bytes else {}),
+ "industry_type": os.getenv("PREDICT_INDUSTRY_TYPE") or "general",
+ "quality_type": os.getenv("PREDICT_QUALITY_TYPE") or "original",
+ "shadow": os.getenv("PREDICT_SHADOW") or "false",
+ "refine": os.getenv("PREDICT_REFINE") or "true",
+ },
+ webhook=webhook,
+ )
+ print("created job:", job)
+
+ print("\n=== get (by id) ===")
+ details = client.predictions.get(job["_id"]) # string only
+ print("get by id:", details.get("status"))
+
+ print("\n=== wait ===")
+ final_status = client.predictions.wait(
+ job["_id"], {"maxAttempts": 30, "retryFactor": 1, "retryInterval": 1.0}
+ )
+ print("wait ->", final_status.get("status"))
+
+ print("\n=== outputs ===")
+ print(final_status.get("output"))
+
+ print("\n=== create_and_wait ===")
+ final_result = client.predictions.create_and_wait(
+ name=name,
+ input={
+ **({"image": img_bytes} if img_bytes else {}),
+ "industry_type": os.getenv("PREDICT_INDUSTRY_TYPE") or "general",
+ "quality_type": os.getenv("PREDICT_QUALITY_TYPE") or "original",
+ "shadow": os.getenv("PREDICT_SHADOW") or "false",
+ "refine": os.getenv("PREDICT_REFINE") or "true",
+ },
+ webhook=webhook,
+ options={"maxAttempts": 60, "retryFactor": 1, "retryInterval": 2.0},
+ )
+ print("create_and_wait ->", final_result.get("status"))
+
+ print("\nDone.")
+ except Exception as err:
+ print("Error:", getattr(err, "message", str(err)))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tests/pixelbin_test.py b/tests/pixelbin_test.py
index 7a055cd..bbb4d30 100644
--- a/tests/pixelbin_test.py
+++ b/tests/pixelbin_test.py
@@ -55,6 +55,7 @@ def test_pixelbin_config_and_client(self):
self.assertEqual(self.pixelbinClient.config, self.pixelbinConfig)
self.assertIsInstance(self.pixelbinClient.assets, Assets)
self.assertIsInstance(self.pixelbinClient.organization, Organization)
+ self.assertTrue(hasattr(self.pixelbinClient, "predictions"))
def test_pixelbin_config_token_1(self):
with self.assertRaises(Exception) as context:
@@ -1589,7 +1590,6 @@ def make_request_side_effect(**kwargs):
)
def test_uploader_upload_0_maxRetries(self):
-
def make_request_side_effect(**kwargs):
method = kwargs.get("method")
if method == "put":
@@ -1690,61 +1690,303 @@ def make_request_side_effect(**kwargs):
# Test cases for invalid `chunkSize` values
def test_invalid_chunk_size_type(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"chunkSize": "invalid"})
- self.assertEqual(str(context.exception), "Invalid chunkSize: Must be a positive integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"chunkSize": "invalid"}
+ )
+ self.assertEqual(
+ str(context.exception), "Invalid chunkSize: Must be a positive integer."
+ )
def test_invalid_chunk_size_value(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"chunkSize": -1})
- self.assertEqual(str(context.exception), "Invalid chunkSize: Must be a positive integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"chunkSize": -1}
+ )
+ self.assertEqual(
+ str(context.exception), "Invalid chunkSize: Must be a positive integer."
+ )
def test_invalid_chunk_size_float(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"chunkSize": 10.5})
- self.assertEqual(str(context.exception), "Invalid chunkSize: Must be a positive integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"chunkSize": 10.5}
+ )
+ self.assertEqual(
+ str(context.exception), "Invalid chunkSize: Must be a positive integer."
+ )
# Test cases for invalid `maxRetries` values
def test_invalid_max_retries_type(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"maxRetries": "invalid"})
- self.assertEqual(str(context.exception), "Invalid maxRetries: Must be a non-negative integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"maxRetries": "invalid"}
+ )
+ self.assertEqual(
+ str(context.exception),
+ "Invalid maxRetries: Must be a non-negative integer.",
+ )
def test_invalid_max_retries_value(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"maxRetries": -1})
- self.assertEqual(str(context.exception), "Invalid maxRetries: Must be a non-negative integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"maxRetries": -1}
+ )
+ self.assertEqual(
+ str(context.exception),
+ "Invalid maxRetries: Must be a non-negative integer.",
+ )
def test_invalid_max_retries_float(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"maxRetries": 1.5})
- self.assertEqual(str(context.exception), "Invalid maxRetries: Must be a non-negative integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"maxRetries": 1.5}
+ )
+ self.assertEqual(
+ str(context.exception),
+ "Invalid maxRetries: Must be a non-negative integer.",
+ )
# Test cases for invalid `concurrency` values
def test_invalid_concurrency_type(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"concurrency": "invalid"})
- self.assertEqual(str(context.exception), "Invalid concurrency: Must be a positive integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"concurrency": "invalid"}
+ )
+ self.assertEqual(
+ str(context.exception), "Invalid concurrency: Must be a positive integer."
+ )
def test_invalid_concurrency_value(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"concurrency": 0})
- self.assertEqual(str(context.exception), "Invalid concurrency: Must be a positive integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"concurrency": 0}
+ )
+ self.assertEqual(
+ str(context.exception), "Invalid concurrency: Must be a positive integer."
+ )
def test_invalid_concurrency_float(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"concurrency": 2.5})
- self.assertEqual(str(context.exception), "Invalid concurrency: Must be a positive integer.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"concurrency": 2.5}
+ )
+ self.assertEqual(
+ str(context.exception), "Invalid concurrency: Must be a positive integer."
+ )
# Test cases for `exponentialFactor` values
def test_invalid_exponential_factor_type(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"exponentialFactor": "invalid"})
- self.assertEqual(str(context.exception), "Invalid exponentialFactor: Must be a positive number.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"exponentialFactor": "invalid"}
+ )
+ self.assertEqual(
+ str(context.exception),
+ "Invalid exponentialFactor: Must be a positive number.",
+ )
def test_invalid_exponential_factor_value(self):
with self.assertRaises(PixelbinIllegalArgumentError) as context:
- self.pixelbinClient.uploader.upload(file="dummy_file", uploadOptions={"exponentialFactor": -1})
- self.assertEqual(str(context.exception), "Invalid exponentialFactor: Must be a positive number.")
+ self.pixelbinClient.uploader.upload(
+ file="dummy_file", uploadOptions={"exponentialFactor": -1}
+ )
+ self.assertEqual(
+ str(context.exception),
+ "Invalid exponentialFactor: Must be a positive number.",
+ )
+
+ def test_predictions_create(self):
+ # Intentionally do not import Predictions directly; it should be accessed via client only
+ form_data = FormData()
+ with mock.patch.object(
+ form_data, "add_field", wraps=form_data.add_field
+ ) as spy_add_field:
+ with mock.patch.object(
+ AiohttpHelper, "_AiohttpHelper__get_formdata"
+ ) as mock_get_formdata:
+ mock_get_formdata.return_value = form_data
+ with mock.patch.object(
+ AiohttpHelper, "_AiohttpHelper__make_request"
+ ) as mock_request:
+ mock_response = {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {
+ "_id": "erase--bg--001",
+ "status": "ACCEPTED",
+ "urls": {
+ "get": "/service/platform/transformation/v1.0/predictions/erase--bg--001"
+ },
+ }
+ ).encode(),
+ }
+ mock_request.return_value = mock_response
+
+ pixelbin = self.pixelbinClient
+ img_path = "./tests/1.jpeg"
+ mask_path = "./tests/1.jpeg"
+ job = pixelbin.predictions.create(
+ name="erase_bg",
+ input={
+ "image": b"x",
+ "mask": b"y",
+ "industry_type": "general",
+ "quality_type": "original",
+ "shadow": "false",
+ "refine": "true",
+ },
+ webhook="https://example.com/webhook",
+ )
+
+ called = mock_request.call_args.kwargs
+ self.assertEqual(called["method"], "post")
+ self.assertEqual(
+ called["url"],
+ f"{CONFIG['domain']}/service/platform/transformation/v1.0/predictions/erase/bg",
+ )
+ self.assertEqual(called["params"], {})
+ self.assertIsInstance(called["data"], FormData)
+ # both fields should have been added via add_field
+ calls = [c.args[0] for c in spy_add_field.mock_calls]
+ self.assertIn("input.image", calls)
+ self.assertIn("input.mask", calls)
+ self.assertIn("input.industry_type", calls)
+ self.assertIn("input.quality_type", calls)
+ self.assertIn("input.shadow", calls)
+ self.assertIn("input.refine", calls)
+ self.assertEqual(job["_id"], "erase--bg--001")
+
+ def test_predictions_get(self):
+ with mock.patch.object(
+ AiohttpHelper, "_AiohttpHelper__make_request"
+ ) as mock_request:
+ mock_response = {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {
+ "_id": "erase--bg--001",
+ "status": "SUCCESS",
+ "output": ["https://example.com/out.png"],
+ }
+ ).encode(),
+ }
+ mock_request.return_value = mock_response
+ pixelbin = self.pixelbinClient
+ status = pixelbin.predictions.get("erase--bg--001")
+ self.assertEqual(status["status"], "SUCCESS")
+ called = mock_request.call_args.kwargs
+ self.assertEqual(called["method"], "get")
+ self.assertEqual(
+ called["url"],
+ f"{CONFIG['domain']}/service/platform/transformation/v1.0/predictions/erase--bg--001",
+ )
+
+ def test_predictions_wait(self):
+ with mock.patch.object(
+ AiohttpHelper, "_AiohttpHelper__make_request"
+ ) as mock_request:
+ responses = [
+ {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {"_id": "rid", "status": "ACCEPTED"}
+ ).encode(),
+ },
+ {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {"_id": "rid", "status": "ACCEPTED"}
+ ).encode(),
+ },
+ {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {"_id": "rid", "status": "SUCCESS", "output": "ok"}
+ ).encode(),
+ },
+ ]
+ mock_request.side_effect = responses
+ pixelbin = self.pixelbinClient
+ status = pixelbin.predictions.wait("rid")
+ self.assertEqual(status["status"], "SUCCESS")
+
+ def test_predictions_wait_with_options(self):
+ with mock.patch.object(
+ AiohttpHelper, "_AiohttpHelper__make_request"
+ ) as mock_request:
+ responses = [
+ {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {"_id": "rid", "status": "ACCEPTED"}
+ ).encode(),
+ },
+ {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {"_id": "rid", "status": "SUCCESS", "output": "ok"}
+ ).encode(),
+ },
+ ]
+ mock_request.side_effect = responses
+ pixelbin = self.pixelbinClient
+ status = pixelbin.predictions.wait(
+ "rid", {"maxAttempts": 999, "retryFactor": 10, "retryInterval": 0.0001}
+ )
+ self.assertEqual(status["status"], "SUCCESS")
+
+ def test_predictions_list(self):
+ with mock.patch.object(
+ AiohttpHelper, "_AiohttpHelper__make_request"
+ ) as mock_request:
+ mock_response = {
+ "status_code": 200,
+ "content": ujson.dumps(
+ [
+ {
+ "name": "erase_bg",
+ "displayName": "Erase Background",
+ "description": "Removes image background.",
+ "bannerImage": "https://cdn.pixelbin.io/v2/.../erase-bg.png",
+ }
+ ]
+ ).encode(),
+ }
+ mock_request.return_value = mock_response
+ pixelbin = self.pixelbinClient
+ items = pixelbin.predictions.list()
+ self.assertTrue(isinstance(items, list))
+ called = mock_request.call_args.kwargs
+ self.assertEqual(called["method"], "get")
+ self.assertEqual(
+ called["url"],
+ f"{CONFIG['domain']}/service/public/transformation/v1.0/predictions",
+ )
+
+ def test_predictions_get_schema(self):
+ with mock.patch.object(
+ AiohttpHelper, "_AiohttpHelper__make_request"
+ ) as mock_request:
+ mock_response = {
+ "status_code": 200,
+ "content": ujson.dumps(
+ {
+ "name": "erase_bg",
+ "displayName": "Erase Background",
+ "input": {"image": {"oneOf": []}},
+ }
+ ).encode(),
+ }
+ mock_request.return_value = mock_response
+ pixelbin = self.pixelbinClient
+ schema = pixelbin.predictions.get_schema("erase_bg")
+ self.assertTrue(isinstance(schema, dict))
+ called = mock_request.call_args.kwargs
+ self.assertEqual(called["method"], "get")
+ self.assertEqual(
+ called["url"],
+ f"{CONFIG['domain']}/service/public/transformation/v1.0/predictions/schema/erase_bg",
+ )
class SequentialTestLoader(unittest.TestLoader):