From 31100e2ee17426153efea46f8787d2cfb5e2a9ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 18:10:16 +0000 Subject: [PATCH 01/14] chore(internal): fix MCP server import ordering --- packages/mcp-server/src/instructions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mcp-server/src/instructions.ts b/packages/mcp-server/src/instructions.ts index 09c278fd..ffe655a0 100644 --- a/packages/mcp-server/src/instructions.ts +++ b/packages/mcp-server/src/instructions.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import fs from 'fs/promises'; -import { readEnv } from './util'; import { getLogger } from './logger'; +import { readEnv } from './util'; const INSTRUCTIONS_CACHE_TTL_MS = 15 * 60 * 1000; // 15 minutes From 35dc080ca7ef76d09db5152fbc8e3af285581822 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:00:10 +0000 Subject: [PATCH 02/14] chore(mcp-server): increase local docs search result count from 5 to 10 --- packages/mcp-server/src/docs-search-tool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mcp-server/src/docs-search-tool.ts b/packages/mcp-server/src/docs-search-tool.ts index 476e7007..25c9c7ea 100644 --- a/packages/mcp-server/src/docs-search-tool.ts +++ b/packages/mcp-server/src/docs-search-tool.ts @@ -63,7 +63,7 @@ async function searchLocal(args: Record): Promise { query, language, detail, - maxResults: 5, + maxResults: 10, }).results; } From e2cf4dcd2be96f3d7d60244e40592aa94f393e8c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 15:52:00 +0000 Subject: [PATCH 03/14] chore(internal): codegen related update --- packages/mcp-server/src/util.ts | 4 ++-- src/internal/utils/env.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/mcp-server/src/util.ts b/packages/mcp-server/src/util.ts index 40ed5501..069a2b47 100644 --- a/packages/mcp-server/src/util.ts +++ b/packages/mcp-server/src/util.ts @@ -2,9 +2,9 @@ export const readEnv = (env: string): string | undefined => { if (typeof (globalThis as any).process !== 'undefined') { - return (globalThis as any).process.env?.[env]?.trim(); + return (globalThis as any).process.env?.[env]?.trim() || undefined; } else if (typeof (globalThis as any).Deno !== 'undefined') { - return (globalThis as any).Deno.env?.get?.(env)?.trim(); + return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined; } return; }; diff --git a/src/internal/utils/env.ts b/src/internal/utils/env.ts index 2d848007..cc5fa0fa 100644 --- a/src/internal/utils/env.ts +++ b/src/internal/utils/env.ts @@ -9,10 +9,10 @@ */ export const readEnv = (env: string): string | undefined => { if (typeof (globalThis as any).process !== 'undefined') { - return (globalThis as any).process.env?.[env]?.trim() ?? undefined; + return (globalThis as any).process.env?.[env]?.trim() || undefined; } if (typeof (globalThis as any).Deno !== 'undefined') { - return (globalThis as any).Deno.env?.get?.(env)?.trim(); + return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined; } return undefined; }; From 7f1ff53ef5fedeb78fd73571664789c858133351 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:11:51 +0000 Subject: [PATCH 04/14] chore(internal): show error causes in MCP servers when running in local mode --- packages/mcp-server/src/code-tool-worker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mcp-server/src/code-tool-worker.ts b/packages/mcp-server/src/code-tool-worker.ts index 23ff1794..07b79f57 100644 --- a/packages/mcp-server/src/code-tool-worker.ts +++ b/packages/mcp-server/src/code-tool-worker.ts @@ -233,7 +233,8 @@ function makeSdkProxy(obj: T, { path, isBelievedBad = false }: function parseError(code: string, error: unknown): string | undefined { if (!(error instanceof Error)) return; - const message = error.name ? `${error.name}: ${error.message}` : error.message; + const cause = error.cause instanceof Error ? `: ${error.cause.message}` : ''; + const message = error.name ? `${error.name}: ${error.message}${cause}` : `${error.message}${cause}`; try { // Deno uses V8; the first ":LINE:COLUMN" is the top of stack. const lineNumber = error.stack?.match(/:([0-9]+):[0-9]+/)?.[1]; From d2bc9ce8f62be8c4da65f655b8113a0bca685c37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:40:50 +0000 Subject: [PATCH 05/14] feat(api): dam related webhook events --- .stats.yml | 6 +- README.md | 2 + api.md | 5 + packages/mcp-server/README.md | 13 +- packages/mcp-server/src/auth.ts | 29 +- packages/mcp-server/src/local-docs-search.ts | 744 ++++++++---------- src/client.ts | 37 +- src/resources/index.ts | 5 + src/resources/shared.ts | 61 +- src/resources/webhooks.ts | 133 +++- tests/api-resources/accounts/origins.test.ts | 1 - .../accounts/url-endpoints.test.ts | 1 - tests/api-resources/accounts/usage.test.ts | 1 - tests/api-resources/assets.test.ts | 1 - tests/api-resources/beta/v2/files.test.ts | 1 - .../api-resources/cache/invalidation.test.ts | 1 - .../custom-metadata-fields.test.ts | 1 - tests/api-resources/files/bulk.test.ts | 1 - tests/api-resources/files/files.test.ts | 1 - tests/api-resources/files/metadata.test.ts | 1 - tests/api-resources/files/versions.test.ts | 1 - tests/api-resources/folders/folders.test.ts | 1 - tests/api-resources/folders/job.test.ts | 1 - tests/api-resources/saved-extensions.test.ts | 1 - tests/api-resources/webhooks.test.ts | 1 - tests/index.test.ts | 88 +-- 26 files changed, 532 insertions(+), 606 deletions(-) diff --git a/.stats.yml b/.stats.yml index df5aafb6..3e331fe9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-63aff1629530786015da3c86131afa8a9b60545d488884b77641f1d4b89c6e9d.yml -openapi_spec_hash: 586d357bd7e5217d240a99e0d83c6d1f -config_hash: 47cb702ee2cb52c58d803ae39ade9b44 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-1422f7513f230162270b197061e5768c2e0c803b94b8cd03a5e72544ac75a27f.yml +openapi_spec_hash: 41175e752e6f6ce900b36aecba687fa7 +config_hash: 17e408231b0b01676298010c7405f483 diff --git a/README.md b/README.md index fd8899f7..459d8582 100644 --- a/README.md +++ b/README.md @@ -430,6 +430,7 @@ You can use the `maxRetries` option to configure or disable this: ```js // Configure the default for all requests: const client = new ImageKit({ + privateKey: 'My Private Key', maxRetries: 0, // default is 2 }); @@ -447,6 +448,7 @@ Requests time out after 1 minute by default. You can configure this with a `time ```ts // Configure the default for all requests: const client = new ImageKit({ + privateKey: 'My Private Key', timeout: 20 * 1000, // 20 seconds (default is 1 minute) }); diff --git a/api.md b/api.md index 94780b7e..7ba4ee91 100644 --- a/api.md +++ b/api.md @@ -229,6 +229,11 @@ Methods: Types: - BaseWebhookEvent +- DamFileCreateEvent +- DamFileDeleteEvent +- DamFileUpdateEvent +- DamFileVersionCreateEvent +- DamFileVersionDeleteEvent - UploadPostTransformErrorEvent - UploadPostTransformSuccessEvent - UploadPreTransformErrorEvent diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md index 2fe6b778..84fefd40 100644 --- a/packages/mcp-server/README.md +++ b/packages/mcp-server/README.md @@ -80,24 +80,13 @@ and repeatably. Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket. -Authorization can be provided via the `Authorization` header using the Basic scheme. - -Additionally, authorization can be provided via the following headers: -| Header | Equivalent client option | Security scheme | -| ---------------------------------- | ------------------------ | --------------- | -| `x-imagekit-private-key` | `privateKey` | basicAuth | -| `x-optional-imagekit-ignores-this` | `password` | basicAuth | - A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`: ```json { "mcpServers": { "imagekit_nodejs_api": { - "url": "http://localhost:3000", - "headers": { - "Authorization": "Basic " - } + "url": "http://localhost:3000" } } } diff --git a/packages/mcp-server/src/auth.ts b/packages/mcp-server/src/auth.ts index 085cac43..234c710e 100644 --- a/packages/mcp-server/src/auth.ts +++ b/packages/mcp-server/src/auth.ts @@ -5,34 +5,7 @@ import { ClientOptions } from '@imagekit/nodejs'; import { McpOptions } from './options'; export const parseClientAuthHeaders = (req: IncomingMessage, required?: boolean): Partial => { - if (req.headers.authorization) { - const scheme = req.headers.authorization.split(' ')[0]!; - const value = req.headers.authorization.slice(scheme.length + 1); - switch (scheme) { - case 'Basic': - const rawValue = Buffer.from(value, 'base64').toString(); - return { - privateKey: rawValue.slice(0, rawValue.search(':')), - password: rawValue.slice(rawValue.search(':') + 1), - }; - default: - throw new Error( - 'Unsupported authorization scheme. Expected the "Authorization" header to be a supported scheme (Basic).', - ); - } - } else if (required) { - throw new Error('Missing required Authorization header; see WWW-Authenticate header for details.'); - } - - const privateKey = - Array.isArray(req.headers['x-imagekit-private-key']) ? - req.headers['x-imagekit-private-key'][0] - : req.headers['x-imagekit-private-key']; - const password = - Array.isArray(req.headers['x-optional-imagekit-ignores-this']) ? - req.headers['x-optional-imagekit-ignores-this'][0] - : req.headers['x-optional-imagekit-ignores-this']; - return { privateKey, password }; + return {}; }; export const getStainlessApiKey = (req: IncomingMessage, mcpOptions: McpOptions): string | undefined => { diff --git a/packages/mcp-server/src/local-docs-search.ts b/packages/mcp-server/src/local-docs-search.ts index 294e25cf..f73653de 100644 --- a/packages/mcp-server/src/local-docs-search.ts +++ b/packages/mcp-server/src/local-docs-search.ts @@ -72,7 +72,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'customMetadataFields create', example: - "imagekit custom-metadata-fields create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --label price \\\n --name price \\\n --schema '{type: Number}'", + "imagekit custom-metadata-fields create \\\n --private-key 'My Private Key' \\\n --label price \\\n --name price \\\n --schema '{type: Number}'", }, csharp: { method: 'CustomMetadataFields.Create', @@ -82,11 +82,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.New(context.TODO(), imagekit.CustomMetadataFieldNewParams{\n\t\tLabel: "price",\n\t\tName: "price",\n\t\tSchema: imagekit.CustomMetadataFieldNewParamsSchema{\n\t\t\tType: "Number",\n\t\t\tMinValue: imagekit.CustomMetadataFieldNewParamsSchemaMinValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t},\n\t\t\tMaxValue: imagekit.CustomMetadataFieldNewParamsSchemaMaxValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.New(context.TODO(), imagekit.CustomMetadataFieldNewParams{\n\t\tLabel: "price",\n\t\tName: "price",\n\t\tSchema: imagekit.CustomMetadataFieldNewParamsSchema{\n\t\t\tType: "Number",\n\t\t\tMinValue: imagekit.CustomMetadataFieldNewParamsSchemaMinValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t},\n\t\t\tMaxValue: imagekit.CustomMetadataFieldNewParamsSchemaMaxValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/customMetadataFields \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "label": "price",\n "name": "price",\n "schema": {\n "type": "Number",\n "maxValue": 3000,\n "minValue": 1000\n }\n }\'', + 'curl https://api.imagekit.io/v1/customMetadataFields \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "label": "price",\n "name": "price",\n "schema": {\n "type": "Number",\n "maxValue": 3000,\n "minValue": 1000\n }\n }\'', }, java: { method: 'customMetadataFields().create', @@ -96,22 +96,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->create', example: - "customMetadataFields->create(\n label: 'price',\n name: 'price',\n schema: [\n 'type' => 'Number',\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", + "customMetadataFields->create(\n label: 'price',\n name: 'price',\n schema: [\n 'type' => 'Number',\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.create', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_field = client.custom_metadata_fields.create(\n label="price",\n name="price",\n schema={\n "type": "Number",\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_field = client.custom_metadata_fields.create(\n label="price",\n name="price",\n schema={\n "type": "Number",\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', }, ruby: { method: 'custom_metadata_fields.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.create(label: "price", name: "price", schema: {type: :Number})\n\nputs(custom_metadata_field)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.create(label: "price", name: "price", schema: {type: :Number})\n\nputs(custom_metadata_field)', }, typescript: { method: 'client.customMetadataFields.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataField = await client.customMetadataFields.create({\n label: 'price',\n name: 'price',\n schema: {\n type: 'Number',\n minValue: 1000,\n maxValue: 3000,\n },\n});\n\nconsole.log(customMetadataField.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.create({\n label: 'price',\n name: 'price',\n schema: {\n type: 'Number',\n minValue: 1000,\n maxValue: 3000,\n },\n});\n\nconsole.log(customMetadataField.id);", }, }, }, @@ -132,8 +132,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'customMetadataFields list', - example: - "imagekit custom-metadata-fields list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", + example: "imagekit custom-metadata-fields list \\\n --private-key 'My Private Key'", }, csharp: { method: 'CustomMetadataFields.List', @@ -143,11 +142,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataFields, err := client.CustomMetadataFields.List(context.TODO(), imagekit.CustomMetadataFieldListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataFields)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataFields, err := client.CustomMetadataFields.List(context.TODO(), imagekit.CustomMetadataFieldListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataFields)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/customMetadataFields \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/customMetadataFields', }, java: { method: 'customMetadataFields().list', @@ -157,22 +155,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->list', example: - "customMetadataFields->list(\n folderPath: 'folderPath', includeDeleted: true\n);\n\nvar_dump($customMetadataFields);", + "customMetadataFields->list(\n folderPath: 'folderPath', includeDeleted: true\n);\n\nvar_dump($customMetadataFields);", }, python: { method: 'custom_metadata_fields.list', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_fields = client.custom_metadata_fields.list()\nprint(custom_metadata_fields)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_fields = client.custom_metadata_fields.list()\nprint(custom_metadata_fields)', }, ruby: { method: 'custom_metadata_fields.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_fields = image_kit.custom_metadata_fields.list\n\nputs(custom_metadata_fields)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_fields = image_kit.custom_metadata_fields.list\n\nputs(custom_metadata_fields)', }, typescript: { method: 'client.customMetadataFields.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataFields = await client.customMetadataFields.list();\n\nconsole.log(customMetadataFields);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataFields = await client.customMetadataFields.list();\n\nconsole.log(customMetadataFields);", }, }, }, @@ -196,8 +194,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'customMetadataFields update', - example: - "imagekit custom-metadata-fields update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit custom-metadata-fields update \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'CustomMetadataFields.Update', @@ -207,11 +204,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.CustomMetadataFieldUpdateParams{\n\t\t\tLabel: imagekit.String("price"),\n\t\t\tSchema: imagekit.CustomMetadataFieldUpdateParamsSchema{\n\t\t\t\tMinValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMinValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t\t},\n\t\t\t\tMaxValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMaxValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.CustomMetadataFieldUpdateParams{\n\t\t\tLabel: imagekit.String("price"),\n\t\t\tSchema: imagekit.CustomMetadataFieldUpdateParamsSchema{\n\t\t\t\tMinValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMinValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t\t},\n\t\t\t\tMaxValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMaxValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X PATCH \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X PATCH', }, java: { method: 'customMetadataFields().update', @@ -221,22 +217,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->update', example: - "customMetadataFields->update(\n 'id',\n label: 'price',\n schema: [\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", + "customMetadataFields->update(\n 'id',\n label: 'price',\n schema: [\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.update', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_field = client.custom_metadata_fields.update(\n id="id",\n label="price",\n schema={\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_field = client.custom_metadata_fields.update(\n id="id",\n label="price",\n schema={\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', }, ruby: { method: 'custom_metadata_fields.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.update("id")\n\nputs(custom_metadata_field)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.update("id")\n\nputs(custom_metadata_field)', }, typescript: { method: 'client.customMetadataFields.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataField = await client.customMetadataFields.update('id', {\n label: 'price',\n schema: { minValue: 1000, maxValue: 3000 },\n});\n\nconsole.log(customMetadataField.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.update('id', {\n label: 'price',\n schema: { minValue: 1000, maxValue: 3000 },\n});\n\nconsole.log(customMetadataField.id);", }, }, }, @@ -256,8 +252,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'customMetadataFields delete', - example: - "imagekit custom-metadata-fields delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit custom-metadata-fields delete \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'CustomMetadataFields.Delete', @@ -267,11 +262,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X DELETE', }, java: { method: 'customMetadataFields().delete', @@ -281,22 +275,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->delete', example: - "customMetadataFields->delete('id');\n\nvar_dump($customMetadataField);", + "customMetadataFields->delete('id');\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_field = client.custom_metadata_fields.delete(\n "id",\n)\nprint(custom_metadata_field)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_field = client.custom_metadata_fields.delete(\n "id",\n)\nprint(custom_metadata_field)', }, ruby: { method: 'custom_metadata_fields.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.delete("id")\n\nputs(custom_metadata_field)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.delete("id")\n\nputs(custom_metadata_field)', }, typescript: { method: 'client.customMetadataFields.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataField = await client.customMetadataFields.delete('id');\n\nconsole.log(customMetadataField);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.delete('id');\n\nconsole.log(customMetadataField);", }, }, }, @@ -342,7 +336,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files upload', example: - "imagekit files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name fileName", + "imagekit files upload \\\n --private-key 'My Private Key' \\\n --file 'Example data' \\\n --file-name fileName", }, csharp: { method: 'Files.Upload', @@ -352,11 +346,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Upload', example: - 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', }, http: { example: - 'curl https://upload.imagekit.io/api/v1/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', + 'curl https://upload.imagekit.io/api/v1/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', }, java: { method: 'files().upload', @@ -366,22 +360,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->upload', example: - "files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n expire: 0,\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n publicKey: 'publicKey',\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n signature: 'signature',\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", + "files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n expire: 0,\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n publicKey: 'publicKey',\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n signature: 'signature',\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", }, python: { method: 'files.upload', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', }, ruby: { method: 'files.upload', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', }, typescript: { method: 'client.files.upload', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", }, }, }, @@ -402,8 +396,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'files get', - example: - "imagekit files get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", + example: "imagekit files get \\\n --private-key 'My Private Key' \\\n --file-id fileId", }, csharp: { method: 'Files.Get', @@ -413,11 +406,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/details \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/details', }, java: { method: 'files().get', @@ -427,22 +419,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->get', example: - "files->get('fileId');\n\nvar_dump($file);", + "files->get('fileId');\n\nvar_dump($file);", }, python: { method: 'files.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.get(\n "fileId",\n)\nprint(file.video_codec)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.get(\n "fileId",\n)\nprint(file.video_codec)', }, ruby: { method: 'files.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.get("fileId")\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.get("fileId")\n\nputs(file)', }, typescript: { method: 'client.files.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.get('fileId');\n\nconsole.log(file.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.get('fileId');\n\nconsole.log(file.videoCodec);", }, }, }, @@ -464,8 +456,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'files update', - example: - "imagekit files update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", + example: "imagekit files update \\\n --private-key 'My Private Key' \\\n --file-id fileId", }, csharp: { method: 'Files.Update', @@ -475,11 +466,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Update(\n\t\tcontext.TODO(),\n\t\t"fileId",\n\t\timagekit.FileUpdateParams{\n\t\t\tUpdateFileRequest: imagekit.UpdateFileRequestUnionParam{\n\t\t\t\tOfUpdateFileDetails: &imagekit.UpdateFileRequestUpdateFileDetailsParam{},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Update(\n\t\tcontext.TODO(),\n\t\t"fileId",\n\t\timagekit.FileUpdateParams{\n\t\t\tUpdateFileRequest: imagekit.UpdateFileRequestUnionParam{\n\t\t\t\tOfUpdateFileDetails: &imagekit.UpdateFileRequestUpdateFileDetailsParam{},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/details \\\n -X PATCH \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "extensions": [\n {\n "name": "remove-bg",\n "options": {\n "add_shadow": true\n }\n },\n {\n "maxTags": 5,\n "minConfidence": 95,\n "name": "google-auto-tagging"\n },\n {\n "name": "ai-auto-description"\n },\n {\n "name": "ai-tasks",\n "tasks": [\n {\n "instruction": "What types of clothing items are visible in this image?",\n "type": "select_tags",\n "vocabulary": [\n "shirt",\n "tshirt",\n "dress",\n "trousers",\n "jacket"\n ]\n },\n {\n "instruction": "Is this a luxury or high-end fashion item?",\n "type": "yes_no",\n "on_yes": {\n "add_tags": [\n "luxury",\n "premium"\n ]\n }\n }\n ]\n },\n {\n "id": "ext_abc123",\n "name": "saved-extension"\n }\n ],\n "tags": [\n "tag1",\n "tag2"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/$FILE_ID/details \\\n -X PATCH \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "extensions": [\n {\n "name": "remove-bg",\n "options": {\n "add_shadow": true\n }\n },\n {\n "maxTags": 5,\n "minConfidence": 95,\n "name": "google-auto-tagging"\n },\n {\n "name": "ai-auto-description"\n },\n {\n "name": "ai-tasks",\n "tasks": [\n {\n "instruction": "What types of clothing items are visible in this image?",\n "type": "select_tags",\n "vocabulary": [\n "shirt",\n "tshirt",\n "dress",\n "trousers",\n "jacket"\n ]\n },\n {\n "instruction": "Is this a luxury or high-end fashion item?",\n "type": "yes_no",\n "on_yes": {\n "add_tags": [\n "luxury",\n "premium"\n ]\n }\n }\n ]\n },\n {\n "id": "ext_abc123",\n "name": "saved-extension"\n }\n ],\n "tags": [\n "tag1",\n "tag2"\n ]\n }\'', }, java: { method: 'files().update', @@ -489,22 +480,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->update', example: - "files->update(\n 'fileId',\n customCoordinates: 'customCoordinates',\n customMetadata: ['foo' => 'bar'],\n description: 'description',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n removeAITags: ['string'],\n tags: ['tag1', 'tag2'],\n webhookURL: 'https://example.com',\n publish: ['isPublished' => true, 'includeFileVersions' => true],\n);\n\nvar_dump($file);", + "files->update(\n 'fileId',\n customCoordinates: 'customCoordinates',\n customMetadata: ['foo' => 'bar'],\n description: 'description',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n removeAITags: ['string'],\n tags: ['tag1', 'tag2'],\n webhookURL: 'https://example.com',\n publish: ['isPublished' => true, 'includeFileVersions' => true],\n);\n\nvar_dump($file);", }, python: { method: 'files.update', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.update(\n file_id="fileId",\n)\nprint(file)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.update(\n file_id="fileId",\n)\nprint(file)', }, ruby: { method: 'files.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.update("fileId", update_file_request: {})\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.update("fileId", update_file_request: {})\n\nputs(file)', }, typescript: { method: 'client.files.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.update('fileId');\n\nconsole.log(file);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.update('fileId');\n\nconsole.log(file);", }, }, }, @@ -523,8 +514,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'files delete', - example: - "imagekit files delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", + example: "imagekit files delete \\\n --private-key 'My Private Key' \\\n --file-id fileId", }, csharp: { method: 'Files.Delete', @@ -534,11 +524,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Files.Delete(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Files.Delete(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/$FILE_ID \\\n -X DELETE', }, java: { method: 'files().delete', @@ -548,22 +537,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->delete', example: - "files->delete('fileId');\n\nvar_dump($result);", + "files->delete('fileId');\n\nvar_dump($result);", }, python: { method: 'files.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.files.delete(\n "fileId",\n)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.files.delete(\n "fileId",\n)', }, ruby: { method: 'files.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.files.delete("fileId")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.files.delete("fileId")\n\nputs(result)', }, typescript: { method: 'client.files.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.files.delete('fileId');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.files.delete('fileId');", }, }, }, @@ -584,7 +573,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files copy', example: - "imagekit files copy \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /folder/to/copy/into/ \\\n --source-file-path /path/to/file.jpg", + "imagekit files copy \\\n --private-key 'My Private Key' \\\n --destination-path /folder/to/copy/into/ \\\n --source-file-path /path/to/file.jpg", }, csharp: { method: 'Files.Copy', @@ -594,11 +583,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Copy', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Copy(context.TODO(), imagekit.FileCopyParams{\n\t\tDestinationPath: "/folder/to/copy/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Copy(context.TODO(), imagekit.FileCopyParams{\n\t\tDestinationPath: "/folder/to/copy/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/copy \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/folder/to/copy/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', + 'curl https://api.imagekit.io/v1/files/copy \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/folder/to/copy/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', }, java: { method: 'files().copy', @@ -608,22 +597,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->copy', example: - "files->copy(\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n includeFileVersions: false,\n);\n\nvar_dump($response);", + "files->copy(\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n includeFileVersions: false,\n);\n\nvar_dump($response);", }, python: { method: 'files.copy', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.copy(\n destination_path="/folder/to/copy/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.copy(\n destination_path="/folder/to/copy/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', }, ruby: { method: 'files.copy', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.copy(destination_path: "/folder/to/copy/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.copy(destination_path: "/folder/to/copy/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', }, typescript: { method: 'client.files.copy', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.copy({\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.copy({\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", }, }, }, @@ -644,7 +633,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files move', example: - "imagekit files move \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /folder/to/move/into/ \\\n --source-file-path /path/to/file.jpg", + "imagekit files move \\\n --private-key 'My Private Key' \\\n --destination-path /folder/to/move/into/ \\\n --source-file-path /path/to/file.jpg", }, csharp: { method: 'Files.Move', @@ -654,11 +643,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Move', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Move(context.TODO(), imagekit.FileMoveParams{\n\t\tDestinationPath: "/folder/to/move/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Move(context.TODO(), imagekit.FileMoveParams{\n\t\tDestinationPath: "/folder/to/move/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/move \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/folder/to/move/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', + 'curl https://api.imagekit.io/v1/files/move \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/folder/to/move/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', }, java: { method: 'files().move', @@ -668,22 +657,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->move', example: - "files->move(\n destinationPath: '/folder/to/move/into/', sourceFilePath: '/path/to/file.jpg'\n);\n\nvar_dump($response);", + "files->move(\n destinationPath: '/folder/to/move/into/', sourceFilePath: '/path/to/file.jpg'\n);\n\nvar_dump($response);", }, python: { method: 'files.move', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.move(\n destination_path="/folder/to/move/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.move(\n destination_path="/folder/to/move/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', }, ruby: { method: 'files.move', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.move(destination_path: "/folder/to/move/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.move(destination_path: "/folder/to/move/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', }, typescript: { method: 'client.files.move', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.move({\n destinationPath: '/folder/to/move/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.move({\n destinationPath: '/folder/to/move/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", }, }, }, @@ -704,7 +693,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files rename', example: - "imagekit files rename \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-path /path/to/file.jpg \\\n --new-file-name newFileName.jpg", + "imagekit files rename \\\n --private-key 'My Private Key' \\\n --file-path /path/to/file.jpg \\\n --new-file-name newFileName.jpg", }, csharp: { method: 'Files.Rename', @@ -714,11 +703,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Rename', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Rename(context.TODO(), imagekit.FileRenameParams{\n\t\tFilePath: "/path/to/file.jpg",\n\t\tNewFileName: "newFileName.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.PurgeRequestID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Rename(context.TODO(), imagekit.FileRenameParams{\n\t\tFilePath: "/path/to/file.jpg",\n\t\tNewFileName: "newFileName.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.PurgeRequestID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/rename \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "filePath": "/path/to/file.jpg",\n "newFileName": "newFileName.jpg",\n "purgeCache": true\n }\'', + 'curl https://api.imagekit.io/v1/files/rename \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "filePath": "/path/to/file.jpg",\n "newFileName": "newFileName.jpg",\n "purgeCache": true\n }\'', }, java: { method: 'files().rename', @@ -728,22 +717,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->rename', example: - "files->rename(\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n purgeCache: true,\n);\n\nvar_dump($response);", + "files->rename(\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n purgeCache: true,\n);\n\nvar_dump($response);", }, python: { method: 'files.rename', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.rename(\n file_path="/path/to/file.jpg",\n new_file_name="newFileName.jpg",\n)\nprint(response.purge_request_id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.rename(\n file_path="/path/to/file.jpg",\n new_file_name="newFileName.jpg",\n)\nprint(response.purge_request_id)', }, ruby: { method: 'files.rename', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.rename(file_path: "/path/to/file.jpg", new_file_name: "newFileName.jpg")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.rename(file_path: "/path/to/file.jpg", new_file_name: "newFileName.jpg")\n\nputs(response)', }, typescript: { method: 'client.files.rename', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.rename({\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n});\n\nconsole.log(response.purgeRequestId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.rename({\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n});\n\nconsole.log(response.purgeRequestId);", }, }, }, @@ -764,7 +753,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk delete', example: - "imagekit files:bulk delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", + "imagekit files:bulk delete \\\n --private-key 'My Private Key' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", }, csharp: { method: 'Files.Bulk.Delete', @@ -774,11 +763,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tbulk, err := client.Files.Bulk.Delete(context.TODO(), imagekit.FileBulkDeleteParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", bulk.SuccessfullyDeletedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tbulk, err := client.Files.Bulk.Delete(context.TODO(), imagekit.FileBulkDeleteParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", bulk.SuccessfullyDeletedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/batch/deleteByFileIds \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/batch/deleteByFileIds \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', }, java: { method: 'files().bulk().delete', @@ -788,22 +777,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->delete', example: - "files->bulk->delete(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be']\n);\n\nvar_dump($bulk);", + "files->bulk->delete(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be']\n);\n\nvar_dump($bulk);", }, python: { method: 'files.bulk.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nbulk = client.files.bulk.delete(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(bulk.successfully_deleted_file_ids)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nbulk = client.files.bulk.delete(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(bulk.successfully_deleted_file_ids)', }, ruby: { method: 'files.bulk.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nbulk = image_kit.files.bulk.delete(file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"])\n\nputs(bulk)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nbulk = image_kit.files.bulk.delete(file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"])\n\nputs(bulk)', }, typescript: { method: 'client.files.bulk.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst bulk = await client.files.bulk.delete({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(bulk.successfullyDeletedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst bulk = await client.files.bulk.delete({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(bulk.successfullyDeletedFileIds);", }, }, }, @@ -824,7 +813,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk addTags', example: - "imagekit files:bulk add-tags \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", + "imagekit files:bulk add-tags \\\n --private-key 'My Private Key' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", }, csharp: { method: 'Files.Bulk.AddTags', @@ -834,11 +823,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.AddTags', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Bulk.AddTags(context.TODO(), imagekit.FileBulkAddTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Bulk.AddTags(context.TODO(), imagekit.FileBulkAddTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/addTags \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/addTags \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', }, java: { method: 'files().bulk().addTags', @@ -848,22 +837,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->addTags', example: - "files->bulk->addTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", + "files->bulk->addTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", }, python: { method: 'files.bulk.add_tags', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.bulk.add_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.bulk.add_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', }, ruby: { method: 'files.bulk.add_tags', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.bulk.add_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.bulk.add_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', }, typescript: { method: 'client.files.bulk.addTags', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.bulk.addTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.addTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", }, }, }, @@ -884,7 +873,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk removeTags', example: - "imagekit files:bulk remove-tags \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", + "imagekit files:bulk remove-tags \\\n --private-key 'My Private Key' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", }, csharp: { method: 'Files.Bulk.RemoveTags', @@ -894,11 +883,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.RemoveTags', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveTags(context.TODO(), imagekit.FileBulkRemoveTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveTags(context.TODO(), imagekit.FileBulkRemoveTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/removeTags \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/removeTags \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', }, java: { method: 'files().bulk().removeTags', @@ -908,22 +897,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->removeTags', example: - "files->bulk->removeTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", + "files->bulk->removeTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", }, python: { method: 'files.bulk.remove_tags', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.bulk.remove_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.bulk.remove_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', }, ruby: { method: 'files.bulk.remove_tags', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.bulk.remove_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.bulk.remove_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', }, typescript: { method: 'client.files.bulk.removeTags', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.bulk.removeTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.removeTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", }, }, }, @@ -944,7 +933,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk removeAiTags', example: - "imagekit files:bulk remove-ai-tags \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --ai-tag t-shirt \\\n --ai-tag round-neck \\\n --ai-tag sale2019 \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", + "imagekit files:bulk remove-ai-tags \\\n --private-key 'My Private Key' \\\n --ai-tag t-shirt \\\n --ai-tag round-neck \\\n --ai-tag sale2019 \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", }, csharp: { method: 'Files.Bulk.RemoveAITags', @@ -954,11 +943,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.RemoveAITags', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveAITags(context.TODO(), imagekit.FileBulkRemoveAITagsParams{\n\t\tAITags: []string{"t-shirt", "round-neck", "sale2019"},\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveAITags(context.TODO(), imagekit.FileBulkRemoveAITagsParams{\n\t\tAITags: []string{"t-shirt", "round-neck", "sale2019"},\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/removeAITags \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "AITags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ],\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/removeAITags \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "AITags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ],\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', }, java: { method: 'files().bulk().removeAiTags', @@ -968,22 +957,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->removeAITags', example: - "files->bulk->removeAITags(\n aiTags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n);\n\nvar_dump($response);", + "files->bulk->removeAITags(\n aiTags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n);\n\nvar_dump($response);", }, python: { method: 'files.bulk.remove_ai_tags', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.bulk.remove_ai_tags(\n ai_tags=["t-shirt", "round-neck", "sale2019"],\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(response.successfully_updated_file_ids)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.bulk.remove_ai_tags(\n ai_tags=["t-shirt", "round-neck", "sale2019"],\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(response.successfully_updated_file_ids)', }, ruby: { method: 'files.bulk.remove_ai_tags', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.bulk.remove_ai_tags(\n ai_tags: ["t-shirt", "round-neck", "sale2019"],\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"]\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.bulk.remove_ai_tags(\n ai_tags: ["t-shirt", "round-neck", "sale2019"],\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"]\n)\n\nputs(response)', }, typescript: { method: 'client.files.bulk.removeAITags', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.bulk.removeAITags({\n AITags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.removeAITags({\n AITags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", }, }, }, @@ -1003,8 +992,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'versions list', - example: - "imagekit files:versions list \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", + example: "imagekit files:versions list \\\n --private-key 'My Private Key' \\\n --file-id fileId", }, csharp: { method: 'Files.Versions.List', @@ -1014,11 +1002,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfiles, err := client.Files.Versions.List(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", files)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfiles, err := client.Files.Versions.List(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", files)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions', }, java: { method: 'files().versions().list', @@ -1028,22 +1015,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->list', example: - "files->versions->list('fileId');\n\nvar_dump($files);", + "files->versions->list('fileId');\n\nvar_dump($files);", }, python: { method: 'files.versions.list', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfiles = client.files.versions.list(\n "fileId",\n)\nprint(files)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfiles = client.files.versions.list(\n "fileId",\n)\nprint(files)', }, ruby: { method: 'files.versions.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfiles = image_kit.files.versions.list("fileId")\n\nputs(files)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfiles = image_kit.files.versions.list("fileId")\n\nputs(files)', }, typescript: { method: 'client.files.versions.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst files = await client.files.versions.list('fileId');\n\nconsole.log(files);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst files = await client.files.versions.list('fileId');\n\nconsole.log(files);", }, }, }, @@ -1064,7 +1051,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'versions get', example: - "imagekit files:versions get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId", + "imagekit files:versions get \\\n --private-key 'My Private Key' \\\n --file-id fileId \\\n --version-id versionId", }, csharp: { method: 'Files.Versions.Get', @@ -1074,11 +1061,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Versions.Get(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionGetParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Versions.Get(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionGetParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID', }, java: { method: 'files().versions().get', @@ -1088,22 +1074,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->get', example: - "files->versions->get('versionId', fileID: 'fileId');\n\nvar_dump($file);", + "files->versions->get('versionId', fileID: 'fileId');\n\nvar_dump($file);", }, python: { method: 'files.versions.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.versions.get(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.versions.get(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', }, ruby: { method: 'files.versions.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.versions.get("versionId", file_id: "fileId")\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.versions.get("versionId", file_id: "fileId")\n\nputs(file)', }, typescript: { method: 'client.files.versions.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.versions.get('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.versions.get('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", }, }, }, @@ -1124,7 +1110,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'versions delete', example: - "imagekit files:versions delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId", + "imagekit files:versions delete \\\n --private-key 'My Private Key' \\\n --file-id fileId \\\n --version-id versionId", }, csharp: { method: 'Files.Versions.Delete', @@ -1134,11 +1120,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tversion, err := client.Files.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionDeleteParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", version)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tversion, err := client.Files.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionDeleteParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", version)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID \\\n -X DELETE', }, java: { method: 'files().versions().delete', @@ -1148,22 +1133,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->delete', example: - "files->versions->delete('versionId', fileID: 'fileId');\n\nvar_dump($version);", + "files->versions->delete('versionId', fileID: 'fileId');\n\nvar_dump($version);", }, python: { method: 'files.versions.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nversion = client.files.versions.delete(\n version_id="versionId",\n file_id="fileId",\n)\nprint(version)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nversion = client.files.versions.delete(\n version_id="versionId",\n file_id="fileId",\n)\nprint(version)', }, ruby: { method: 'files.versions.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nversion = image_kit.files.versions.delete("versionId", file_id: "fileId")\n\nputs(version)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nversion = image_kit.files.versions.delete("versionId", file_id: "fileId")\n\nputs(version)', }, typescript: { method: 'client.files.versions.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst version = await client.files.versions.delete('versionId', { fileId: 'fileId' });\n\nconsole.log(version);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst version = await client.files.versions.delete('versionId', { fileId: 'fileId' });\n\nconsole.log(version);", }, }, }, @@ -1184,7 +1169,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'versions restore', example: - "imagekit files:versions restore \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId", + "imagekit files:versions restore \\\n --private-key 'My Private Key' \\\n --file-id fileId \\\n --version-id versionId", }, csharp: { method: 'Files.Versions.Restore', @@ -1194,11 +1179,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.Restore', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Versions.Restore(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionRestoreParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Versions.Restore(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionRestoreParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID/restore \\\n -X PUT \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID/restore \\\n -X PUT', }, java: { method: 'files().versions().restore', @@ -1208,22 +1192,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->restore', example: - "files->versions->restore('versionId', fileID: 'fileId');\n\nvar_dump($file);", + "files->versions->restore('versionId', fileID: 'fileId');\n\nvar_dump($file);", }, python: { method: 'files.versions.restore', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.versions.restore(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.versions.restore(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', }, ruby: { method: 'files.versions.restore', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.versions.restore("versionId", file_id: "fileId")\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.versions.restore("versionId", file_id: "fileId")\n\nputs(file)', }, typescript: { method: 'client.files.versions.restore', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.versions.restore('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.versions.restore('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", }, }, }, @@ -1244,8 +1228,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'metadata get', - example: - "imagekit files:metadata get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", + example: "imagekit files:metadata get \\\n --private-key 'My Private Key' \\\n --file-id fileId", }, csharp: { method: 'Files.Metadata.Get', @@ -1255,11 +1238,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Metadata.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tmetadata, err := client.Files.Metadata.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tmetadata, err := client.Files.Metadata.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/metadata \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/metadata', }, java: { method: 'files().metadata().get', @@ -1269,22 +1251,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->metadata->get', example: - "files->metadata->get('fileId');\n\nvar_dump($metadata);", + "files->metadata->get('fileId');\n\nvar_dump($metadata);", }, python: { method: 'files.metadata.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nmetadata = client.files.metadata.get(\n "fileId",\n)\nprint(metadata.video_codec)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nmetadata = client.files.metadata.get(\n "fileId",\n)\nprint(metadata.video_codec)', }, ruby: { method: 'files.metadata.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nmetadata = image_kit.files.metadata.get("fileId")\n\nputs(metadata)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nmetadata = image_kit.files.metadata.get("fileId")\n\nputs(metadata)', }, typescript: { method: 'client.files.metadata.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst metadata = await client.files.metadata.get('fileId');\n\nconsole.log(metadata.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst metadata = await client.files.metadata.get('fileId');\n\nconsole.log(metadata.videoCodec);", }, }, }, @@ -1306,7 +1288,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'metadata getFromURL', example: - "imagekit files:metadata get-from-url \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --url https://example.com", + "imagekit files:metadata get-from-url \\\n --private-key 'My Private Key' \\\n --url https://example.com", }, csharp: { method: 'Files.Metadata.GetFromUrl', @@ -1316,11 +1298,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Metadata.GetFromURL', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tmetadata, err := client.Files.Metadata.GetFromURL(context.TODO(), imagekit.FileMetadataGetFromURLParams{\n\t\tURL: "https://example.com",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tmetadata, err := client.Files.Metadata.GetFromURL(context.TODO(), imagekit.FileMetadataGetFromURLParams{\n\t\tURL: "https://example.com",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/metadata \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/metadata', }, java: { method: 'files().metadata().getFromUrl', @@ -1330,22 +1311,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->metadata->getFromURL', example: - "files->metadata->getFromURL(url: 'https://example.com');\n\nvar_dump($metadata);", + "files->metadata->getFromURL(url: 'https://example.com');\n\nvar_dump($metadata);", }, python: { method: 'files.metadata.get_from_url', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nmetadata = client.files.metadata.get_from_url(\n url="https://example.com",\n)\nprint(metadata.video_codec)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nmetadata = client.files.metadata.get_from_url(\n url="https://example.com",\n)\nprint(metadata.video_codec)', }, ruby: { method: 'files.metadata.get_from_url', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nmetadata = image_kit.files.metadata.get_from_url(url: "https://example.com")\n\nputs(metadata)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nmetadata = image_kit.files.metadata.get_from_url(url: "https://example.com")\n\nputs(metadata)', }, typescript: { method: 'client.files.metadata.getFromURL', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst metadata = await client.files.metadata.getFromURL({ url: 'https://example.com' });\n\nconsole.log(metadata.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst metadata = await client.files.metadata.getFromURL({ url: 'https://example.com' });\n\nconsole.log(metadata.videoCodec);", }, }, }, @@ -1365,8 +1346,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions list', - example: - "imagekit saved-extensions list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", + example: "imagekit saved-extensions list \\\n --private-key 'My Private Key'", }, csharp: { method: 'SavedExtensions.List', @@ -1376,11 +1356,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtensions, err := client.SavedExtensions.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtensions)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtensions, err := client.SavedExtensions.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtensions)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/saved-extensions \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/saved-extensions', }, java: { method: 'savedExtensions().list', @@ -1390,22 +1369,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->list', example: - "savedExtensions->list();\n\nvar_dump($savedExtensions);", + "savedExtensions->list();\n\nvar_dump($savedExtensions);", }, python: { method: 'saved_extensions.list', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extensions = client.saved_extensions.list()\nprint(saved_extensions)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extensions = client.saved_extensions.list()\nprint(saved_extensions)', }, ruby: { method: 'saved_extensions.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extensions = image_kit.saved_extensions.list\n\nputs(saved_extensions)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extensions = image_kit.saved_extensions.list\n\nputs(saved_extensions)', }, typescript: { method: 'client.savedExtensions.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtensions = await client.savedExtensions.list();\n\nconsole.log(savedExtensions);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtensions = await client.savedExtensions.list();\n\nconsole.log(savedExtensions);", }, }, }, @@ -1431,7 +1410,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'savedExtensions create', example: - "imagekit saved-extensions create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --config '{name: remove-bg}' \\\n --description 'Analyzes vehicle images for type, condition, and quality assessment' \\\n --name 'Car Quality Analysis'", + "imagekit saved-extensions create \\\n --private-key 'My Private Key' \\\n --config '{name: remove-bg}' \\\n --description 'Analyzes vehicle images for type, condition, and quality assessment' \\\n --name 'Car Quality Analysis'", }, csharp: { method: 'SavedExtensions.Create', @@ -1441,11 +1420,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n\t"github.com/imagekit-developer/imagekit-go/shared"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.New(context.TODO(), imagekit.SavedExtensionNewParams{\n\t\tConfig: shared.ExtensionConfigUnionParam{\n\t\t\tOfRemoveBg: &shared.ExtensionConfigRemoveBgParam{},\n\t\t},\n\t\tDescription: "Analyzes vehicle images for type, condition, and quality assessment",\n\t\tName: "Car Quality Analysis",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n\t"github.com/imagekit-developer/imagekit-go/shared"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.New(context.TODO(), imagekit.SavedExtensionNewParams{\n\t\tConfig: shared.ExtensionConfigUnionParam{\n\t\t\tOfRemoveBg: &shared.ExtensionConfigRemoveBgParam{},\n\t\t},\n\t\tDescription: "Analyzes vehicle images for type, condition, and quality assessment",\n\t\tName: "Car Quality Analysis",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/saved-extensions \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "config": {\n "name": "remove-bg"\n },\n "description": "Analyzes vehicle images for type, condition, and quality assessment",\n "name": "Car Quality Analysis"\n }\'', + 'curl https://api.imagekit.io/v1/saved-extensions \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "config": {\n "name": "remove-bg"\n },\n "description": "Analyzes vehicle images for type, condition, and quality assessment",\n "name": "Car Quality Analysis"\n }\'', }, java: { method: 'savedExtensions().create', @@ -1455,22 +1434,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->create', example: - "savedExtensions->create(\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n);\n\nvar_dump($savedExtension);", + "savedExtensions->create(\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n);\n\nvar_dump($savedExtension);", }, python: { method: 'saved_extensions.create', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extension = client.saved_extensions.create(\n config={\n "name": "remove-bg"\n },\n description="Analyzes vehicle images for type, condition, and quality assessment",\n name="Car Quality Analysis",\n)\nprint(saved_extension.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extension = client.saved_extensions.create(\n config={\n "name": "remove-bg"\n },\n description="Analyzes vehicle images for type, condition, and quality assessment",\n name="Car Quality Analysis",\n)\nprint(saved_extension.id)', }, ruby: { method: 'saved_extensions.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extension = image_kit.saved_extensions.create(\n config: {name: :"remove-bg"},\n description: "Analyzes vehicle images for type, condition, and quality assessment",\n name: "Car Quality Analysis"\n)\n\nputs(saved_extension)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extension = image_kit.saved_extensions.create(\n config: {name: :"remove-bg"},\n description: "Analyzes vehicle images for type, condition, and quality assessment",\n name: "Car Quality Analysis"\n)\n\nputs(saved_extension)', }, typescript: { method: 'client.savedExtensions.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtension = await client.savedExtensions.create({\n config: { name: 'remove-bg' },\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n});\n\nconsole.log(savedExtension.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.create({\n config: { name: 'remove-bg' },\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n});\n\nconsole.log(savedExtension.id);", }, }, }, @@ -1490,8 +1469,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions get', - example: - "imagekit saved-extensions get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit saved-extensions get \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'SavedExtensions.Get', @@ -1501,11 +1479,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/saved-extensions/$ID', }, java: { method: 'savedExtensions().get', @@ -1515,22 +1492,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->get', example: - "savedExtensions->get('id');\n\nvar_dump($savedExtension);", + "savedExtensions->get('id');\n\nvar_dump($savedExtension);", }, python: { method: 'saved_extensions.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extension = client.saved_extensions.get(\n "id",\n)\nprint(saved_extension.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extension = client.saved_extensions.get(\n "id",\n)\nprint(saved_extension.id)', }, ruby: { method: 'saved_extensions.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extension = image_kit.saved_extensions.get("id")\n\nputs(saved_extension)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extension = image_kit.saved_extensions.get("id")\n\nputs(saved_extension)', }, typescript: { method: 'client.savedExtensions.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtension = await client.savedExtensions.get('id');\n\nconsole.log(savedExtension.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.get('id');\n\nconsole.log(savedExtension.id);", }, }, }, @@ -1556,8 +1533,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions update', - example: - "imagekit saved-extensions update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit saved-extensions update \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'SavedExtensions.Update', @@ -1567,11 +1543,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.SavedExtensionUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.SavedExtensionUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', }, http: { example: - "curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X PATCH \\\n -H 'Content-Type: application/json' \\\n -u \"$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS\" \\\n -d '{}'", + "curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X PATCH \\\n -H 'Content-Type: application/json' \\\n -d '{}'", }, java: { method: 'savedExtensions().update', @@ -1581,22 +1557,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->update', example: - "savedExtensions->update(\n 'id',\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'x',\n name: 'x',\n);\n\nvar_dump($savedExtension);", + "savedExtensions->update(\n 'id',\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'x',\n name: 'x',\n);\n\nvar_dump($savedExtension);", }, python: { method: 'saved_extensions.update', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extension = client.saved_extensions.update(\n id="id",\n)\nprint(saved_extension.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extension = client.saved_extensions.update(\n id="id",\n)\nprint(saved_extension.id)', }, ruby: { method: 'saved_extensions.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extension = image_kit.saved_extensions.update("id")\n\nputs(saved_extension)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extension = image_kit.saved_extensions.update("id")\n\nputs(saved_extension)', }, typescript: { method: 'client.savedExtensions.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtension = await client.savedExtensions.update('id');\n\nconsole.log(savedExtension.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.update('id');\n\nconsole.log(savedExtension.id);", }, }, }, @@ -1614,8 +1590,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions delete', - example: - "imagekit saved-extensions delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit saved-extensions delete \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'SavedExtensions.Delete', @@ -1625,11 +1600,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.SavedExtensions.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.SavedExtensions.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X DELETE', }, java: { method: 'savedExtensions().delete', @@ -1639,22 +1613,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->delete', example: - "savedExtensions->delete('id');\n\nvar_dump($result);", + "savedExtensions->delete('id');\n\nvar_dump($result);", }, python: { method: 'saved_extensions.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.saved_extensions.delete(\n "id",\n)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.saved_extensions.delete(\n "id",\n)', }, ruby: { method: 'saved_extensions.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.saved_extensions.delete("id")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.saved_extensions.delete("id")\n\nputs(result)', }, typescript: { method: 'client.savedExtensions.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.savedExtensions.delete('id');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.savedExtensions.delete('id');", }, }, }, @@ -1683,7 +1657,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'assets list', - example: "imagekit assets list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", + example: "imagekit assets list \\\n --private-key 'My Private Key'", }, csharp: { method: 'Assets.List', @@ -1693,11 +1667,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Assets.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tassets, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", assets)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tassets, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", assets)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files', }, java: { method: 'assets().list', @@ -1707,22 +1680,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'assets->list', example: - "assets->list(\n fileType: 'all',\n limit: 1,\n path: 'path',\n searchQuery: 'searchQuery',\n skip: 0,\n sort: 'ASC_NAME',\n type: 'file',\n);\n\nvar_dump($assets);", + "assets->list(\n fileType: 'all',\n limit: 1,\n path: 'path',\n searchQuery: 'searchQuery',\n skip: 0,\n sort: 'ASC_NAME',\n type: 'file',\n);\n\nvar_dump($assets);", }, python: { method: 'assets.list', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nassets = client.assets.list()\nprint(assets)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nassets = client.assets.list()\nprint(assets)', }, ruby: { method: 'assets.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nassets = image_kit.assets.list\n\nputs(assets)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nassets = image_kit.assets.list\n\nputs(assets)', }, typescript: { method: 'client.assets.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst assets = await client.assets.list();\n\nconsole.log(assets);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst assets = await client.assets.list();\n\nconsole.log(assets);", }, }, }, @@ -1743,7 +1716,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'invalidation create', example: - "imagekit cache:invalidation create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --url https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + "imagekit cache:invalidation create \\\n --private-key 'My Private Key' \\\n --url https://ik.imagekit.io/your_imagekit_id/default-image.jpg", }, csharp: { method: 'Cache.Invalidation.Create', @@ -1753,11 +1726,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Cache.Invalidation.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.New(context.TODO(), imagekit.CacheInvalidationNewParams{\n\t\tURL: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.RequestID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.New(context.TODO(), imagekit.CacheInvalidationNewParams{\n\t\tURL: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.RequestID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/purge \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg"\n }\'', + 'curl https://api.imagekit.io/v1/files/purge \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg"\n }\'', }, java: { method: 'cache().invalidation().create', @@ -1767,22 +1740,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'cache->invalidation->create', example: - "cache->invalidation->create(\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg'\n);\n\nvar_dump($invalidation);", + "cache->invalidation->create(\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg'\n);\n\nvar_dump($invalidation);", }, python: { method: 'cache.invalidation.create', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ninvalidation = client.cache.invalidation.create(\n url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n)\nprint(invalidation.request_id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\ninvalidation = client.cache.invalidation.create(\n url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n)\nprint(invalidation.request_id)', }, ruby: { method: 'cache.invalidation.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ninvalidation = image_kit.cache.invalidation.create(url: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg")\n\nputs(invalidation)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ninvalidation = image_kit.cache.invalidation.create(url: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg")\n\nputs(invalidation)', }, typescript: { method: 'client.cache.invalidation.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst invalidation = await client.cache.invalidation.create({\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg',\n});\n\nconsole.log(invalidation.requestId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst invalidation = await client.cache.invalidation.create({\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg',\n});\n\nconsole.log(invalidation.requestId);", }, }, }, @@ -1802,7 +1775,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'invalidation get', example: - "imagekit cache:invalidation get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --request-id requestId", + "imagekit cache:invalidation get \\\n --private-key 'My Private Key' \\\n --request-id requestId", }, csharp: { method: 'Cache.Invalidation.Get', @@ -1812,11 +1785,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Cache.Invalidation.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.Get(context.TODO(), "requestId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.Status)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.Get(context.TODO(), "requestId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.Status)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/files/purge/$REQUEST_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/files/purge/$REQUEST_ID', }, java: { method: 'cache().invalidation().get', @@ -1826,22 +1798,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'cache->invalidation->get', example: - "cache->invalidation->get('requestId');\n\nvar_dump($invalidation);", + "cache->invalidation->get('requestId');\n\nvar_dump($invalidation);", }, python: { method: 'cache.invalidation.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ninvalidation = client.cache.invalidation.get(\n "requestId",\n)\nprint(invalidation.status)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\ninvalidation = client.cache.invalidation.get(\n "requestId",\n)\nprint(invalidation.status)', }, ruby: { method: 'cache.invalidation.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ninvalidation = image_kit.cache.invalidation.get("requestId")\n\nputs(invalidation)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ninvalidation = image_kit.cache.invalidation.get("requestId")\n\nputs(invalidation)', }, typescript: { method: 'client.cache.invalidation.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst invalidation = await client.cache.invalidation.get('requestId');\n\nconsole.log(invalidation.status);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst invalidation = await client.cache.invalidation.get('requestId');\n\nconsole.log(invalidation.status);", }, }, }, @@ -1862,7 +1834,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders create', example: - "imagekit folders create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-name summer \\\n --parent-folder-path /product/images/", + "imagekit folders create \\\n --private-key 'My Private Key' \\\n --folder-name summer \\\n --parent-folder-path /product/images/", }, csharp: { method: 'Folders.Create', @@ -1872,11 +1844,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfolder, err := client.Folders.New(context.TODO(), imagekit.FolderNewParams{\n\t\tFolderName: "summer",\n\t\tParentFolderPath: "/product/images/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfolder, err := client.Folders.New(context.TODO(), imagekit.FolderNewParams{\n\t\tFolderName: "summer",\n\t\tParentFolderPath: "/product/images/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/folder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "folderName": "summer",\n "parentFolderPath": "/product/images/"\n }\'', + 'curl https://api.imagekit.io/v1/folder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "folderName": "summer",\n "parentFolderPath": "/product/images/"\n }\'', }, java: { method: 'folders().create', @@ -1886,22 +1858,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->create', example: - "folders->create(\n folderName: 'summer', parentFolderPath: '/product/images/'\n);\n\nvar_dump($folder);", + "folders->create(\n folderName: 'summer', parentFolderPath: '/product/images/'\n);\n\nvar_dump($folder);", }, python: { method: 'folders.create', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfolder = client.folders.create(\n folder_name="summer",\n parent_folder_path="/product/images/",\n)\nprint(folder)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfolder = client.folders.create(\n folder_name="summer",\n parent_folder_path="/product/images/",\n)\nprint(folder)', }, ruby: { method: 'folders.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfolder = image_kit.folders.create(folder_name: "summer", parent_folder_path: "/product/images/")\n\nputs(folder)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfolder = image_kit.folders.create(folder_name: "summer", parent_folder_path: "/product/images/")\n\nputs(folder)', }, typescript: { method: 'client.folders.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst folder = await client.folders.create({\n folderName: 'summer',\n parentFolderPath: '/product/images/',\n});\n\nconsole.log(folder);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst folder = await client.folders.create({\n folderName: 'summer',\n parentFolderPath: '/product/images/',\n});\n\nconsole.log(folder);", }, }, }, @@ -1922,7 +1894,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders delete', example: - "imagekit folders delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-path /folder/to/delete/", + "imagekit folders delete \\\n --private-key 'My Private Key' \\\n --folder-path /folder/to/delete/", }, csharp: { method: 'Folders.Delete', @@ -1932,11 +1904,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfolder, err := client.Folders.Delete(context.TODO(), imagekit.FolderDeleteParams{\n\t\tFolderPath: "/folder/to/delete/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfolder, err := client.Folders.Delete(context.TODO(), imagekit.FolderDeleteParams{\n\t\tFolderPath: "/folder/to/delete/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/folder \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/folder \\\n -X DELETE', }, java: { method: 'folders().delete', @@ -1946,22 +1917,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->delete', example: - "folders->delete(folderPath: '/folder/to/delete/');\n\nvar_dump($folder);", + "folders->delete(folderPath: '/folder/to/delete/');\n\nvar_dump($folder);", }, python: { method: 'folders.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfolder = client.folders.delete(\n folder_path="/folder/to/delete/",\n)\nprint(folder)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfolder = client.folders.delete(\n folder_path="/folder/to/delete/",\n)\nprint(folder)', }, ruby: { method: 'folders.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfolder = image_kit.folders.delete(folder_path: "/folder/to/delete/")\n\nputs(folder)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfolder = image_kit.folders.delete(folder_path: "/folder/to/delete/")\n\nputs(folder)', }, typescript: { method: 'client.folders.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst folder = await client.folders.delete({ folderPath: '/folder/to/delete/' });\n\nconsole.log(folder);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst folder = await client.folders.delete({ folderPath: '/folder/to/delete/' });\n\nconsole.log(folder);", }, }, }, @@ -1982,7 +1953,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders copy', example: - "imagekit folders copy \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", + "imagekit folders copy \\\n --private-key 'My Private Key' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", }, csharp: { method: 'Folders.Copy', @@ -1992,11 +1963,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Copy', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Folders.Copy(context.TODO(), imagekit.FolderCopyParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Folders.Copy(context.TODO(), imagekit.FolderCopyParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/bulkJobs/copyFolder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder",\n "includeVersions": true\n }\'', + 'curl https://api.imagekit.io/v1/bulkJobs/copyFolder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder",\n "includeVersions": true\n }\'', }, java: { method: 'folders().copy', @@ -2006,22 +1977,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->copy', example: - "folders->copy(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n includeVersions: true,\n);\n\nvar_dump($response);", + "folders->copy(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n includeVersions: true,\n);\n\nvar_dump($response);", }, python: { method: 'folders.copy', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.folders.copy(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.folders.copy(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', }, ruby: { method: 'folders.copy', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.folders.copy(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.folders.copy(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', }, typescript: { method: 'client.folders.copy', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.folders.copy({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.copy({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", }, }, }, @@ -2042,7 +2013,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders move', example: - "imagekit folders move \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", + "imagekit folders move \\\n --private-key 'My Private Key' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", }, csharp: { method: 'Folders.Move', @@ -2052,11 +2023,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Move', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Folders.Move(context.TODO(), imagekit.FolderMoveParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Folders.Move(context.TODO(), imagekit.FolderMoveParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/bulkJobs/moveFolder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder"\n }\'', + 'curl https://api.imagekit.io/v1/bulkJobs/moveFolder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder"\n }\'', }, java: { method: 'folders().move', @@ -2066,22 +2037,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->move', example: - "folders->move(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n);\n\nvar_dump($response);", + "folders->move(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n);\n\nvar_dump($response);", }, python: { method: 'folders.move', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.folders.move(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.folders.move(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', }, ruby: { method: 'folders.move', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.folders.move(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.folders.move(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', }, typescript: { method: 'client.folders.move', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.folders.move({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.move({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", }, }, }, @@ -2102,7 +2073,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders rename', example: - "imagekit folders rename \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-path /path/of/folder \\\n --new-folder-name new-folder-name", + "imagekit folders rename \\\n --private-key 'My Private Key' \\\n --folder-path /path/of/folder \\\n --new-folder-name new-folder-name", }, csharp: { method: 'Folders.Rename', @@ -2112,11 +2083,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Rename', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Folders.Rename(context.TODO(), imagekit.FolderRenameParams{\n\t\tFolderPath: "/path/of/folder",\n\t\tNewFolderName: "new-folder-name",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Folders.Rename(context.TODO(), imagekit.FolderRenameParams{\n\t\tFolderPath: "/path/of/folder",\n\t\tNewFolderName: "new-folder-name",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/bulkJobs/renameFolder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "folderPath": "/path/of/folder",\n "newFolderName": "new-folder-name",\n "purgeCache": true\n }\'', + 'curl https://api.imagekit.io/v1/bulkJobs/renameFolder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "folderPath": "/path/of/folder",\n "newFolderName": "new-folder-name",\n "purgeCache": true\n }\'', }, java: { method: 'folders().rename', @@ -2126,22 +2097,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->rename', example: - "folders->rename(\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n purgeCache: true,\n);\n\nvar_dump($response);", + "folders->rename(\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n purgeCache: true,\n);\n\nvar_dump($response);", }, python: { method: 'folders.rename', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.folders.rename(\n folder_path="/path/of/folder",\n new_folder_name="new-folder-name",\n)\nprint(response.job_id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.folders.rename(\n folder_path="/path/of/folder",\n new_folder_name="new-folder-name",\n)\nprint(response.job_id)', }, ruby: { method: 'folders.rename', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.folders.rename(folder_path: "/path/of/folder", new_folder_name: "new-folder-name")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.folders.rename(folder_path: "/path/of/folder", new_folder_name: "new-folder-name")\n\nputs(response)', }, typescript: { method: 'client.folders.rename', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.folders.rename({\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n});\n\nconsole.log(response.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.rename({\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n});\n\nconsole.log(response.jobId);", }, }, }, @@ -2161,8 +2132,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'job get', - example: - "imagekit folders:job get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --job-id jobId", + example: "imagekit folders:job get \\\n --private-key 'My Private Key' \\\n --job-id jobId", }, csharp: { method: 'Folders.Job.Get', @@ -2172,11 +2142,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Job.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tjob, err := client.Folders.Job.Get(context.TODO(), "jobId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", job.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tjob, err := client.Folders.Job.Get(context.TODO(), "jobId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", job.JobID)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/bulkJobs/$JOB_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/bulkJobs/$JOB_ID', }, java: { method: 'folders().job().get', @@ -2186,22 +2155,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->job->get', example: - "folders->job->get('jobId');\n\nvar_dump($job);", + "folders->job->get('jobId');\n\nvar_dump($job);", }, python: { method: 'folders.job.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\njob = client.folders.job.get(\n "jobId",\n)\nprint(job.job_id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\njob = client.folders.job.get(\n "jobId",\n)\nprint(job.job_id)', }, ruby: { method: 'folders.job.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\njob = image_kit.folders.job.get("jobId")\n\nputs(job)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\njob = image_kit.folders.job.get("jobId")\n\nputs(job)', }, typescript: { method: 'client.folders.job.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst job = await client.folders.job.get('jobId');\n\nconsole.log(job.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst job = await client.folders.job.get('jobId');\n\nconsole.log(job.jobId);", }, }, }, @@ -2223,7 +2192,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'usage get', example: - "imagekit accounts:usage get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --end-date \"'2019-12-27'\" \\\n --start-date \"'2019-12-27'\"", + "imagekit accounts:usage get \\\n --private-key 'My Private Key' \\\n --end-date \"'2019-12-27'\" \\\n --start-date \"'2019-12-27'\"", }, csharp: { method: 'Accounts.Usage.Get', @@ -2233,11 +2202,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Usage.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\t"time"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tusage, err := client.Accounts.Usage.Get(context.TODO(), imagekit.AccountUsageGetParams{\n\t\tEndDate: time.Now(),\n\t\tStartDate: time.Now(),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", usage.BandwidthBytes)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\t"time"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tusage, err := client.Accounts.Usage.Get(context.TODO(), imagekit.AccountUsageGetParams{\n\t\tEndDate: time.Now(),\n\t\tStartDate: time.Now(),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", usage.BandwidthBytes)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/accounts/usage \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/accounts/usage', }, java: { method: 'accounts().usage().get', @@ -2247,22 +2215,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->usage->get', example: - "accounts->usage->get(\n endDate: '2019-12-27', startDate: '2019-12-27'\n);\n\nvar_dump($usage);", + "accounts->usage->get(\n endDate: '2019-12-27', startDate: '2019-12-27'\n);\n\nvar_dump($usage);", }, python: { method: 'accounts.usage.get', example: - 'import os\nfrom datetime import date\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nusage = client.accounts.usage.get(\n end_date=date.fromisoformat("2019-12-27"),\n start_date=date.fromisoformat("2019-12-27"),\n)\nprint(usage.bandwidth_bytes)', + 'from datetime import date\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\nusage = client.accounts.usage.get(\n end_date=date.fromisoformat("2019-12-27"),\n start_date=date.fromisoformat("2019-12-27"),\n)\nprint(usage.bandwidth_bytes)', }, ruby: { method: 'accounts.usage.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nusage = image_kit.accounts.usage.get(end_date: "2019-12-27", start_date: "2019-12-27")\n\nputs(usage)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nusage = image_kit.accounts.usage.get(end_date: "2019-12-27", start_date: "2019-12-27")\n\nputs(usage)', }, typescript: { method: 'client.accounts.usage.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst usage = await client.accounts.usage.get({ endDate: '2019-12-27', startDate: '2019-12-27' });\n\nconsole.log(usage.bandwidthBytes);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst usage = await client.accounts.usage.get({ endDate: '2019-12-27', startDate: '2019-12-27' });\n\nconsole.log(usage.bandwidthBytes);", }, }, }, @@ -2281,8 +2249,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'origins list', - example: - "imagekit accounts:origins list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", + example: "imagekit accounts:origins list \\\n --private-key 'My Private Key'", }, csharp: { method: 'Accounts.Origins.List', @@ -2292,11 +2259,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponses, err := client.Accounts.Origins.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponses)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponses, err := client.Accounts.Origins.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponses)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/accounts/origins \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/accounts/origins', }, java: { method: 'accounts().origins().list', @@ -2306,22 +2272,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->list', example: - "accounts->origins->list();\n\nvar_dump($originResponses);", + "accounts->origins->list();\n\nvar_dump($originResponses);", }, python: { method: 'accounts.origins.list', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_responses = client.accounts.origins.list()\nprint(origin_responses)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_responses = client.accounts.origins.list()\nprint(origin_responses)', }, ruby: { method: 'accounts.origins.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_responses = image_kit.accounts.origins.list\n\nputs(origin_responses)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_responses = image_kit.accounts.origins.list\n\nputs(origin_responses)', }, typescript: { method: 'client.accounts.origins.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponses = await client.accounts.origins.list();\n\nconsole.log(originResponses);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponses = await client.accounts.origins.list();\n\nconsole.log(originResponses);", }, }, }, @@ -2342,7 +2308,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'origins create', example: - "imagekit accounts:origins create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", + "imagekit accounts:origins create \\\n --private-key 'My Private Key' \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", }, csharp: { method: 'Accounts.Origins.Create', @@ -2352,11 +2318,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.New(context.TODO(), imagekit.AccountOriginNewParams{\n\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\tBucket: "test-bucket",\n\t\t\t\tName: "My S3 Origin",\n\t\t\t\tSecretKey: "secrettest123",\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.New(context.TODO(), imagekit.AccountOriginNewParams{\n\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\tBucket: "test-bucket",\n\t\t\t\tName: "My S3 Origin",\n\t\t\t\tSecretKey: "secrettest123",\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/origins \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/origins \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', }, java: { method: 'accounts().origins().create', @@ -2366,22 +2332,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->create', example: - "accounts->origins->create(\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", + "accounts->origins->create(\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", }, python: { method: 'accounts.origins.create', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_response = client.accounts.origins.create(\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_response = client.accounts.origins.create(\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', }, ruby: { method: 'accounts.origins.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_response = image_kit.accounts.origins.create(\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_response = image_kit.accounts.origins.create(\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', }, typescript: { method: 'client.accounts.origins.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponse = await client.accounts.origins.create({\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponse = await client.accounts.origins.create({\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", }, }, }, @@ -2400,8 +2366,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'origins get', - example: - "imagekit accounts:origins get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit accounts:origins get \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'Accounts.Origins.Get', @@ -2411,11 +2376,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/accounts/origins/$ID', }, java: { method: 'accounts().origins().get', @@ -2425,22 +2389,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->get', example: - "accounts->origins->get('id');\n\nvar_dump($originResponse);", + "accounts->origins->get('id');\n\nvar_dump($originResponse);", }, python: { method: 'accounts.origins.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_response = client.accounts.origins.get(\n "id",\n)\nprint(origin_response)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_response = client.accounts.origins.get(\n "id",\n)\nprint(origin_response)', }, ruby: { method: 'accounts.origins.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_response = image_kit.accounts.origins.get("id")\n\nputs(origin_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_response = image_kit.accounts.origins.get("id")\n\nputs(origin_response)', }, typescript: { method: 'client.accounts.origins.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponse = await client.accounts.origins.get('id');\n\nconsole.log(originResponse);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponse = await client.accounts.origins.get('id');\n\nconsole.log(originResponse);", }, }, }, @@ -2462,7 +2426,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'origins update', example: - "imagekit accounts:origins update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", + "imagekit accounts:origins update \\\n --private-key 'My Private Key' \\\n --id id \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", }, csharp: { method: 'Accounts.Origins.Update', @@ -2472,11 +2436,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountOriginUpdateParams{\n\t\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\t\tBucket: "test-bucket",\n\t\t\t\t\tName: "My S3 Origin",\n\t\t\t\t\tSecretKey: "secrettest123",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountOriginUpdateParams{\n\t\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\t\tBucket: "test-bucket",\n\t\t\t\t\tName: "My S3 Origin",\n\t\t\t\t\tSecretKey: "secrettest123",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', }, java: { method: 'accounts().origins().update', @@ -2486,22 +2450,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->update', example: - "accounts->origins->update(\n 'id',\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", + "accounts->origins->update(\n 'id',\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", }, python: { method: 'accounts.origins.update', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_response = client.accounts.origins.update(\n id="id",\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_response = client.accounts.origins.update(\n id="id",\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', }, ruby: { method: 'accounts.origins.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_response = image_kit.accounts.origins.update(\n "id",\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_response = image_kit.accounts.origins.update(\n "id",\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', }, typescript: { method: 'client.accounts.origins.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponse = await client.accounts.origins.update('id', {\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponse = await client.accounts.origins.update('id', {\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", }, }, }, @@ -2520,8 +2484,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'origins delete', - example: - "imagekit accounts:origins delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit accounts:origins delete \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'Accounts.Origins.Delete', @@ -2531,11 +2494,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Accounts.Origins.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Accounts.Origins.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X DELETE', }, java: { method: 'accounts().origins().delete', @@ -2545,22 +2507,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->delete', example: - "accounts->origins->delete('id');\n\nvar_dump($result);", + "accounts->origins->delete('id');\n\nvar_dump($result);", }, python: { method: 'accounts.origins.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.accounts.origins.delete(\n "id",\n)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.accounts.origins.delete(\n "id",\n)', }, ruby: { method: 'accounts.origins.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.accounts.origins.delete("id")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.accounts.origins.delete("id")\n\nputs(result)', }, typescript: { method: 'client.accounts.origins.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.accounts.origins.delete('id');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.accounts.origins.delete('id');", }, }, }, @@ -2580,8 +2542,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'urlEndpoints list', - example: - "imagekit accounts:url-endpoints list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", + example: "imagekit accounts:url-endpoints list \\\n --private-key 'My Private Key'", }, csharp: { method: 'Accounts.UrlEndpoints.List', @@ -2591,11 +2552,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponses, err := client.Accounts.URLEndpoints.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponses)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponses, err := client.Accounts.URLEndpoints.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponses)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/accounts/url-endpoints \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints', }, java: { method: 'accounts().urlEndpoints().list', @@ -2605,22 +2565,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->list', example: - "accounts->urlEndpoints->list();\n\nvar_dump($urlEndpointResponses);", + "accounts->urlEndpoints->list();\n\nvar_dump($urlEndpointResponses);", }, python: { method: 'accounts.url_endpoints.list', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_responses = client.accounts.url_endpoints.list()\nprint(url_endpoint_responses)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_responses = client.accounts.url_endpoints.list()\nprint(url_endpoint_responses)', }, ruby: { method: 'accounts.url_endpoints.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_responses = image_kit.accounts.url_endpoints.list\n\nputs(url_endpoint_responses)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_responses = image_kit.accounts.url_endpoints.list\n\nputs(url_endpoint_responses)', }, typescript: { method: 'client.accounts.urlEndpoints.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponses = await client.accounts.urlEndpoints.list();\n\nconsole.log(urlEndpointResponses);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponses = await client.accounts.urlEndpoints.list();\n\nconsole.log(urlEndpointResponses);", }, }, }, @@ -2647,7 +2607,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'urlEndpoints create', example: - "imagekit accounts:url-endpoints create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --description 'My custom URL endpoint'", + "imagekit accounts:url-endpoints create \\\n --private-key 'My Private Key' \\\n --description 'My custom URL endpoint'", }, csharp: { method: 'Accounts.UrlEndpoints.Create', @@ -2657,11 +2617,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.New(context.TODO(), imagekit.AccountURLEndpointNewParams{\n\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\tDescription: "My custom URL endpoint",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.New(context.TODO(), imagekit.AccountURLEndpointNewParams{\n\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\tDescription: "My custom URL endpoint",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/url-endpoints \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/url-endpoints \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', }, java: { method: 'accounts().urlEndpoints().create', @@ -2671,22 +2631,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->create', example: - "accounts->urlEndpoints->create(\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", + "accounts->urlEndpoints->create(\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", }, python: { method: 'accounts.url_endpoints.create', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_response = client.accounts.url_endpoints.create(\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_response = client.accounts.url_endpoints.create(\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', }, ruby: { method: 'accounts.url_endpoints.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.create(description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.create(description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', }, typescript: { method: 'client.accounts.urlEndpoints.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.create({\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.create({\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", }, }, }, @@ -2707,8 +2667,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'urlEndpoints get', - example: - "imagekit accounts:url-endpoints get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit accounts:url-endpoints get \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'Accounts.UrlEndpoints.Get', @@ -2718,11 +2677,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID', }, java: { method: 'accounts().urlEndpoints().get', @@ -2732,22 +2690,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->get', example: - "accounts->urlEndpoints->get('id');\n\nvar_dump($urlEndpointResponse);", + "accounts->urlEndpoints->get('id');\n\nvar_dump($urlEndpointResponse);", }, python: { method: 'accounts.url_endpoints.get', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_response = client.accounts.url_endpoints.get(\n "id",\n)\nprint(url_endpoint_response.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_response = client.accounts.url_endpoints.get(\n "id",\n)\nprint(url_endpoint_response.id)', }, ruby: { method: 'accounts.url_endpoints.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.get("id")\n\nputs(url_endpoint_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.get("id")\n\nputs(url_endpoint_response)', }, typescript: { method: 'client.accounts.urlEndpoints.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.get('id');\n\nconsole.log(urlEndpointResponse.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.get('id');\n\nconsole.log(urlEndpointResponse.id);", }, }, }, @@ -2775,7 +2733,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'urlEndpoints update', example: - "imagekit accounts:url-endpoints update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id \\\n --description 'My custom URL endpoint'", + "imagekit accounts:url-endpoints update \\\n --private-key 'My Private Key' \\\n --id id \\\n --description 'My custom URL endpoint'", }, csharp: { method: 'Accounts.UrlEndpoints.Update', @@ -2785,11 +2743,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountURLEndpointUpdateParams{\n\t\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\t\tDescription: "My custom URL endpoint",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountURLEndpointUpdateParams{\n\t\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\t\tDescription: "My custom URL endpoint",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', }, java: { method: 'accounts().urlEndpoints().update', @@ -2799,22 +2757,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->update', example: - "accounts->urlEndpoints->update(\n 'id',\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", + "accounts->urlEndpoints->update(\n 'id',\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", }, python: { method: 'accounts.url_endpoints.update', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_response = client.accounts.url_endpoints.update(\n id="id",\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_response = client.accounts.url_endpoints.update(\n id="id",\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', }, ruby: { method: 'accounts.url_endpoints.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.update("id", description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.update("id", description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', }, typescript: { method: 'client.accounts.urlEndpoints.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.update('id', {\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.update('id', {\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", }, }, }, @@ -2833,8 +2791,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'urlEndpoints delete', - example: - "imagekit accounts:url-endpoints delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", + example: "imagekit accounts:url-endpoints delete \\\n --private-key 'My Private Key' \\\n --id id", }, csharp: { method: 'Accounts.UrlEndpoints.Delete', @@ -2844,11 +2801,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Accounts.URLEndpoints.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Accounts.URLEndpoints.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: - 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', + example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X DELETE', }, java: { method: 'accounts().urlEndpoints().delete', @@ -2858,22 +2814,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->delete', example: - "accounts->urlEndpoints->delete('id');\n\nvar_dump($result);", + "accounts->urlEndpoints->delete('id');\n\nvar_dump($result);", }, python: { method: 'accounts.url_endpoints.delete', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.accounts.url_endpoints.delete(\n "id",\n)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.accounts.url_endpoints.delete(\n "id",\n)', }, ruby: { method: 'accounts.url_endpoints.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.accounts.url_endpoints.delete("id")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.accounts.url_endpoints.delete("id")\n\nputs(result)', }, typescript: { method: 'client.accounts.urlEndpoints.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.accounts.urlEndpoints.delete('id');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.accounts.urlEndpoints.delete('id');", }, }, }, @@ -2916,7 +2872,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files upload', example: - "imagekit beta:v2:files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name fileName", + "imagekit beta:v2:files upload \\\n --private-key 'My Private Key' \\\n --file 'Example data' \\\n --file-name fileName", }, csharp: { method: 'Beta.V2.Files.Upload', @@ -2926,11 +2882,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Beta.V2.Files.Upload', example: - 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Beta.V2.Files.Upload(context.TODO(), imagekit.BetaV2FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Beta.V2.Files.Upload(context.TODO(), imagekit.BetaV2FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', }, http: { example: - 'curl https://upload.imagekit.io/api/v2/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', + 'curl https://upload.imagekit.io/api/v2/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', }, java: { method: 'beta().v2().files().upload', @@ -2940,22 +2896,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'beta->v2->files->upload', example: - "beta->v2->files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", + "beta->v2->files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", }, python: { method: 'beta.v2.files.upload', example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.beta.v2.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', + 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.beta.v2.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', }, ruby: { method: 'beta.v2.files.upload', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.beta.v2.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.beta.v2.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', }, typescript: { method: 'client.beta.v2.files.upload', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.beta.v2.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.beta.v2.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", }, }, }, @@ -2969,8 +2925,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.webhooks.unwrap', perLanguage: { cli: { - example: - "imagekit webhooks unwrap \\\n --private-key 'My Private Key' \\\n --password 'My Password'", + example: "imagekit webhooks unwrap \\\n --private-key 'My Private Key'", }, csharp: { example: 'WebhookUnwrapParams parameters = new();\n\nawait client.Webhooks.Unwrap(parameters);', @@ -2978,7 +2933,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Webhooks.Unwrap', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Webhooks.Unwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Webhooks.Unwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, java: { example: @@ -2987,22 +2942,21 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'webhooks->unwrap', example: - "webhooks->unwrap();\n\nvar_dump($result);", + "webhooks->unwrap();\n\nvar_dump($result);", }, python: { method: 'webhooks.unwrap', - example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.webhooks.unwrap()', + example: 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.webhooks.unwrap()', }, ruby: { method: 'webhooks.unwrap', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.webhooks.unwrap\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.webhooks.unwrap\n\nputs(result)', }, typescript: { method: 'client.webhooks.unwrap', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.webhooks.unwrap();", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.webhooks.unwrap();", }, }, }, @@ -3016,8 +2970,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.webhooks.unsafeUnwrap', perLanguage: { cli: { - example: - "imagekit webhooks unsafe-unwrap \\\n --private-key 'My Private Key' \\\n --password 'My Password'", + example: "imagekit webhooks unsafe-unwrap \\\n --private-key 'My Private Key'", }, csharp: { example: @@ -3026,7 +2979,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Webhooks.UnsafeUnwrap', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Webhooks.UnsafeUnwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Webhooks.UnsafeUnwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, java: { example: @@ -3035,22 +2988,21 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'webhooks->unsafeUnwrap', example: - "webhooks->unsafeUnwrap();\n\nvar_dump($result);", + "webhooks->unsafeUnwrap();\n\nvar_dump($result);", }, python: { method: 'webhooks.unsafe_unwrap', - example: - 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.webhooks.unsafe_unwrap()', + example: 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.webhooks.unsafe_unwrap()', }, ruby: { method: 'webhooks.unsafe_unwrap', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.webhooks.unsafe_unwrap\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.webhooks.unsafe_unwrap\n\nputs(result)', }, typescript: { method: 'client.webhooks.unsafeUnwrap', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.webhooks.unsafeUnwrap();", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.webhooks.unsafeUnwrap();", }, }, }, @@ -3060,12 +3012,12 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ { language: 'python', content: - '# Image Kit Python API library\n\n\n[![PyPI version](https://img.shields.io/pypi/v/imagekitio.svg?label=pypi%20(stable))](https://pypi.org/project/imagekitio/)\n\nThe Image Kit Python library provides convenient access to the Image Kit REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install imagekitio\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\n\nresponse = client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.video_codec)\n```\n\nWhile you can provide a `private_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `IMAGEKIT_PRIVATE_KEY="My Private Key"` to your `.env` file\nso that your Private Key is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncImageKit` instead of `ImageKit` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom imagekitio import AsyncImageKit\n\nclient = AsyncImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install imagekitio[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom imagekitio import DefaultAioHttpClient\nfrom imagekitio import AsyncImageKit\n\nasync def main() -> None:\n async with AsyncImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\n\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n transformation={\n "post": [{\n "type": "thumbnail",\n "value": "w-150,h-150",\n }, {\n "protocol": "dash",\n "type": "abs",\n "value": "sr-240_360_480_720_1080",\n }]\n },\n)\nprint(response.transformation)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\n\nclient.files.upload(\n file=Path("/path/to/file"),\n file_name="fileName",\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `imagekitio.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `imagekitio.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `imagekitio.APIError`.\n\n```python\nimport imagekitio\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\n\ntry:\n client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\nexcept imagekitio.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept imagekitio.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept imagekitio.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = ImageKit(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `IMAGE_KIT_LOG` to `info`.\n\n```shell\n$ export IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.with_raw_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nfile = response.parse() # get the object that `files.upload()` would have returned\nprint(file.video_codec)\n```\n\nThese methods return an [`APIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.files.with_streaming_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom imagekitio import ImageKit, DefaultHttpxClient\n\nclient = ImageKit(\n # Or use the `IMAGE_KIT_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom imagekitio import ImageKit\n\nwith ImageKit() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport imagekitio\nprint(imagekitio.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', + '# Image Kit Python API library\n\n\n[![PyPI version](https://img.shields.io/pypi/v/imagekitio.svg?label=pypi%20(stable))](https://pypi.org/project/imagekitio/)\n\nThe Image Kit Python library provides convenient access to the Image Kit REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install imagekitio\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\nresponse = client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.video_codec)\n```\n\n\n\n## Async usage\n\nSimply import `AsyncImageKit` instead of `ImageKit` and use `await` with each API call:\n\n```python\nimport asyncio\nfrom imagekitio import AsyncImageKit\n\nclient = AsyncImageKit(\n private_key="My Private Key",\n)\n\nasync def main() -> None:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install imagekitio[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport asyncio\nfrom imagekitio import DefaultAioHttpClient\nfrom imagekitio import AsyncImageKit\n\nasync def main() -> None:\n async with AsyncImageKit(\n private_key="My Private Key",\n http_client=DefaultAioHttpClient(),\n) as client:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n transformation={\n "post": [{\n "type": "thumbnail",\n "value": "w-150,h-150",\n }, {\n "protocol": "dash",\n "type": "abs",\n "value": "sr-240_360_480_720_1080",\n }]\n },\n)\nprint(response.transformation)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\nclient.files.upload(\n file=Path("/path/to/file"),\n file_name="fileName",\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `imagekitio.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `imagekitio.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `imagekitio.APIError`.\n\n```python\nimport imagekitio\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\ntry:\n client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\nexcept imagekitio.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept imagekitio.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept imagekitio.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n private_key="My Private Key",\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n private_key="My Private Key",\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = ImageKit(\n private_key="My Private Key",\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `IMAGE_KIT_LOG` to `info`.\n\n```shell\n$ export IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\nresponse = client.files.with_raw_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nfile = response.parse() # get the object that `files.upload()` would have returned\nprint(file.video_codec)\n```\n\nThese methods return an [`APIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.files.with_streaming_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom imagekitio import ImageKit, DefaultHttpxClient\n\nclient = ImageKit(\n private_key="My Private Key",\n # Or use the `IMAGE_KIT_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom imagekitio import ImageKit\n\nwith ImageKit(\n private_key="My Private Key",\n) as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport imagekitio\nprint(imagekitio.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', }, { language: 'go', content: - '# Image Kit Go API Library\n\nGo Reference\n\nThe Image Kit Go library provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference)\nfrom applications written in Go.\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n\n\n```go\nimport (\n\t"github.com/imagekit-developer/imagekit-go" // imported as SDK_PackageName\n)\n```\n\n\n\nOr to pin the version:\n\n\n\n```sh\ngo get -u \'github.com/imagekit-developer/imagekit-go@v0.0.1\'\n```\n\n\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"), // defaults to os.LookupEnv("IMAGEKIT_PRIVATE_KEY")\n\t\toption.WithPassword("My Password"), // defaults to os.LookupEnv("OPTIONAL_IMAGEKIT_IGNORES_THIS")\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Files.Upload(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/imagekit-developer/imagekit-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\tFileName: "file-name.jpg",\n})\nif err != nil {\n\tvar apierr *imagekit.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/api/v1/files/upload": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Files.Upload(\n\tctx,\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("/path/to/file")\nimagekit.FileUploadParams{\n\tFile: file,\n\tFileName: "fileName",\n}\n\n// A file from a string\nimagekit.FileUploadParams{\n\tFile: strings.NewReader("my file contents"),\n\tFileName: "fileName",\n}\n\n// With a custom filename and contentType\nimagekit.FileUploadParams{\n\tFile: imagekit.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n\tFileName: "fileName",\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := imagekit.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\nresponse, err := client.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", response)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', + '# Image Kit Go API Library\n\nGo Reference\n\nThe Image Kit Go library provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference)\nfrom applications written in Go.\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n\n\n```go\nimport (\n\t"github.com/imagekit-developer/imagekit-go" // imported as SDK_PackageName\n)\n```\n\n\n\nOr to pin the version:\n\n\n\n```sh\ngo get -u \'github.com/imagekit-developer/imagekit-go@v0.0.1\'\n```\n\n\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"), // defaults to os.LookupEnv("IMAGEKIT_PRIVATE_KEY")\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Files.Upload(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/imagekit-developer/imagekit-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\tFileName: "file-name.jpg",\n})\nif err != nil {\n\tvar apierr *imagekit.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/api/v1/files/upload": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Files.Upload(\n\tctx,\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("/path/to/file")\nimagekit.FileUploadParams{\n\tFile: file,\n\tFileName: "fileName",\n}\n\n// A file from a string\nimagekit.FileUploadParams{\n\tFile: strings.NewReader("my file contents"),\n\tFileName: "fileName",\n}\n\n// With a custom filename and contentType\nimagekit.FileUploadParams{\n\tFile: imagekit.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n\tFileName: "fileName",\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := imagekit.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\nresponse, err := client.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", response)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', }, { language: 'terraform', @@ -3075,17 +3027,17 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ { language: 'typescript', content: - "# Image Kit TypeScript API Library\n\n[![NPM version](https://img.shields.io/npm/v/@imagekit/nodejs.svg?label=npm%20(stable))](https://npmjs.org/package/@imagekit/nodejs) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@imagekit/nodejs)\n\nThis library provides convenient access to the Image Kit REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install @imagekit/nodejs\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\n```js\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n});\n\nconsole.log(response.videoCodec);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst params: ImageKit.FileUploadParams = {\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n};\nconst response: ImageKit.FileUploadResponse = await client.files.upload(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport ImageKit, { toFile } from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.files.upload({ file: fs.createReadStream('/path/to/file'), fileName: 'fileName' });\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.files.upload({ file: new File(['my bytes'], 'file'), fileName: 'fileName' });\n\n// You can also pass a `fetch` `Response`:\nawait client.files.upload({ file: await fetch('https://somesite/file'), fileName: 'fileName' });\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.files.upload({\n file: await toFile(Buffer.from('my bytes'), 'file'),\n fileName: 'fileName',\n});\nawait client.files.upload({\n file: await toFile(new Uint8Array([0, 1, 2]), 'file'),\n fileName: 'fileName',\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\n```ts\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .catch(async (err) => {\n if (err instanceof ImageKit.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\n```js\n// Configure the default for all requests:\nconst client = new ImageKit({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\n```ts\n// Configure the default for all requests:\nconst client = new ImageKit({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\n```ts\nconst client = new ImageKit();\n\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: response, response: raw } = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(response.videoCodec);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `IMAGE_KIT_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new ImageKit({\n logger: logger.child({ name: 'ImageKit' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.files.upload({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport fetch from 'my-fetch';\n\nconst client = new ImageKit({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new ImageKit({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n **Bun** [[docs](https://bun.sh/guides/http/proxy)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\n\n```ts\nimport ImageKit from 'npm:@imagekit/nodejs';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new ImageKit({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-nodejs/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n", + "# Image Kit TypeScript API Library\n\n[![NPM version](https://img.shields.io/npm/v/@imagekit/nodejs.svg?label=npm%20(stable))](https://npmjs.org/package/@imagekit/nodejs) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@imagekit/nodejs)\n\nThis library provides convenient access to the Image Kit REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install @imagekit/nodejs\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\n```js\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n});\n\nconsole.log(response.videoCodec);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst params: ImageKit.FileUploadParams = {\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n};\nconst response: ImageKit.FileUploadResponse = await client.files.upload(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport ImageKit, { toFile } from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.files.upload({ file: fs.createReadStream('/path/to/file'), fileName: 'fileName' });\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.files.upload({ file: new File(['my bytes'], 'file'), fileName: 'fileName' });\n\n// You can also pass a `fetch` `Response`:\nawait client.files.upload({ file: await fetch('https://somesite/file'), fileName: 'fileName' });\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.files.upload({\n file: await toFile(Buffer.from('my bytes'), 'file'),\n fileName: 'fileName',\n});\nawait client.files.upload({\n file: await toFile(new Uint8Array([0, 1, 2]), 'file'),\n fileName: 'fileName',\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\n```ts\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .catch(async (err) => {\n if (err instanceof ImageKit.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\n```js\n// Configure the default for all requests:\nconst client = new ImageKit({\n privateKey: 'My Private Key',\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\n```ts\n// Configure the default for all requests:\nconst client = new ImageKit({\n privateKey: 'My Private Key',\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\n```ts\nconst client = new ImageKit();\n\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: response, response: raw } = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(response.videoCodec);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `IMAGE_KIT_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new ImageKit({\n logger: logger.child({ name: 'ImageKit' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.files.upload({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport fetch from 'my-fetch';\n\nconst client = new ImageKit({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new ImageKit({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n **Bun** [[docs](https://bun.sh/guides/http/proxy)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\n\n```ts\nimport ImageKit from 'npm:@imagekit/nodejs';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new ImageKit({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-nodejs/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n", }, { language: 'ruby', content: - '# Image Kit Ruby API library\n\nThe Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/imagekit-developer/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekitio).\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n\n\n```ruby\ngem "imagekitio", "~> 0.0.1"\n```\n\n\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "imagekitio"\n\nimage_kit = Imagekitio::Client.new(\n private_key: ENV["IMAGEKIT_PRIVATE_KEY"], # This is the default and can be omitted\n password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted\n)\n\nresponse = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\nputs(response.videoCodec)\n```\n\n\n\n\n\n### File uploads\n\nRequest parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.\n\n```ruby\nrequire "pathname"\n\n# Use `Pathname` to send the filename and/or avoid paging a large file into memory:\nresponse = image_kit.files.upload(file: Pathname("/path/to/file"))\n\n# Alternatively, pass file contents or a `StringIO` directly:\nresponse = image_kit.files.upload(file: File.read("/path/to/file"))\n\n# Or, to control the filename and/or content type:\nfile = Imagekitio::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")\nresponse = image_kit.files.upload(file: file)\n\nputs(response.videoCodec)\n```\n\nNote that you can also pass a raw `IO` descriptor, but this disables retries, as the library can\'t be sure if the descriptor is a file or pipe (which cannot be rewound).\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Imagekitio::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n file = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n )\nrescue Imagekitio::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue Imagekitio::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue Imagekitio::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {max_retries: 5}\n)\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n timeout: nil # default is 60\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {timeout: 5}\n)\n```\n\nOn timeout, `Imagekitio::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `Imagekitio::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\nresponse =\n image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(response[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `Imagekitio::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `Imagekitio::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\n# You can also splat a full Params class:\nparams = Imagekitio::FileUploadParams.new(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\nimage_kit.files.upload(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :all\nputs(Imagekitio::AssetListParams::FileType::ALL)\n\n# Revealed type: `T.all(Imagekitio::AssetListParams::FileType, Symbol)`\nT.reveal_type(Imagekitio::AssetListParams::FileType::ALL)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nimage_kit.assets.list(\n file_type: Imagekitio::AssetListParams::FileType::ALL,\n # …\n)\n\n# Literal values are also permissible:\nimage_kit.assets.list(\n file_type: :all,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/imagekit-developer/imagekit-ruby/tree/master/CONTRIBUTING.md).\n', + '# Image Kit Ruby API library\n\nThe Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/imagekit-developer/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekitio).\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n\n\n```ruby\ngem "imagekitio", "~> 0.0.1"\n```\n\n\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\nputs(response.videoCodec)\n```\n\n\n\n\n\n### File uploads\n\nRequest parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.\n\n```ruby\nrequire "pathname"\n\n# Use `Pathname` to send the filename and/or avoid paging a large file into memory:\nresponse = image_kit.files.upload(file: Pathname("/path/to/file"))\n\n# Alternatively, pass file contents or a `StringIO` directly:\nresponse = image_kit.files.upload(file: File.read("/path/to/file"))\n\n# Or, to control the filename and/or content type:\nfile = Imagekitio::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")\nresponse = image_kit.files.upload(file: file)\n\nputs(response.videoCodec)\n```\n\nNote that you can also pass a raw `IO` descriptor, but this disables retries, as the library can\'t be sure if the descriptor is a file or pipe (which cannot be rewound).\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Imagekitio::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n file = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n )\nrescue Imagekitio::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue Imagekitio::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue Imagekitio::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n max_retries: 0, # default is 2\n private_key: "My Private Key"\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {max_retries: 5}\n)\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n timeout: nil, # default is 60\n private_key: "My Private Key"\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {timeout: 5}\n)\n```\n\nOn timeout, `Imagekitio::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `Imagekitio::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\nresponse =\n image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(response[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `Imagekitio::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `Imagekitio::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\n# You can also splat a full Params class:\nparams = Imagekitio::FileUploadParams.new(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\nimage_kit.files.upload(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :all\nputs(Imagekitio::AssetListParams::FileType::ALL)\n\n# Revealed type: `T.all(Imagekitio::AssetListParams::FileType, Symbol)`\nT.reveal_type(Imagekitio::AssetListParams::FileType::ALL)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nimage_kit.assets.list(\n file_type: Imagekitio::AssetListParams::FileType::ALL,\n # …\n)\n\n# Literal values are also permissible:\nimage_kit.assets.list(\n file_type: :all,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/imagekit-developer/imagekit-ruby/tree/master/CONTRIBUTING.md).\n', }, { language: 'java', content: - '# Image Kit Java API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.imagekit.api/image-kit-java)](https://central.sonatype.com/artifact/com.imagekit.api/image-kit-java/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.imagekit.api/image-kit-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1)\n\n\nThe Image Kit Java SDK provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference) from applications written in Java.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1).\n\n## Installation\n\n### Gradle\n\n~~~kotlin\nimplementation("com.imagekit.api:image-kit-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.imagekit.api\n image-kit-java\n 0.0.1\n\n~~~\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .privateKey("My Private Key")\n .password("My Password")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n // Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n // Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\n .fromEnv()\n .privateKey("My Private Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------------- | -------------------------------------- | -------------------------------- | -------- | --------------------------- |\n| `privateKey` | `imagekit.imagekitPrivateKey` | `IMAGEKIT_PRIVATE_KEY` | true | - |\n| `password` | `imagekit.optionalImagekitIgnoresThis` | `OPTIONAL_IMAGEKIT_IGNORES_THIS` | false | `"do_not_set"` |\n| `webhookSecret` | `imagekit.imagekitWebhookSecret` | `IMAGEKIT_WEBHOOK_SECRET` | false | - |\n| `baseUrl` | `imagekit.baseUrl` | `IMAGE_KIT_BASE_URL` | true | `"https://api.imagekit.io"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\n\nImageKitClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Image Kit API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.files().upload(...)` should be called with an instance of `FileUploadParams`, and it will return an instance of `FileUploadResponse`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.async().files().upload(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.imagekit.api.client.ImageKitClientAsync;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClientAsync;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClientAsync client = ImageKitOkHttpClientAsync.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.files().upload(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.nio.file.Paths;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(Paths.get("/path/to/file"))\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file("content".getBytes())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.MultipartField;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.InputStream;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(MultipartField.builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.imagekit.api.core.http.Headers;\nimport com.imagekit.api.core.http.HttpResponseFor;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nHttpResponseFor response = client.files().withRawResponse().upload(params);\n\nint statusCode = response.statusCode();\nHeaders headers = response.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse parsedResponse = response.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ImageKitServiceException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ImageKitIoException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitIoException.kt): I/O networking errors.\n\n- [`ImageKitRetryableException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ImageKitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `IMAGE_KIT_LOG` environment variable to `info`:\n\n```sh\nexport IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport IMAGE_KIT_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `image-kit-java-core` is published with a [configuration file](image-kit-java-core/src/main/resources/META-INF/proguard/image-kit-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `image-kit-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClient.kt), [`ImageKitClientAsync`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsync.kt), [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt), and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), all of which can work with any HTTP client\n- `image-kit-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) and [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), which provide a way to construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), respectively, using OkHttp\n- `image-kit-java`\n - Depends on and exposes the APIs of both `image-kit-java-core` and `image-kit-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Copy `image-kit-java-client-okhttp`\'s [`OkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Write a class that implements the [`HttpClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/http/HttpClient.kt) interface\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .transformation(FileUploadParams.Transformation.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) object to its setter:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(JsonValue.from(42))\n .fileName("file-name.jpg")\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.JsonMissing;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.Map;\n\nMap additionalProperties = client.files().upload(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.imagekit.api.core.JsonField;\nimport java.io.InputStream;\nimport java.util.Optional;\n\nJsonField file = client.files().upload(params)._file();\n\nif (file.isMissing()) {\n // The property is absent from the JSON response\n} else if (file.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional jsonString = file.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = file.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/imagekit-java/issues) with questions, bugs, or suggestions.\n', + '# Image Kit Java API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.imagekit.api/image-kit-java)](https://central.sonatype.com/artifact/com.imagekit.api/image-kit-java/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.imagekit.api/image-kit-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1)\n\n\nThe Image Kit Java SDK provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference) from applications written in Java.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1).\n\n## Installation\n\n### Gradle\n\n~~~kotlin\nimplementation("com.imagekit.api:image-kit-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.imagekit.api\n image-kit-java\n 0.0.1\n\n~~~\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .privateKey("My Private Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n // Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n // Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\n .fromEnv()\n .privateKey("My Private Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------------- | -------------------------------------- | -------------------------------- | -------- | --------------------------- |\n| `privateKey` | `imagekit.imagekitPrivateKey` | `IMAGEKIT_PRIVATE_KEY` | true | - |\n| `password` | `imagekit.optionalImagekitIgnoresThis` | `OPTIONAL_IMAGEKIT_IGNORES_THIS` | false | `"do_not_set"` |\n| `webhookSecret` | `imagekit.imagekitWebhookSecret` | `IMAGEKIT_WEBHOOK_SECRET` | false | - |\n| `baseUrl` | `imagekit.baseUrl` | `IMAGE_KIT_BASE_URL` | true | `"https://api.imagekit.io"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\n\nImageKitClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Image Kit API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.files().upload(...)` should be called with an instance of `FileUploadParams`, and it will return an instance of `FileUploadResponse`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.async().files().upload(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.imagekit.api.client.ImageKitClientAsync;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClientAsync;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClientAsync client = ImageKitOkHttpClientAsync.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.files().upload(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.nio.file.Paths;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(Paths.get("/path/to/file"))\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file("content".getBytes())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.MultipartField;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.InputStream;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(MultipartField.builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.imagekit.api.core.http.Headers;\nimport com.imagekit.api.core.http.HttpResponseFor;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nHttpResponseFor response = client.files().withRawResponse().upload(params);\n\nint statusCode = response.statusCode();\nHeaders headers = response.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse parsedResponse = response.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ImageKitServiceException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ImageKitIoException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitIoException.kt): I/O networking errors.\n\n- [`ImageKitRetryableException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ImageKitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `IMAGE_KIT_LOG` environment variable to `info`:\n\n```sh\nexport IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport IMAGE_KIT_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `image-kit-java-core` is published with a [configuration file](image-kit-java-core/src/main/resources/META-INF/proguard/image-kit-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `image-kit-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClient.kt), [`ImageKitClientAsync`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsync.kt), [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt), and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), all of which can work with any HTTP client\n- `image-kit-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) and [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), which provide a way to construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), respectively, using OkHttp\n- `image-kit-java`\n - Depends on and exposes the APIs of both `image-kit-java-core` and `image-kit-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Copy `image-kit-java-client-okhttp`\'s [`OkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Write a class that implements the [`HttpClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/http/HttpClient.kt) interface\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .transformation(FileUploadParams.Transformation.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) object to its setter:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(JsonValue.from(42))\n .fileName("file-name.jpg")\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.JsonMissing;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.Map;\n\nMap additionalProperties = client.files().upload(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.imagekit.api.core.JsonField;\nimport java.io.InputStream;\nimport java.util.Optional;\n\nJsonField file = client.files().upload(params)._file();\n\nif (file.isMissing()) {\n // The property is absent from the JSON response\n} else if (file.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional jsonString = file.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = file.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/imagekit-java/issues) with questions, bugs, or suggestions.\n', }, { language: 'csharp', @@ -3095,12 +3047,12 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ { language: 'cli', content: - "# Image Kit CLI\n\nThe official CLI for the [Image Kit REST API](https://imagekit.io/docs/api-reference).\n\n## Installation\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https://go.dev/doc/install) version 1.22 or later installed.\n\n~~~sh\ngo install 'github.com/stainless-sdks/imagekit-cli/cmd/imagekit@latest'\n~~~\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME/go/bin` (or `$GOPATH/bin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n~~~sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)/bin\"\n~~~\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts/run` script to run the tool locally:\n\n~~~sh\n./scripts/run args...\n~~~\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n~~~sh\nimagekit [resource] [flags...]\n~~~\n\n~~~sh\nimagekit files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name file-name.jpg\n~~~\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable | Description | Required | Default value |\n| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------- |\n| `IMAGEKIT_PRIVATE_KEY` | Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n | yes | |\n| `OPTIONAL_IMAGEKIT_IGNORES_THIS` | ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n | no | `\"do_not_set\"` |\n| `IMAGEKIT_WEBHOOK_SECRET` | Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n | no | `null` |\n\n### Global flags\n\n- `--private-key` - Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n (can also be set with `IMAGEKIT_PRIVATE_KEY` env var)\n- `--password` - ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n (can also be set with `OPTIONAL_IMAGEKIT_IGNORES_THIS` env var)\n- `--webhook-secret` - Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n (can also be set with `IMAGEKIT_WEBHOOK_SECRET` env var)\n- `--help` - Show command line usage\n- `--debug` - Enable debug logging (includes HTTP request/response details)\n- `--version`, `-v` - Show the CLI version\n- `--base-url` - Use a custom API backend URL\n- `--format` - Change the output format (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--format-error` - Change the output format for errors (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--transform` - Transform the data output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n- `--transform-error` - Transform the error output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n\n### Passing files as arguments\n\nTo pass files to your API, you can use the `@myfile.ext` syntax:\n\n~~~bash\nimagekit --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\nimagekit --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nimagekit < --username '\\@abe'\n~~~\n\n#### Explicit encoding\n\nFor JSON endpoints, the CLI tool does filetype sniffing to determine whether the\nfile contents should be sent as a string literal (for plain text files) or as a\nbase64-encoded string literal (for binary files). If you need to explicitly send\nthe file as either plain text or base64-encoded data, you can use\n`@file://myfile.txt` (for string encoding) or `@data://myfile.dat` (for\nbase64-encoding). Note that absolute paths will begin with `@file://` or\n`@data://`, followed by a third `/` (for example, `@file:///tmp/file.txt`).\n\n~~~bash\nimagekit --arg @data://file.txt\n~~~\n", + "# Image Kit CLI\n\nThe official CLI for the [Image Kit REST API](https://imagekit.io/docs/api-reference).\n\n## Installation\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https://go.dev/doc/install) version 1.22 or later installed.\n\n~~~sh\ngo install 'github.com/stainless-sdks/imagekit-cli/cmd/imagekit@latest'\n~~~\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME/go/bin` (or `$GOPATH/bin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n~~~sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)/bin\"\n~~~\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts/run` script to run the tool locally:\n\n~~~sh\n./scripts/run args...\n~~~\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n~~~sh\nimagekit [resource] [flags...]\n~~~\n\n~~~sh\nimagekit files upload \\\n --private-key 'My Private Key' \\\n --file 'Example data' \\\n --file-name file-name.jpg\n~~~\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable | Description | Required | Default value |\n| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------- |\n| `IMAGEKIT_PRIVATE_KEY` | Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n | yes | |\n| `OPTIONAL_IMAGEKIT_IGNORES_THIS` | ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n | no | `\"do_not_set\"` |\n| `IMAGEKIT_WEBHOOK_SECRET` | Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n | no | `null` |\n\n### Global flags\n\n- `--private-key` - Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n (can also be set with `IMAGEKIT_PRIVATE_KEY` env var)\n- `--password` - ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n (can also be set with `OPTIONAL_IMAGEKIT_IGNORES_THIS` env var)\n- `--webhook-secret` - Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n (can also be set with `IMAGEKIT_WEBHOOK_SECRET` env var)\n- `--help` - Show command line usage\n- `--debug` - Enable debug logging (includes HTTP request/response details)\n- `--version`, `-v` - Show the CLI version\n- `--base-url` - Use a custom API backend URL\n- `--format` - Change the output format (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--format-error` - Change the output format for errors (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--transform` - Transform the data output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n- `--transform-error` - Transform the error output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n\n### Passing files as arguments\n\nTo pass files to your API, you can use the `@myfile.ext` syntax:\n\n~~~bash\nimagekit --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\nimagekit --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nimagekit < --username '\\@abe'\n~~~\n\n#### Explicit encoding\n\nFor JSON endpoints, the CLI tool does filetype sniffing to determine whether the\nfile contents should be sent as a string literal (for plain text files) or as a\nbase64-encoded string literal (for binary files). If you need to explicitly send\nthe file as either plain text or base64-encoded data, you can use\n`@file://myfile.txt` (for string encoding) or `@data://myfile.dat` (for\nbase64-encoding). Note that absolute paths will begin with `@file://` or\n`@data://`, followed by a third `/` (for example, `@file:///tmp/file.txt`).\n\n~~~bash\nimagekit --arg @data://file.txt\n~~~\n", }, { language: 'php', content: - '# Image Kit PHP API Library\n\nThe Image Kit PHP library provides convenient access to the Image Kit REST API from any PHP 8.1.0+ application.\n\n## Installation\n\nTo use this package, install via Composer by adding the following to your application\'s `composer.json`:\n\n```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:stainless-sdks/imagekit-php.git"\n }\n ],\n "require": {\n "imagekit/imagekit": "dev-main"\n }\n}\n```\n\n## Usage\n\n```php\nfiles->upload(file: \'file\', fileName: \'file-name.jpg\');\n\nvar_dump($response->videoCodec);\n```', + '# Image Kit PHP API Library\n\nThe Image Kit PHP library provides convenient access to the Image Kit REST API from any PHP 8.1.0+ application.\n\n## Installation\n\nTo use this package, install via Composer by adding the following to your application\'s `composer.json`:\n\n```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:stainless-sdks/imagekit-php.git"\n }\n ],\n "require": {\n "imagekit/imagekit": "dev-main"\n }\n}\n```\n\n## Usage\n\n```php\nfiles->upload(file: \'file\', fileName: \'file-name.jpg\');\n\nvar_dump($response->videoCodec);\n```', }, ]; diff --git a/src/client.ts b/src/client.ts index 7be4e749..6cfdf65b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -35,6 +35,11 @@ import { } from './resources/saved-extensions'; import { BaseWebhookEvent, + DamFileCreateEvent, + DamFileDeleteEvent, + DamFileUpdateEvent, + DamFileVersionCreateEvent, + DamFileVersionDeleteEvent, UnsafeUnwrapWebhookEvent, UnwrapWebhookEvent, UploadPostTransformErrorEvent, @@ -82,7 +87,6 @@ import { import { type Fetch } from './internal/builtin-types'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; import { FinalRequestOptions, RequestOptions } from './internal/request-options'; -import { toBase64 } from './internal/utils/base64'; import { readEnv } from './internal/utils/env'; import { type LogLevel, @@ -295,30 +299,7 @@ export class ImageKit { } protected validateHeaders({ values, nulls }: NullableHeaders) { - if (this.privateKey && this.password && values.get('authorization')) { - return; - } - if (nulls.has('authorization')) { - return; - } - - throw new Error( - 'Could not resolve authentication method. Expected the privateKey or password to be set. Or for the "Authorization" headers to be explicitly omitted', - ); - } - - protected async authHeaders(opts: FinalRequestOptions): Promise { - if (!this.privateKey) { - return undefined; - } - - if (!this.password) { - return undefined; - } - - const credentials = `${this.privateKey}:${this.password}`; - const Authorization = `Basic ${toBase64(credentials)}`; - return buildHeaders([{ Authorization }]); + return; } /** @@ -747,7 +728,6 @@ export class ImageKit { ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), ...getPlatformHeaders(), }, - await this.authHeaders(options), this._options.defaultHeaders, bodyHeaders, options.headers, @@ -917,6 +897,11 @@ export declare namespace ImageKit { export { Webhooks as Webhooks, type BaseWebhookEvent as BaseWebhookEvent, + type DamFileCreateEvent as DamFileCreateEvent, + type DamFileDeleteEvent as DamFileDeleteEvent, + type DamFileUpdateEvent as DamFileUpdateEvent, + type DamFileVersionCreateEvent as DamFileVersionCreateEvent, + type DamFileVersionDeleteEvent as DamFileVersionDeleteEvent, type UploadPostTransformErrorEvent as UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent as UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent as UploadPreTransformErrorEvent, diff --git a/src/resources/index.ts b/src/resources/index.ts index a6ba6506..f2b18b19 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -53,6 +53,11 @@ export { export { Webhooks, type BaseWebhookEvent, + type DamFileCreateEvent, + type DamFileDeleteEvent, + type DamFileUpdateEvent, + type DamFileVersionCreateEvent, + type DamFileVersionDeleteEvent, type UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent, diff --git a/src/resources/shared.ts b/src/resources/shared.ts index fcd500ad..2a4d9643 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -147,10 +147,8 @@ export namespace ExtensionConfig { min_selections?: number; /** - * Array of possible tag values. The combined length of all strings must not exceed - * 500 characters, and values cannot include the `%` character. When providing - * large vocabularies (more than 30 items), the AI may not follow the list - * strictly. + * Array of possible tag values. Combined length of all strings must not exceed 500 + * characters. Cannot contain the `%` character. */ vocabulary?: Array; } @@ -183,10 +181,7 @@ export namespace ExtensionConfig { min_selections?: number; /** - * An array of possible values matching the custom metadata field type. If not - * provided for SingleSelect or MultiSelect field types, all values from the custom - * metadata field definition will be used. When providing large vocabularies (above - * 30 items), the AI may not strictly adhere to the list. + * Array of possible values matching the custom metadata field type. */ vocabulary?: Array; } @@ -473,10 +468,8 @@ export namespace Extensions { min_selections?: number; /** - * Array of possible tag values. The combined length of all strings must not exceed - * 500 characters, and values cannot include the `%` character. When providing - * large vocabularies (more than 30 items), the AI may not follow the list - * strictly. + * Array of possible tag values. Combined length of all strings must not exceed 500 + * characters. Cannot contain the `%` character. */ vocabulary?: Array; } @@ -509,10 +502,7 @@ export namespace Extensions { min_selections?: number; /** - * An array of possible values matching the custom metadata field type. If not - * provided for SingleSelect or MultiSelect field types, all values from the custom - * metadata field definition will be used. When providing large vocabularies (above - * 30 items), the AI may not strictly adhere to the list. + * Array of possible values matching the custom metadata field type. */ vocabulary?: Array; } @@ -792,25 +782,8 @@ export type Overlay = TextOverlay | ImageOverlay | VideoOverlay | SubtitleOverla export interface OverlayPosition { /** - * Sets the anchor point on the base asset from which the overlay offset is - * calculated. The default value is `top_left`. Maps to `lap` in the URL. Can only - * be used with one or more of `x`, `y`, `xCenter`, or `yCenter`. - */ - anchorPoint?: - | 'top' - | 'left' - | 'right' - | 'bottom' - | 'top_left' - | 'top_right' - | 'bottom_left' - | 'bottom_right' - | 'center'; - - /** - * Specifies the position of the overlay relative to the parent image or video. If - * one or more of `x`, `y`, `xCenter`, or `yCenter` parameters are specified, this - * parameter is ignored. Maps to `lfo` in the URL. + * Specifies the position of the overlay relative to the parent image or video. + * Maps to `lfo` in the URL. */ focus?: | 'center' @@ -832,15 +805,6 @@ export interface OverlayPosition { */ x?: number | string; - /** - * Specifies the x-coordinate on the base asset where the overlay's center will be - * positioned. It also accepts arithmetic expressions such as `bw_mul_0.4` or - * `bw_sub_cw`. Maps to `lxc` in the URL. Cannot be used together with `x`, but can - * be used with `y`. Learn about - * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). - */ - xCenter?: number | string; - /** * Specifies the y-coordinate of the top-left corner of the base asset where the * overlay's top-left corner will be positioned. It also accepts arithmetic @@ -849,15 +813,6 @@ export interface OverlayPosition { * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). */ y?: number | string; - - /** - * Specifies the y-coordinate on the base asset where the overlay's center will be - * positioned. It also accepts arithmetic expressions such as `bh_mul_0.4` or - * `bh_sub_ch`. Maps to `lyc` in the URL. Cannot be used together with `y`, but can - * be used with `x`. Learn about - * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). - */ - yCenter?: number | string; } export interface OverlayTiming { diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index 66b8a83d..dd4bf11d 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -36,6 +36,120 @@ export interface BaseWebhookEvent { type: string; } +/** + * Triggered when a file is created. + */ +export interface DamFileCreateEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.created'; +} + +/** + * Triggered when a file is deleted. + */ +export interface DamFileDeleteEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: DamFileDeleteEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file.deleted'; +} + +export namespace DamFileDeleteEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + } +} + +/** + * Triggered when a file is updated. + */ +export interface DamFileUpdateEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.updated'; +} + +/** + * Triggered when a file version is created. + */ +export interface DamFileVersionCreateEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: unknown; + + /** + * Type of the webhook event. + */ + type: 'file-version.created'; +} + +/** + * Triggered when a file version is deleted. + */ +export interface DamFileVersionDeleteEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: DamFileVersionDeleteEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file-version.deleted'; +} + +export namespace DamFileVersionDeleteEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + + /** + * The unique `versionId` of the deleted file version. + */ + versionId: string; + } +} + /** * Triggered when a post-transformation fails. The original file remains available, * but the requested transformation could not be generated. @@ -1040,7 +1154,12 @@ export type UnsafeUnwrapWebhookEvent = | UploadPreTransformSuccessEvent | UploadPreTransformErrorEvent | UploadPostTransformSuccessEvent - | UploadPostTransformErrorEvent; + | UploadPostTransformErrorEvent + | DamFileCreateEvent + | DamFileUpdateEvent + | DamFileDeleteEvent + | DamFileVersionCreateEvent + | DamFileVersionDeleteEvent; /** * Triggered when a new video transformation request is accepted for processing. @@ -1054,11 +1173,21 @@ export type UnwrapWebhookEvent = | UploadPreTransformSuccessEvent | UploadPreTransformErrorEvent | UploadPostTransformSuccessEvent - | UploadPostTransformErrorEvent; + | UploadPostTransformErrorEvent + | DamFileCreateEvent + | DamFileUpdateEvent + | DamFileDeleteEvent + | DamFileVersionCreateEvent + | DamFileVersionDeleteEvent; export declare namespace Webhooks { export { type BaseWebhookEvent as BaseWebhookEvent, + type DamFileCreateEvent as DamFileCreateEvent, + type DamFileDeleteEvent as DamFileDeleteEvent, + type DamFileUpdateEvent as DamFileUpdateEvent, + type DamFileVersionCreateEvent as DamFileVersionCreateEvent, + type DamFileVersionDeleteEvent as DamFileVersionDeleteEvent, type UploadPostTransformErrorEvent as UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent as UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent as UploadPreTransformErrorEvent, diff --git a/tests/api-resources/accounts/origins.test.ts b/tests/api-resources/accounts/origins.test.ts index 2be57f09..bd57caf2 100644 --- a/tests/api-resources/accounts/origins.test.ts +++ b/tests/api-resources/accounts/origins.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/accounts/url-endpoints.test.ts b/tests/api-resources/accounts/url-endpoints.test.ts index b53af030..f3c87825 100644 --- a/tests/api-resources/accounts/url-endpoints.test.ts +++ b/tests/api-resources/accounts/url-endpoints.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/accounts/usage.test.ts b/tests/api-resources/accounts/usage.test.ts index 161cdc71..e52782c3 100644 --- a/tests/api-resources/accounts/usage.test.ts +++ b/tests/api-resources/accounts/usage.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/assets.test.ts b/tests/api-resources/assets.test.ts index bf41276e..e1630336 100644 --- a/tests/api-resources/assets.test.ts +++ b/tests/api-resources/assets.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/beta/v2/files.test.ts b/tests/api-resources/beta/v2/files.test.ts index 69af3768..88cbd986 100644 --- a/tests/api-resources/beta/v2/files.test.ts +++ b/tests/api-resources/beta/v2/files.test.ts @@ -4,7 +4,6 @@ import ImageKit, { toFile } from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/cache/invalidation.test.ts b/tests/api-resources/cache/invalidation.test.ts index d804f743..f45286c7 100644 --- a/tests/api-resources/cache/invalidation.test.ts +++ b/tests/api-resources/cache/invalidation.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/custom-metadata-fields.test.ts b/tests/api-resources/custom-metadata-fields.test.ts index 3fbf78f7..6d2f062b 100644 --- a/tests/api-resources/custom-metadata-fields.test.ts +++ b/tests/api-resources/custom-metadata-fields.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/bulk.test.ts b/tests/api-resources/files/bulk.test.ts index 1c417b90..9c8b4794 100644 --- a/tests/api-resources/files/bulk.test.ts +++ b/tests/api-resources/files/bulk.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/files.test.ts b/tests/api-resources/files/files.test.ts index aeb90697..9ade42d0 100644 --- a/tests/api-resources/files/files.test.ts +++ b/tests/api-resources/files/files.test.ts @@ -4,7 +4,6 @@ import ImageKit, { toFile } from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/metadata.test.ts b/tests/api-resources/files/metadata.test.ts index fd318072..43bbb5c5 100644 --- a/tests/api-resources/files/metadata.test.ts +++ b/tests/api-resources/files/metadata.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/versions.test.ts b/tests/api-resources/files/versions.test.ts index 873ec8cc..d52d1687 100644 --- a/tests/api-resources/files/versions.test.ts +++ b/tests/api-resources/files/versions.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/folders/folders.test.ts b/tests/api-resources/folders/folders.test.ts index c4672ba4..16ecbb22 100644 --- a/tests/api-resources/folders/folders.test.ts +++ b/tests/api-resources/folders/folders.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/folders/job.test.ts b/tests/api-resources/folders/job.test.ts index 7ab1e5ac..fbf2ea40 100644 --- a/tests/api-resources/folders/job.test.ts +++ b/tests/api-resources/folders/job.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/saved-extensions.test.ts b/tests/api-resources/saved-extensions.test.ts index 5b4a731e..6ff5eaa9 100644 --- a/tests/api-resources/saved-extensions.test.ts +++ b/tests/api-resources/saved-extensions.test.ts @@ -4,7 +4,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/webhooks.test.ts b/tests/api-resources/webhooks.test.ts index e5547f28..3a9a0472 100644 --- a/tests/api-resources/webhooks.test.ts +++ b/tests/api-resources/webhooks.test.ts @@ -6,7 +6,6 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/index.test.ts b/tests/index.test.ts index 32f31df0..c2ab2cb8 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -24,7 +24,6 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultHeaders: { 'X-My-Default-Header': '2' }, privateKey: 'My Private Key', - password: 'My Password', }); test('they are used in the request', async () => { @@ -92,7 +91,6 @@ describe('instantiate client', () => { logger: logger, logLevel: 'debug', privateKey: 'My Private Key', - password: 'My Password', }); await forceAPIResponseForClient(client); @@ -100,7 +98,7 @@ describe('instantiate client', () => { }); test('default logLevel is warn', async () => { - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); expect(client.logLevel).toBe('warn'); }); @@ -117,7 +115,6 @@ describe('instantiate client', () => { logger: logger, logLevel: 'info', privateKey: 'My Private Key', - password: 'My Password', }); await forceAPIResponseForClient(client); @@ -134,11 +131,7 @@ describe('instantiate client', () => { }; process.env['IMAGE_KIT_LOG'] = 'debug'; - const client = new ImageKit({ - logger: logger, - privateKey: 'My Private Key', - password: 'My Password', - }); + const client = new ImageKit({ logger: logger, privateKey: 'My Private Key' }); expect(client.logLevel).toBe('debug'); await forceAPIResponseForClient(client); @@ -155,11 +148,7 @@ describe('instantiate client', () => { }; process.env['IMAGE_KIT_LOG'] = 'not a log level'; - const client = new ImageKit({ - logger: logger, - privateKey: 'My Private Key', - password: 'My Password', - }); + const client = new ImageKit({ logger: logger, privateKey: 'My Private Key' }); expect(client.logLevel).toBe('warn'); expect(warnMock).toHaveBeenCalledWith( 'process.env[\'IMAGE_KIT_LOG\'] was set to "not a log level", expected one of ["off","error","warn","info","debug"]', @@ -180,7 +169,6 @@ describe('instantiate client', () => { logger: logger, logLevel: 'off', privateKey: 'My Private Key', - password: 'My Password', }); await forceAPIResponseForClient(client); @@ -201,7 +189,6 @@ describe('instantiate client', () => { logger: logger, logLevel: 'debug', privateKey: 'My Private Key', - password: 'My Password', }); expect(client.logLevel).toBe('debug'); expect(warnMock).not.toHaveBeenCalled(); @@ -214,7 +201,6 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo' }, privateKey: 'My Private Key', - password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/foo?apiVersion=foo'); }); @@ -224,7 +210,6 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo', hello: 'world' }, privateKey: 'My Private Key', - password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/foo?apiVersion=foo&hello=world'); }); @@ -234,7 +219,6 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultQuery: { hello: 'world' }, privateKey: 'My Private Key', - password: 'My Password', }); expect(client.buildURL('/foo', { hello: undefined })).toEqual('http://localhost:5000/foo'); }); @@ -244,7 +228,6 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/', privateKey: 'My Private Key', - password: 'My Password', fetch: (url) => { return Promise.resolve( new Response(JSON.stringify({ url, custom: true }), { @@ -263,7 +246,6 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/', privateKey: 'My Private Key', - password: 'My Password', fetch: defaultFetch, }); }); @@ -272,7 +254,6 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', privateKey: 'My Private Key', - password: 'My Password', fetch: (...args) => { return new Promise((resolve, reject) => setTimeout( @@ -305,7 +286,6 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/', privateKey: 'My Private Key', - password: 'My Password', fetch: testFetch, }); @@ -318,7 +298,6 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/custom/path/', privateKey: 'My Private Key', - password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); @@ -327,7 +306,6 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/custom/path', privateKey: 'My Private Key', - password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); @@ -337,45 +315,37 @@ describe('instantiate client', () => { }); test('explicit option', () => { - const client = new ImageKit({ - baseURL: 'https://example.com', - privateKey: 'My Private Key', - password: 'My Password', - }); + const client = new ImageKit({ baseURL: 'https://example.com', privateKey: 'My Private Key' }); expect(client.baseURL).toEqual('https://example.com'); }); test('env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = 'https://example.com/from_env'; - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); expect(client.baseURL).toEqual('https://example.com/from_env'); }); test('empty env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = ''; // empty - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); expect(client.baseURL).toEqual('https://api.imagekit.io'); }); test('blank env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = ' '; // blank - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); expect(client.baseURL).toEqual('https://api.imagekit.io'); }); test('in request options', () => { - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/option/foo', ); }); test('in request options overridden by client options', () => { - const client = new ImageKit({ - privateKey: 'My Private Key', - password: 'My Password', - baseURL: 'http://localhost:5000/client', - }); + const client = new ImageKit({ privateKey: 'My Private Key', baseURL: 'http://localhost:5000/client' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/client/foo', ); @@ -383,7 +353,7 @@ describe('instantiate client', () => { test('in request options overridden by env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = 'http://localhost:5000/env'; - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/env/foo', ); @@ -391,15 +361,11 @@ describe('instantiate client', () => { }); test('maxRetries option is correctly set', () => { - const client = new ImageKit({ - maxRetries: 4, - privateKey: 'My Private Key', - password: 'My Password', - }); + const client = new ImageKit({ maxRetries: 4, privateKey: 'My Private Key' }); expect(client.maxRetries).toEqual(4); // default - const client2 = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client2 = new ImageKit({ privateKey: 'My Private Key' }); expect(client2.maxRetries).toEqual(2); }); @@ -409,7 +375,6 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', maxRetries: 3, privateKey: 'My Private Key', - password: 'My Password', }); const newClient = client.withOptions({ @@ -436,7 +401,6 @@ describe('instantiate client', () => { defaultHeaders: { 'X-Test-Header': 'test-value' }, defaultQuery: { 'test-param': 'test-value' }, privateKey: 'My Private Key', - password: 'My Password', }); const newClient = client.withOptions({ @@ -455,7 +419,6 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', timeout: 1000, privateKey: 'My Private Key', - password: 'My Password', }); // Modify the client properties directly after creation @@ -485,24 +448,20 @@ describe('instantiate client', () => { test('with environment variable arguments', () => { // set options via env var process.env['IMAGEKIT_PRIVATE_KEY'] = 'My Private Key'; - process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'My Password'; const client = new ImageKit(); expect(client.privateKey).toBe('My Private Key'); - expect(client.password).toBe('My Password'); }); test('with overridden environment variable arguments', () => { // set options via env var process.env['IMAGEKIT_PRIVATE_KEY'] = 'another My Private Key'; - process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'another My Password'; - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); expect(client.privateKey).toBe('My Private Key'); - expect(client.password).toBe('My Password'); }); }); describe('request building', () => { - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); describe('custom headers', () => { test('handles undefined', async () => { @@ -521,7 +480,7 @@ describe('request building', () => { }); describe('default encoder', () => { - const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); + const client = new ImageKit({ privateKey: 'My Private Key' }); class Serializable { toJSON() { @@ -608,7 +567,6 @@ describe('retries', () => { const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', timeout: 10, fetch: testFetch, }); @@ -643,7 +601,6 @@ describe('retries', () => { const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', fetch: testFetch, maxRetries: 4, }); @@ -672,7 +629,6 @@ describe('retries', () => { }; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', fetch: testFetch, maxRetries: 4, }); @@ -706,7 +662,6 @@ describe('retries', () => { }; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', fetch: testFetch, maxRetries: 4, defaultHeaders: { 'X-Stainless-Retry-Count': null }, @@ -740,7 +695,6 @@ describe('retries', () => { }; const client = new ImageKit({ privateKey: 'My Private Key', - password: 'My Password', fetch: testFetch, maxRetries: 4, }); @@ -773,11 +727,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new ImageKit({ - privateKey: 'My Private Key', - password: 'My Password', - fetch: testFetch, - }); + const client = new ImageKit({ privateKey: 'My Private Key', fetch: testFetch }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); @@ -807,11 +757,7 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new ImageKit({ - privateKey: 'My Private Key', - password: 'My Password', - fetch: testFetch, - }); + const client = new ImageKit({ privateKey: 'My Private Key', fetch: testFetch }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); From 79ae799823f2dcdde7eece7fc0588916e453537e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:24:24 +0000 Subject: [PATCH 06/14] feat(api): fix spec indentation --- .stats.yml | 4 +- README.md | 7 +- packages/mcp-server/README.md | 13 +- packages/mcp-server/src/auth.ts | 29 +- packages/mcp-server/src/local-docs-search.ts | 744 ++++++++++-------- src/client.ts | 27 +- tests/api-resources/accounts/origins.test.ts | 1 + .../accounts/url-endpoints.test.ts | 1 + tests/api-resources/accounts/usage.test.ts | 1 + tests/api-resources/assets.test.ts | 1 + tests/api-resources/beta/v2/files.test.ts | 1 + .../api-resources/cache/invalidation.test.ts | 1 + .../custom-metadata-fields.test.ts | 1 + tests/api-resources/files/bulk.test.ts | 1 + tests/api-resources/files/files.test.ts | 1 + tests/api-resources/files/metadata.test.ts | 1 + tests/api-resources/files/versions.test.ts | 1 + tests/api-resources/folders/folders.test.ts | 1 + tests/api-resources/folders/job.test.ts | 1 + tests/api-resources/saved-extensions.test.ts | 1 + tests/api-resources/webhooks.test.ts | 1 + tests/index.test.ts | 88 ++- 22 files changed, 554 insertions(+), 373 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3e331fe9..5beb1d71 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-1422f7513f230162270b197061e5768c2e0c803b94b8cd03a5e72544ac75a27f.yml -openapi_spec_hash: 41175e752e6f6ce900b36aecba687fa7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-f4cd00365ba96133e0675eae3d5d3c6ac13874789e2ce69a84310ab64a4f87dd.yml +openapi_spec_hash: dce632cfbb5464a98c0f5d8eb9573d68 config_hash: 17e408231b0b01676298010c7405f483 diff --git a/README.md b/README.md index 459d8582..7951aa2c 100644 --- a/README.md +++ b/README.md @@ -337,7 +337,10 @@ Generate authentication parameters for secure client-side file uploads: ```ts // Generate authentication parameters for client-side uploads -const authParams = client.helper.getAuthenticationParameters(); +const authParams = client.helper.getAuthenticationParameters({ + privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted + password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted +}); console.log(authParams); // Result: { token: 'uuid-token', expire: timestamp, signature: 'hmac-signature' } @@ -430,7 +433,6 @@ You can use the `maxRetries` option to configure or disable this: ```js // Configure the default for all requests: const client = new ImageKit({ - privateKey: 'My Private Key', maxRetries: 0, // default is 2 }); @@ -448,7 +450,6 @@ Requests time out after 1 minute by default. You can configure this with a `time ```ts // Configure the default for all requests: const client = new ImageKit({ - privateKey: 'My Private Key', timeout: 20 * 1000, // 20 seconds (default is 1 minute) }); diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md index 84fefd40..2fe6b778 100644 --- a/packages/mcp-server/README.md +++ b/packages/mcp-server/README.md @@ -80,13 +80,24 @@ and repeatably. Launching the client with `--transport=http` launches the server as a remote server using Streamable HTTP transport. The `--port` setting can choose the port it will run on, and the `--socket` setting allows it to run on a Unix socket. +Authorization can be provided via the `Authorization` header using the Basic scheme. + +Additionally, authorization can be provided via the following headers: +| Header | Equivalent client option | Security scheme | +| ---------------------------------- | ------------------------ | --------------- | +| `x-imagekit-private-key` | `privateKey` | basicAuth | +| `x-optional-imagekit-ignores-this` | `password` | basicAuth | + A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`: ```json { "mcpServers": { "imagekit_nodejs_api": { - "url": "http://localhost:3000" + "url": "http://localhost:3000", + "headers": { + "Authorization": "Basic " + } } } } diff --git a/packages/mcp-server/src/auth.ts b/packages/mcp-server/src/auth.ts index 234c710e..085cac43 100644 --- a/packages/mcp-server/src/auth.ts +++ b/packages/mcp-server/src/auth.ts @@ -5,7 +5,34 @@ import { ClientOptions } from '@imagekit/nodejs'; import { McpOptions } from './options'; export const parseClientAuthHeaders = (req: IncomingMessage, required?: boolean): Partial => { - return {}; + if (req.headers.authorization) { + const scheme = req.headers.authorization.split(' ')[0]!; + const value = req.headers.authorization.slice(scheme.length + 1); + switch (scheme) { + case 'Basic': + const rawValue = Buffer.from(value, 'base64').toString(); + return { + privateKey: rawValue.slice(0, rawValue.search(':')), + password: rawValue.slice(rawValue.search(':') + 1), + }; + default: + throw new Error( + 'Unsupported authorization scheme. Expected the "Authorization" header to be a supported scheme (Basic).', + ); + } + } else if (required) { + throw new Error('Missing required Authorization header; see WWW-Authenticate header for details.'); + } + + const privateKey = + Array.isArray(req.headers['x-imagekit-private-key']) ? + req.headers['x-imagekit-private-key'][0] + : req.headers['x-imagekit-private-key']; + const password = + Array.isArray(req.headers['x-optional-imagekit-ignores-this']) ? + req.headers['x-optional-imagekit-ignores-this'][0] + : req.headers['x-optional-imagekit-ignores-this']; + return { privateKey, password }; }; export const getStainlessApiKey = (req: IncomingMessage, mcpOptions: McpOptions): string | undefined => { diff --git a/packages/mcp-server/src/local-docs-search.ts b/packages/mcp-server/src/local-docs-search.ts index f73653de..294e25cf 100644 --- a/packages/mcp-server/src/local-docs-search.ts +++ b/packages/mcp-server/src/local-docs-search.ts @@ -72,7 +72,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'customMetadataFields create', example: - "imagekit custom-metadata-fields create \\\n --private-key 'My Private Key' \\\n --label price \\\n --name price \\\n --schema '{type: Number}'", + "imagekit custom-metadata-fields create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --label price \\\n --name price \\\n --schema '{type: Number}'", }, csharp: { method: 'CustomMetadataFields.Create', @@ -82,11 +82,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.New(context.TODO(), imagekit.CustomMetadataFieldNewParams{\n\t\tLabel: "price",\n\t\tName: "price",\n\t\tSchema: imagekit.CustomMetadataFieldNewParamsSchema{\n\t\t\tType: "Number",\n\t\t\tMinValue: imagekit.CustomMetadataFieldNewParamsSchemaMinValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t},\n\t\t\tMaxValue: imagekit.CustomMetadataFieldNewParamsSchemaMaxValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.New(context.TODO(), imagekit.CustomMetadataFieldNewParams{\n\t\tLabel: "price",\n\t\tName: "price",\n\t\tSchema: imagekit.CustomMetadataFieldNewParamsSchema{\n\t\t\tType: "Number",\n\t\t\tMinValue: imagekit.CustomMetadataFieldNewParamsSchemaMinValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t},\n\t\t\tMaxValue: imagekit.CustomMetadataFieldNewParamsSchemaMaxValueUnion{\n\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/customMetadataFields \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "label": "price",\n "name": "price",\n "schema": {\n "type": "Number",\n "maxValue": 3000,\n "minValue": 1000\n }\n }\'', + 'curl https://api.imagekit.io/v1/customMetadataFields \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "label": "price",\n "name": "price",\n "schema": {\n "type": "Number",\n "maxValue": 3000,\n "minValue": 1000\n }\n }\'', }, java: { method: 'customMetadataFields().create', @@ -96,22 +96,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->create', example: - "customMetadataFields->create(\n label: 'price',\n name: 'price',\n schema: [\n 'type' => 'Number',\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", + "customMetadataFields->create(\n label: 'price',\n name: 'price',\n schema: [\n 'type' => 'Number',\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.create', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_field = client.custom_metadata_fields.create(\n label="price",\n name="price",\n schema={\n "type": "Number",\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_field = client.custom_metadata_fields.create(\n label="price",\n name="price",\n schema={\n "type": "Number",\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', }, ruby: { method: 'custom_metadata_fields.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.create(label: "price", name: "price", schema: {type: :Number})\n\nputs(custom_metadata_field)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.create(label: "price", name: "price", schema: {type: :Number})\n\nputs(custom_metadata_field)', }, typescript: { method: 'client.customMetadataFields.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.create({\n label: 'price',\n name: 'price',\n schema: {\n type: 'Number',\n minValue: 1000,\n maxValue: 3000,\n },\n});\n\nconsole.log(customMetadataField.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataField = await client.customMetadataFields.create({\n label: 'price',\n name: 'price',\n schema: {\n type: 'Number',\n minValue: 1000,\n maxValue: 3000,\n },\n});\n\nconsole.log(customMetadataField.id);", }, }, }, @@ -132,7 +132,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'customMetadataFields list', - example: "imagekit custom-metadata-fields list \\\n --private-key 'My Private Key'", + example: + "imagekit custom-metadata-fields list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", }, csharp: { method: 'CustomMetadataFields.List', @@ -142,10 +143,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataFields, err := client.CustomMetadataFields.List(context.TODO(), imagekit.CustomMetadataFieldListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataFields)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataFields, err := client.CustomMetadataFields.List(context.TODO(), imagekit.CustomMetadataFieldListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataFields)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/customMetadataFields', + example: + 'curl https://api.imagekit.io/v1/customMetadataFields \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'customMetadataFields().list', @@ -155,22 +157,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->list', example: - "customMetadataFields->list(\n folderPath: 'folderPath', includeDeleted: true\n);\n\nvar_dump($customMetadataFields);", + "customMetadataFields->list(\n folderPath: 'folderPath', includeDeleted: true\n);\n\nvar_dump($customMetadataFields);", }, python: { method: 'custom_metadata_fields.list', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_fields = client.custom_metadata_fields.list()\nprint(custom_metadata_fields)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_fields = client.custom_metadata_fields.list()\nprint(custom_metadata_fields)', }, ruby: { method: 'custom_metadata_fields.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_fields = image_kit.custom_metadata_fields.list\n\nputs(custom_metadata_fields)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_fields = image_kit.custom_metadata_fields.list\n\nputs(custom_metadata_fields)', }, typescript: { method: 'client.customMetadataFields.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataFields = await client.customMetadataFields.list();\n\nconsole.log(customMetadataFields);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataFields = await client.customMetadataFields.list();\n\nconsole.log(customMetadataFields);", }, }, }, @@ -194,7 +196,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'customMetadataFields update', - example: "imagekit custom-metadata-fields update \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit custom-metadata-fields update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'CustomMetadataFields.Update', @@ -204,10 +207,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.CustomMetadataFieldUpdateParams{\n\t\t\tLabel: imagekit.String("price"),\n\t\t\tSchema: imagekit.CustomMetadataFieldUpdateParamsSchema{\n\t\t\t\tMinValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMinValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t\t},\n\t\t\t\tMaxValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMaxValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.CustomMetadataFieldUpdateParams{\n\t\t\tLabel: imagekit.String("price"),\n\t\t\tSchema: imagekit.CustomMetadataFieldUpdateParamsSchema{\n\t\t\t\tMinValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMinValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(1000),\n\t\t\t\t},\n\t\t\t\tMaxValue: imagekit.CustomMetadataFieldUpdateParamsSchemaMaxValueUnion{\n\t\t\t\t\tOfFloat: imagekit.Float(3000),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField.ID)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X PATCH', + example: + 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X PATCH \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'customMetadataFields().update', @@ -217,22 +221,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->update', example: - "customMetadataFields->update(\n 'id',\n label: 'price',\n schema: [\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", + "customMetadataFields->update(\n 'id',\n label: 'price',\n schema: [\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.update', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_field = client.custom_metadata_fields.update(\n id="id",\n label="price",\n schema={\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_field = client.custom_metadata_fields.update(\n id="id",\n label="price",\n schema={\n "min_value": 1000,\n "max_value": 3000,\n },\n)\nprint(custom_metadata_field.id)', }, ruby: { method: 'custom_metadata_fields.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.update("id")\n\nputs(custom_metadata_field)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.update("id")\n\nputs(custom_metadata_field)', }, typescript: { method: 'client.customMetadataFields.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.update('id', {\n label: 'price',\n schema: { minValue: 1000, maxValue: 3000 },\n});\n\nconsole.log(customMetadataField.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataField = await client.customMetadataFields.update('id', {\n label: 'price',\n schema: { minValue: 1000, maxValue: 3000 },\n});\n\nconsole.log(customMetadataField.id);", }, }, }, @@ -252,7 +256,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'customMetadataFields delete', - example: "imagekit custom-metadata-fields delete \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit custom-metadata-fields delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'CustomMetadataFields.Delete', @@ -262,10 +267,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.CustomMetadataFields.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tcustomMetadataField, err := client.CustomMetadataFields.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", customMetadataField)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X DELETE', + example: + 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'customMetadataFields().delete', @@ -275,22 +281,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->delete', example: - "customMetadataFields->delete('id');\n\nvar_dump($customMetadataField);", + "customMetadataFields->delete('id');\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\ncustom_metadata_field = client.custom_metadata_fields.delete(\n "id",\n)\nprint(custom_metadata_field)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ncustom_metadata_field = client.custom_metadata_fields.delete(\n "id",\n)\nprint(custom_metadata_field)', }, ruby: { method: 'custom_metadata_fields.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.delete("id")\n\nputs(custom_metadata_field)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ncustom_metadata_field = image_kit.custom_metadata_fields.delete("id")\n\nputs(custom_metadata_field)', }, typescript: { method: 'client.customMetadataFields.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.delete('id');\n\nconsole.log(customMetadataField);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst customMetadataField = await client.customMetadataFields.delete('id');\n\nconsole.log(customMetadataField);", }, }, }, @@ -336,7 +342,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files upload', example: - "imagekit files upload \\\n --private-key 'My Private Key' \\\n --file 'Example data' \\\n --file-name fileName", + "imagekit files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name fileName", }, csharp: { method: 'Files.Upload', @@ -346,11 +352,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Upload', example: - 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', }, http: { example: - 'curl https://upload.imagekit.io/api/v1/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', + 'curl https://upload.imagekit.io/api/v1/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', }, java: { method: 'files().upload', @@ -360,22 +366,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->upload', example: - "files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n expire: 0,\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n publicKey: 'publicKey',\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n signature: 'signature',\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", + "files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n expire: 0,\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n publicKey: 'publicKey',\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n signature: 'signature',\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", }, python: { method: 'files.upload', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', }, ruby: { method: 'files.upload', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', }, typescript: { method: 'client.files.upload', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", }, }, }, @@ -396,7 +402,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'files get', - example: "imagekit files get \\\n --private-key 'My Private Key' \\\n --file-id fileId", + example: + "imagekit files get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", }, csharp: { method: 'Files.Get', @@ -406,10 +413,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/details', + example: + 'curl https://api.imagekit.io/v1/files/$FILE_ID/details \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().get', @@ -419,22 +427,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->get', example: - "files->get('fileId');\n\nvar_dump($file);", + "files->get('fileId');\n\nvar_dump($file);", }, python: { method: 'files.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.get(\n "fileId",\n)\nprint(file.video_codec)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.get(\n "fileId",\n)\nprint(file.video_codec)', }, ruby: { method: 'files.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.get("fileId")\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.get("fileId")\n\nputs(file)', }, typescript: { method: 'client.files.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.get('fileId');\n\nconsole.log(file.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.get('fileId');\n\nconsole.log(file.videoCodec);", }, }, }, @@ -456,7 +464,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'files update', - example: "imagekit files update \\\n --private-key 'My Private Key' \\\n --file-id fileId", + example: + "imagekit files update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", }, csharp: { method: 'Files.Update', @@ -466,11 +475,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Update(\n\t\tcontext.TODO(),\n\t\t"fileId",\n\t\timagekit.FileUpdateParams{\n\t\t\tUpdateFileRequest: imagekit.UpdateFileRequestUnionParam{\n\t\t\t\tOfUpdateFileDetails: &imagekit.UpdateFileRequestUpdateFileDetailsParam{},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Update(\n\t\tcontext.TODO(),\n\t\t"fileId",\n\t\timagekit.FileUpdateParams{\n\t\t\tUpdateFileRequest: imagekit.UpdateFileRequestUnionParam{\n\t\t\t\tOfUpdateFileDetails: &imagekit.UpdateFileRequestUpdateFileDetailsParam{},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/$FILE_ID/details \\\n -X PATCH \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "extensions": [\n {\n "name": "remove-bg",\n "options": {\n "add_shadow": true\n }\n },\n {\n "maxTags": 5,\n "minConfidence": 95,\n "name": "google-auto-tagging"\n },\n {\n "name": "ai-auto-description"\n },\n {\n "name": "ai-tasks",\n "tasks": [\n {\n "instruction": "What types of clothing items are visible in this image?",\n "type": "select_tags",\n "vocabulary": [\n "shirt",\n "tshirt",\n "dress",\n "trousers",\n "jacket"\n ]\n },\n {\n "instruction": "Is this a luxury or high-end fashion item?",\n "type": "yes_no",\n "on_yes": {\n "add_tags": [\n "luxury",\n "premium"\n ]\n }\n }\n ]\n },\n {\n "id": "ext_abc123",\n "name": "saved-extension"\n }\n ],\n "tags": [\n "tag1",\n "tag2"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/$FILE_ID/details \\\n -X PATCH \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "extensions": [\n {\n "name": "remove-bg",\n "options": {\n "add_shadow": true\n }\n },\n {\n "maxTags": 5,\n "minConfidence": 95,\n "name": "google-auto-tagging"\n },\n {\n "name": "ai-auto-description"\n },\n {\n "name": "ai-tasks",\n "tasks": [\n {\n "instruction": "What types of clothing items are visible in this image?",\n "type": "select_tags",\n "vocabulary": [\n "shirt",\n "tshirt",\n "dress",\n "trousers",\n "jacket"\n ]\n },\n {\n "instruction": "Is this a luxury or high-end fashion item?",\n "type": "yes_no",\n "on_yes": {\n "add_tags": [\n "luxury",\n "premium"\n ]\n }\n }\n ]\n },\n {\n "id": "ext_abc123",\n "name": "saved-extension"\n }\n ],\n "tags": [\n "tag1",\n "tag2"\n ]\n }\'', }, java: { method: 'files().update', @@ -480,22 +489,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->update', example: - "files->update(\n 'fileId',\n customCoordinates: 'customCoordinates',\n customMetadata: ['foo' => 'bar'],\n description: 'description',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n removeAITags: ['string'],\n tags: ['tag1', 'tag2'],\n webhookURL: 'https://example.com',\n publish: ['isPublished' => true, 'includeFileVersions' => true],\n);\n\nvar_dump($file);", + "files->update(\n 'fileId',\n customCoordinates: 'customCoordinates',\n customMetadata: ['foo' => 'bar'],\n description: 'description',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n removeAITags: ['string'],\n tags: ['tag1', 'tag2'],\n webhookURL: 'https://example.com',\n publish: ['isPublished' => true, 'includeFileVersions' => true],\n);\n\nvar_dump($file);", }, python: { method: 'files.update', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.update(\n file_id="fileId",\n)\nprint(file)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.update(\n file_id="fileId",\n)\nprint(file)', }, ruby: { method: 'files.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.update("fileId", update_file_request: {})\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.update("fileId", update_file_request: {})\n\nputs(file)', }, typescript: { method: 'client.files.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.update('fileId');\n\nconsole.log(file);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.update('fileId');\n\nconsole.log(file);", }, }, }, @@ -514,7 +523,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'files delete', - example: "imagekit files delete \\\n --private-key 'My Private Key' \\\n --file-id fileId", + example: + "imagekit files delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", }, csharp: { method: 'Files.Delete', @@ -524,10 +534,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Files.Delete(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Files.Delete(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/$FILE_ID \\\n -X DELETE', + example: + 'curl https://api.imagekit.io/v1/files/$FILE_ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().delete', @@ -537,22 +548,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->delete', example: - "files->delete('fileId');\n\nvar_dump($result);", + "files->delete('fileId');\n\nvar_dump($result);", }, python: { method: 'files.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.files.delete(\n "fileId",\n)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.files.delete(\n "fileId",\n)', }, ruby: { method: 'files.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.files.delete("fileId")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.files.delete("fileId")\n\nputs(result)', }, typescript: { method: 'client.files.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.files.delete('fileId');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.files.delete('fileId');", }, }, }, @@ -573,7 +584,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files copy', example: - "imagekit files copy \\\n --private-key 'My Private Key' \\\n --destination-path /folder/to/copy/into/ \\\n --source-file-path /path/to/file.jpg", + "imagekit files copy \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /folder/to/copy/into/ \\\n --source-file-path /path/to/file.jpg", }, csharp: { method: 'Files.Copy', @@ -583,11 +594,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Copy', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Copy(context.TODO(), imagekit.FileCopyParams{\n\t\tDestinationPath: "/folder/to/copy/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Copy(context.TODO(), imagekit.FileCopyParams{\n\t\tDestinationPath: "/folder/to/copy/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/copy \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/folder/to/copy/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', + 'curl https://api.imagekit.io/v1/files/copy \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/folder/to/copy/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', }, java: { method: 'files().copy', @@ -597,22 +608,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->copy', example: - "files->copy(\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n includeFileVersions: false,\n);\n\nvar_dump($response);", + "files->copy(\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n includeFileVersions: false,\n);\n\nvar_dump($response);", }, python: { method: 'files.copy', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.copy(\n destination_path="/folder/to/copy/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.copy(\n destination_path="/folder/to/copy/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', }, ruby: { method: 'files.copy', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.copy(destination_path: "/folder/to/copy/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.copy(destination_path: "/folder/to/copy/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', }, typescript: { method: 'client.files.copy', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.copy({\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.copy({\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", }, }, }, @@ -633,7 +644,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files move', example: - "imagekit files move \\\n --private-key 'My Private Key' \\\n --destination-path /folder/to/move/into/ \\\n --source-file-path /path/to/file.jpg", + "imagekit files move \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /folder/to/move/into/ \\\n --source-file-path /path/to/file.jpg", }, csharp: { method: 'Files.Move', @@ -643,11 +654,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Move', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Move(context.TODO(), imagekit.FileMoveParams{\n\t\tDestinationPath: "/folder/to/move/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Move(context.TODO(), imagekit.FileMoveParams{\n\t\tDestinationPath: "/folder/to/move/into/",\n\t\tSourceFilePath: "/path/to/file.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/move \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/folder/to/move/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', + 'curl https://api.imagekit.io/v1/files/move \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/folder/to/move/into/",\n "sourceFilePath": "/path/to/file.jpg"\n }\'', }, java: { method: 'files().move', @@ -657,22 +668,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->move', example: - "files->move(\n destinationPath: '/folder/to/move/into/', sourceFilePath: '/path/to/file.jpg'\n);\n\nvar_dump($response);", + "files->move(\n destinationPath: '/folder/to/move/into/', sourceFilePath: '/path/to/file.jpg'\n);\n\nvar_dump($response);", }, python: { method: 'files.move', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.move(\n destination_path="/folder/to/move/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.move(\n destination_path="/folder/to/move/into/",\n source_file_path="/path/to/file.jpg",\n)\nprint(response)', }, ruby: { method: 'files.move', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.move(destination_path: "/folder/to/move/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.move(destination_path: "/folder/to/move/into/", source_file_path: "/path/to/file.jpg")\n\nputs(response)', }, typescript: { method: 'client.files.move', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.move({\n destinationPath: '/folder/to/move/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.move({\n destinationPath: '/folder/to/move/into/',\n sourceFilePath: '/path/to/file.jpg',\n});\n\nconsole.log(response);", }, }, }, @@ -693,7 +704,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files rename', example: - "imagekit files rename \\\n --private-key 'My Private Key' \\\n --file-path /path/to/file.jpg \\\n --new-file-name newFileName.jpg", + "imagekit files rename \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-path /path/to/file.jpg \\\n --new-file-name newFileName.jpg", }, csharp: { method: 'Files.Rename', @@ -703,11 +714,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Rename', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Rename(context.TODO(), imagekit.FileRenameParams{\n\t\tFilePath: "/path/to/file.jpg",\n\t\tNewFileName: "newFileName.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.PurgeRequestID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Rename(context.TODO(), imagekit.FileRenameParams{\n\t\tFilePath: "/path/to/file.jpg",\n\t\tNewFileName: "newFileName.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.PurgeRequestID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/rename \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "filePath": "/path/to/file.jpg",\n "newFileName": "newFileName.jpg",\n "purgeCache": true\n }\'', + 'curl https://api.imagekit.io/v1/files/rename \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "filePath": "/path/to/file.jpg",\n "newFileName": "newFileName.jpg",\n "purgeCache": true\n }\'', }, java: { method: 'files().rename', @@ -717,22 +728,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->rename', example: - "files->rename(\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n purgeCache: true,\n);\n\nvar_dump($response);", + "files->rename(\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n purgeCache: true,\n);\n\nvar_dump($response);", }, python: { method: 'files.rename', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.rename(\n file_path="/path/to/file.jpg",\n new_file_name="newFileName.jpg",\n)\nprint(response.purge_request_id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.rename(\n file_path="/path/to/file.jpg",\n new_file_name="newFileName.jpg",\n)\nprint(response.purge_request_id)', }, ruby: { method: 'files.rename', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.rename(file_path: "/path/to/file.jpg", new_file_name: "newFileName.jpg")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.rename(file_path: "/path/to/file.jpg", new_file_name: "newFileName.jpg")\n\nputs(response)', }, typescript: { method: 'client.files.rename', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.rename({\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n});\n\nconsole.log(response.purgeRequestId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.rename({\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n});\n\nconsole.log(response.purgeRequestId);", }, }, }, @@ -753,7 +764,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk delete', example: - "imagekit files:bulk delete \\\n --private-key 'My Private Key' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", + "imagekit files:bulk delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", }, csharp: { method: 'Files.Bulk.Delete', @@ -763,11 +774,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tbulk, err := client.Files.Bulk.Delete(context.TODO(), imagekit.FileBulkDeleteParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", bulk.SuccessfullyDeletedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tbulk, err := client.Files.Bulk.Delete(context.TODO(), imagekit.FileBulkDeleteParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", bulk.SuccessfullyDeletedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/batch/deleteByFileIds \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/batch/deleteByFileIds \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', }, java: { method: 'files().bulk().delete', @@ -777,22 +788,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->delete', example: - "files->bulk->delete(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be']\n);\n\nvar_dump($bulk);", + "files->bulk->delete(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be']\n);\n\nvar_dump($bulk);", }, python: { method: 'files.bulk.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nbulk = client.files.bulk.delete(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(bulk.successfully_deleted_file_ids)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nbulk = client.files.bulk.delete(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(bulk.successfully_deleted_file_ids)', }, ruby: { method: 'files.bulk.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nbulk = image_kit.files.bulk.delete(file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"])\n\nputs(bulk)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nbulk = image_kit.files.bulk.delete(file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"])\n\nputs(bulk)', }, typescript: { method: 'client.files.bulk.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst bulk = await client.files.bulk.delete({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(bulk.successfullyDeletedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst bulk = await client.files.bulk.delete({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(bulk.successfullyDeletedFileIds);", }, }, }, @@ -813,7 +824,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk addTags', example: - "imagekit files:bulk add-tags \\\n --private-key 'My Private Key' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", + "imagekit files:bulk add-tags \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", }, csharp: { method: 'Files.Bulk.AddTags', @@ -823,11 +834,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.AddTags', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Bulk.AddTags(context.TODO(), imagekit.FileBulkAddTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Bulk.AddTags(context.TODO(), imagekit.FileBulkAddTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/addTags \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/addTags \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', }, java: { method: 'files().bulk().addTags', @@ -837,22 +848,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->addTags', example: - "files->bulk->addTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", + "files->bulk->addTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", }, python: { method: 'files.bulk.add_tags', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.bulk.add_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.bulk.add_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', }, ruby: { method: 'files.bulk.add_tags', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.bulk.add_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.bulk.add_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', }, typescript: { method: 'client.files.bulk.addTags', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.addTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.bulk.addTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", }, }, }, @@ -873,7 +884,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk removeTags', example: - "imagekit files:bulk remove-tags \\\n --private-key 'My Private Key' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", + "imagekit files:bulk remove-tags \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be \\\n --tag t-shirt \\\n --tag round-neck \\\n --tag sale2019", }, csharp: { method: 'Files.Bulk.RemoveTags', @@ -883,11 +894,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.RemoveTags', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveTags(context.TODO(), imagekit.FileBulkRemoveTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveTags(context.TODO(), imagekit.FileBulkRemoveTagsParams{\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t\tTags: []string{"t-shirt", "round-neck", "sale2019"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/removeTags \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/removeTags \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ],\n "tags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ]\n }\'', }, java: { method: 'files().bulk().removeTags', @@ -897,22 +908,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->removeTags', example: - "files->bulk->removeTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", + "files->bulk->removeTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);", }, python: { method: 'files.bulk.remove_tags', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.bulk.remove_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.bulk.remove_tags(\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags=["t-shirt", "round-neck", "sale2019"],\n)\nprint(response.successfully_updated_file_ids)', }, ruby: { method: 'files.bulk.remove_tags', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.bulk.remove_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.bulk.remove_tags(\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n tags: ["t-shirt", "round-neck", "sale2019"]\n)\n\nputs(response)', }, typescript: { method: 'client.files.bulk.removeTags', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.removeTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.bulk.removeTags({\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", }, }, }, @@ -933,7 +944,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'bulk removeAiTags', example: - "imagekit files:bulk remove-ai-tags \\\n --private-key 'My Private Key' \\\n --ai-tag t-shirt \\\n --ai-tag round-neck \\\n --ai-tag sale2019 \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", + "imagekit files:bulk remove-ai-tags \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --ai-tag t-shirt \\\n --ai-tag round-neck \\\n --ai-tag sale2019 \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be", }, csharp: { method: 'Files.Bulk.RemoveAITags', @@ -943,11 +954,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Bulk.RemoveAITags', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveAITags(context.TODO(), imagekit.FileBulkRemoveAITagsParams{\n\t\tAITags: []string{"t-shirt", "round-neck", "sale2019"},\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Files.Bulk.RemoveAITags(context.TODO(), imagekit.FileBulkRemoveAITagsParams{\n\t\tAITags: []string{"t-shirt", "round-neck", "sale2019"},\n\t\tFileIDs: []string{"598821f949c0a938d57563bd", "598821f949c0a938d57563be"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.SuccessfullyUpdatedFileIDs)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/removeAITags \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "AITags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ],\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', + 'curl https://api.imagekit.io/v1/files/removeAITags \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "AITags": [\n "t-shirt",\n "round-neck",\n "sale2019"\n ],\n "fileIds": [\n "598821f949c0a938d57563bd",\n "598821f949c0a938d57563be"\n ]\n }\'', }, java: { method: 'files().bulk().removeAiTags', @@ -957,22 +968,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->bulk->removeAITags', example: - "files->bulk->removeAITags(\n aiTags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n);\n\nvar_dump($response);", + "files->bulk->removeAITags(\n aiTags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n);\n\nvar_dump($response);", }, python: { method: 'files.bulk.remove_ai_tags', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.bulk.remove_ai_tags(\n ai_tags=["t-shirt", "round-neck", "sale2019"],\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(response.successfully_updated_file_ids)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.files.bulk.remove_ai_tags(\n ai_tags=["t-shirt", "round-neck", "sale2019"],\n file_ids=["598821f949c0a938d57563bd", "598821f949c0a938d57563be"],\n)\nprint(response.successfully_updated_file_ids)', }, ruby: { method: 'files.bulk.remove_ai_tags', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.bulk.remove_ai_tags(\n ai_tags: ["t-shirt", "round-neck", "sale2019"],\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"]\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.files.bulk.remove_ai_tags(\n ai_tags: ["t-shirt", "round-neck", "sale2019"],\n file_ids: ["598821f949c0a938d57563bd", "598821f949c0a938d57563be"]\n)\n\nputs(response)', }, typescript: { method: 'client.files.bulk.removeAITags', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.removeAITags({\n AITags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.bulk.removeAITags({\n AITags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n});\n\nconsole.log(response.successfullyUpdatedFileIds);", }, }, }, @@ -992,7 +1003,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'versions list', - example: "imagekit files:versions list \\\n --private-key 'My Private Key' \\\n --file-id fileId", + example: + "imagekit files:versions list \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", }, csharp: { method: 'Files.Versions.List', @@ -1002,10 +1014,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfiles, err := client.Files.Versions.List(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", files)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfiles, err := client.Files.Versions.List(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", files)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions', + example: + 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().versions().list', @@ -1015,22 +1028,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->list', example: - "files->versions->list('fileId');\n\nvar_dump($files);", + "files->versions->list('fileId');\n\nvar_dump($files);", }, python: { method: 'files.versions.list', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfiles = client.files.versions.list(\n "fileId",\n)\nprint(files)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfiles = client.files.versions.list(\n "fileId",\n)\nprint(files)', }, ruby: { method: 'files.versions.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfiles = image_kit.files.versions.list("fileId")\n\nputs(files)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfiles = image_kit.files.versions.list("fileId")\n\nputs(files)', }, typescript: { method: 'client.files.versions.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst files = await client.files.versions.list('fileId');\n\nconsole.log(files);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst files = await client.files.versions.list('fileId');\n\nconsole.log(files);", }, }, }, @@ -1051,7 +1064,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'versions get', example: - "imagekit files:versions get \\\n --private-key 'My Private Key' \\\n --file-id fileId \\\n --version-id versionId", + "imagekit files:versions get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId", }, csharp: { method: 'Files.Versions.Get', @@ -1061,10 +1074,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Versions.Get(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionGetParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Versions.Get(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionGetParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID', + example: + 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().versions().get', @@ -1074,22 +1088,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->get', example: - "files->versions->get('versionId', fileID: 'fileId');\n\nvar_dump($file);", + "files->versions->get('versionId', fileID: 'fileId');\n\nvar_dump($file);", }, python: { method: 'files.versions.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.versions.get(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.versions.get(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', }, ruby: { method: 'files.versions.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.versions.get("versionId", file_id: "fileId")\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.versions.get("versionId", file_id: "fileId")\n\nputs(file)', }, typescript: { method: 'client.files.versions.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.versions.get('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.versions.get('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", }, }, }, @@ -1110,7 +1124,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'versions delete', example: - "imagekit files:versions delete \\\n --private-key 'My Private Key' \\\n --file-id fileId \\\n --version-id versionId", + "imagekit files:versions delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId", }, csharp: { method: 'Files.Versions.Delete', @@ -1120,10 +1134,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tversion, err := client.Files.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionDeleteParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", version)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tversion, err := client.Files.Versions.Delete(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionDeleteParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", version)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID \\\n -X DELETE', + example: + 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().versions().delete', @@ -1133,22 +1148,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->delete', example: - "files->versions->delete('versionId', fileID: 'fileId');\n\nvar_dump($version);", + "files->versions->delete('versionId', fileID: 'fileId');\n\nvar_dump($version);", }, python: { method: 'files.versions.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nversion = client.files.versions.delete(\n version_id="versionId",\n file_id="fileId",\n)\nprint(version)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nversion = client.files.versions.delete(\n version_id="versionId",\n file_id="fileId",\n)\nprint(version)', }, ruby: { method: 'files.versions.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nversion = image_kit.files.versions.delete("versionId", file_id: "fileId")\n\nputs(version)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nversion = image_kit.files.versions.delete("versionId", file_id: "fileId")\n\nputs(version)', }, typescript: { method: 'client.files.versions.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst version = await client.files.versions.delete('versionId', { fileId: 'fileId' });\n\nconsole.log(version);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst version = await client.files.versions.delete('versionId', { fileId: 'fileId' });\n\nconsole.log(version);", }, }, }, @@ -1169,7 +1184,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'versions restore', example: - "imagekit files:versions restore \\\n --private-key 'My Private Key' \\\n --file-id fileId \\\n --version-id versionId", + "imagekit files:versions restore \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId", }, csharp: { method: 'Files.Versions.Restore', @@ -1179,10 +1194,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Versions.Restore', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfile, err := client.Files.Versions.Restore(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionRestoreParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfile, err := client.Files.Versions.Restore(\n\t\tcontext.TODO(),\n\t\t"versionId",\n\t\timagekit.FileVersionRestoreParams{\n\t\t\tFileID: "fileId",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", file.VideoCodec)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID/restore \\\n -X PUT', + example: + 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID/restore \\\n -X PUT \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().versions().restore', @@ -1192,22 +1208,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->versions->restore', example: - "files->versions->restore('versionId', fileID: 'fileId');\n\nvar_dump($file);", + "files->versions->restore('versionId', fileID: 'fileId');\n\nvar_dump($file);", }, python: { method: 'files.versions.restore', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfile = client.files.versions.restore(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfile = client.files.versions.restore(\n version_id="versionId",\n file_id="fileId",\n)\nprint(file.video_codec)', }, ruby: { method: 'files.versions.restore', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfile = image_kit.files.versions.restore("versionId", file_id: "fileId")\n\nputs(file)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfile = image_kit.files.versions.restore("versionId", file_id: "fileId")\n\nputs(file)', }, typescript: { method: 'client.files.versions.restore', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.versions.restore('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst file = await client.files.versions.restore('versionId', { fileId: 'fileId' });\n\nconsole.log(file.videoCodec);", }, }, }, @@ -1228,7 +1244,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'metadata get', - example: "imagekit files:metadata get \\\n --private-key 'My Private Key' \\\n --file-id fileId", + example: + "imagekit files:metadata get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId", }, csharp: { method: 'Files.Metadata.Get', @@ -1238,10 +1255,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Metadata.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tmetadata, err := client.Files.Metadata.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tmetadata, err := client.Files.Metadata.Get(context.TODO(), "fileId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/metadata', + example: + 'curl https://api.imagekit.io/v1/files/$FILE_ID/metadata \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().metadata().get', @@ -1251,22 +1269,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->metadata->get', example: - "files->metadata->get('fileId');\n\nvar_dump($metadata);", + "files->metadata->get('fileId');\n\nvar_dump($metadata);", }, python: { method: 'files.metadata.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nmetadata = client.files.metadata.get(\n "fileId",\n)\nprint(metadata.video_codec)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nmetadata = client.files.metadata.get(\n "fileId",\n)\nprint(metadata.video_codec)', }, ruby: { method: 'files.metadata.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nmetadata = image_kit.files.metadata.get("fileId")\n\nputs(metadata)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nmetadata = image_kit.files.metadata.get("fileId")\n\nputs(metadata)', }, typescript: { method: 'client.files.metadata.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst metadata = await client.files.metadata.get('fileId');\n\nconsole.log(metadata.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst metadata = await client.files.metadata.get('fileId');\n\nconsole.log(metadata.videoCodec);", }, }, }, @@ -1288,7 +1306,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'metadata getFromURL', example: - "imagekit files:metadata get-from-url \\\n --private-key 'My Private Key' \\\n --url https://example.com", + "imagekit files:metadata get-from-url \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --url https://example.com", }, csharp: { method: 'Files.Metadata.GetFromUrl', @@ -1298,10 +1316,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Files.Metadata.GetFromURL', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tmetadata, err := client.Files.Metadata.GetFromURL(context.TODO(), imagekit.FileMetadataGetFromURLParams{\n\t\tURL: "https://example.com",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tmetadata, err := client.Files.Metadata.GetFromURL(context.TODO(), imagekit.FileMetadataGetFromURLParams{\n\t\tURL: "https://example.com",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", metadata.VideoCodec)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/metadata', + example: + 'curl https://api.imagekit.io/v1/metadata \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'files().metadata().getFromUrl', @@ -1311,22 +1330,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->metadata->getFromURL', example: - "files->metadata->getFromURL(url: 'https://example.com');\n\nvar_dump($metadata);", + "files->metadata->getFromURL(url: 'https://example.com');\n\nvar_dump($metadata);", }, python: { method: 'files.metadata.get_from_url', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nmetadata = client.files.metadata.get_from_url(\n url="https://example.com",\n)\nprint(metadata.video_codec)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nmetadata = client.files.metadata.get_from_url(\n url="https://example.com",\n)\nprint(metadata.video_codec)', }, ruby: { method: 'files.metadata.get_from_url', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nmetadata = image_kit.files.metadata.get_from_url(url: "https://example.com")\n\nputs(metadata)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nmetadata = image_kit.files.metadata.get_from_url(url: "https://example.com")\n\nputs(metadata)', }, typescript: { method: 'client.files.metadata.getFromURL', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst metadata = await client.files.metadata.getFromURL({ url: 'https://example.com' });\n\nconsole.log(metadata.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst metadata = await client.files.metadata.getFromURL({ url: 'https://example.com' });\n\nconsole.log(metadata.videoCodec);", }, }, }, @@ -1346,7 +1365,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions list', - example: "imagekit saved-extensions list \\\n --private-key 'My Private Key'", + example: + "imagekit saved-extensions list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", }, csharp: { method: 'SavedExtensions.List', @@ -1356,10 +1376,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtensions, err := client.SavedExtensions.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtensions)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtensions, err := client.SavedExtensions.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtensions)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/saved-extensions', + example: + 'curl https://api.imagekit.io/v1/saved-extensions \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'savedExtensions().list', @@ -1369,22 +1390,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->list', example: - "savedExtensions->list();\n\nvar_dump($savedExtensions);", + "savedExtensions->list();\n\nvar_dump($savedExtensions);", }, python: { method: 'saved_extensions.list', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extensions = client.saved_extensions.list()\nprint(saved_extensions)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extensions = client.saved_extensions.list()\nprint(saved_extensions)', }, ruby: { method: 'saved_extensions.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extensions = image_kit.saved_extensions.list\n\nputs(saved_extensions)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extensions = image_kit.saved_extensions.list\n\nputs(saved_extensions)', }, typescript: { method: 'client.savedExtensions.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtensions = await client.savedExtensions.list();\n\nconsole.log(savedExtensions);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtensions = await client.savedExtensions.list();\n\nconsole.log(savedExtensions);", }, }, }, @@ -1410,7 +1431,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'savedExtensions create', example: - "imagekit saved-extensions create \\\n --private-key 'My Private Key' \\\n --config '{name: remove-bg}' \\\n --description 'Analyzes vehicle images for type, condition, and quality assessment' \\\n --name 'Car Quality Analysis'", + "imagekit saved-extensions create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --config '{name: remove-bg}' \\\n --description 'Analyzes vehicle images for type, condition, and quality assessment' \\\n --name 'Car Quality Analysis'", }, csharp: { method: 'SavedExtensions.Create', @@ -1420,11 +1441,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n\t"github.com/imagekit-developer/imagekit-go/shared"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.New(context.TODO(), imagekit.SavedExtensionNewParams{\n\t\tConfig: shared.ExtensionConfigUnionParam{\n\t\t\tOfRemoveBg: &shared.ExtensionConfigRemoveBgParam{},\n\t\t},\n\t\tDescription: "Analyzes vehicle images for type, condition, and quality assessment",\n\t\tName: "Car Quality Analysis",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n\t"github.com/imagekit-developer/imagekit-go/shared"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.New(context.TODO(), imagekit.SavedExtensionNewParams{\n\t\tConfig: shared.ExtensionConfigUnionParam{\n\t\t\tOfRemoveBg: &shared.ExtensionConfigRemoveBgParam{},\n\t\t},\n\t\tDescription: "Analyzes vehicle images for type, condition, and quality assessment",\n\t\tName: "Car Quality Analysis",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/saved-extensions \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "config": {\n "name": "remove-bg"\n },\n "description": "Analyzes vehicle images for type, condition, and quality assessment",\n "name": "Car Quality Analysis"\n }\'', + 'curl https://api.imagekit.io/v1/saved-extensions \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "config": {\n "name": "remove-bg"\n },\n "description": "Analyzes vehicle images for type, condition, and quality assessment",\n "name": "Car Quality Analysis"\n }\'', }, java: { method: 'savedExtensions().create', @@ -1434,22 +1455,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->create', example: - "savedExtensions->create(\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n);\n\nvar_dump($savedExtension);", + "savedExtensions->create(\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n);\n\nvar_dump($savedExtension);", }, python: { method: 'saved_extensions.create', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extension = client.saved_extensions.create(\n config={\n "name": "remove-bg"\n },\n description="Analyzes vehicle images for type, condition, and quality assessment",\n name="Car Quality Analysis",\n)\nprint(saved_extension.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extension = client.saved_extensions.create(\n config={\n "name": "remove-bg"\n },\n description="Analyzes vehicle images for type, condition, and quality assessment",\n name="Car Quality Analysis",\n)\nprint(saved_extension.id)', }, ruby: { method: 'saved_extensions.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extension = image_kit.saved_extensions.create(\n config: {name: :"remove-bg"},\n description: "Analyzes vehicle images for type, condition, and quality assessment",\n name: "Car Quality Analysis"\n)\n\nputs(saved_extension)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extension = image_kit.saved_extensions.create(\n config: {name: :"remove-bg"},\n description: "Analyzes vehicle images for type, condition, and quality assessment",\n name: "Car Quality Analysis"\n)\n\nputs(saved_extension)', }, typescript: { method: 'client.savedExtensions.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.create({\n config: { name: 'remove-bg' },\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n});\n\nconsole.log(savedExtension.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtension = await client.savedExtensions.create({\n config: { name: 'remove-bg' },\n description: 'Analyzes vehicle images for type, condition, and quality assessment',\n name: 'Car Quality Analysis',\n});\n\nconsole.log(savedExtension.id);", }, }, }, @@ -1469,7 +1490,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions get', - example: "imagekit saved-extensions get \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit saved-extensions get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'SavedExtensions.Get', @@ -1479,10 +1501,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/saved-extensions/$ID', + example: + 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'savedExtensions().get', @@ -1492,22 +1515,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->get', example: - "savedExtensions->get('id');\n\nvar_dump($savedExtension);", + "savedExtensions->get('id');\n\nvar_dump($savedExtension);", }, python: { method: 'saved_extensions.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extension = client.saved_extensions.get(\n "id",\n)\nprint(saved_extension.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extension = client.saved_extensions.get(\n "id",\n)\nprint(saved_extension.id)', }, ruby: { method: 'saved_extensions.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extension = image_kit.saved_extensions.get("id")\n\nputs(saved_extension)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extension = image_kit.saved_extensions.get("id")\n\nputs(saved_extension)', }, typescript: { method: 'client.savedExtensions.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.get('id');\n\nconsole.log(savedExtension.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtension = await client.savedExtensions.get('id');\n\nconsole.log(savedExtension.id);", }, }, }, @@ -1533,7 +1556,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions update', - example: "imagekit saved-extensions update \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit saved-extensions update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'SavedExtensions.Update', @@ -1543,11 +1567,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.SavedExtensionUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tsavedExtension, err := client.SavedExtensions.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.SavedExtensionUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", savedExtension.ID)\n}\n', }, http: { example: - "curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X PATCH \\\n -H 'Content-Type: application/json' \\\n -d '{}'", + "curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X PATCH \\\n -H 'Content-Type: application/json' \\\n -u \"$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS\" \\\n -d '{}'", }, java: { method: 'savedExtensions().update', @@ -1557,22 +1581,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->update', example: - "savedExtensions->update(\n 'id',\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'x',\n name: 'x',\n);\n\nvar_dump($savedExtension);", + "savedExtensions->update(\n 'id',\n config: [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n description: 'x',\n name: 'x',\n);\n\nvar_dump($savedExtension);", }, python: { method: 'saved_extensions.update', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nsaved_extension = client.saved_extensions.update(\n id="id",\n)\nprint(saved_extension.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nsaved_extension = client.saved_extensions.update(\n id="id",\n)\nprint(saved_extension.id)', }, ruby: { method: 'saved_extensions.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nsaved_extension = image_kit.saved_extensions.update("id")\n\nputs(saved_extension)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nsaved_extension = image_kit.saved_extensions.update("id")\n\nputs(saved_extension)', }, typescript: { method: 'client.savedExtensions.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.update('id');\n\nconsole.log(savedExtension.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst savedExtension = await client.savedExtensions.update('id');\n\nconsole.log(savedExtension.id);", }, }, }, @@ -1590,7 +1614,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'savedExtensions delete', - example: "imagekit saved-extensions delete \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit saved-extensions delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'SavedExtensions.Delete', @@ -1600,10 +1625,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.SavedExtensions.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.SavedExtensions.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.SavedExtensions.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X DELETE', + example: + 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'savedExtensions().delete', @@ -1613,22 +1639,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'savedExtensions->delete', example: - "savedExtensions->delete('id');\n\nvar_dump($result);", + "savedExtensions->delete('id');\n\nvar_dump($result);", }, python: { method: 'saved_extensions.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.saved_extensions.delete(\n "id",\n)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.saved_extensions.delete(\n "id",\n)', }, ruby: { method: 'saved_extensions.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.saved_extensions.delete("id")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.saved_extensions.delete("id")\n\nputs(result)', }, typescript: { method: 'client.savedExtensions.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.savedExtensions.delete('id');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.savedExtensions.delete('id');", }, }, }, @@ -1657,7 +1683,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'assets list', - example: "imagekit assets list \\\n --private-key 'My Private Key'", + example: "imagekit assets list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", }, csharp: { method: 'Assets.List', @@ -1667,10 +1693,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Assets.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tassets, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", assets)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tassets, err := client.Assets.List(context.TODO(), imagekit.AssetListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", assets)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files', + example: + 'curl https://api.imagekit.io/v1/files \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'assets().list', @@ -1680,22 +1707,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'assets->list', example: - "assets->list(\n fileType: 'all',\n limit: 1,\n path: 'path',\n searchQuery: 'searchQuery',\n skip: 0,\n sort: 'ASC_NAME',\n type: 'file',\n);\n\nvar_dump($assets);", + "assets->list(\n fileType: 'all',\n limit: 1,\n path: 'path',\n searchQuery: 'searchQuery',\n skip: 0,\n sort: 'ASC_NAME',\n type: 'file',\n);\n\nvar_dump($assets);", }, python: { method: 'assets.list', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nassets = client.assets.list()\nprint(assets)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nassets = client.assets.list()\nprint(assets)', }, ruby: { method: 'assets.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nassets = image_kit.assets.list\n\nputs(assets)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nassets = image_kit.assets.list\n\nputs(assets)', }, typescript: { method: 'client.assets.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst assets = await client.assets.list();\n\nconsole.log(assets);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst assets = await client.assets.list();\n\nconsole.log(assets);", }, }, }, @@ -1716,7 +1743,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'invalidation create', example: - "imagekit cache:invalidation create \\\n --private-key 'My Private Key' \\\n --url https://ik.imagekit.io/your_imagekit_id/default-image.jpg", + "imagekit cache:invalidation create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --url https://ik.imagekit.io/your_imagekit_id/default-image.jpg", }, csharp: { method: 'Cache.Invalidation.Create', @@ -1726,11 +1753,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Cache.Invalidation.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.New(context.TODO(), imagekit.CacheInvalidationNewParams{\n\t\tURL: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.RequestID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.New(context.TODO(), imagekit.CacheInvalidationNewParams{\n\t\tURL: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.RequestID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/files/purge \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg"\n }\'', + 'curl https://api.imagekit.io/v1/files/purge \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg"\n }\'', }, java: { method: 'cache().invalidation().create', @@ -1740,22 +1767,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'cache->invalidation->create', example: - "cache->invalidation->create(\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg'\n);\n\nvar_dump($invalidation);", + "cache->invalidation->create(\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg'\n);\n\nvar_dump($invalidation);", }, python: { method: 'cache.invalidation.create', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\ninvalidation = client.cache.invalidation.create(\n url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n)\nprint(invalidation.request_id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ninvalidation = client.cache.invalidation.create(\n url="https://ik.imagekit.io/your_imagekit_id/default-image.jpg",\n)\nprint(invalidation.request_id)', }, ruby: { method: 'cache.invalidation.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ninvalidation = image_kit.cache.invalidation.create(url: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg")\n\nputs(invalidation)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ninvalidation = image_kit.cache.invalidation.create(url: "https://ik.imagekit.io/your_imagekit_id/default-image.jpg")\n\nputs(invalidation)', }, typescript: { method: 'client.cache.invalidation.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst invalidation = await client.cache.invalidation.create({\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg',\n});\n\nconsole.log(invalidation.requestId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst invalidation = await client.cache.invalidation.create({\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg',\n});\n\nconsole.log(invalidation.requestId);", }, }, }, @@ -1775,7 +1802,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'invalidation get', example: - "imagekit cache:invalidation get \\\n --private-key 'My Private Key' \\\n --request-id requestId", + "imagekit cache:invalidation get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --request-id requestId", }, csharp: { method: 'Cache.Invalidation.Get', @@ -1785,10 +1812,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Cache.Invalidation.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.Get(context.TODO(), "requestId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.Status)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tinvalidation, err := client.Cache.Invalidation.Get(context.TODO(), "requestId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", invalidation.Status)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/files/purge/$REQUEST_ID', + example: + 'curl https://api.imagekit.io/v1/files/purge/$REQUEST_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'cache().invalidation().get', @@ -1798,22 +1826,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'cache->invalidation->get', example: - "cache->invalidation->get('requestId');\n\nvar_dump($invalidation);", + "cache->invalidation->get('requestId');\n\nvar_dump($invalidation);", }, python: { method: 'cache.invalidation.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\ninvalidation = client.cache.invalidation.get(\n "requestId",\n)\nprint(invalidation.status)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\ninvalidation = client.cache.invalidation.get(\n "requestId",\n)\nprint(invalidation.status)', }, ruby: { method: 'cache.invalidation.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\ninvalidation = image_kit.cache.invalidation.get("requestId")\n\nputs(invalidation)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\ninvalidation = image_kit.cache.invalidation.get("requestId")\n\nputs(invalidation)', }, typescript: { method: 'client.cache.invalidation.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst invalidation = await client.cache.invalidation.get('requestId');\n\nconsole.log(invalidation.status);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst invalidation = await client.cache.invalidation.get('requestId');\n\nconsole.log(invalidation.status);", }, }, }, @@ -1834,7 +1862,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders create', example: - "imagekit folders create \\\n --private-key 'My Private Key' \\\n --folder-name summer \\\n --parent-folder-path /product/images/", + "imagekit folders create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-name summer \\\n --parent-folder-path /product/images/", }, csharp: { method: 'Folders.Create', @@ -1844,11 +1872,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfolder, err := client.Folders.New(context.TODO(), imagekit.FolderNewParams{\n\t\tFolderName: "summer",\n\t\tParentFolderPath: "/product/images/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfolder, err := client.Folders.New(context.TODO(), imagekit.FolderNewParams{\n\t\tFolderName: "summer",\n\t\tParentFolderPath: "/product/images/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/folder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "folderName": "summer",\n "parentFolderPath": "/product/images/"\n }\'', + 'curl https://api.imagekit.io/v1/folder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "folderName": "summer",\n "parentFolderPath": "/product/images/"\n }\'', }, java: { method: 'folders().create', @@ -1858,22 +1886,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->create', example: - "folders->create(\n folderName: 'summer', parentFolderPath: '/product/images/'\n);\n\nvar_dump($folder);", + "folders->create(\n folderName: 'summer', parentFolderPath: '/product/images/'\n);\n\nvar_dump($folder);", }, python: { method: 'folders.create', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfolder = client.folders.create(\n folder_name="summer",\n parent_folder_path="/product/images/",\n)\nprint(folder)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfolder = client.folders.create(\n folder_name="summer",\n parent_folder_path="/product/images/",\n)\nprint(folder)', }, ruby: { method: 'folders.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfolder = image_kit.folders.create(folder_name: "summer", parent_folder_path: "/product/images/")\n\nputs(folder)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfolder = image_kit.folders.create(folder_name: "summer", parent_folder_path: "/product/images/")\n\nputs(folder)', }, typescript: { method: 'client.folders.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst folder = await client.folders.create({\n folderName: 'summer',\n parentFolderPath: '/product/images/',\n});\n\nconsole.log(folder);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst folder = await client.folders.create({\n folderName: 'summer',\n parentFolderPath: '/product/images/',\n});\n\nconsole.log(folder);", }, }, }, @@ -1894,7 +1922,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders delete', example: - "imagekit folders delete \\\n --private-key 'My Private Key' \\\n --folder-path /folder/to/delete/", + "imagekit folders delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-path /folder/to/delete/", }, csharp: { method: 'Folders.Delete', @@ -1904,10 +1932,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Delete', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tfolder, err := client.Folders.Delete(context.TODO(), imagekit.FolderDeleteParams{\n\t\tFolderPath: "/folder/to/delete/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tfolder, err := client.Folders.Delete(context.TODO(), imagekit.FolderDeleteParams{\n\t\tFolderPath: "/folder/to/delete/",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", folder)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/folder \\\n -X DELETE', + example: + 'curl https://api.imagekit.io/v1/folder \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'folders().delete', @@ -1917,22 +1946,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->delete', example: - "folders->delete(folderPath: '/folder/to/delete/');\n\nvar_dump($folder);", + "folders->delete(folderPath: '/folder/to/delete/');\n\nvar_dump($folder);", }, python: { method: 'folders.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nfolder = client.folders.delete(\n folder_path="/folder/to/delete/",\n)\nprint(folder)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nfolder = client.folders.delete(\n folder_path="/folder/to/delete/",\n)\nprint(folder)', }, ruby: { method: 'folders.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nfolder = image_kit.folders.delete(folder_path: "/folder/to/delete/")\n\nputs(folder)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nfolder = image_kit.folders.delete(folder_path: "/folder/to/delete/")\n\nputs(folder)', }, typescript: { method: 'client.folders.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst folder = await client.folders.delete({ folderPath: '/folder/to/delete/' });\n\nconsole.log(folder);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst folder = await client.folders.delete({ folderPath: '/folder/to/delete/' });\n\nconsole.log(folder);", }, }, }, @@ -1953,7 +1982,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders copy', example: - "imagekit folders copy \\\n --private-key 'My Private Key' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", + "imagekit folders copy \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", }, csharp: { method: 'Folders.Copy', @@ -1963,11 +1992,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Copy', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Folders.Copy(context.TODO(), imagekit.FolderCopyParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Folders.Copy(context.TODO(), imagekit.FolderCopyParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/bulkJobs/copyFolder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder",\n "includeVersions": true\n }\'', + 'curl https://api.imagekit.io/v1/bulkJobs/copyFolder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder",\n "includeVersions": true\n }\'', }, java: { method: 'folders().copy', @@ -1977,22 +2006,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->copy', example: - "folders->copy(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n includeVersions: true,\n);\n\nvar_dump($response);", + "folders->copy(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n includeVersions: true,\n);\n\nvar_dump($response);", }, python: { method: 'folders.copy', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.folders.copy(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.folders.copy(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', }, ruby: { method: 'folders.copy', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.folders.copy(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.folders.copy(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', }, typescript: { method: 'client.folders.copy', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.copy({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.folders.copy({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", }, }, }, @@ -2013,7 +2042,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders move', example: - "imagekit folders move \\\n --private-key 'My Private Key' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", + "imagekit folders move \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --destination-path /path/of/destination/folder \\\n --source-folder-path /path/of/source/folder", }, csharp: { method: 'Folders.Move', @@ -2023,11 +2052,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Move', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Folders.Move(context.TODO(), imagekit.FolderMoveParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Folders.Move(context.TODO(), imagekit.FolderMoveParams{\n\t\tDestinationPath: "/path/of/destination/folder",\n\t\tSourceFolderPath: "/path/of/source/folder",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/bulkJobs/moveFolder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder"\n }\'', + 'curl https://api.imagekit.io/v1/bulkJobs/moveFolder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "destinationPath": "/path/of/destination/folder",\n "sourceFolderPath": "/path/of/source/folder"\n }\'', }, java: { method: 'folders().move', @@ -2037,22 +2066,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->move', example: - "folders->move(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n);\n\nvar_dump($response);", + "folders->move(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n);\n\nvar_dump($response);", }, python: { method: 'folders.move', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.folders.move(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.folders.move(\n destination_path="/path/of/destination/folder",\n source_folder_path="/path/of/source/folder",\n)\nprint(response.job_id)', }, ruby: { method: 'folders.move', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.folders.move(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.folders.move(\n destination_path: "/path/of/destination/folder",\n source_folder_path: "/path/of/source/folder"\n)\n\nputs(response)', }, typescript: { method: 'client.folders.move', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.move({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.folders.move({\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n});\n\nconsole.log(response.jobId);", }, }, }, @@ -2073,7 +2102,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'folders rename', example: - "imagekit folders rename \\\n --private-key 'My Private Key' \\\n --folder-path /path/of/folder \\\n --new-folder-name new-folder-name", + "imagekit folders rename \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-path /path/of/folder \\\n --new-folder-name new-folder-name", }, csharp: { method: 'Folders.Rename', @@ -2083,11 +2112,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Rename', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Folders.Rename(context.TODO(), imagekit.FolderRenameParams{\n\t\tFolderPath: "/path/of/folder",\n\t\tNewFolderName: "new-folder-name",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Folders.Rename(context.TODO(), imagekit.FolderRenameParams{\n\t\tFolderPath: "/path/of/folder",\n\t\tNewFolderName: "new-folder-name",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.JobID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/bulkJobs/renameFolder \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "folderPath": "/path/of/folder",\n "newFolderName": "new-folder-name",\n "purgeCache": true\n }\'', + 'curl https://api.imagekit.io/v1/bulkJobs/renameFolder \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "folderPath": "/path/of/folder",\n "newFolderName": "new-folder-name",\n "purgeCache": true\n }\'', }, java: { method: 'folders().rename', @@ -2097,22 +2126,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->rename', example: - "folders->rename(\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n purgeCache: true,\n);\n\nvar_dump($response);", + "folders->rename(\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n purgeCache: true,\n);\n\nvar_dump($response);", }, python: { method: 'folders.rename', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.folders.rename(\n folder_path="/path/of/folder",\n new_folder_name="new-folder-name",\n)\nprint(response.job_id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.folders.rename(\n folder_path="/path/of/folder",\n new_folder_name="new-folder-name",\n)\nprint(response.job_id)', }, ruby: { method: 'folders.rename', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.folders.rename(folder_path: "/path/of/folder", new_folder_name: "new-folder-name")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.folders.rename(folder_path: "/path/of/folder", new_folder_name: "new-folder-name")\n\nputs(response)', }, typescript: { method: 'client.folders.rename', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.rename({\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n});\n\nconsole.log(response.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.folders.rename({\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n});\n\nconsole.log(response.jobId);", }, }, }, @@ -2132,7 +2161,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'job get', - example: "imagekit folders:job get \\\n --private-key 'My Private Key' \\\n --job-id jobId", + example: + "imagekit folders:job get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --job-id jobId", }, csharp: { method: 'Folders.Job.Get', @@ -2142,10 +2172,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Folders.Job.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tjob, err := client.Folders.Job.Get(context.TODO(), "jobId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", job.JobID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tjob, err := client.Folders.Job.Get(context.TODO(), "jobId")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", job.JobID)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/bulkJobs/$JOB_ID', + example: + 'curl https://api.imagekit.io/v1/bulkJobs/$JOB_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'folders().job().get', @@ -2155,22 +2186,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'folders->job->get', example: - "folders->job->get('jobId');\n\nvar_dump($job);", + "folders->job->get('jobId');\n\nvar_dump($job);", }, python: { method: 'folders.job.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\njob = client.folders.job.get(\n "jobId",\n)\nprint(job.job_id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\njob = client.folders.job.get(\n "jobId",\n)\nprint(job.job_id)', }, ruby: { method: 'folders.job.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\njob = image_kit.folders.job.get("jobId")\n\nputs(job)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\njob = image_kit.folders.job.get("jobId")\n\nputs(job)', }, typescript: { method: 'client.folders.job.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst job = await client.folders.job.get('jobId');\n\nconsole.log(job.jobId);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst job = await client.folders.job.get('jobId');\n\nconsole.log(job.jobId);", }, }, }, @@ -2192,7 +2223,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'usage get', example: - "imagekit accounts:usage get \\\n --private-key 'My Private Key' \\\n --end-date \"'2019-12-27'\" \\\n --start-date \"'2019-12-27'\"", + "imagekit accounts:usage get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --end-date \"'2019-12-27'\" \\\n --start-date \"'2019-12-27'\"", }, csharp: { method: 'Accounts.Usage.Get', @@ -2202,10 +2233,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Usage.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\t"time"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tusage, err := client.Accounts.Usage.Get(context.TODO(), imagekit.AccountUsageGetParams{\n\t\tEndDate: time.Now(),\n\t\tStartDate: time.Now(),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", usage.BandwidthBytes)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\t"time"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tusage, err := client.Accounts.Usage.Get(context.TODO(), imagekit.AccountUsageGetParams{\n\t\tEndDate: time.Now(),\n\t\tStartDate: time.Now(),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", usage.BandwidthBytes)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/accounts/usage', + example: + 'curl https://api.imagekit.io/v1/accounts/usage \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'accounts().usage().get', @@ -2215,22 +2247,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->usage->get', example: - "accounts->usage->get(\n endDate: '2019-12-27', startDate: '2019-12-27'\n);\n\nvar_dump($usage);", + "accounts->usage->get(\n endDate: '2019-12-27', startDate: '2019-12-27'\n);\n\nvar_dump($usage);", }, python: { method: 'accounts.usage.get', example: - 'from datetime import date\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\nusage = client.accounts.usage.get(\n end_date=date.fromisoformat("2019-12-27"),\n start_date=date.fromisoformat("2019-12-27"),\n)\nprint(usage.bandwidth_bytes)', + 'import os\nfrom datetime import date\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nusage = client.accounts.usage.get(\n end_date=date.fromisoformat("2019-12-27"),\n start_date=date.fromisoformat("2019-12-27"),\n)\nprint(usage.bandwidth_bytes)', }, ruby: { method: 'accounts.usage.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nusage = image_kit.accounts.usage.get(end_date: "2019-12-27", start_date: "2019-12-27")\n\nputs(usage)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nusage = image_kit.accounts.usage.get(end_date: "2019-12-27", start_date: "2019-12-27")\n\nputs(usage)', }, typescript: { method: 'client.accounts.usage.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst usage = await client.accounts.usage.get({ endDate: '2019-12-27', startDate: '2019-12-27' });\n\nconsole.log(usage.bandwidthBytes);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst usage = await client.accounts.usage.get({ endDate: '2019-12-27', startDate: '2019-12-27' });\n\nconsole.log(usage.bandwidthBytes);", }, }, }, @@ -2249,7 +2281,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'origins list', - example: "imagekit accounts:origins list \\\n --private-key 'My Private Key'", + example: + "imagekit accounts:origins list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", }, csharp: { method: 'Accounts.Origins.List', @@ -2259,10 +2292,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponses, err := client.Accounts.Origins.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponses)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponses, err := client.Accounts.Origins.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponses)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/accounts/origins', + example: + 'curl https://api.imagekit.io/v1/accounts/origins \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'accounts().origins().list', @@ -2272,22 +2306,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->list', example: - "accounts->origins->list();\n\nvar_dump($originResponses);", + "accounts->origins->list();\n\nvar_dump($originResponses);", }, python: { method: 'accounts.origins.list', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_responses = client.accounts.origins.list()\nprint(origin_responses)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_responses = client.accounts.origins.list()\nprint(origin_responses)', }, ruby: { method: 'accounts.origins.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_responses = image_kit.accounts.origins.list\n\nputs(origin_responses)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_responses = image_kit.accounts.origins.list\n\nputs(origin_responses)', }, typescript: { method: 'client.accounts.origins.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponses = await client.accounts.origins.list();\n\nconsole.log(originResponses);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponses = await client.accounts.origins.list();\n\nconsole.log(originResponses);", }, }, }, @@ -2308,7 +2342,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'origins create', example: - "imagekit accounts:origins create \\\n --private-key 'My Private Key' \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", + "imagekit accounts:origins create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", }, csharp: { method: 'Accounts.Origins.Create', @@ -2318,11 +2352,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.New(context.TODO(), imagekit.AccountOriginNewParams{\n\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\tBucket: "test-bucket",\n\t\t\t\tName: "My S3 Origin",\n\t\t\t\tSecretKey: "secrettest123",\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.New(context.TODO(), imagekit.AccountOriginNewParams{\n\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\tBucket: "test-bucket",\n\t\t\t\tName: "My S3 Origin",\n\t\t\t\tSecretKey: "secrettest123",\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/origins \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/origins \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', }, java: { method: 'accounts().origins().create', @@ -2332,22 +2366,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->create', example: - "accounts->origins->create(\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", + "accounts->origins->create(\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", }, python: { method: 'accounts.origins.create', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_response = client.accounts.origins.create(\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_response = client.accounts.origins.create(\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', }, ruby: { method: 'accounts.origins.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_response = image_kit.accounts.origins.create(\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_response = image_kit.accounts.origins.create(\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', }, typescript: { method: 'client.accounts.origins.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponse = await client.accounts.origins.create({\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponse = await client.accounts.origins.create({\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", }, }, }, @@ -2366,7 +2400,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'origins get', - example: "imagekit accounts:origins get \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit accounts:origins get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'Accounts.Origins.Get', @@ -2376,10 +2411,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/accounts/origins/$ID', + example: + 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'accounts().origins().get', @@ -2389,22 +2425,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->get', example: - "accounts->origins->get('id');\n\nvar_dump($originResponse);", + "accounts->origins->get('id');\n\nvar_dump($originResponse);", }, python: { method: 'accounts.origins.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_response = client.accounts.origins.get(\n "id",\n)\nprint(origin_response)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_response = client.accounts.origins.get(\n "id",\n)\nprint(origin_response)', }, ruby: { method: 'accounts.origins.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_response = image_kit.accounts.origins.get("id")\n\nputs(origin_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_response = image_kit.accounts.origins.get("id")\n\nputs(origin_response)', }, typescript: { method: 'client.accounts.origins.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponse = await client.accounts.origins.get('id');\n\nconsole.log(originResponse);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponse = await client.accounts.origins.get('id');\n\nconsole.log(originResponse);", }, }, }, @@ -2426,7 +2462,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'origins update', example: - "imagekit accounts:origins update \\\n --private-key 'My Private Key' \\\n --id id \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", + "imagekit accounts:origins update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id \\\n --access-key AKIAIOSFODNN7EXAMPLE \\\n --bucket product-images \\\n --name 'US S3 Storage' \\\n --secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \\\n --type S3 \\\n --endpoint https://s3.eu-central-1.wasabisys.com \\\n --base-url https://images.example.com/assets \\\n --client-email service-account@project.iam.gserviceaccount.com \\\n --private-key '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...' \\\n --account-name account123 \\\n --container images \\\n --sas-token '?sv=2023-01-03&sr=c&sig=abc123' \\\n --client-id akeneo-client-id \\\n --client-secret akeneo-client-secret \\\n --password strongpassword123 \\\n --username integration-user", }, csharp: { method: 'Accounts.Origins.Update', @@ -2436,11 +2472,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountOriginUpdateParams{\n\t\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\t\tBucket: "test-bucket",\n\t\t\t\t\tName: "My S3 Origin",\n\t\t\t\t\tSecretKey: "secrettest123",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\toriginResponse, err := client.Accounts.Origins.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountOriginUpdateParams{\n\t\t\tOriginRequest: imagekit.OriginRequestUnionParam{\n\t\t\t\tOfS3: &imagekit.OriginRequestS3Param{\n\t\t\t\t\tAccessKey: "AKIATEST123",\n\t\t\t\t\tBucket: "test-bucket",\n\t\t\t\t\tName: "My S3 Origin",\n\t\t\t\t\tSecretKey: "secrettest123",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", originResponse)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "accessKey": "AKIAIOSFODNN7EXAMPLE",\n "bucket": "product-images",\n "name": "US S3 Storage",\n "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n "type": "S3",\n "baseUrlForCanonicalHeader": "https://cdn.example.com",\n "prefix": "raw-assets"\n }\'', }, java: { method: 'accounts().origins().update', @@ -2450,22 +2486,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->update', example: - "accounts->origins->update(\n 'id',\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", + "accounts->origins->update(\n 'id',\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'gcs-media',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'AKENEO_PIM',\n baseURLForCanonicalHeader: 'https://cdn.example.com',\n includeCanonicalHeader: false,\n prefix: 'uploads',\n endpoint: 'https://s3.eu-central-1.wasabisys.com',\n s3ForcePathStyle: true,\n baseURL: 'https://akeneo.company.com',\n forwardHostHeaderToOrigin: false,\n clientEmail: 'service-account@project.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----\\\\nMIIEv...',\n accountName: 'account123',\n container: 'images',\n sasToken: '?sv=2023-01-03&sr=c&sig=abc123',\n clientID: 'akeneo-client-id',\n clientSecret: 'akeneo-client-secret',\n password: 'strongpassword123',\n username: 'integration-user',\n);\n\nvar_dump($originResponse);", }, python: { method: 'accounts.origins.update', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\norigin_response = client.accounts.origins.update(\n id="id",\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\norigin_response = client.accounts.origins.update(\n id="id",\n access_key="AKIAIOSFODNN7EXAMPLE",\n bucket="product-images",\n name="US S3 Storage",\n secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",\n type="S3",\n)\nprint(origin_response)', }, ruby: { method: 'accounts.origins.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\norigin_response = image_kit.accounts.origins.update(\n "id",\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\norigin_response = image_kit.accounts.origins.update(\n "id",\n origin_request: {accessKey: "AKIATEST123", bucket: "test-bucket", name: "My S3 Origin", secretKey: "secrettest123", type: :S3}\n)\n\nputs(origin_response)', }, typescript: { method: 'client.accounts.origins.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponse = await client.accounts.origins.update('id', {\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst originResponse = await client.accounts.origins.update('id', {\n accessKey: 'AKIAIOSFODNN7EXAMPLE',\n bucket: 'product-images',\n name: 'US S3 Storage',\n secretKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',\n type: 'S3',\n});\n\nconsole.log(originResponse);", }, }, }, @@ -2484,7 +2520,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'origins delete', - example: "imagekit accounts:origins delete \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit accounts:origins delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'Accounts.Origins.Delete', @@ -2494,10 +2531,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.Origins.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Accounts.Origins.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Accounts.Origins.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X DELETE', + example: + 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'accounts().origins().delete', @@ -2507,22 +2545,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->origins->delete', example: - "accounts->origins->delete('id');\n\nvar_dump($result);", + "accounts->origins->delete('id');\n\nvar_dump($result);", }, python: { method: 'accounts.origins.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.accounts.origins.delete(\n "id",\n)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.accounts.origins.delete(\n "id",\n)', }, ruby: { method: 'accounts.origins.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.accounts.origins.delete("id")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.accounts.origins.delete("id")\n\nputs(result)', }, typescript: { method: 'client.accounts.origins.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.accounts.origins.delete('id');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.accounts.origins.delete('id');", }, }, }, @@ -2542,7 +2580,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'urlEndpoints list', - example: "imagekit accounts:url-endpoints list \\\n --private-key 'My Private Key'", + example: + "imagekit accounts:url-endpoints list \\\n --private-key 'My Private Key' \\\n --password 'My Password'", }, csharp: { method: 'Accounts.UrlEndpoints.List', @@ -2552,10 +2591,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.List', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponses, err := client.Accounts.URLEndpoints.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponses)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponses, err := client.Accounts.URLEndpoints.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponses)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints', + example: + 'curl https://api.imagekit.io/v1/accounts/url-endpoints \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'accounts().urlEndpoints().list', @@ -2565,22 +2605,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->list', example: - "accounts->urlEndpoints->list();\n\nvar_dump($urlEndpointResponses);", + "accounts->urlEndpoints->list();\n\nvar_dump($urlEndpointResponses);", }, python: { method: 'accounts.url_endpoints.list', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_responses = client.accounts.url_endpoints.list()\nprint(url_endpoint_responses)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_responses = client.accounts.url_endpoints.list()\nprint(url_endpoint_responses)', }, ruby: { method: 'accounts.url_endpoints.list', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_responses = image_kit.accounts.url_endpoints.list\n\nputs(url_endpoint_responses)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_responses = image_kit.accounts.url_endpoints.list\n\nputs(url_endpoint_responses)', }, typescript: { method: 'client.accounts.urlEndpoints.list', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponses = await client.accounts.urlEndpoints.list();\n\nconsole.log(urlEndpointResponses);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponses = await client.accounts.urlEndpoints.list();\n\nconsole.log(urlEndpointResponses);", }, }, }, @@ -2607,7 +2647,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'urlEndpoints create', example: - "imagekit accounts:url-endpoints create \\\n --private-key 'My Private Key' \\\n --description 'My custom URL endpoint'", + "imagekit accounts:url-endpoints create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --description 'My custom URL endpoint'", }, csharp: { method: 'Accounts.UrlEndpoints.Create', @@ -2617,11 +2657,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.New', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.New(context.TODO(), imagekit.AccountURLEndpointNewParams{\n\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\tDescription: "My custom URL endpoint",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.New(context.TODO(), imagekit.AccountURLEndpointNewParams{\n\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\tDescription: "My custom URL endpoint",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/url-endpoints \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/url-endpoints \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', }, java: { method: 'accounts().urlEndpoints().create', @@ -2631,22 +2671,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->create', example: - "accounts->urlEndpoints->create(\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", + "accounts->urlEndpoints->create(\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", }, python: { method: 'accounts.url_endpoints.create', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_response = client.accounts.url_endpoints.create(\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_response = client.accounts.url_endpoints.create(\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', }, ruby: { method: 'accounts.url_endpoints.create', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.create(description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.create(description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', }, typescript: { method: 'client.accounts.urlEndpoints.create', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.create({\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.create({\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", }, }, }, @@ -2667,7 +2707,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'urlEndpoints get', - example: "imagekit accounts:url-endpoints get \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit accounts:url-endpoints get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'Accounts.UrlEndpoints.Get', @@ -2677,10 +2718,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.Get', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Get(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID', + example: + 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'accounts().urlEndpoints().get', @@ -2690,22 +2732,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->get', example: - "accounts->urlEndpoints->get('id');\n\nvar_dump($urlEndpointResponse);", + "accounts->urlEndpoints->get('id');\n\nvar_dump($urlEndpointResponse);", }, python: { method: 'accounts.url_endpoints.get', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_response = client.accounts.url_endpoints.get(\n "id",\n)\nprint(url_endpoint_response.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_response = client.accounts.url_endpoints.get(\n "id",\n)\nprint(url_endpoint_response.id)', }, ruby: { method: 'accounts.url_endpoints.get', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.get("id")\n\nputs(url_endpoint_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.get("id")\n\nputs(url_endpoint_response)', }, typescript: { method: 'client.accounts.urlEndpoints.get', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.get('id');\n\nconsole.log(urlEndpointResponse.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.get('id');\n\nconsole.log(urlEndpointResponse.id);", }, }, }, @@ -2733,7 +2775,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'urlEndpoints update', example: - "imagekit accounts:url-endpoints update \\\n --private-key 'My Private Key' \\\n --id id \\\n --description 'My custom URL endpoint'", + "imagekit accounts:url-endpoints update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id \\\n --description 'My custom URL endpoint'", }, csharp: { method: 'Accounts.UrlEndpoints.Update', @@ -2743,11 +2785,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.Update', example: - 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountURLEndpointUpdateParams{\n\t\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\t\tDescription: "My custom URL endpoint",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', + 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\turlEndpointResponse, err := client.Accounts.URLEndpoints.Update(\n\t\tcontext.TODO(),\n\t\t"id",\n\t\timagekit.AccountURLEndpointUpdateParams{\n\t\t\tURLEndpointRequest: imagekit.URLEndpointRequestParam{\n\t\t\t\tDescription: "My custom URL endpoint",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", urlEndpointResponse.ID)\n}\n', }, http: { example: - 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', + 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -d \'{\n "description": "My custom URL endpoint",\n "origins": [\n "origin-id-1"\n ],\n "urlPrefix": "product-images"\n }\'', }, java: { method: 'accounts().urlEndpoints().update', @@ -2757,22 +2799,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->update', example: - "accounts->urlEndpoints->update(\n 'id',\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", + "accounts->urlEndpoints->update(\n 'id',\n description: 'My custom URL endpoint',\n origins: ['origin-id-1'],\n urlPrefix: 'product-images',\n urlRewriter: ['type' => 'CLOUDINARY', 'preserveAssetDeliveryTypes' => true],\n);\n\nvar_dump($urlEndpointResponse);", }, python: { method: 'accounts.url_endpoints.update', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nurl_endpoint_response = client.accounts.url_endpoints.update(\n id="id",\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nurl_endpoint_response = client.accounts.url_endpoints.update(\n id="id",\n description="My custom URL endpoint",\n)\nprint(url_endpoint_response.id)', }, ruby: { method: 'accounts.url_endpoints.update', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.update("id", description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nurl_endpoint_response = image_kit.accounts.url_endpoints.update("id", description: "My custom URL endpoint")\n\nputs(url_endpoint_response)', }, typescript: { method: 'client.accounts.urlEndpoints.update', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.update('id', {\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.update('id', {\n description: 'My custom URL endpoint',\n});\n\nconsole.log(urlEndpointResponse.id);", }, }, }, @@ -2791,7 +2833,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ perLanguage: { cli: { method: 'urlEndpoints delete', - example: "imagekit accounts:url-endpoints delete \\\n --private-key 'My Private Key' \\\n --id id", + example: + "imagekit accounts:url-endpoints delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id", }, csharp: { method: 'Accounts.UrlEndpoints.Delete', @@ -2801,10 +2844,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Accounts.URLEndpoints.Delete', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Accounts.URLEndpoints.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Accounts.URLEndpoints.Delete(context.TODO(), "id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, http: { - example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X DELETE', + example: + 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"', }, java: { method: 'accounts().urlEndpoints().delete', @@ -2814,22 +2858,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'accounts->urlEndpoints->delete', example: - "accounts->urlEndpoints->delete('id');\n\nvar_dump($result);", + "accounts->urlEndpoints->delete('id');\n\nvar_dump($result);", }, python: { method: 'accounts.url_endpoints.delete', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.accounts.url_endpoints.delete(\n "id",\n)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.accounts.url_endpoints.delete(\n "id",\n)', }, ruby: { method: 'accounts.url_endpoints.delete', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.accounts.url_endpoints.delete("id")\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.accounts.url_endpoints.delete("id")\n\nputs(result)', }, typescript: { method: 'client.accounts.urlEndpoints.delete', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.accounts.urlEndpoints.delete('id');", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.accounts.urlEndpoints.delete('id');", }, }, }, @@ -2872,7 +2916,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ cli: { method: 'files upload', example: - "imagekit beta:v2:files upload \\\n --private-key 'My Private Key' \\\n --file 'Example data' \\\n --file-name fileName", + "imagekit beta:v2:files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name fileName", }, csharp: { method: 'Beta.V2.Files.Upload', @@ -2882,11 +2926,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Beta.V2.Files.Upload', example: - 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\tresponse, err := client.Beta.V2.Files.Upload(context.TODO(), imagekit.BetaV2FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', + 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\tresponse, err := client.Beta.V2.Files.Upload(context.TODO(), imagekit.BetaV2FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\tFileName: "fileName",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n', }, http: { example: - 'curl https://upload.imagekit.io/api/v2/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', + 'curl https://upload.imagekit.io/api/v2/files/upload \\\n -H \'Content-Type: multipart/form-data\' \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS" \\\n -F \'file=@/path/to/file\' \\\n -F fileName=fileName \\\n -F checks=\'"request.folder" : "marketing/"\n \' \\\n -F customMetadata=\'{"brand":"bar","color":"bar"}\' \\\n -F description=\'Running shoes\' \\\n -F extensions=\'[{"name":"remove-bg","options":{"add_shadow":true}},{"maxTags":5,"minConfidence":95,"name":"google-auto-tagging"},{"name":"ai-auto-description"},{"name":"ai-tasks","tasks":[{"instruction":"What types of clothing items are visible in this image?","type":"select_tags","vocabulary":["shirt","tshirt","dress","trousers","jacket"]},{"instruction":"Is this a luxury or high-end fashion item?","type":"yes_no","on_yes":{"add_tags":["luxury","premium"]}}]},{"id":"ext_abc123","name":"saved-extension"}]\' \\\n -F responseFields=\'["tags","customCoordinates","isPrivateFile"]\' \\\n -F tags=\'["t-shirt","round-neck","men"]\' \\\n -F transformation=\'{"post":[{"type":"thumbnail","value":"w-150,h-150"},{"protocol":"dash","type":"abs","value":"sr-240_360_480_720_1080"}]}\'', }, java: { method: 'beta().v2().files().upload', @@ -2896,22 +2940,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'beta->v2->files->upload', example: - "beta->v2->files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", + "beta->v2->files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", }, python: { method: 'beta.v2.files.upload', example: - 'from imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.beta.v2.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nresponse = client.beta.v2.files.upload(\n file=b"Example data",\n file_name="fileName",\n)\nprint(response.video_codec)', }, ruby: { method: 'beta.v2.files.upload', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.beta.v2.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresponse = image_kit.beta.v2.files.upload(file: StringIO.new("Example data"), file_name: "fileName")\n\nputs(response)', }, typescript: { method: 'client.beta.v2.files.upload', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.beta.v2.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.beta.v2.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'fileName',\n});\n\nconsole.log(response.videoCodec);", }, }, }, @@ -2925,7 +2969,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.webhooks.unwrap', perLanguage: { cli: { - example: "imagekit webhooks unwrap \\\n --private-key 'My Private Key'", + example: + "imagekit webhooks unwrap \\\n --private-key 'My Private Key' \\\n --password 'My Password'", }, csharp: { example: 'WebhookUnwrapParams parameters = new();\n\nawait client.Webhooks.Unwrap(parameters);', @@ -2933,7 +2978,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Webhooks.Unwrap', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Webhooks.Unwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Webhooks.Unwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, java: { example: @@ -2942,21 +2987,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'webhooks->unwrap', example: - "webhooks->unwrap();\n\nvar_dump($result);", + "webhooks->unwrap();\n\nvar_dump($result);", }, python: { method: 'webhooks.unwrap', - example: 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.webhooks.unwrap()', + example: + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.webhooks.unwrap()', }, ruby: { method: 'webhooks.unwrap', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.webhooks.unwrap\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.webhooks.unwrap\n\nputs(result)', }, typescript: { method: 'client.webhooks.unwrap', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.webhooks.unwrap();", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.webhooks.unwrap();", }, }, }, @@ -2970,7 +3016,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [ qualified: 'client.webhooks.unsafeUnwrap', perLanguage: { cli: { - example: "imagekit webhooks unsafe-unwrap \\\n --private-key 'My Private Key'", + example: + "imagekit webhooks unsafe-unwrap \\\n --private-key 'My Private Key' \\\n --password 'My Password'", }, csharp: { example: @@ -2979,7 +3026,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ go: { method: 'client.Webhooks.UnsafeUnwrap', example: - 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t)\n\terr := client.Webhooks.UnsafeUnwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', + 'package main\n\nimport (\n\t"context"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"),\n\t\toption.WithPassword("My Password"),\n\t)\n\terr := client.Webhooks.UnsafeUnwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n', }, java: { example: @@ -2988,21 +3035,22 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'webhooks->unsafeUnwrap', example: - "webhooks->unsafeUnwrap();\n\nvar_dump($result);", + "webhooks->unsafeUnwrap();\n\nvar_dump($result);", }, python: { method: 'webhooks.unsafe_unwrap', - example: 'from imagekitio import ImageKit\n\nclient = ImageKit()\nclient.webhooks.unsafe_unwrap()', + example: + 'import os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\nclient.webhooks.unsafe_unwrap()', }, ruby: { method: 'webhooks.unsafe_unwrap', example: - 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresult = image_kit.webhooks.unsafe_unwrap\n\nputs(result)', + 'require "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key", password: "My Password")\n\nresult = image_kit.webhooks.unsafe_unwrap\n\nputs(result)', }, typescript: { method: 'client.webhooks.unsafeUnwrap', example: - "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.webhooks.unsafeUnwrap();", + "import ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nawait client.webhooks.unsafeUnwrap();", }, }, }, @@ -3012,12 +3060,12 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ { language: 'python', content: - '# Image Kit Python API library\n\n\n[![PyPI version](https://img.shields.io/pypi/v/imagekitio.svg?label=pypi%20(stable))](https://pypi.org/project/imagekitio/)\n\nThe Image Kit Python library provides convenient access to the Image Kit REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install imagekitio\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\nresponse = client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.video_codec)\n```\n\n\n\n## Async usage\n\nSimply import `AsyncImageKit` instead of `ImageKit` and use `await` with each API call:\n\n```python\nimport asyncio\nfrom imagekitio import AsyncImageKit\n\nclient = AsyncImageKit(\n private_key="My Private Key",\n)\n\nasync def main() -> None:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install imagekitio[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport asyncio\nfrom imagekitio import DefaultAioHttpClient\nfrom imagekitio import AsyncImageKit\n\nasync def main() -> None:\n async with AsyncImageKit(\n private_key="My Private Key",\n http_client=DefaultAioHttpClient(),\n) as client:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n transformation={\n "post": [{\n "type": "thumbnail",\n "value": "w-150,h-150",\n }, {\n "protocol": "dash",\n "type": "abs",\n "value": "sr-240_360_480_720_1080",\n }]\n },\n)\nprint(response.transformation)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\nclient.files.upload(\n file=Path("/path/to/file"),\n file_name="fileName",\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `imagekitio.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `imagekitio.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `imagekitio.APIError`.\n\n```python\nimport imagekitio\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\n\ntry:\n client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\nexcept imagekitio.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept imagekitio.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept imagekitio.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n private_key="My Private Key",\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n private_key="My Private Key",\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = ImageKit(\n private_key="My Private Key",\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `IMAGE_KIT_LOG` to `info`.\n\n```shell\n$ export IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key="My Private Key",\n)\nresponse = client.files.with_raw_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nfile = response.parse() # get the object that `files.upload()` would have returned\nprint(file.video_codec)\n```\n\nThese methods return an [`APIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.files.with_streaming_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom imagekitio import ImageKit, DefaultHttpxClient\n\nclient = ImageKit(\n private_key="My Private Key",\n # Or use the `IMAGE_KIT_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom imagekitio import ImageKit\n\nwith ImageKit(\n private_key="My Private Key",\n) as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport imagekitio\nprint(imagekitio.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', + '# Image Kit Python API library\n\n\n[![PyPI version](https://img.shields.io/pypi/v/imagekitio.svg?label=pypi%20(stable))](https://pypi.org/project/imagekitio/)\n\nThe Image Kit Python library provides convenient access to the Image Kit REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install imagekitio\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom imagekitio import ImageKit\n\nclient = ImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\n\nresponse = client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.video_codec)\n```\n\nWhile you can provide a `private_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `IMAGEKIT_PRIVATE_KEY="My Private Key"` to your `.env` file\nso that your Private Key is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncImageKit` instead of `ImageKit` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom imagekitio import AsyncImageKit\n\nclient = AsyncImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install imagekitio[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom imagekitio import DefaultAioHttpClient\nfrom imagekitio import AsyncImageKit\n\nasync def main() -> None:\n async with AsyncImageKit(\n private_key=os.environ.get("IMAGEKIT_PRIVATE_KEY"), # This is the default and can be omitted\n password=os.environ.get("OPTIONAL_IMAGEKIT_IGNORES_THIS"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n response = await client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\n print(response.video_codec)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\n\nresponse = client.files.upload(\n file=b"Example data",\n file_name="fileName",\n transformation={\n "post": [{\n "type": "thumbnail",\n "value": "w-150,h-150",\n }, {\n "protocol": "dash",\n "type": "abs",\n "value": "sr-240_360_480_720_1080",\n }]\n },\n)\nprint(response.transformation)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\n\nclient.files.upload(\n file=Path("/path/to/file"),\n file_name="fileName",\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `imagekitio.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `imagekitio.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `imagekitio.APIError`.\n\n```python\nimport imagekitio\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\n\ntry:\n client.files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n )\nexcept imagekitio.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept imagekitio.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept imagekitio.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom imagekitio import ImageKit\n\n# Configure the default for all requests:\nclient = ImageKit(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = ImageKit(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).files.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `IMAGE_KIT_LOG` to `info`.\n\n```shell\n$ export IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom imagekitio import ImageKit\n\nclient = ImageKit()\nresponse = client.files.with_raw_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nfile = response.parse() # get the object that `files.upload()` would have returned\nprint(file.video_codec)\n```\n\nThese methods return an [`APIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/imagekit-developer/imagekit-python/tree/master/src/imagekitio/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.files.with_streaming_response.upload(\n file=b"https://www.example.com/public-url.jpg",\n file_name="file-name.jpg",\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom imagekitio import ImageKit, DefaultHttpxClient\n\nclient = ImageKit(\n # Or use the `IMAGE_KIT_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom imagekitio import ImageKit\n\nwith ImageKit() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport imagekitio\nprint(imagekitio.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', }, { language: 'go', content: - '# Image Kit Go API Library\n\nGo Reference\n\nThe Image Kit Go library provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference)\nfrom applications written in Go.\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n\n\n```go\nimport (\n\t"github.com/imagekit-developer/imagekit-go" // imported as SDK_PackageName\n)\n```\n\n\n\nOr to pin the version:\n\n\n\n```sh\ngo get -u \'github.com/imagekit-developer/imagekit-go@v0.0.1\'\n```\n\n\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"), // defaults to os.LookupEnv("IMAGEKIT_PRIVATE_KEY")\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Files.Upload(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/imagekit-developer/imagekit-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\tFileName: "file-name.jpg",\n})\nif err != nil {\n\tvar apierr *imagekit.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/api/v1/files/upload": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Files.Upload(\n\tctx,\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("/path/to/file")\nimagekit.FileUploadParams{\n\tFile: file,\n\tFileName: "fileName",\n}\n\n// A file from a string\nimagekit.FileUploadParams{\n\tFile: strings.NewReader("my file contents"),\n\tFileName: "fileName",\n}\n\n// With a custom filename and contentType\nimagekit.FileUploadParams{\n\tFile: imagekit.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n\tFileName: "fileName",\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := imagekit.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\nresponse, err := client.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", response)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', + '# Image Kit Go API Library\n\nGo Reference\n\nThe Image Kit Go library provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference)\nfrom applications written in Go.\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n\n\n```go\nimport (\n\t"github.com/imagekit-developer/imagekit-go" // imported as SDK_PackageName\n)\n```\n\n\n\nOr to pin the version:\n\n\n\n```sh\ngo get -u \'github.com/imagekit-developer/imagekit-go@v0.0.1\'\n```\n\n\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/imagekit-developer/imagekit-go"\n\t"github.com/imagekit-developer/imagekit-go/option"\n)\n\nfunc main() {\n\tclient := imagekit.NewClient(\n\t\toption.WithPrivateKey("My Private Key"), // defaults to os.LookupEnv("IMAGEKIT_PRIVATE_KEY")\n\t\toption.WithPassword("My Password"), // defaults to os.LookupEnv("OPTIONAL_IMAGEKIT_IGNORES_THIS")\n\t)\n\tresponse, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VideoCodec)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Files.Upload(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/imagekit-developer/imagekit-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{\n\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\tFileName: "file-name.jpg",\n})\nif err != nil {\n\tvar apierr *imagekit.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/api/v1/files/upload": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Files.Upload(\n\tctx,\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("/path/to/file")\nimagekit.FileUploadParams{\n\tFile: file,\n\tFileName: "fileName",\n}\n\n// A file from a string\nimagekit.FileUploadParams{\n\tFile: strings.NewReader("my file contents"),\n\tFileName: "fileName",\n}\n\n// With a custom filename and contentType\nimagekit.FileUploadParams{\n\tFile: imagekit.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n\tFileName: "fileName",\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := imagekit.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\nresponse, err := client.Files.Upload(\n\tcontext.TODO(),\n\timagekit.FileUploadParams{\n\t\tFile: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))),\n\t\tFileName: "file-name.jpg",\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", response)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n', }, { language: 'terraform', @@ -3027,17 +3075,17 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ { language: 'typescript', content: - "# Image Kit TypeScript API Library\n\n[![NPM version](https://img.shields.io/npm/v/@imagekit/nodejs.svg?label=npm%20(stable))](https://npmjs.org/package/@imagekit/nodejs) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@imagekit/nodejs)\n\nThis library provides convenient access to the Image Kit REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install @imagekit/nodejs\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\n```js\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n});\n\nconsole.log(response.videoCodec);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst params: ImageKit.FileUploadParams = {\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n};\nconst response: ImageKit.FileUploadResponse = await client.files.upload(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport ImageKit, { toFile } from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.files.upload({ file: fs.createReadStream('/path/to/file'), fileName: 'fileName' });\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.files.upload({ file: new File(['my bytes'], 'file'), fileName: 'fileName' });\n\n// You can also pass a `fetch` `Response`:\nawait client.files.upload({ file: await fetch('https://somesite/file'), fileName: 'fileName' });\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.files.upload({\n file: await toFile(Buffer.from('my bytes'), 'file'),\n fileName: 'fileName',\n});\nawait client.files.upload({\n file: await toFile(new Uint8Array([0, 1, 2]), 'file'),\n fileName: 'fileName',\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\n```ts\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .catch(async (err) => {\n if (err instanceof ImageKit.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\n```js\n// Configure the default for all requests:\nconst client = new ImageKit({\n privateKey: 'My Private Key',\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\n```ts\n// Configure the default for all requests:\nconst client = new ImageKit({\n privateKey: 'My Private Key',\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\n```ts\nconst client = new ImageKit();\n\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: response, response: raw } = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(response.videoCodec);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `IMAGE_KIT_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new ImageKit({\n logger: logger.child({ name: 'ImageKit' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.files.upload({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport fetch from 'my-fetch';\n\nconst client = new ImageKit({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new ImageKit({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n **Bun** [[docs](https://bun.sh/guides/http/proxy)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\n\n```ts\nimport ImageKit from 'npm:@imagekit/nodejs';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new ImageKit({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-nodejs/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n", + "# Image Kit TypeScript API Library\n\n[![NPM version](https://img.shields.io/npm/v/@imagekit/nodejs.svg?label=npm%20(stable))](https://npmjs.org/package/@imagekit/nodejs) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@imagekit/nodejs)\n\nThis library provides convenient access to the Image Kit REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). The full API of this library can be found in [api.md](api.md).\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install @imagekit/nodejs\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n\n```js\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst response = await client.files.upload({\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n});\n\nconsole.log(response.videoCodec);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted\n password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted\n});\n\nconst params: ImageKit.FileUploadParams = {\n file: fs.createReadStream('path/to/file'),\n fileName: 'file-name.jpg',\n};\nconst response: ImageKit.FileUploadResponse = await client.files.upload(params);\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport ImageKit, { toFile } from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.files.upload({ file: fs.createReadStream('/path/to/file'), fileName: 'fileName' });\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.files.upload({ file: new File(['my bytes'], 'file'), fileName: 'fileName' });\n\n// You can also pass a `fetch` `Response`:\nawait client.files.upload({ file: await fetch('https://somesite/file'), fileName: 'fileName' });\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.files.upload({\n file: await toFile(Buffer.from('my bytes'), 'file'),\n fileName: 'fileName',\n});\nawait client.files.upload({\n file: await toFile(new Uint8Array([0, 1, 2]), 'file'),\n fileName: 'fileName',\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n\n```ts\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .catch(async (err) => {\n if (err instanceof ImageKit.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n });\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n\n```js\n// Configure the default for all requests:\nconst client = new ImageKit({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n\n```ts\n// Configure the default for all requests:\nconst client = new ImageKit({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' }, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n\n\n\n\n## Advanced Usage\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n\n```ts\nconst client = new ImageKit();\n\nconst response = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: response, response: raw } = await client.files\n .upload({ file: fs.createReadStream('path/to/file'), fileName: 'file-name.jpg' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(response.videoCodec);\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `IMAGE_KIT_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new ImageKit({\n logger: logger.child({ name: 'ImageKit' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.files.upload({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport fetch from 'my-fetch';\n\nconst client = new ImageKit({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new ImageKit({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n **Bun** [[docs](https://bun.sh/guides/http/proxy)]\n\n```ts\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]\n\n```ts\nimport ImageKit from 'npm:@imagekit/nodejs';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new ImageKit({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/imagekit-developer/imagekit-nodejs/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n", }, { language: 'ruby', content: - '# Image Kit Ruby API library\n\nThe Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/imagekit-developer/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekitio).\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n\n\n```ruby\ngem "imagekitio", "~> 0.0.1"\n```\n\n\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "imagekitio"\n\nimage_kit = Imagekitio::Client.new(private_key: "My Private Key")\n\nresponse = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\nputs(response.videoCodec)\n```\n\n\n\n\n\n### File uploads\n\nRequest parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.\n\n```ruby\nrequire "pathname"\n\n# Use `Pathname` to send the filename and/or avoid paging a large file into memory:\nresponse = image_kit.files.upload(file: Pathname("/path/to/file"))\n\n# Alternatively, pass file contents or a `StringIO` directly:\nresponse = image_kit.files.upload(file: File.read("/path/to/file"))\n\n# Or, to control the filename and/or content type:\nfile = Imagekitio::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")\nresponse = image_kit.files.upload(file: file)\n\nputs(response.videoCodec)\n```\n\nNote that you can also pass a raw `IO` descriptor, but this disables retries, as the library can\'t be sure if the descriptor is a file or pipe (which cannot be rewound).\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Imagekitio::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n file = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n )\nrescue Imagekitio::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue Imagekitio::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue Imagekitio::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n max_retries: 0, # default is 2\n private_key: "My Private Key"\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {max_retries: 5}\n)\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n timeout: nil, # default is 60\n private_key: "My Private Key"\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {timeout: 5}\n)\n```\n\nOn timeout, `Imagekitio::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `Imagekitio::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\nresponse =\n image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(response[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `Imagekitio::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `Imagekitio::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\n# You can also splat a full Params class:\nparams = Imagekitio::FileUploadParams.new(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\nimage_kit.files.upload(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :all\nputs(Imagekitio::AssetListParams::FileType::ALL)\n\n# Revealed type: `T.all(Imagekitio::AssetListParams::FileType, Symbol)`\nT.reveal_type(Imagekitio::AssetListParams::FileType::ALL)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nimage_kit.assets.list(\n file_type: Imagekitio::AssetListParams::FileType::ALL,\n # …\n)\n\n# Literal values are also permissible:\nimage_kit.assets.list(\n file_type: :all,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/imagekit-developer/imagekit-ruby/tree/master/CONTRIBUTING.md).\n', + '# Image Kit Ruby API library\n\nThe Image Kit Ruby library provides convenient access to the Image Kit REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/imagekit-developer/imagekit-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/imagekitio).\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference).\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n\n\n```ruby\ngem "imagekitio", "~> 0.0.1"\n```\n\n\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "imagekitio"\n\nimage_kit = Imagekitio::Client.new(\n private_key: ENV["IMAGEKIT_PRIVATE_KEY"], # This is the default and can be omitted\n password: ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"] # This is the default and can be omitted\n)\n\nresponse = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\nputs(response.videoCodec)\n```\n\n\n\n\n\n### File uploads\n\nRequest parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.\n\n```ruby\nrequire "pathname"\n\n# Use `Pathname` to send the filename and/or avoid paging a large file into memory:\nresponse = image_kit.files.upload(file: Pathname("/path/to/file"))\n\n# Alternatively, pass file contents or a `StringIO` directly:\nresponse = image_kit.files.upload(file: File.read("/path/to/file"))\n\n# Or, to control the filename and/or content type:\nfile = Imagekitio::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")\nresponse = image_kit.files.upload(file: file)\n\nputs(response.videoCodec)\n```\n\nNote that you can also pass a raw `IO` descriptor, but this disables retries, as the library can\'t be sure if the descriptor is a file or pipe (which cannot be rewound).\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Imagekitio::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n file = image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n )\nrescue Imagekitio::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue Imagekitio::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue Imagekitio::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {max_retries: 5}\n)\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nimage_kit = Imagekitio::Client.new(\n timeout: nil # default is 60\n)\n\n# Or, configure per-request:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {timeout: 5}\n)\n```\n\nOn timeout, `Imagekitio::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `Imagekitio::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\nresponse =\n image_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg",\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(response[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `Imagekitio::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `Imagekitio::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nimage_kit.files.upload(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\n\n# You can also splat a full Params class:\nparams = Imagekitio::FileUploadParams.new(\n file: StringIO.new("https://www.example.com/public-url.jpg"),\n file_name: "file-name.jpg"\n)\nimage_kit.files.upload(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :all\nputs(Imagekitio::AssetListParams::FileType::ALL)\n\n# Revealed type: `T.all(Imagekitio::AssetListParams::FileType, Symbol)`\nT.reveal_type(Imagekitio::AssetListParams::FileType::ALL)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nimage_kit.assets.list(\n file_type: Imagekitio::AssetListParams::FileType::ALL,\n # …\n)\n\n# Literal values are also permissible:\nimage_kit.assets.list(\n file_type: :all,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/imagekit-developer/imagekit-ruby/tree/master/CONTRIBUTING.md).\n', }, { language: 'java', content: - '# Image Kit Java API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.imagekit.api/image-kit-java)](https://central.sonatype.com/artifact/com.imagekit.api/image-kit-java/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.imagekit.api/image-kit-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1)\n\n\nThe Image Kit Java SDK provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference) from applications written in Java.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1).\n\n## Installation\n\n### Gradle\n\n~~~kotlin\nimplementation("com.imagekit.api:image-kit-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.imagekit.api\n image-kit-java\n 0.0.1\n\n~~~\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .privateKey("My Private Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n // Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n // Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\n .fromEnv()\n .privateKey("My Private Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------------- | -------------------------------------- | -------------------------------- | -------- | --------------------------- |\n| `privateKey` | `imagekit.imagekitPrivateKey` | `IMAGEKIT_PRIVATE_KEY` | true | - |\n| `password` | `imagekit.optionalImagekitIgnoresThis` | `OPTIONAL_IMAGEKIT_IGNORES_THIS` | false | `"do_not_set"` |\n| `webhookSecret` | `imagekit.imagekitWebhookSecret` | `IMAGEKIT_WEBHOOK_SECRET` | false | - |\n| `baseUrl` | `imagekit.baseUrl` | `IMAGE_KIT_BASE_URL` | true | `"https://api.imagekit.io"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\n\nImageKitClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Image Kit API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.files().upload(...)` should be called with an instance of `FileUploadParams`, and it will return an instance of `FileUploadResponse`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.async().files().upload(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.imagekit.api.client.ImageKitClientAsync;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClientAsync;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClientAsync client = ImageKitOkHttpClientAsync.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.files().upload(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.nio.file.Paths;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(Paths.get("/path/to/file"))\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file("content".getBytes())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.MultipartField;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.InputStream;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(MultipartField.builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.imagekit.api.core.http.Headers;\nimport com.imagekit.api.core.http.HttpResponseFor;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nHttpResponseFor response = client.files().withRawResponse().upload(params);\n\nint statusCode = response.statusCode();\nHeaders headers = response.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse parsedResponse = response.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ImageKitServiceException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ImageKitIoException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitIoException.kt): I/O networking errors.\n\n- [`ImageKitRetryableException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ImageKitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `IMAGE_KIT_LOG` environment variable to `info`:\n\n```sh\nexport IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport IMAGE_KIT_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `image-kit-java-core` is published with a [configuration file](image-kit-java-core/src/main/resources/META-INF/proguard/image-kit-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `image-kit-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClient.kt), [`ImageKitClientAsync`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsync.kt), [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt), and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), all of which can work with any HTTP client\n- `image-kit-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) and [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), which provide a way to construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), respectively, using OkHttp\n- `image-kit-java`\n - Depends on and exposes the APIs of both `image-kit-java-core` and `image-kit-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Copy `image-kit-java-client-okhttp`\'s [`OkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Write a class that implements the [`HttpClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/http/HttpClient.kt) interface\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .transformation(FileUploadParams.Transformation.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) object to its setter:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(JsonValue.from(42))\n .fileName("file-name.jpg")\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.JsonMissing;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.Map;\n\nMap additionalProperties = client.files().upload(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.imagekit.api.core.JsonField;\nimport java.io.InputStream;\nimport java.util.Optional;\n\nJsonField file = client.files().upload(params)._file();\n\nif (file.isMissing()) {\n // The property is absent from the JSON response\n} else if (file.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional jsonString = file.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = file.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/imagekit-java/issues) with questions, bugs, or suggestions.\n', + '# Image Kit Java API Library\n\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.imagekit.api/image-kit-java)](https://central.sonatype.com/artifact/com.imagekit.api/image-kit-java/0.0.1)\n[![javadoc](https://javadoc.io/badge2/com.imagekit.api/image-kit-java/0.0.1/javadoc.svg)](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1)\n\n\nThe Image Kit Java SDK provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference) from applications written in Java.\n\n\n\n\n\n## MCP Server\n\nUse the Image Kit MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40imagekit%2Fapi-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40imagekit%2Fapi-mcp%22%5D%2C%22env%22%3A%7B%22IMAGEKIT_PRIVATE_KEY%22%3A%22My%20Private%20Key%22%2C%22OPTIONAL_IMAGEKIT_IGNORES_THIS%22%3A%22My%20Password%22%2C%22IMAGEKIT_WEBHOOK_SECRET%22%3A%22My%20Webhook%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\nThe REST API documentation can be found on [imagekit.io](https://imagekit.io/docs/api-reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.imagekit.api/image-kit-java/0.0.1).\n\n## Installation\n\n### Gradle\n\n~~~kotlin\nimplementation("com.imagekit.api:image-kit-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n\n com.imagekit.api\n image-kit-java\n 0.0.1\n\n~~~\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .privateKey("My Private Key")\n .password("My Password")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n // Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n // Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\n .fromEnv()\n .privateKey("My Private Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------------- | -------------------------------------- | -------------------------------- | -------- | --------------------------- |\n| `privateKey` | `imagekit.imagekitPrivateKey` | `IMAGEKIT_PRIVATE_KEY` | true | - |\n| `password` | `imagekit.optionalImagekitIgnoresThis` | `OPTIONAL_IMAGEKIT_IGNORES_THIS` | false | `"do_not_set"` |\n| `webhookSecret` | `imagekit.imagekitWebhookSecret` | `IMAGEKIT_WEBHOOK_SECRET` | false | - |\n| `baseUrl` | `imagekit.baseUrl` | `IMAGE_KIT_BASE_URL` | true | `"https://api.imagekit.io"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\n\nImageKitClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Image Kit API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.files().upload(...)` should be called with an instance of `FileUploadParams`, and it will return an instance of `FileUploadResponse`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.async().files().upload(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.imagekit.api.client.ImageKitClientAsync;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClientAsync;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `imagekit.imagekitPrivateKey`, `imagekit.optionalImagekitIgnoresThis`, `imagekit.imagekitWebhookSecret` and `imagekit.baseUrl` system properties\n// Or configures using the `IMAGEKIT_PRIVATE_KEY`, `OPTIONAL_IMAGEKIT_IGNORES_THIS`, `IMAGEKIT_WEBHOOK_SECRET` and `IMAGE_KIT_BASE_URL` environment variables\nImageKitClientAsync client = ImageKitOkHttpClientAsync.fromEnv();\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nCompletableFuture response = client.files().upload(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.nio.file.Paths;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(Paths.get("/path/to/file"))\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file("content".getBytes())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.MultipartField;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.InputStream;\nimport java.net.URL;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(MultipartField.builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nFileUploadResponse response = client.files().upload(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.imagekit.api.core.http.Headers;\nimport com.imagekit.api.core.http.HttpResponseFor;\nimport com.imagekit.api.models.files.FileUploadParams;\nimport com.imagekit.api.models.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("https://www.example.com/public-url.jpg".getBytes()))\n .fileName("file-name.jpg")\n .build();\nHttpResponseFor response = client.files().withRawResponse().upload(params);\n\nint statusCode = response.statusCode();\nHeaders headers = response.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse parsedResponse = response.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`ImageKitServiceException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`ImageKitIoException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitIoException.kt): I/O networking errors.\n\n- [`ImageKitRetryableException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`ImageKitException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `IMAGE_KIT_LOG` environment variable to `info`:\n\n```sh\nexport IMAGE_KIT_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport IMAGE_KIT_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `image-kit-java-core` is published with a [configuration file](image-kit-java-core/src/main/resources/META-INF/proguard/image-kit-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport java.time.Duration;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `image-kit-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClient.kt), [`ImageKitClientAsync`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsync.kt), [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt), and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), all of which can work with any HTTP client\n- `image-kit-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) and [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), which provide a way to construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) and [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), respectively, using OkHttp\n- `image-kit-java`\n - Depends on and exposes the APIs of both `image-kit-java-core` and `image-kit-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Copy `image-kit-java-client-okhttp`\'s [`OkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`image-kit-java` dependency](#installation) with `image-kit-java-core`\n2. Write a class that implements the [`HttpClient`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/http/HttpClient.kt) interface\n3. Construct [`ImageKitClientImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientImpl.kt) or [`ImageKitClientAsyncImpl`](image-kit-java-core/src/main/kotlin/com/imagekit/api/client/ImageKitClientAsyncImpl.kt), similarly to [`ImageKitOkHttpClient`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClient.kt) or [`ImageKitOkHttpClientAsync`](image-kit-java-client-okhttp/src/main/kotlin/com/imagekit/api/client/okhttp/ImageKitOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .transformation(FileUploadParams.Transformation.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) object to its setter:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .file(JsonValue.from(42))\n .fileName("file-name.jpg")\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](image-kit-java-core/src/main/kotlin/com/imagekit/api/core/Values.kt):\n\n```java\nimport com.imagekit.api.core.JsonMissing;\nimport com.imagekit.api.models.files.FileUploadParams;\n\nFileUploadParams params = FileUploadParams.builder()\n .fileName("fileName")\n .file(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.imagekit.api.core.JsonValue;\nimport java.util.Map;\n\nMap additionalProperties = client.files().upload(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.imagekit.api.core.JsonField;\nimport java.io.InputStream;\nimport java.util.Optional;\n\nJsonField file = client.files().upload(params)._file();\n\nif (file.isMissing()) {\n // The property is absent from the JSON response\n} else if (file.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional jsonString = file.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = file.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`ImageKitInvalidDataException`](image-kit-java-core/src/main/kotlin/com/imagekit/api/errors/ImageKitInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.imagekit.api.models.files.FileUploadResponse;\n\nFileUploadResponse response = client.files().upload(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\n\nImageKitClient client = ImageKitOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField` instead of just plain `T`?\n\nUsing `JsonField` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/imagekit-java/issues) with questions, bugs, or suggestions.\n', }, { language: 'csharp', @@ -3047,12 +3095,12 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ { language: 'cli', content: - "# Image Kit CLI\n\nThe official CLI for the [Image Kit REST API](https://imagekit.io/docs/api-reference).\n\n## Installation\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https://go.dev/doc/install) version 1.22 or later installed.\n\n~~~sh\ngo install 'github.com/stainless-sdks/imagekit-cli/cmd/imagekit@latest'\n~~~\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME/go/bin` (or `$GOPATH/bin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n~~~sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)/bin\"\n~~~\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts/run` script to run the tool locally:\n\n~~~sh\n./scripts/run args...\n~~~\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n~~~sh\nimagekit [resource] [flags...]\n~~~\n\n~~~sh\nimagekit files upload \\\n --private-key 'My Private Key' \\\n --file 'Example data' \\\n --file-name file-name.jpg\n~~~\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable | Description | Required | Default value |\n| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------- |\n| `IMAGEKIT_PRIVATE_KEY` | Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n | yes | |\n| `OPTIONAL_IMAGEKIT_IGNORES_THIS` | ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n | no | `\"do_not_set\"` |\n| `IMAGEKIT_WEBHOOK_SECRET` | Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n | no | `null` |\n\n### Global flags\n\n- `--private-key` - Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n (can also be set with `IMAGEKIT_PRIVATE_KEY` env var)\n- `--password` - ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n (can also be set with `OPTIONAL_IMAGEKIT_IGNORES_THIS` env var)\n- `--webhook-secret` - Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n (can also be set with `IMAGEKIT_WEBHOOK_SECRET` env var)\n- `--help` - Show command line usage\n- `--debug` - Enable debug logging (includes HTTP request/response details)\n- `--version`, `-v` - Show the CLI version\n- `--base-url` - Use a custom API backend URL\n- `--format` - Change the output format (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--format-error` - Change the output format for errors (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--transform` - Transform the data output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n- `--transform-error` - Transform the error output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n\n### Passing files as arguments\n\nTo pass files to your API, you can use the `@myfile.ext` syntax:\n\n~~~bash\nimagekit --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\nimagekit --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nimagekit < --username '\\@abe'\n~~~\n\n#### Explicit encoding\n\nFor JSON endpoints, the CLI tool does filetype sniffing to determine whether the\nfile contents should be sent as a string literal (for plain text files) or as a\nbase64-encoded string literal (for binary files). If you need to explicitly send\nthe file as either plain text or base64-encoded data, you can use\n`@file://myfile.txt` (for string encoding) or `@data://myfile.dat` (for\nbase64-encoding). Note that absolute paths will begin with `@file://` or\n`@data://`, followed by a third `/` (for example, `@file:///tmp/file.txt`).\n\n~~~bash\nimagekit --arg @data://file.txt\n~~~\n", + "# Image Kit CLI\n\nThe official CLI for the [Image Kit REST API](https://imagekit.io/docs/api-reference).\n\n## Installation\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https://go.dev/doc/install) version 1.22 or later installed.\n\n~~~sh\ngo install 'github.com/stainless-sdks/imagekit-cli/cmd/imagekit@latest'\n~~~\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME/go/bin` (or `$GOPATH/bin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n~~~sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)/bin\"\n~~~\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts/run` script to run the tool locally:\n\n~~~sh\n./scripts/run args...\n~~~\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n~~~sh\nimagekit [resource] [flags...]\n~~~\n\n~~~sh\nimagekit files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name file-name.jpg\n~~~\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable | Description | Required | Default value |\n| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------- |\n| `IMAGEKIT_PRIVATE_KEY` | Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n | yes | |\n| `OPTIONAL_IMAGEKIT_IGNORES_THIS` | ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n | no | `\"do_not_set\"` |\n| `IMAGEKIT_WEBHOOK_SECRET` | Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n | no | `null` |\n\n### Global flags\n\n- `--private-key` - Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n (can also be set with `IMAGEKIT_PRIVATE_KEY` env var)\n- `--password` - ImageKit uses your API key as username and ignores the password. \nThe SDK sets a dummy value. You can ignore this field.\n (can also be set with `OPTIONAL_IMAGEKIT_IGNORES_THIS` env var)\n- `--webhook-secret` - Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\nOnly required if you're using webhooks.\n (can also be set with `IMAGEKIT_WEBHOOK_SECRET` env var)\n- `--help` - Show command line usage\n- `--debug` - Enable debug logging (includes HTTP request/response details)\n- `--version`, `-v` - Show the CLI version\n- `--base-url` - Use a custom API backend URL\n- `--format` - Change the output format (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--format-error` - Change the output format for errors (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--transform` - Transform the data output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n- `--transform-error` - Transform the error output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n\n### Passing files as arguments\n\nTo pass files to your API, you can use the `@myfile.ext` syntax:\n\n~~~bash\nimagekit --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\nimagekit --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nimagekit < --username '\\@abe'\n~~~\n\n#### Explicit encoding\n\nFor JSON endpoints, the CLI tool does filetype sniffing to determine whether the\nfile contents should be sent as a string literal (for plain text files) or as a\nbase64-encoded string literal (for binary files). If you need to explicitly send\nthe file as either plain text or base64-encoded data, you can use\n`@file://myfile.txt` (for string encoding) or `@data://myfile.dat` (for\nbase64-encoding). Note that absolute paths will begin with `@file://` or\n`@data://`, followed by a third `/` (for example, `@file:///tmp/file.txt`).\n\n~~~bash\nimagekit --arg @data://file.txt\n~~~\n", }, { language: 'php', content: - '# Image Kit PHP API Library\n\nThe Image Kit PHP library provides convenient access to the Image Kit REST API from any PHP 8.1.0+ application.\n\n## Installation\n\nTo use this package, install via Composer by adding the following to your application\'s `composer.json`:\n\n```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:stainless-sdks/imagekit-php.git"\n }\n ],\n "require": {\n "imagekit/imagekit": "dev-main"\n }\n}\n```\n\n## Usage\n\n```php\nfiles->upload(file: \'file\', fileName: \'file-name.jpg\');\n\nvar_dump($response->videoCodec);\n```', + '# Image Kit PHP API Library\n\nThe Image Kit PHP library provides convenient access to the Image Kit REST API from any PHP 8.1.0+ application.\n\n## Installation\n\nTo use this package, install via Composer by adding the following to your application\'s `composer.json`:\n\n```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:stainless-sdks/imagekit-php.git"\n }\n ],\n "require": {\n "imagekit/imagekit": "dev-main"\n }\n}\n```\n\n## Usage\n\n```php\nfiles->upload(file: \'file\', fileName: \'file-name.jpg\');\n\nvar_dump($response->videoCodec);\n```', }, ]; diff --git a/src/client.ts b/src/client.ts index 6cfdf65b..8ee3430a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -87,6 +87,7 @@ import { import { type Fetch } from './internal/builtin-types'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; import { FinalRequestOptions, RequestOptions } from './internal/request-options'; +import { toBase64 } from './internal/utils/base64'; import { readEnv } from './internal/utils/env'; import { type LogLevel, @@ -299,7 +300,30 @@ export class ImageKit { } protected validateHeaders({ values, nulls }: NullableHeaders) { - return; + if (this.privateKey && this.password && values.get('authorization')) { + return; + } + if (nulls.has('authorization')) { + return; + } + + throw new Error( + 'Could not resolve authentication method. Expected the privateKey or password to be set. Or for the "Authorization" headers to be explicitly omitted', + ); + } + + protected async authHeaders(opts: FinalRequestOptions): Promise { + if (!this.privateKey) { + return undefined; + } + + if (!this.password) { + return undefined; + } + + const credentials = `${this.privateKey}:${this.password}`; + const Authorization = `Basic ${toBase64(credentials)}`; + return buildHeaders([{ Authorization }]); } /** @@ -728,6 +752,7 @@ export class ImageKit { ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), ...getPlatformHeaders(), }, + await this.authHeaders(options), this._options.defaultHeaders, bodyHeaders, options.headers, diff --git a/tests/api-resources/accounts/origins.test.ts b/tests/api-resources/accounts/origins.test.ts index bd57caf2..2be57f09 100644 --- a/tests/api-resources/accounts/origins.test.ts +++ b/tests/api-resources/accounts/origins.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/accounts/url-endpoints.test.ts b/tests/api-resources/accounts/url-endpoints.test.ts index f3c87825..b53af030 100644 --- a/tests/api-resources/accounts/url-endpoints.test.ts +++ b/tests/api-resources/accounts/url-endpoints.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/accounts/usage.test.ts b/tests/api-resources/accounts/usage.test.ts index e52782c3..161cdc71 100644 --- a/tests/api-resources/accounts/usage.test.ts +++ b/tests/api-resources/accounts/usage.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/assets.test.ts b/tests/api-resources/assets.test.ts index e1630336..bf41276e 100644 --- a/tests/api-resources/assets.test.ts +++ b/tests/api-resources/assets.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/beta/v2/files.test.ts b/tests/api-resources/beta/v2/files.test.ts index 88cbd986..69af3768 100644 --- a/tests/api-resources/beta/v2/files.test.ts +++ b/tests/api-resources/beta/v2/files.test.ts @@ -4,6 +4,7 @@ import ImageKit, { toFile } from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/cache/invalidation.test.ts b/tests/api-resources/cache/invalidation.test.ts index f45286c7..d804f743 100644 --- a/tests/api-resources/cache/invalidation.test.ts +++ b/tests/api-resources/cache/invalidation.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/custom-metadata-fields.test.ts b/tests/api-resources/custom-metadata-fields.test.ts index 6d2f062b..3fbf78f7 100644 --- a/tests/api-resources/custom-metadata-fields.test.ts +++ b/tests/api-resources/custom-metadata-fields.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/bulk.test.ts b/tests/api-resources/files/bulk.test.ts index 9c8b4794..1c417b90 100644 --- a/tests/api-resources/files/bulk.test.ts +++ b/tests/api-resources/files/bulk.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/files.test.ts b/tests/api-resources/files/files.test.ts index 9ade42d0..aeb90697 100644 --- a/tests/api-resources/files/files.test.ts +++ b/tests/api-resources/files/files.test.ts @@ -4,6 +4,7 @@ import ImageKit, { toFile } from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/metadata.test.ts b/tests/api-resources/files/metadata.test.ts index 43bbb5c5..fd318072 100644 --- a/tests/api-resources/files/metadata.test.ts +++ b/tests/api-resources/files/metadata.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/files/versions.test.ts b/tests/api-resources/files/versions.test.ts index d52d1687..873ec8cc 100644 --- a/tests/api-resources/files/versions.test.ts +++ b/tests/api-resources/files/versions.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/folders/folders.test.ts b/tests/api-resources/folders/folders.test.ts index 16ecbb22..c4672ba4 100644 --- a/tests/api-resources/folders/folders.test.ts +++ b/tests/api-resources/folders/folders.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/folders/job.test.ts b/tests/api-resources/folders/job.test.ts index fbf2ea40..7ab1e5ac 100644 --- a/tests/api-resources/folders/job.test.ts +++ b/tests/api-resources/folders/job.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/saved-extensions.test.ts b/tests/api-resources/saved-extensions.test.ts index 6ff5eaa9..5b4a731e 100644 --- a/tests/api-resources/saved-extensions.test.ts +++ b/tests/api-resources/saved-extensions.test.ts @@ -4,6 +4,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/api-resources/webhooks.test.ts b/tests/api-resources/webhooks.test.ts index 3a9a0472..e5547f28 100644 --- a/tests/api-resources/webhooks.test.ts +++ b/tests/api-resources/webhooks.test.ts @@ -6,6 +6,7 @@ import ImageKit from '@imagekit/nodejs'; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); diff --git a/tests/index.test.ts b/tests/index.test.ts index c2ab2cb8..32f31df0 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -24,6 +24,7 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultHeaders: { 'X-My-Default-Header': '2' }, privateKey: 'My Private Key', + password: 'My Password', }); test('they are used in the request', async () => { @@ -91,6 +92,7 @@ describe('instantiate client', () => { logger: logger, logLevel: 'debug', privateKey: 'My Private Key', + password: 'My Password', }); await forceAPIResponseForClient(client); @@ -98,7 +100,7 @@ describe('instantiate client', () => { }); test('default logLevel is warn', async () => { - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client.logLevel).toBe('warn'); }); @@ -115,6 +117,7 @@ describe('instantiate client', () => { logger: logger, logLevel: 'info', privateKey: 'My Private Key', + password: 'My Password', }); await forceAPIResponseForClient(client); @@ -131,7 +134,11 @@ describe('instantiate client', () => { }; process.env['IMAGE_KIT_LOG'] = 'debug'; - const client = new ImageKit({ logger: logger, privateKey: 'My Private Key' }); + const client = new ImageKit({ + logger: logger, + privateKey: 'My Private Key', + password: 'My Password', + }); expect(client.logLevel).toBe('debug'); await forceAPIResponseForClient(client); @@ -148,7 +155,11 @@ describe('instantiate client', () => { }; process.env['IMAGE_KIT_LOG'] = 'not a log level'; - const client = new ImageKit({ logger: logger, privateKey: 'My Private Key' }); + const client = new ImageKit({ + logger: logger, + privateKey: 'My Private Key', + password: 'My Password', + }); expect(client.logLevel).toBe('warn'); expect(warnMock).toHaveBeenCalledWith( 'process.env[\'IMAGE_KIT_LOG\'] was set to "not a log level", expected one of ["off","error","warn","info","debug"]', @@ -169,6 +180,7 @@ describe('instantiate client', () => { logger: logger, logLevel: 'off', privateKey: 'My Private Key', + password: 'My Password', }); await forceAPIResponseForClient(client); @@ -189,6 +201,7 @@ describe('instantiate client', () => { logger: logger, logLevel: 'debug', privateKey: 'My Private Key', + password: 'My Password', }); expect(client.logLevel).toBe('debug'); expect(warnMock).not.toHaveBeenCalled(); @@ -201,6 +214,7 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo' }, privateKey: 'My Private Key', + password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/foo?apiVersion=foo'); }); @@ -210,6 +224,7 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultQuery: { apiVersion: 'foo', hello: 'world' }, privateKey: 'My Private Key', + password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/foo?apiVersion=foo&hello=world'); }); @@ -219,6 +234,7 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', defaultQuery: { hello: 'world' }, privateKey: 'My Private Key', + password: 'My Password', }); expect(client.buildURL('/foo', { hello: undefined })).toEqual('http://localhost:5000/foo'); }); @@ -228,6 +244,7 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/', privateKey: 'My Private Key', + password: 'My Password', fetch: (url) => { return Promise.resolve( new Response(JSON.stringify({ url, custom: true }), { @@ -246,6 +263,7 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/', privateKey: 'My Private Key', + password: 'My Password', fetch: defaultFetch, }); }); @@ -254,6 +272,7 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', privateKey: 'My Private Key', + password: 'My Password', fetch: (...args) => { return new Promise((resolve, reject) => setTimeout( @@ -286,6 +305,7 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/', privateKey: 'My Private Key', + password: 'My Password', fetch: testFetch, }); @@ -298,6 +318,7 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/custom/path/', privateKey: 'My Private Key', + password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); @@ -306,6 +327,7 @@ describe('instantiate client', () => { const client = new ImageKit({ baseURL: 'http://localhost:5000/custom/path', privateKey: 'My Private Key', + password: 'My Password', }); expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo'); }); @@ -315,37 +337,45 @@ describe('instantiate client', () => { }); test('explicit option', () => { - const client = new ImageKit({ baseURL: 'https://example.com', privateKey: 'My Private Key' }); + const client = new ImageKit({ + baseURL: 'https://example.com', + privateKey: 'My Private Key', + password: 'My Password', + }); expect(client.baseURL).toEqual('https://example.com'); }); test('env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = 'https://example.com/from_env'; - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client.baseURL).toEqual('https://example.com/from_env'); }); test('empty env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = ''; // empty - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client.baseURL).toEqual('https://api.imagekit.io'); }); test('blank env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = ' '; // blank - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client.baseURL).toEqual('https://api.imagekit.io'); }); test('in request options', () => { - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/option/foo', ); }); test('in request options overridden by client options', () => { - const client = new ImageKit({ privateKey: 'My Private Key', baseURL: 'http://localhost:5000/client' }); + const client = new ImageKit({ + privateKey: 'My Private Key', + password: 'My Password', + baseURL: 'http://localhost:5000/client', + }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/client/foo', ); @@ -353,7 +383,7 @@ describe('instantiate client', () => { test('in request options overridden by env variable', () => { process.env['IMAGE_KIT_BASE_URL'] = 'http://localhost:5000/env'; - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( 'http://localhost:5000/env/foo', ); @@ -361,11 +391,15 @@ describe('instantiate client', () => { }); test('maxRetries option is correctly set', () => { - const client = new ImageKit({ maxRetries: 4, privateKey: 'My Private Key' }); + const client = new ImageKit({ + maxRetries: 4, + privateKey: 'My Private Key', + password: 'My Password', + }); expect(client.maxRetries).toEqual(4); // default - const client2 = new ImageKit({ privateKey: 'My Private Key' }); + const client2 = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client2.maxRetries).toEqual(2); }); @@ -375,6 +409,7 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', maxRetries: 3, privateKey: 'My Private Key', + password: 'My Password', }); const newClient = client.withOptions({ @@ -401,6 +436,7 @@ describe('instantiate client', () => { defaultHeaders: { 'X-Test-Header': 'test-value' }, defaultQuery: { 'test-param': 'test-value' }, privateKey: 'My Private Key', + password: 'My Password', }); const newClient = client.withOptions({ @@ -419,6 +455,7 @@ describe('instantiate client', () => { baseURL: 'http://localhost:5000/', timeout: 1000, privateKey: 'My Private Key', + password: 'My Password', }); // Modify the client properties directly after creation @@ -448,20 +485,24 @@ describe('instantiate client', () => { test('with environment variable arguments', () => { // set options via env var process.env['IMAGEKIT_PRIVATE_KEY'] = 'My Private Key'; + process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'My Password'; const client = new ImageKit(); expect(client.privateKey).toBe('My Private Key'); + expect(client.password).toBe('My Password'); }); test('with overridden environment variable arguments', () => { // set options via env var process.env['IMAGEKIT_PRIVATE_KEY'] = 'another My Private Key'; - const client = new ImageKit({ privateKey: 'My Private Key' }); + process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'another My Password'; + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); expect(client.privateKey).toBe('My Private Key'); + expect(client.password).toBe('My Password'); }); }); describe('request building', () => { - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); describe('custom headers', () => { test('handles undefined', async () => { @@ -480,7 +521,7 @@ describe('request building', () => { }); describe('default encoder', () => { - const client = new ImageKit({ privateKey: 'My Private Key' }); + const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' }); class Serializable { toJSON() { @@ -567,6 +608,7 @@ describe('retries', () => { const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', timeout: 10, fetch: testFetch, }); @@ -601,6 +643,7 @@ describe('retries', () => { const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', fetch: testFetch, maxRetries: 4, }); @@ -629,6 +672,7 @@ describe('retries', () => { }; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', fetch: testFetch, maxRetries: 4, }); @@ -662,6 +706,7 @@ describe('retries', () => { }; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', fetch: testFetch, maxRetries: 4, defaultHeaders: { 'X-Stainless-Retry-Count': null }, @@ -695,6 +740,7 @@ describe('retries', () => { }; const client = new ImageKit({ privateKey: 'My Private Key', + password: 'My Password', fetch: testFetch, maxRetries: 4, }); @@ -727,7 +773,11 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new ImageKit({ privateKey: 'My Private Key', fetch: testFetch }); + const client = new ImageKit({ + privateKey: 'My Private Key', + password: 'My Password', + fetch: testFetch, + }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); @@ -757,7 +807,11 @@ describe('retries', () => { return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); }; - const client = new ImageKit({ privateKey: 'My Private Key', fetch: testFetch }); + const client = new ImageKit({ + privateKey: 'My Private Key', + password: 'My Password', + fetch: testFetch, + }); expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); expect(count).toEqual(2); From 65c6eec03f5907dedd73500eeba8f9aa0de1f66c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:31:00 +0000 Subject: [PATCH 07/14] feat(api): indentation fix --- .stats.yml | 4 ++-- src/resources/webhooks.ts | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5beb1d71..3ae941b7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-f4cd00365ba96133e0675eae3d5d3c6ac13874789e2ce69a84310ab64a4f87dd.yml -openapi_spec_hash: dce632cfbb5464a98c0f5d8eb9573d68 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-3234424a3a5871f31f5d6dcb8173593fc6c1db14802a0e71f14f3527ad16c871.yml +openapi_spec_hash: 017a8ab68d905ed9e163022f68d8be78 config_hash: 17e408231b0b01676298010c7405f483 diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index dd4bf11d..3e75f069 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -111,7 +111,10 @@ export interface DamFileVersionCreateEvent extends BaseWebhookEvent { */ created_at: string; - data: unknown; + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; /** * Type of the webhook event. From bd6474f9af40cae66818a260f21087d4e19f76af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:39:36 +0000 Subject: [PATCH 08/14] feat(api): merge with main to bring back missing parameters --- .stats.yml | 4 +-- src/resources/shared.ts | 61 +++++++++++++++++++++++++++++++++++------ 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3ae941b7..0898c6b1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-3234424a3a5871f31f5d6dcb8173593fc6c1db14802a0e71f14f3527ad16c871.yml -openapi_spec_hash: 017a8ab68d905ed9e163022f68d8be78 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-18b46cb8c1dd5cd0eea8559fa9671600540c5c4bee32f2d74f932416b7a1aee0.yml +openapi_spec_hash: 539770659847d04a92ef965a5313adde config_hash: 17e408231b0b01676298010c7405f483 diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 2a4d9643..fcd500ad 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -147,8 +147,10 @@ export namespace ExtensionConfig { min_selections?: number; /** - * Array of possible tag values. Combined length of all strings must not exceed 500 - * characters. Cannot contain the `%` character. + * Array of possible tag values. The combined length of all strings must not exceed + * 500 characters, and values cannot include the `%` character. When providing + * large vocabularies (more than 30 items), the AI may not follow the list + * strictly. */ vocabulary?: Array; } @@ -181,7 +183,10 @@ export namespace ExtensionConfig { min_selections?: number; /** - * Array of possible values matching the custom metadata field type. + * An array of possible values matching the custom metadata field type. If not + * provided for SingleSelect or MultiSelect field types, all values from the custom + * metadata field definition will be used. When providing large vocabularies (above + * 30 items), the AI may not strictly adhere to the list. */ vocabulary?: Array; } @@ -468,8 +473,10 @@ export namespace Extensions { min_selections?: number; /** - * Array of possible tag values. Combined length of all strings must not exceed 500 - * characters. Cannot contain the `%` character. + * Array of possible tag values. The combined length of all strings must not exceed + * 500 characters, and values cannot include the `%` character. When providing + * large vocabularies (more than 30 items), the AI may not follow the list + * strictly. */ vocabulary?: Array; } @@ -502,7 +509,10 @@ export namespace Extensions { min_selections?: number; /** - * Array of possible values matching the custom metadata field type. + * An array of possible values matching the custom metadata field type. If not + * provided for SingleSelect or MultiSelect field types, all values from the custom + * metadata field definition will be used. When providing large vocabularies (above + * 30 items), the AI may not strictly adhere to the list. */ vocabulary?: Array; } @@ -782,8 +792,25 @@ export type Overlay = TextOverlay | ImageOverlay | VideoOverlay | SubtitleOverla export interface OverlayPosition { /** - * Specifies the position of the overlay relative to the parent image or video. - * Maps to `lfo` in the URL. + * Sets the anchor point on the base asset from which the overlay offset is + * calculated. The default value is `top_left`. Maps to `lap` in the URL. Can only + * be used with one or more of `x`, `y`, `xCenter`, or `yCenter`. + */ + anchorPoint?: + | 'top' + | 'left' + | 'right' + | 'bottom' + | 'top_left' + | 'top_right' + | 'bottom_left' + | 'bottom_right' + | 'center'; + + /** + * Specifies the position of the overlay relative to the parent image or video. If + * one or more of `x`, `y`, `xCenter`, or `yCenter` parameters are specified, this + * parameter is ignored. Maps to `lfo` in the URL. */ focus?: | 'center' @@ -805,6 +832,15 @@ export interface OverlayPosition { */ x?: number | string; + /** + * Specifies the x-coordinate on the base asset where the overlay's center will be + * positioned. It also accepts arithmetic expressions such as `bw_mul_0.4` or + * `bw_sub_cw`. Maps to `lxc` in the URL. Cannot be used together with `x`, but can + * be used with `y`. Learn about + * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + */ + xCenter?: number | string; + /** * Specifies the y-coordinate of the top-left corner of the base asset where the * overlay's top-left corner will be positioned. It also accepts arithmetic @@ -813,6 +849,15 @@ export interface OverlayPosition { * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). */ y?: number | string; + + /** + * Specifies the y-coordinate on the base asset where the overlay's center will be + * positioned. It also accepts arithmetic expressions such as `bh_mul_0.4` or + * `bh_sub_ch`. Maps to `lyc` in the URL. Cannot be used together with `y`, but can + * be used with `x`. Learn about + * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations). + */ + yCenter?: number | string; } export interface OverlayTiming { From c14843b8e77bc24a871ed594962105fbfa7fa38a Mon Sep 17 00:00:00 2001 From: Manu Chaudhary Date: Fri, 10 Apr 2026 12:17:39 +0530 Subject: [PATCH 09/14] feat(docs): simplify authentication parameters example in README --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 7951aa2c..fd8899f7 100644 --- a/README.md +++ b/README.md @@ -337,10 +337,7 @@ Generate authentication parameters for secure client-side file uploads: ```ts // Generate authentication parameters for client-side uploads -const authParams = client.helper.getAuthenticationParameters({ - privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted - password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted -}); +const authParams = client.helper.getAuthenticationParameters(); console.log(authParams); // Result: { token: 'uuid-token', expire: timestamp, signature: 'hmac-signature' } From a86f04c6c187b3bedced5146a5ca717eccc8492e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:55:10 +0000 Subject: [PATCH 10/14] feat(api): update webhook event names and remove DAM prefix --- .stats.yml | 4 +- api.md | 15 +- src/client.ts | 20 +- src/resources/index.ts | 10 +- src/resources/webhooks.ts | 381 +++++++++++++++++++++++++------------- 5 files changed, 276 insertions(+), 154 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0898c6b1..4bc5fef0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-18b46cb8c1dd5cd0eea8559fa9671600540c5c4bee32f2d74f932416b7a1aee0.yml -openapi_spec_hash: 539770659847d04a92ef965a5313adde +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d73a37dc3426586109bd153f02c6a605036b6a7396bba5173d013468c5291ce6.yml +openapi_spec_hash: c193c6e557ff477481ec8d5ac8a0c96e config_hash: 17e408231b0b01676298010c7405f483 diff --git a/api.md b/api.md index 7ba4ee91..a5fbc2ad 100644 --- a/api.md +++ b/api.md @@ -229,11 +229,6 @@ Methods: Types: - BaseWebhookEvent -- DamFileCreateEvent -- DamFileDeleteEvent -- DamFileUpdateEvent -- DamFileVersionCreateEvent -- DamFileVersionDeleteEvent - UploadPostTransformErrorEvent - UploadPostTransformSuccessEvent - UploadPreTransformErrorEvent @@ -241,6 +236,16 @@ Types: - VideoTransformationAcceptedEvent - VideoTransformationErrorEvent - VideoTransformationReadyEvent +- FileCreatedWebhookEvent +- FileUpdatedWebhookEvent +- FileDeletedWebhookEvent +- FileVersionCreatedWebhookEvent +- FileVersionDeletedWebhookEvent +- FileCreatedWebhookEvent +- FileUpdatedWebhookEvent +- FileDeletedWebhookEvent +- FileVersionCreatedWebhookEvent +- FileVersionDeletedWebhookEvent - UnsafeUnwrapWebhookEvent - UnwrapWebhookEvent diff --git a/src/client.ts b/src/client.ts index 8ee3430a..5d14b48c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -35,11 +35,11 @@ import { } from './resources/saved-extensions'; import { BaseWebhookEvent, - DamFileCreateEvent, - DamFileDeleteEvent, - DamFileUpdateEvent, - DamFileVersionCreateEvent, - DamFileVersionDeleteEvent, + FileCreatedWebhookEvent, + FileDeletedWebhookEvent, + FileUpdatedWebhookEvent, + FileVersionCreatedWebhookEvent, + FileVersionDeletedWebhookEvent, UnsafeUnwrapWebhookEvent, UnwrapWebhookEvent, UploadPostTransformErrorEvent, @@ -922,11 +922,6 @@ export declare namespace ImageKit { export { Webhooks as Webhooks, type BaseWebhookEvent as BaseWebhookEvent, - type DamFileCreateEvent as DamFileCreateEvent, - type DamFileDeleteEvent as DamFileDeleteEvent, - type DamFileUpdateEvent as DamFileUpdateEvent, - type DamFileVersionCreateEvent as DamFileVersionCreateEvent, - type DamFileVersionDeleteEvent as DamFileVersionDeleteEvent, type UploadPostTransformErrorEvent as UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent as UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent as UploadPreTransformErrorEvent, @@ -934,6 +929,11 @@ export declare namespace ImageKit { type VideoTransformationAcceptedEvent as VideoTransformationAcceptedEvent, type VideoTransformationErrorEvent as VideoTransformationErrorEvent, type VideoTransformationReadyEvent as VideoTransformationReadyEvent, + type FileCreatedWebhookEvent as FileCreatedWebhookEvent, + type FileUpdatedWebhookEvent as FileUpdatedWebhookEvent, + type FileDeletedWebhookEvent as FileDeletedWebhookEvent, + type FileVersionCreatedWebhookEvent as FileVersionCreatedWebhookEvent, + type FileVersionDeletedWebhookEvent as FileVersionDeletedWebhookEvent, type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, }; diff --git a/src/resources/index.ts b/src/resources/index.ts index f2b18b19..b4d1a843 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -53,11 +53,6 @@ export { export { Webhooks, type BaseWebhookEvent, - type DamFileCreateEvent, - type DamFileDeleteEvent, - type DamFileUpdateEvent, - type DamFileVersionCreateEvent, - type DamFileVersionDeleteEvent, type UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent, @@ -65,6 +60,11 @@ export { type VideoTransformationAcceptedEvent, type VideoTransformationErrorEvent, type VideoTransformationReadyEvent, + type FileCreatedWebhookEvent, + type FileUpdatedWebhookEvent, + type FileDeletedWebhookEvent, + type FileVersionCreatedWebhookEvent, + type FileVersionDeletedWebhookEvent, type UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent, } from './webhooks'; diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index 3e75f069..21f8efaf 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -36,123 +36,6 @@ export interface BaseWebhookEvent { type: string; } -/** - * Triggered when a file is created. - */ -export interface DamFileCreateEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file.created'; -} - -/** - * Triggered when a file is deleted. - */ -export interface DamFileDeleteEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - data: DamFileDeleteEvent.Data; - - /** - * Type of the webhook event. - */ - type: 'file.deleted'; -} - -export namespace DamFileDeleteEvent { - export interface Data { - /** - * The unique `fileId` of the deleted file. - */ - fileId: string; - } -} - -/** - * Triggered when a file is updated. - */ -export interface DamFileUpdateEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file.updated'; -} - -/** - * Triggered when a file version is created. - */ -export interface DamFileVersionCreateEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file-version.created'; -} - -/** - * Triggered when a file version is deleted. - */ -export interface DamFileVersionDeleteEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - data: DamFileVersionDeleteEvent.Data; - - /** - * Type of the webhook event. - */ - type: 'file-version.deleted'; -} - -export namespace DamFileVersionDeleteEvent { - export interface Data { - /** - * The unique `fileId` of the deleted file. - */ - fileId: string; - - /** - * The unique `versionId` of the deleted file version. - */ - versionId: string; - } -} - /** * Triggered when a post-transformation fails. The original file remains available, * but the requested transformation could not be generated. @@ -1145,6 +1028,240 @@ export namespace VideoTransformationReadyEvent { } } +/** + * Triggered when a file is created. + */ +export interface FileCreatedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.created'; +} + +/** + * Triggered when a file is updated. + */ +export interface FileUpdatedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.updated'; +} + +/** + * Triggered when a file is deleted. + */ +export interface FileDeletedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: FileDeletedWebhookEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file.deleted'; +} + +export namespace FileDeletedWebhookEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + } +} + +/** + * Triggered when a file version is created. + */ +export interface FileVersionCreatedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file-version.created'; +} + +/** + * Triggered when a file version is deleted. + */ +export interface FileVersionDeletedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: FileVersionDeletedWebhookEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file-version.deleted'; +} + +export namespace FileVersionDeletedWebhookEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + + /** + * The unique `versionId` of the deleted file version. + */ + versionId: string; + } +} + +/** + * Triggered when a file is created. + */ +export interface FileCreatedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.created'; +} + +/** + * Triggered when a file is updated. + */ +export interface FileUpdatedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.updated'; +} + +/** + * Triggered when a file is deleted. + */ +export interface FileDeletedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: FileDeletedWebhookEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file.deleted'; +} + +export namespace FileDeletedWebhookEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + } +} + +/** + * Triggered when a file version is created. + */ +export interface FileVersionCreatedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file-version.created'; +} + +/** + * Triggered when a file version is deleted. + */ +export interface FileVersionDeletedWebhookEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: FileVersionDeletedWebhookEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file-version.deleted'; +} + +export namespace FileVersionDeletedWebhookEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + + /** + * The unique `versionId` of the deleted file version. + */ + versionId: string; + } +} + /** * Triggered when a new video transformation request is accepted for processing. * This event confirms that ImageKit has received and queued your transformation @@ -1158,11 +1275,11 @@ export type UnsafeUnwrapWebhookEvent = | UploadPreTransformErrorEvent | UploadPostTransformSuccessEvent | UploadPostTransformErrorEvent - | DamFileCreateEvent - | DamFileUpdateEvent - | DamFileDeleteEvent - | DamFileVersionCreateEvent - | DamFileVersionDeleteEvent; + | FileCreatedWebhookEvent + | FileUpdatedWebhookEvent + | FileDeletedWebhookEvent + | FileVersionCreatedWebhookEvent + | FileVersionDeletedWebhookEvent; /** * Triggered when a new video transformation request is accepted for processing. @@ -1177,20 +1294,15 @@ export type UnwrapWebhookEvent = | UploadPreTransformErrorEvent | UploadPostTransformSuccessEvent | UploadPostTransformErrorEvent - | DamFileCreateEvent - | DamFileUpdateEvent - | DamFileDeleteEvent - | DamFileVersionCreateEvent - | DamFileVersionDeleteEvent; + | FileCreatedWebhookEvent + | FileUpdatedWebhookEvent + | FileDeletedWebhookEvent + | FileVersionCreatedWebhookEvent + | FileVersionDeletedWebhookEvent; export declare namespace Webhooks { export { type BaseWebhookEvent as BaseWebhookEvent, - type DamFileCreateEvent as DamFileCreateEvent, - type DamFileDeleteEvent as DamFileDeleteEvent, - type DamFileUpdateEvent as DamFileUpdateEvent, - type DamFileVersionCreateEvent as DamFileVersionCreateEvent, - type DamFileVersionDeleteEvent as DamFileVersionDeleteEvent, type UploadPostTransformErrorEvent as UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent as UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent as UploadPreTransformErrorEvent, @@ -1198,6 +1310,11 @@ export declare namespace Webhooks { type VideoTransformationAcceptedEvent as VideoTransformationAcceptedEvent, type VideoTransformationErrorEvent as VideoTransformationErrorEvent, type VideoTransformationReadyEvent as VideoTransformationReadyEvent, + type FileCreatedWebhookEvent as FileCreatedWebhookEvent, + type FileUpdatedWebhookEvent as FileUpdatedWebhookEvent, + type FileDeletedWebhookEvent as FileDeletedWebhookEvent, + type FileVersionCreatedWebhookEvent as FileVersionCreatedWebhookEvent, + type FileVersionDeletedWebhookEvent as FileVersionDeletedWebhookEvent, type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, }; From 24b7f4b33977691dadbed303fd10acd532dcd5c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:59:26 +0000 Subject: [PATCH 11/14] fix(api): rename DamFile events to File for consistency --- .stats.yml | 2 +- api.md | 15 +- src/client.ts | 20 +- src/resources/index.ts | 10 +- src/resources/webhooks.ts | 381 +++++++++++++------------------------- 5 files changed, 153 insertions(+), 275 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4bc5fef0..aae6cba6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 47 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d73a37dc3426586109bd153f02c6a605036b6a7396bba5173d013468c5291ce6.yml openapi_spec_hash: c193c6e557ff477481ec8d5ac8a0c96e -config_hash: 17e408231b0b01676298010c7405f483 +config_hash: 32b155378f65c234d3abeb18519fb3cd diff --git a/api.md b/api.md index a5fbc2ad..742e7a39 100644 --- a/api.md +++ b/api.md @@ -229,6 +229,11 @@ Methods: Types: - BaseWebhookEvent +- FileCreateEvent +- FileDeleteEvent +- FileUpdateEvent +- FileVersionCreateEvent +- FileVersionDeleteEvent - UploadPostTransformErrorEvent - UploadPostTransformSuccessEvent - UploadPreTransformErrorEvent @@ -236,16 +241,6 @@ Types: - VideoTransformationAcceptedEvent - VideoTransformationErrorEvent - VideoTransformationReadyEvent -- FileCreatedWebhookEvent -- FileUpdatedWebhookEvent -- FileDeletedWebhookEvent -- FileVersionCreatedWebhookEvent -- FileVersionDeletedWebhookEvent -- FileCreatedWebhookEvent -- FileUpdatedWebhookEvent -- FileDeletedWebhookEvent -- FileVersionCreatedWebhookEvent -- FileVersionDeletedWebhookEvent - UnsafeUnwrapWebhookEvent - UnwrapWebhookEvent diff --git a/src/client.ts b/src/client.ts index 5d14b48c..77700f16 100644 --- a/src/client.ts +++ b/src/client.ts @@ -35,11 +35,11 @@ import { } from './resources/saved-extensions'; import { BaseWebhookEvent, - FileCreatedWebhookEvent, - FileDeletedWebhookEvent, - FileUpdatedWebhookEvent, - FileVersionCreatedWebhookEvent, - FileVersionDeletedWebhookEvent, + FileCreateEvent, + FileDeleteEvent, + FileUpdateEvent, + FileVersionCreateEvent, + FileVersionDeleteEvent, UnsafeUnwrapWebhookEvent, UnwrapWebhookEvent, UploadPostTransformErrorEvent, @@ -922,6 +922,11 @@ export declare namespace ImageKit { export { Webhooks as Webhooks, type BaseWebhookEvent as BaseWebhookEvent, + type FileCreateEvent as FileCreateEvent, + type FileDeleteEvent as FileDeleteEvent, + type FileUpdateEvent as FileUpdateEvent, + type FileVersionCreateEvent as FileVersionCreateEvent, + type FileVersionDeleteEvent as FileVersionDeleteEvent, type UploadPostTransformErrorEvent as UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent as UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent as UploadPreTransformErrorEvent, @@ -929,11 +934,6 @@ export declare namespace ImageKit { type VideoTransformationAcceptedEvent as VideoTransformationAcceptedEvent, type VideoTransformationErrorEvent as VideoTransformationErrorEvent, type VideoTransformationReadyEvent as VideoTransformationReadyEvent, - type FileCreatedWebhookEvent as FileCreatedWebhookEvent, - type FileUpdatedWebhookEvent as FileUpdatedWebhookEvent, - type FileDeletedWebhookEvent as FileDeletedWebhookEvent, - type FileVersionCreatedWebhookEvent as FileVersionCreatedWebhookEvent, - type FileVersionDeletedWebhookEvent as FileVersionDeletedWebhookEvent, type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, }; diff --git a/src/resources/index.ts b/src/resources/index.ts index b4d1a843..cda97941 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -53,6 +53,11 @@ export { export { Webhooks, type BaseWebhookEvent, + type FileCreateEvent, + type FileDeleteEvent, + type FileUpdateEvent, + type FileVersionCreateEvent, + type FileVersionDeleteEvent, type UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent, @@ -60,11 +65,6 @@ export { type VideoTransformationAcceptedEvent, type VideoTransformationErrorEvent, type VideoTransformationReadyEvent, - type FileCreatedWebhookEvent, - type FileUpdatedWebhookEvent, - type FileDeletedWebhookEvent, - type FileVersionCreatedWebhookEvent, - type FileVersionDeletedWebhookEvent, type UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent, } from './webhooks'; diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index 21f8efaf..cce8a7b6 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -36,6 +36,123 @@ export interface BaseWebhookEvent { type: string; } +/** + * Triggered when a file is created. + */ +export interface FileCreateEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.created'; +} + +/** + * Triggered when a file is deleted. + */ +export interface FileDeleteEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: FileDeleteEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file.deleted'; +} + +export namespace FileDeleteEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + } +} + +/** + * Triggered when a file is updated. + */ +export interface FileUpdateEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file.updated'; +} + +/** + * Triggered when a file version is created. + */ +export interface FileVersionCreateEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + /** + * Object containing details of a file or file version. + */ + data: FilesAPI.File; + + /** + * Type of the webhook event. + */ + type: 'file-version.created'; +} + +/** + * Triggered when a file version is deleted. + */ +export interface FileVersionDeleteEvent extends BaseWebhookEvent { + /** + * Timestamp of when the event occurred in ISO8601 format. + */ + created_at: string; + + data: FileVersionDeleteEvent.Data; + + /** + * Type of the webhook event. + */ + type: 'file-version.deleted'; +} + +export namespace FileVersionDeleteEvent { + export interface Data { + /** + * The unique `fileId` of the deleted file. + */ + fileId: string; + + /** + * The unique `versionId` of the deleted file version. + */ + versionId: string; + } +} + /** * Triggered when a post-transformation fails. The original file remains available, * but the requested transformation could not be generated. @@ -1028,240 +1145,6 @@ export namespace VideoTransformationReadyEvent { } } -/** - * Triggered when a file is created. - */ -export interface FileCreatedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file.created'; -} - -/** - * Triggered when a file is updated. - */ -export interface FileUpdatedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file.updated'; -} - -/** - * Triggered when a file is deleted. - */ -export interface FileDeletedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - data: FileDeletedWebhookEvent.Data; - - /** - * Type of the webhook event. - */ - type: 'file.deleted'; -} - -export namespace FileDeletedWebhookEvent { - export interface Data { - /** - * The unique `fileId` of the deleted file. - */ - fileId: string; - } -} - -/** - * Triggered when a file version is created. - */ -export interface FileVersionCreatedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file-version.created'; -} - -/** - * Triggered when a file version is deleted. - */ -export interface FileVersionDeletedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - data: FileVersionDeletedWebhookEvent.Data; - - /** - * Type of the webhook event. - */ - type: 'file-version.deleted'; -} - -export namespace FileVersionDeletedWebhookEvent { - export interface Data { - /** - * The unique `fileId` of the deleted file. - */ - fileId: string; - - /** - * The unique `versionId` of the deleted file version. - */ - versionId: string; - } -} - -/** - * Triggered when a file is created. - */ -export interface FileCreatedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file.created'; -} - -/** - * Triggered when a file is updated. - */ -export interface FileUpdatedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file.updated'; -} - -/** - * Triggered when a file is deleted. - */ -export interface FileDeletedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - data: FileDeletedWebhookEvent.Data; - - /** - * Type of the webhook event. - */ - type: 'file.deleted'; -} - -export namespace FileDeletedWebhookEvent { - export interface Data { - /** - * The unique `fileId` of the deleted file. - */ - fileId: string; - } -} - -/** - * Triggered when a file version is created. - */ -export interface FileVersionCreatedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - /** - * Object containing details of a file or file version. - */ - data: FilesAPI.File; - - /** - * Type of the webhook event. - */ - type: 'file-version.created'; -} - -/** - * Triggered when a file version is deleted. - */ -export interface FileVersionDeletedWebhookEvent extends BaseWebhookEvent { - /** - * Timestamp of when the event occurred in ISO8601 format. - */ - created_at: string; - - data: FileVersionDeletedWebhookEvent.Data; - - /** - * Type of the webhook event. - */ - type: 'file-version.deleted'; -} - -export namespace FileVersionDeletedWebhookEvent { - export interface Data { - /** - * The unique `fileId` of the deleted file. - */ - fileId: string; - - /** - * The unique `versionId` of the deleted file version. - */ - versionId: string; - } -} - /** * Triggered when a new video transformation request is accepted for processing. * This event confirms that ImageKit has received and queued your transformation @@ -1275,11 +1158,11 @@ export type UnsafeUnwrapWebhookEvent = | UploadPreTransformErrorEvent | UploadPostTransformSuccessEvent | UploadPostTransformErrorEvent - | FileCreatedWebhookEvent - | FileUpdatedWebhookEvent - | FileDeletedWebhookEvent - | FileVersionCreatedWebhookEvent - | FileVersionDeletedWebhookEvent; + | FileCreateEvent + | FileUpdateEvent + | FileDeleteEvent + | FileVersionCreateEvent + | FileVersionDeleteEvent; /** * Triggered when a new video transformation request is accepted for processing. @@ -1294,15 +1177,20 @@ export type UnwrapWebhookEvent = | UploadPreTransformErrorEvent | UploadPostTransformSuccessEvent | UploadPostTransformErrorEvent - | FileCreatedWebhookEvent - | FileUpdatedWebhookEvent - | FileDeletedWebhookEvent - | FileVersionCreatedWebhookEvent - | FileVersionDeletedWebhookEvent; + | FileCreateEvent + | FileUpdateEvent + | FileDeleteEvent + | FileVersionCreateEvent + | FileVersionDeleteEvent; export declare namespace Webhooks { export { type BaseWebhookEvent as BaseWebhookEvent, + type FileCreateEvent as FileCreateEvent, + type FileDeleteEvent as FileDeleteEvent, + type FileUpdateEvent as FileUpdateEvent, + type FileVersionCreateEvent as FileVersionCreateEvent, + type FileVersionDeleteEvent as FileVersionDeleteEvent, type UploadPostTransformErrorEvent as UploadPostTransformErrorEvent, type UploadPostTransformSuccessEvent as UploadPostTransformSuccessEvent, type UploadPreTransformErrorEvent as UploadPreTransformErrorEvent, @@ -1310,11 +1198,6 @@ export declare namespace Webhooks { type VideoTransformationAcceptedEvent as VideoTransformationAcceptedEvent, type VideoTransformationErrorEvent as VideoTransformationErrorEvent, type VideoTransformationReadyEvent as VideoTransformationReadyEvent, - type FileCreatedWebhookEvent as FileCreatedWebhookEvent, - type FileUpdatedWebhookEvent as FileUpdatedWebhookEvent, - type FileDeletedWebhookEvent as FileDeletedWebhookEvent, - type FileVersionCreatedWebhookEvent as FileVersionCreatedWebhookEvent, - type FileVersionDeletedWebhookEvent as FileVersionDeletedWebhookEvent, type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent as UnwrapWebhookEvent, }; From cbfbebc7d6ecb5e71207e9885f7b3195d1d1c316 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 18:07:34 +0000 Subject: [PATCH 12/14] docs: improve examples --- packages/mcp-server/src/local-docs-search.ts | 8 ++++---- tests/api-resources/custom-metadata-fields.test.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/mcp-server/src/local-docs-search.ts b/packages/mcp-server/src/local-docs-search.ts index 294e25cf..7cbbf7ef 100644 --- a/packages/mcp-server/src/local-docs-search.ts +++ b/packages/mcp-server/src/local-docs-search.ts @@ -77,7 +77,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ csharp: { method: 'CustomMetadataFields.Create', example: - 'CustomMetadataFieldCreateParams parameters = new()\n{\n Label = "price",\n Name = "price",\n Schema = new()\n {\n Type = Type.Number,\n DefaultValue = "string",\n IsValueRequired = true,\n MaxLength = 0,\n MaxValue = 3000,\n MinLength = 0,\n MinValue = 1000,\n SelectOptions =\n [\n "small", "medium", "large", 30, 40, true\n ],\n },\n};\n\nvar customMetadataField = await client.CustomMetadataFields.Create(parameters);\n\nConsole.WriteLine(customMetadataField);', + 'CustomMetadataFieldCreateParams parameters = new()\n{\n Label = "price",\n Name = "price",\n Schema = new()\n {\n Type = Type.Number,\n DefaultValue = new(\n\n [\n new UnnamedSchemaWithArrayParent1(true),\n new UnnamedSchemaWithArrayParent1(10),\n new UnnamedSchemaWithArrayParent1("Hello"),\n ]\n ),\n IsValueRequired = true,\n MaxLength = 0,\n MaxValue = 3000,\n MinLength = 0,\n MinValue = 1000,\n SelectOptions =\n [\n "small", "medium", "large", 30, 40, true\n ],\n },\n};\n\nvar customMetadataField = await client.CustomMetadataFields.Create(parameters);\n\nConsole.WriteLine(customMetadataField);', }, go: { method: 'client.CustomMetadataFields.New', @@ -96,7 +96,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->create', example: - "customMetadataFields->create(\n label: 'price',\n name: 'price',\n schema: [\n 'type' => 'Number',\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", + "customMetadataFields->create(\n label: 'price',\n name: 'price',\n schema: [\n 'type' => 'Number',\n 'defaultValue' => [true, 10, 'Hello'],\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.create', @@ -221,7 +221,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'customMetadataFields->update', example: - "customMetadataFields->update(\n 'id',\n label: 'price',\n schema: [\n 'defaultValue' => 'string',\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", + "customMetadataFields->update(\n 'id',\n label: 'price',\n schema: [\n 'defaultValue' => [true, 10, 'Hello'],\n 'isValueRequired' => true,\n 'maxLength' => 0,\n 'maxValue' => 3000,\n 'minLength' => 0,\n 'minValue' => 1000,\n 'selectOptions' => ['small', 'medium', 'large', 30, 40, true],\n ],\n);\n\nvar_dump($customMetadataField);", }, python: { method: 'custom_metadata_fields.update', @@ -489,7 +489,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->update', example: - "files->update(\n 'fileId',\n customCoordinates: 'customCoordinates',\n customMetadata: ['foo' => 'bar'],\n description: 'description',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n removeAITags: ['string'],\n tags: ['tag1', 'tag2'],\n webhookURL: 'https://example.com',\n publish: ['isPublished' => true, 'includeFileVersions' => true],\n);\n\nvar_dump($file);", + "files->update(\n 'fileId',\n customCoordinates: 'customCoordinates',\n customMetadata: ['foo' => 'bar'],\n description: 'description',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n removeAITags: 'all',\n tags: ['tag1', 'tag2'],\n webhookURL: 'https://example.com',\n publish: ['isPublished' => true, 'includeFileVersions' => true],\n);\n\nvar_dump($file);", }, python: { method: 'files.update', diff --git a/tests/api-resources/custom-metadata-fields.test.ts b/tests/api-resources/custom-metadata-fields.test.ts index 3fbf78f7..52e39794 100644 --- a/tests/api-resources/custom-metadata-fields.test.ts +++ b/tests/api-resources/custom-metadata-fields.test.ts @@ -32,7 +32,7 @@ describe('resource customMetadataFields', () => { name: 'price', schema: { type: 'Number', - defaultValue: 'string', + defaultValue: [true, 10, 'Hello'], isValueRequired: true, maxLength: 0, maxValue: 3000, @@ -64,7 +64,7 @@ describe('resource customMetadataFields', () => { { label: 'price', schema: { - defaultValue: 'string', + defaultValue: [true, 10, 'Hello'], isValueRequired: true, maxLength: 0, maxValue: 3000, From eb9b6dc079d3c174b37863892e3dbc5a6ca0a2d5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 21:29:41 +0000 Subject: [PATCH 13/14] chore(internal): codegen related update --- packages/mcp-server/src/local-docs-search.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mcp-server/src/local-docs-search.ts b/packages/mcp-server/src/local-docs-search.ts index 7cbbf7ef..5388085b 100644 --- a/packages/mcp-server/src/local-docs-search.ts +++ b/packages/mcp-server/src/local-docs-search.ts @@ -366,7 +366,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'files->upload', example: - "files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n expire: 0,\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n publicKey: 'publicKey',\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n signature: 'signature',\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", + "files->upload(\n file: FileParam::fromString('Example data', filename: uniqid('file-upload-', true)),\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n expire: 0,\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n publicKey: 'publicKey',\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n signature: 'signature',\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", }, python: { method: 'files.upload', @@ -2940,7 +2940,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [ php: { method: 'beta->v2->files->upload', example: - "beta->v2->files->upload(\n file: 'file',\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", + "beta->v2->files->upload(\n file: FileParam::fromString('Example data', filename: uniqid('file-upload-', true)),\n fileName: 'fileName',\n token: 'token',\n checks: \"\\\"request.folder\\\" : \\\"marketing/\\\"\\n\",\n customCoordinates: 'customCoordinates',\n customMetadata: ['brand' => 'bar', 'color' => 'bar'],\n description: 'Running shoes',\n extensions: [\n [\n 'name' => 'remove-bg',\n 'options' => [\n 'addShadow' => true,\n 'bgColor' => 'bg_color',\n 'bgImageURL' => 'bg_image_url',\n 'semitransparency' => true,\n ],\n ],\n ['maxTags' => 5, 'minConfidence' => 95, 'name' => 'google-auto-tagging'],\n ['name' => 'ai-auto-description'],\n [\n 'name' => 'ai-tasks',\n 'tasks' => [\n [\n 'instruction' => 'What types of clothing items are visible in this image?',\n 'type' => 'select_tags',\n 'maxSelections' => 1,\n 'minSelections' => 0,\n 'vocabulary' => ['shirt', 'tshirt', 'dress', 'trousers', 'jacket'],\n ],\n [\n 'instruction' => 'Is this a luxury or high-end fashion item?',\n 'type' => 'yes_no',\n 'onNo' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onUnknown' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n 'onYes' => [\n 'addTags' => ['luxury', 'premium'],\n 'removeTags' => ['budget', 'affordable'],\n 'setMetadata' => [['field' => 'price_range', 'value' => 'premium']],\n 'unsetMetadata' => [['field' => 'price_range']],\n ],\n ],\n ],\n ],\n ['id' => 'ext_abc123', 'name' => 'saved-extension'],\n ],\n folder: 'folder',\n isPrivateFile: true,\n isPublished: true,\n overwriteAITags: true,\n overwriteCustomMetadata: true,\n overwriteFile: true,\n overwriteTags: true,\n responseFields: ['tags', 'customCoordinates', 'isPrivateFile'],\n tags: ['t-shirt', 'round-neck', 'men'],\n transformation: [\n 'post' => [\n ['type' => 'thumbnail', 'value' => 'w-150,h-150'],\n [\n 'protocol' => 'dash',\n 'type' => 'abs',\n 'value' => 'sr-240_360_480_720_1080',\n ],\n ],\n 'pre' => 'w-300,h-300,q-80',\n ],\n useUniqueFileName: true,\n webhookURL: 'https://example.com',\n);\n\nvar_dump($response);", }, python: { method: 'beta.v2.files.upload', @@ -3100,7 +3100,7 @@ const EMBEDDED_READMES: { language: string; content: string }[] = [ { language: 'php', content: - '# Image Kit PHP API Library\n\nThe Image Kit PHP library provides convenient access to the Image Kit REST API from any PHP 8.1.0+ application.\n\n## Installation\n\nTo use this package, install via Composer by adding the following to your application\'s `composer.json`:\n\n```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:stainless-sdks/imagekit-php.git"\n }\n ],\n "require": {\n "imagekit/imagekit": "dev-main"\n }\n}\n```\n\n## Usage\n\n```php\nfiles->upload(file: \'file\', fileName: \'file-name.jpg\');\n\nvar_dump($response->videoCodec);\n```', + '# Image Kit PHP API Library\n\nThe Image Kit PHP library provides convenient access to the Image Kit REST API from any PHP 8.1.0+ application.\n\n## Installation\n\nTo use this package, install via Composer by adding the following to your application\'s `composer.json`:\n\n```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:stainless-sdks/imagekit-php.git"\n }\n ],\n "require": {\n "imagekit/imagekit": "dev-main"\n }\n}\n```\n\n## Usage\n\n```php\nfiles->upload(\n file: FileParam::fromString(\'https://www.example.com/public-url.jpg\', filename: uniqid(\'file-upload-\', true)),\n fileName: \'file-name.jpg\',\n);\n\nvar_dump($response->videoCodec);\n```', }, ]; From e9463581da3afa5d3ee7ebce419b65dc261457fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 21:30:01 +0000 Subject: [PATCH 14/14] release: 7.5.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 32 +++++++++++++++++++++++++++++++ package.json | 2 +- packages/mcp-server/manifest.json | 2 +- packages/mcp-server/package.json | 2 +- packages/mcp-server/src/server.ts | 2 +- src/version.ts | 2 +- 7 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6731678f..cd52c1e8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.4.0" + ".": "7.5.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index eae4b424..4d406d4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## 7.5.0 (2026-04-10) + +Full Changelog: [v7.4.0...v7.5.0](https://github.com/imagekit-developer/imagekit-nodejs/compare/v7.4.0...v7.5.0) + +### Features + +* **api:** dam related webhook events ([d2bc9ce](https://github.com/imagekit-developer/imagekit-nodejs/commit/d2bc9ce8f62be8c4da65f655b8113a0bca685c37)) +* **api:** fix spec indentation ([79ae799](https://github.com/imagekit-developer/imagekit-nodejs/commit/79ae799823f2dcdde7eece7fc0588916e453537e)) +* **api:** indentation fix ([65c6eec](https://github.com/imagekit-developer/imagekit-nodejs/commit/65c6eec03f5907dedd73500eeba8f9aa0de1f66c)) +* **api:** merge with main to bring back missing parameters ([bd6474f](https://github.com/imagekit-developer/imagekit-nodejs/commit/bd6474f9af40cae66818a260f21087d4e19f76af)) +* **api:** update webhook event names and remove DAM prefix ([a86f04c](https://github.com/imagekit-developer/imagekit-nodejs/commit/a86f04c6c187b3bedced5146a5ca717eccc8492e)) +* **docs:** simplify authentication parameters example in README ([c14843b](https://github.com/imagekit-developer/imagekit-nodejs/commit/c14843b8e77bc24a871ed594962105fbfa7fa38a)) + + +### Bug Fixes + +* **api:** rename DamFile events to File for consistency ([24b7f4b](https://github.com/imagekit-developer/imagekit-nodejs/commit/24b7f4b33977691dadbed303fd10acd532dcd5c1)) + + +### Chores + +* **internal:** codegen related update ([eb9b6dc](https://github.com/imagekit-developer/imagekit-nodejs/commit/eb9b6dc079d3c174b37863892e3dbc5a6ca0a2d5)) +* **internal:** codegen related update ([e2cf4dc](https://github.com/imagekit-developer/imagekit-nodejs/commit/e2cf4dcd2be96f3d7d60244e40592aa94f393e8c)) +* **internal:** fix MCP server import ordering ([31100e2](https://github.com/imagekit-developer/imagekit-nodejs/commit/31100e2ee17426153efea46f8787d2cfb5e2a9ee)) +* **internal:** show error causes in MCP servers when running in local mode ([7f1ff53](https://github.com/imagekit-developer/imagekit-nodejs/commit/7f1ff53ef5fedeb78fd73571664789c858133351)) +* **mcp-server:** increase local docs search result count from 5 to 10 ([35dc080](https://github.com/imagekit-developer/imagekit-nodejs/commit/35dc080ca7ef76d09db5152fbc8e3af285581822)) + + +### Documentation + +* improve examples ([cbfbebc](https://github.com/imagekit-developer/imagekit-nodejs/commit/cbfbebc7d6ecb5e71207e9885f7b3195d1d1c316)) + ## 7.4.0 (2026-04-06) Full Changelog: [v7.3.0...v7.4.0](https://github.com/imagekit-developer/imagekit-nodejs/compare/v7.3.0...v7.4.0) diff --git a/package.json b/package.json index af9466f2..10029643 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@imagekit/nodejs", - "version": "7.4.0", + "version": "7.5.0", "description": "Offical NodeJS SDK for ImageKit.io integration", "author": "Image Kit ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/manifest.json b/packages/mcp-server/manifest.json index 934e4661..c9dbefa4 100644 --- a/packages/mcp-server/manifest.json +++ b/packages/mcp-server/manifest.json @@ -1,7 +1,7 @@ { "dxt_version": "0.2", "name": "@imagekit/api-mcp", - "version": "7.4.0", + "version": "7.5.0", "description": "The official MCP Server for the Image Kit API", "author": { "name": "Image Kit", diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index 26fcf65c..d3b791d3 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "@imagekit/api-mcp", - "version": "7.4.0", + "version": "7.5.0", "description": "The official MCP Server for the Image Kit API", "author": "Image Kit ", "types": "dist/index.d.ts", diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index c9bb80fa..4668d948 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -28,7 +28,7 @@ export const newMcpServer = async ({ new McpServer( { name: 'imagekit_nodejs_api', - version: '7.4.0', + version: '7.5.0', }, { instructions: await getInstructions({ stainlessApiKey, customInstructionsPath }), diff --git a/src/version.ts b/src/version.ts index 06a61128..662d85ef 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '7.4.0'; // x-release-please-version +export const VERSION = '7.5.0'; // x-release-please-version