@imagekit/api-mcp 7.2.2 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/{headers.mjs → auth.js} +21 -2
- package/auth.js.map +1 -0
- package/{headers.js → auth.mjs} +16 -6
- package/auth.mjs.map +1 -0
- package/code-tool-paths.cjs +8 -0
- package/code-tool-paths.cjs.map +1 -0
- package/code-tool-paths.d.cts +2 -0
- package/code-tool-paths.d.cts.map +1 -0
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool-worker.d.mts +5 -0
- package/code-tool-worker.d.mts.map +1 -0
- package/code-tool-worker.d.ts +5 -0
- package/code-tool-worker.d.ts.map +1 -0
- package/code-tool-worker.js +314 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +276 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +11 -2
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +11 -2
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +285 -42
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +253 -43
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +11 -3
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts +11 -3
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +58 -5
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +57 -5
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +6 -3
- package/http.d.mts.map +1 -1
- package/http.d.ts +6 -3
- package/http.d.ts.map +1 -1
- package/http.js +130 -28
- package/http.js.map +1 -1
- package/http.mjs +130 -28
- package/http.mjs.map +1 -1
- package/index.js +17 -12
- package/index.js.map +1 -1
- package/index.mjs +17 -12
- package/index.mjs.map +1 -1
- package/instructions.d.mts +5 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +5 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +61 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +55 -0
- package/instructions.mjs.map +1 -0
- package/local-docs-search.d.mts +28 -0
- package/local-docs-search.d.mts.map +1 -0
- package/local-docs-search.d.ts +28 -0
- package/local-docs-search.d.ts.map +1 -0
- package/local-docs-search.js +2807 -0
- package/local-docs-search.js.map +1 -0
- package/local-docs-search.mjs +2767 -0
- package/local-docs-search.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +349 -0
- package/methods.js.map +1 -0
- package/methods.mjs +345 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +12 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +12 -0
- package/options.d.ts.map +1 -1
- package/options.js +81 -12
- package/options.js.map +1 -1
- package/options.mjs +81 -12
- package/options.mjs.map +1 -1
- package/package.json +89 -15
- package/server.d.mts +18 -11
- package/server.d.mts.map +1 -1
- package/server.d.ts +18 -11
- package/server.d.ts.map +1 -1
- package/server.js +89 -49
- package/server.js.map +1 -1
- package/server.mjs +88 -45
- package/server.mjs.map +1 -1
- package/src/{headers.ts → auth.ts} +18 -1
- package/src/code-tool-paths.cts +5 -0
- package/src/code-tool-types.ts +1 -0
- package/src/code-tool-worker.ts +327 -0
- package/src/code-tool.ts +339 -55
- package/src/docs-search-tool.ts +86 -7
- package/src/http.ts +154 -33
- package/src/index.ts +19 -13
- package/src/instructions.ts +83 -0
- package/src/local-docs-search.ts +3380 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +370 -0
- package/src/options.ts +105 -12
- package/src/server.ts +111 -57
- package/src/stdio.ts +9 -4
- package/src/types.ts +15 -4
- package/src/util.ts +25 -0
- package/stdio.d.mts +2 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +2 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +8 -4
- package/stdio.js.map +1 -1
- package/stdio.mjs +8 -4
- package/stdio.mjs.map +1 -1
- package/types.d.mts +14 -1
- package/types.d.mts.map +1 -1
- package/types.d.ts +14 -1
- package/types.d.ts.map +1 -1
- package/types.js.map +1 -1
- package/types.mjs.map +1 -1
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
- package/headers.d.mts +0 -4
- package/headers.d.mts.map +0 -1
- package/headers.d.ts +0 -4
- package/headers.d.ts.map +0 -1
- package/headers.js.map +0 -1
- package/headers.mjs.map +0 -1
|
@@ -0,0 +1,2767 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import MiniSearch from 'minisearch';
|
|
3
|
+
import * as fs from 'node:fs/promises';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import { getLogger } from "./logger.mjs";
|
|
6
|
+
const EMBEDDED_METHODS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'create',
|
|
9
|
+
endpoint: '/v1/customMetadataFields',
|
|
10
|
+
httpMethod: 'post',
|
|
11
|
+
summary: 'Create new field',
|
|
12
|
+
description: 'This API creates a new custom metadata field. Once a custom metadata field is created either through this API or using the dashboard UI, its value can be set on the assets. The value of a field for an asset can be set using the media library UI or programmatically through upload or update assets API.\n',
|
|
13
|
+
stainlessPath: '(resource) customMetadataFields > (method) create',
|
|
14
|
+
qualified: 'client.customMetadataFields.create',
|
|
15
|
+
params: [
|
|
16
|
+
'label: string;',
|
|
17
|
+
'name: string;',
|
|
18
|
+
"schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; };",
|
|
19
|
+
],
|
|
20
|
+
response: "{ id: string; label: string; name: string; schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }; }",
|
|
21
|
+
markdown: "## create\n\n`client.customMetadataFields.create(label: string, name: string, schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }): { id: string; label: string; name: string; schema: object; }`\n\n**post** `/v1/customMetadataFields`\n\nThis API creates a new custom metadata field. Once a custom metadata field is created either through this API or using the dashboard UI, its value can be set on the assets. The value of a field for an asset can be set using the media library UI or programmatically through upload or update assets API.\n\n\n### Parameters\n\n- `label: string`\n Human readable name of the custom metadata field. This should be unique across all non deleted custom metadata fields. This name is displayed as form field label to the users while setting field value on an asset in the media library UI.\n\n- `name: string`\n API name of the custom metadata field. This should be unique across all (including deleted) custom metadata fields.\n\n- `schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }`\n - `type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'`\n Type of the custom metadata field.\n - `defaultValue?: string | number | boolean | string | number | boolean[]`\n The default value for this custom metadata field. This property is only required if `isValueRequired` property is set to `true`. The value should match the `type` of custom metadata field.\n\n - `isValueRequired?: boolean`\n Sets this custom metadata field as required. Setting custom metadata fields on an asset will throw error if the value for all required fields are not present in upload or update asset API request body.\n\n - `maxLength?: number`\n Maximum length of string. Only set this property if `type` is set to `Text` or `Textarea`.\n\n - `maxValue?: string | number`\n Maximum value of the field. Only set this property if field type is `Date` or `Number`. For `Date` type field, set the minimum date in ISO8601 string format. For `Number` type field, set the minimum numeric value.\n\n - `minLength?: number`\n Minimum length of string. Only set this property if `type` is set to `Text` or `Textarea`.\n\n - `minValue?: string | number`\n Minimum value of the field. Only set this property if field type is `Date` or `Number`. For `Date` type field, set the minimum date in ISO8601 string format. For `Number` type field, set the minimum numeric value.\n\n - `selectOptions?: string | number | boolean[]`\n An array of allowed values. This property is only required if `type` property is set to `SingleSelect` or `MultiSelect`.\n\n\n### Returns\n\n- `{ id: string; label: string; name: string; schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }; }`\n Object containing details of a custom metadata field.\n\n - `id: string`\n - `label: string`\n - `name: string`\n - `schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.create({\n label: 'price',\n name: 'price',\n schema: { type: 'Number' },\n});\n\nconsole.log(customMetadataField);\n```",
|
|
22
|
+
perLanguage: {
|
|
23
|
+
cli: {
|
|
24
|
+
method: 'customMetadataFields create',
|
|
25
|
+
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}'",
|
|
26
|
+
},
|
|
27
|
+
csharp: {
|
|
28
|
+
method: 'CustomMetadataFields.Create',
|
|
29
|
+
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);',
|
|
30
|
+
},
|
|
31
|
+
go: {
|
|
32
|
+
method: 'client.CustomMetadataFields.New',
|
|
33
|
+
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',
|
|
34
|
+
},
|
|
35
|
+
http: {
|
|
36
|
+
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 }\'',
|
|
37
|
+
},
|
|
38
|
+
java: {
|
|
39
|
+
method: 'customMetadataFields().create',
|
|
40
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataField;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataFieldCreateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n CustomMetadataFieldCreateParams params = CustomMetadataFieldCreateParams.builder()\n .label("price")\n .name("price")\n .schema(CustomMetadataFieldCreateParams.Schema.builder()\n .type(CustomMetadataFieldCreateParams.Schema.Type.NUMBER)\n .build())\n .build();\n CustomMetadataField customMetadataField = client.customMetadataFields().create(params);\n }\n}',
|
|
41
|
+
},
|
|
42
|
+
php: {
|
|
43
|
+
method: 'customMetadataFields->create',
|
|
44
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$customMetadataField = $client->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);",
|
|
45
|
+
},
|
|
46
|
+
python: {
|
|
47
|
+
method: 'custom_metadata_fields.create',
|
|
48
|
+
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)',
|
|
49
|
+
},
|
|
50
|
+
ruby: {
|
|
51
|
+
method: 'custom_metadata_fields.create',
|
|
52
|
+
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)',
|
|
53
|
+
},
|
|
54
|
+
typescript: {
|
|
55
|
+
method: 'client.customMetadataFields.create',
|
|
56
|
+
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);",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'list',
|
|
62
|
+
endpoint: '/v1/customMetadataFields',
|
|
63
|
+
httpMethod: 'get',
|
|
64
|
+
summary: 'List all fields',
|
|
65
|
+
description: 'This API returns the array of created custom metadata field objects. By default the API returns only non deleted field objects, but you can include deleted fields in the API response.\n\nYou can also filter results by a specific folder path to retrieve custom metadata fields applicable at that location. This path-specific filtering is useful when using the **Path policy** feature to determine which custom metadata fields are selected for a given path.\n',
|
|
66
|
+
stainlessPath: '(resource) customMetadataFields > (method) list',
|
|
67
|
+
qualified: 'client.customMetadataFields.list',
|
|
68
|
+
params: ['folderPath?: string;', 'includeDeleted?: boolean;'],
|
|
69
|
+
response: "{ id: string; label: string; name: string; schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }; }[]",
|
|
70
|
+
markdown: "## list\n\n`client.customMetadataFields.list(folderPath?: string, includeDeleted?: boolean): object[]`\n\n**get** `/v1/customMetadataFields`\n\nThis API returns the array of created custom metadata field objects. By default the API returns only non deleted field objects, but you can include deleted fields in the API response.\n\nYou can also filter results by a specific folder path to retrieve custom metadata fields applicable at that location. This path-specific filtering is useful when using the **Path policy** feature to determine which custom metadata fields are selected for a given path.\n\n\n### Parameters\n\n- `folderPath?: string`\n The folder path (e.g., `/path/to/folder`) for which to retrieve applicable custom metadata fields. Useful for determining path-specific field selections when the [Path policy](https://imagekit.io/docs/dam/path-policy) feature is in use.\n\n\n- `includeDeleted?: boolean`\n Set it to `true` to include deleted field objects in the API response.\n\n\n### Returns\n\n- `{ id: string; label: string; name: string; schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }; }[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataFields = await client.customMetadataFields.list();\n\nconsole.log(customMetadataFields);\n```",
|
|
71
|
+
perLanguage: {
|
|
72
|
+
cli: {
|
|
73
|
+
method: 'customMetadataFields list',
|
|
74
|
+
example: "imagekit custom-metadata-fields list \\\n --private-key 'My Private Key' \\\n --password 'My Password'",
|
|
75
|
+
},
|
|
76
|
+
csharp: {
|
|
77
|
+
method: 'CustomMetadataFields.List',
|
|
78
|
+
example: 'CustomMetadataFieldListParams parameters = new();\n\nvar customMetadataFields = await client.CustomMetadataFields.List(parameters);\n\nConsole.WriteLine(customMetadataFields);',
|
|
79
|
+
},
|
|
80
|
+
go: {
|
|
81
|
+
method: 'client.CustomMetadataFields.List',
|
|
82
|
+
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',
|
|
83
|
+
},
|
|
84
|
+
http: {
|
|
85
|
+
example: 'curl https://api.imagekit.io/v1/customMetadataFields \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
86
|
+
},
|
|
87
|
+
java: {
|
|
88
|
+
method: 'customMetadataFields().list',
|
|
89
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataField;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataFieldListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n List<CustomMetadataField> customMetadataFields = client.customMetadataFields().list();\n }\n}',
|
|
90
|
+
},
|
|
91
|
+
php: {
|
|
92
|
+
method: 'customMetadataFields->list',
|
|
93
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$customMetadataFields = $client->customMetadataFields->list(\n folderPath: 'folderPath', includeDeleted: true\n);\n\nvar_dump($customMetadataFields);",
|
|
94
|
+
},
|
|
95
|
+
python: {
|
|
96
|
+
method: 'custom_metadata_fields.list',
|
|
97
|
+
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)',
|
|
98
|
+
},
|
|
99
|
+
ruby: {
|
|
100
|
+
method: 'custom_metadata_fields.list',
|
|
101
|
+
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)',
|
|
102
|
+
},
|
|
103
|
+
typescript: {
|
|
104
|
+
method: 'client.customMetadataFields.list',
|
|
105
|
+
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);",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'update',
|
|
111
|
+
endpoint: '/v1/customMetadataFields/{id}',
|
|
112
|
+
httpMethod: 'patch',
|
|
113
|
+
summary: 'Update existing field',
|
|
114
|
+
description: 'This API updates the label or schema of an existing custom metadata field.\n',
|
|
115
|
+
stainlessPath: '(resource) customMetadataFields > (method) update',
|
|
116
|
+
qualified: 'client.customMetadataFields.update',
|
|
117
|
+
params: [
|
|
118
|
+
'id: string;',
|
|
119
|
+
'label?: string;',
|
|
120
|
+
'schema?: { defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; };',
|
|
121
|
+
],
|
|
122
|
+
response: "{ id: string; label: string; name: string; schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }; }",
|
|
123
|
+
markdown: "## update\n\n`client.customMetadataFields.update(id: string, label?: string, schema?: { defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }): { id: string; label: string; name: string; schema: object; }`\n\n**patch** `/v1/customMetadataFields/{id}`\n\nThis API updates the label or schema of an existing custom metadata field.\n\n\n### Parameters\n\n- `id: string`\n\n- `label?: string`\n Human readable name of the custom metadata field. This should be unique across all non deleted custom metadata fields. This name is displayed as form field label to the users while setting field value on an asset in the media library UI. This parameter is required if `schema` is not provided.\n\n- `schema?: { defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }`\n An object that describes the rules for the custom metadata key. This parameter is required if `label` is not provided. Note: `type` cannot be updated and will be ignored if sent with the `schema`. The schema will be validated as per the existing `type`.\n\n - `defaultValue?: string | number | boolean | string | number | boolean[]`\n The default value for this custom metadata field. This property is only required if `isValueRequired` property is set to `true`. The value should match the `type` of custom metadata field.\n\n - `isValueRequired?: boolean`\n Sets this custom metadata field as required. Setting custom metadata fields on an asset will throw error if the value for all required fields are not present in upload or update asset API request body.\n\n - `maxLength?: number`\n Maximum length of string. Only set this property if `type` is set to `Text` or `Textarea`.\n\n - `maxValue?: string | number`\n Maximum value of the field. Only set this property if field type is `Date` or `Number`. For `Date` type field, set the minimum date in ISO8601 string format. For `Number` type field, set the minimum numeric value.\n\n - `minLength?: number`\n Minimum length of string. Only set this property if `type` is set to `Text` or `Textarea`.\n\n - `minValue?: string | number`\n Minimum value of the field. Only set this property if field type is `Date` or `Number`. For `Date` type field, set the minimum date in ISO8601 string format. For `Number` type field, set the minimum numeric value.\n\n - `selectOptions?: string | number | boolean[]`\n An array of allowed values. This property is only required if `type` property is set to `SingleSelect` or `MultiSelect`.\n\n\n### Returns\n\n- `{ id: string; label: string; name: string; schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }; }`\n Object containing details of a custom metadata field.\n\n - `id: string`\n - `label: string`\n - `name: string`\n - `schema: { type: 'Text' | 'Textarea' | 'Number' | 'Date' | 'Boolean' | 'SingleSelect' | 'MultiSelect'; defaultValue?: string | number | boolean | string | number | boolean[]; isValueRequired?: boolean; maxLength?: number; maxValue?: string | number; minLength?: number; minValue?: string | number; selectOptions?: string | number | boolean[]; }`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.update('id');\n\nconsole.log(customMetadataField);\n```",
|
|
124
|
+
perLanguage: {
|
|
125
|
+
cli: {
|
|
126
|
+
method: 'customMetadataFields update',
|
|
127
|
+
example: "imagekit custom-metadata-fields update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
128
|
+
},
|
|
129
|
+
csharp: {
|
|
130
|
+
method: 'CustomMetadataFields.Update',
|
|
131
|
+
example: 'CustomMetadataFieldUpdateParams parameters = new() { ID = "id" };\n\nvar customMetadataField = await client.CustomMetadataFields.Update(parameters);\n\nConsole.WriteLine(customMetadataField);',
|
|
132
|
+
},
|
|
133
|
+
go: {
|
|
134
|
+
method: 'client.CustomMetadataFields.Update',
|
|
135
|
+
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',
|
|
136
|
+
},
|
|
137
|
+
http: {
|
|
138
|
+
example: 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X PATCH \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
139
|
+
},
|
|
140
|
+
java: {
|
|
141
|
+
method: 'customMetadataFields().update',
|
|
142
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataField;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataFieldUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n CustomMetadataField customMetadataField = client.customMetadataFields().update("id");\n }\n}',
|
|
143
|
+
},
|
|
144
|
+
php: {
|
|
145
|
+
method: 'customMetadataFields->update',
|
|
146
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$customMetadataField = $client->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);",
|
|
147
|
+
},
|
|
148
|
+
python: {
|
|
149
|
+
method: 'custom_metadata_fields.update',
|
|
150
|
+
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)',
|
|
151
|
+
},
|
|
152
|
+
ruby: {
|
|
153
|
+
method: 'custom_metadata_fields.update',
|
|
154
|
+
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)',
|
|
155
|
+
},
|
|
156
|
+
typescript: {
|
|
157
|
+
method: 'client.customMetadataFields.update',
|
|
158
|
+
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);",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'delete',
|
|
164
|
+
endpoint: '/v1/customMetadataFields/{id}',
|
|
165
|
+
httpMethod: 'delete',
|
|
166
|
+
summary: 'Delete a field',
|
|
167
|
+
description: 'This API deletes a custom metadata field. Even after deleting a custom metadata field, you cannot create any new custom metadata field with the same name.\n',
|
|
168
|
+
stainlessPath: '(resource) customMetadataFields > (method) delete',
|
|
169
|
+
qualified: 'client.customMetadataFields.delete',
|
|
170
|
+
params: ['id: string;'],
|
|
171
|
+
response: '{ }',
|
|
172
|
+
markdown: "## delete\n\n`client.customMetadataFields.delete(id: string): { }`\n\n**delete** `/v1/customMetadataFields/{id}`\n\nThis API deletes a custom metadata field. Even after deleting a custom metadata field, you cannot create any new custom metadata field with the same name.\n\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ }`\n\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst customMetadataField = await client.customMetadataFields.delete('id');\n\nconsole.log(customMetadataField);\n```",
|
|
173
|
+
perLanguage: {
|
|
174
|
+
cli: {
|
|
175
|
+
method: 'customMetadataFields delete',
|
|
176
|
+
example: "imagekit custom-metadata-fields delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
177
|
+
},
|
|
178
|
+
csharp: {
|
|
179
|
+
method: 'CustomMetadataFields.Delete',
|
|
180
|
+
example: 'CustomMetadataFieldDeleteParams parameters = new() { ID = "id" };\n\nvar customMetadataField = await client.CustomMetadataFields.Delete(parameters);\n\nConsole.WriteLine(customMetadataField);',
|
|
181
|
+
},
|
|
182
|
+
go: {
|
|
183
|
+
method: 'client.CustomMetadataFields.Delete',
|
|
184
|
+
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',
|
|
185
|
+
},
|
|
186
|
+
http: {
|
|
187
|
+
example: 'curl https://api.imagekit.io/v1/customMetadataFields/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
188
|
+
},
|
|
189
|
+
java: {
|
|
190
|
+
method: 'customMetadataFields().delete',
|
|
191
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataFieldDeleteParams;\nimport com.imagekit.api.models.custommetadatafields.CustomMetadataFieldDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n CustomMetadataFieldDeleteResponse customMetadataField = client.customMetadataFields().delete("id");\n }\n}',
|
|
192
|
+
},
|
|
193
|
+
php: {
|
|
194
|
+
method: 'customMetadataFields->delete',
|
|
195
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$customMetadataField = $client->customMetadataFields->delete('id');\n\nvar_dump($customMetadataField);",
|
|
196
|
+
},
|
|
197
|
+
python: {
|
|
198
|
+
method: 'custom_metadata_fields.delete',
|
|
199
|
+
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)',
|
|
200
|
+
},
|
|
201
|
+
ruby: {
|
|
202
|
+
method: 'custom_metadata_fields.delete',
|
|
203
|
+
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)',
|
|
204
|
+
},
|
|
205
|
+
typescript: {
|
|
206
|
+
method: 'client.customMetadataFields.delete',
|
|
207
|
+
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);",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'upload',
|
|
213
|
+
endpoint: '/api/v1/files/upload',
|
|
214
|
+
httpMethod: 'post',
|
|
215
|
+
summary: 'Upload file V1',
|
|
216
|
+
description: 'ImageKit.io allows you to upload files directly from both the server and client sides. For server-side uploads, private API key authentication is used. For client-side uploads, generate a one-time `token`, `signature`, and `expire` from your secure backend using private API. [Learn more](/docs/api-reference/upload-file/upload-file#how-to-implement-client-side-file-upload) about how to implement client-side file upload.\n\nThe [V2 API](/docs/api-reference/upload-file/upload-file-v2) enhances security by verifying the entire payload using JWT.\n\n**File size limit** \\\nOn the free plan, the maximum upload file sizes are 25MB for images, audio, and raw files and 100MB for videos. On the Lite paid plan, these limits increase to 40MB for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan, these limits increase to 50MB for images, audio, and raw files and 2GB for videos. These limits can be further increased with enterprise plans.\n\n**Version limit** \\\nA file can have a maximum of 100 versions.\n\n**Demo applications**\n\n- A full-fledged [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), supporting file selections from local storage, URL, Dropbox, Google Drive, Instagram, and more.\n- [Quick start guides](/docs/quick-start-guides) for various frameworks and technologies.\n',
|
|
217
|
+
stainlessPath: '(resource) files > (method) upload',
|
|
218
|
+
qualified: 'client.files.upload',
|
|
219
|
+
params: [
|
|
220
|
+
'file: string;',
|
|
221
|
+
'fileName: string;',
|
|
222
|
+
'token?: string;',
|
|
223
|
+
'checks?: string;',
|
|
224
|
+
'customCoordinates?: string;',
|
|
225
|
+
'customMetadata?: object;',
|
|
226
|
+
'description?: string;',
|
|
227
|
+
'expire?: number;',
|
|
228
|
+
"extensions?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; } | { id: string; name: 'saved-extension'; }[];",
|
|
229
|
+
'folder?: string;',
|
|
230
|
+
'isPrivateFile?: boolean;',
|
|
231
|
+
'isPublished?: boolean;',
|
|
232
|
+
'overwriteAITags?: boolean;',
|
|
233
|
+
'overwriteCustomMetadata?: boolean;',
|
|
234
|
+
'overwriteFile?: boolean;',
|
|
235
|
+
'overwriteTags?: boolean;',
|
|
236
|
+
'publicKey?: string;',
|
|
237
|
+
'responseFields?: string[];',
|
|
238
|
+
'signature?: string;',
|
|
239
|
+
'tags?: string[];',
|
|
240
|
+
"transformation?: { post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]; pre?: string; };",
|
|
241
|
+
'useUniqueFileName?: boolean;',
|
|
242
|
+
'webhookUrl?: string;',
|
|
243
|
+
],
|
|
244
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; extensionStatus?: { ai-auto-description?: 'success' | 'pending' | 'failed'; ai-tasks?: 'success' | 'pending' | 'failed'; aws-auto-tagging?: 'success' | 'pending' | 'failed'; google-auto-tagging?: 'success' | 'pending' | 'failed'; remove-bg?: 'success' | 'pending' | 'failed'; }; fileId?: string; filePath?: string; fileType?: string; height?: number; isPrivateFile?: boolean; isPublished?: boolean; metadata?: { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: object; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnailUrl?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }",
|
|
245
|
+
markdown: "## upload\n\n`client.files.upload(file: string, fileName: string, token?: string, checks?: string, customCoordinates?: string, customMetadata?: object, description?: string, expire?: number, extensions?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; } | { id: string; name: 'saved-extension'; }[], folder?: string, isPrivateFile?: boolean, isPublished?: boolean, overwriteAITags?: boolean, overwriteCustomMetadata?: boolean, overwriteFile?: boolean, overwriteTags?: boolean, publicKey?: string, responseFields?: string[], signature?: string, tags?: string[], transformation?: { post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]; pre?: string; }, useUniqueFileName?: boolean, webhookUrl?: string): { AITags?: object[]; audioCodec?: string; bitRate?: number; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; extensionStatus?: object; fileId?: string; filePath?: string; fileType?: string; height?: number; isPrivateFile?: boolean; isPublished?: boolean; metadata?: metadata; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnailUrl?: string; url?: string; versionInfo?: object; videoCodec?: string; width?: number; }`\n\n**post** `/api/v1/files/upload`\n\nImageKit.io allows you to upload files directly from both the server and client sides. For server-side uploads, private API key authentication is used. For client-side uploads, generate a one-time `token`, `signature`, and `expire` from your secure backend using private API. [Learn more](/docs/api-reference/upload-file/upload-file#how-to-implement-client-side-file-upload) about how to implement client-side file upload.\n\nThe [V2 API](/docs/api-reference/upload-file/upload-file-v2) enhances security by verifying the entire payload using JWT.\n\n**File size limit** \\\nOn the free plan, the maximum upload file sizes are 25MB for images, audio, and raw files and 100MB for videos. On the Lite paid plan, these limits increase to 40MB for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan, these limits increase to 50MB for images, audio, and raw files and 2GB for videos. These limits can be further increased with enterprise plans.\n\n**Version limit** \\\nA file can have a maximum of 100 versions.\n\n**Demo applications**\n\n- A full-fledged [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), supporting file selections from local storage, URL, Dropbox, Google Drive, Instagram, and more.\n- [Quick start guides](/docs/quick-start-guides) for various frameworks and technologies.\n\n\n### Parameters\n\n- `file: string`\n The API accepts any of the following:\n\n- **Binary data** – send the raw bytes as `multipart/form-data`.\n- **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can fetch.\n- **Base64 string** – the file encoded as a Base64 data URI or plain Base64.\n\nWhen supplying a URL, the server must receive the response headers within 8 seconds; otherwise the request fails with 400 Bad Request.\n\n\n- `fileName: string`\n The name with which the file has to be uploaded.\nThe file name can contain:\n\n - Alphanumeric Characters: `a-z`, `A-Z`, `0-9`.\n - Special Characters: `.`, `-`\n\nAny other character including space will be replaced by `_`\n\n\n- `token?: string`\n A unique value that the ImageKit.io server will use to recognize and prevent subsequent retries for the same request. We suggest using V4 UUIDs, or another random string with enough entropy to avoid collisions. This field is only required for authentication when uploading a file from the client side.\n\n**Note**: Sending a value that has been used in the past will result in a validation error. Even if your previous request resulted in an error, you should always send a new value for this field.\n\n\n- `checks?: string`\n Server-side checks to run on the asset.\nRead more about [Upload API checks](/docs/api-reference/upload-file/upload-file#upload-api-checks).\n\n\n- `customCoordinates?: string`\n Define an important area in the image. This is only relevant for image type files.\n\n - To be passed as a string with the x and y coordinates of the top-left corner, and width and height of the area of interest in the format `x,y,width,height`. For example - `10,10,100,100`\n - Can be used with fo-customtransformation.\n - If this field is not specified and the file is overwritten, then customCoordinates will be removed.\n\n\n- `customMetadata?: object`\n JSON key-value pairs to associate with the asset. Create the custom metadata fields before setting these values.\n\n\n- `description?: string`\n Optional text to describe the contents of the file.\n\n\n- `expire?: number`\n The time until your signature is valid. It must be a [Unix time](https://en.wikipedia.org/wiki/Unix_time) in less than 1 hour into the future. It should be in seconds. This field is only required for authentication when uploading a file from the client side.\n\n\n- `extensions?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; } | { id: string; name: 'saved-extension'; }[]`\n Array of extensions to be applied to the asset. Each extension can be configured with specific parameters based on the extension type.\n\n\n- `folder?: string`\n The folder path in which the image has to be uploaded. If the folder(s) didn't exist before, a new folder(s) is created.\n\nThe folder name can contain:\n\n - Alphanumeric Characters: `a-z` , `A-Z` , `0-9`\n - Special Characters: `/` , `_` , `-`\n\nUsing multiple `/` creates a nested folder.\n\n\n- `isPrivateFile?: boolean`\n Whether to mark the file as private or not.\n\nIf `true`, the file is marked as private and is accessible only using named transformation or signed URL.\n\n\n- `isPublished?: boolean`\n Whether to upload file as published or not.\n\nIf `false`, the file is marked as unpublished, which restricts access to the file only via the media library. Files in draft or unpublished state can only be publicly accessed after being published.\n\nThe option to upload in draft state is only available in custom enterprise pricing plans.\n\n\n- `overwriteAITags?: boolean`\n If set to `true` and a file already exists at the exact location, its AITags will be removed. Set `overwriteAITags` to `false` to preserve AITags.\n\n\n- `overwriteCustomMetadata?: boolean`\n If the request does not have `customMetadata`, and a file already exists at the exact location, existing customMetadata will be removed.\n\n\n- `overwriteFile?: boolean`\n If `false` and `useUniqueFileName` is also `false`, and a file already exists at the exact location, upload API will return an error immediately.\n\n\n- `overwriteTags?: boolean`\n If the request does not have `tags`, and a file already exists at the exact location, existing tags will be removed.\n\n\n- `publicKey?: string`\n Your ImageKit.io public key. This field is only required for authentication when uploading a file from the client side.\n\n\n- `responseFields?: string[]`\n Array of response field keys to include in the API response body.\n\n\n- `signature?: string`\n HMAC-SHA1 digest of the token+expire using your ImageKit.io private API key as a key. Learn how to create a signature on the page below. This should be in lowercase.\n\nSignature must be calculated on the server-side. This field is only required for authentication when uploading a file from the client side.\n\n\n- `tags?: string[]`\n Set the tags while uploading the file.\nProvide an array of tag strings (e.g. `[\"tag1\", \"tag2\", \"tag3\"]`). The combined length of all tag characters must not exceed 500, and the `%` character is not allowed.\nIf this field is not specified and the file is overwritten, the existing tags will be removed.\n\n\n- `transformation?: { post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]; pre?: string; }`\n Configure pre-processing (`pre`) and post-processing (`post`) transformations.\n\n- `pre` — applied before the file is uploaded to the Media Library. \n Useful for reducing file size or applying basic optimizations upfront (e.g., resize, compress).\n\n- `post` — applied immediately after upload. \n Ideal for generating transformed versions (like video encodes or thumbnails) in advance, so they're ready for delivery without delay.\n\nYou can mix and match any combination of post-processing types.\n\n - `post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]`\n List of transformations to apply *after* the file is uploaded. \nEach item must match one of the following types:\n`transformation`, `gif-to-video`, `thumbnail`, `abs`.\n\n - `pre?: string`\n Transformation string to apply before uploading the file to the Media Library. Useful for optimizing files at ingestion.\n\n\n- `useUniqueFileName?: boolean`\n Whether to use a unique filename for this file or not.\n\nIf `true`, ImageKit.io will add a unique suffix to the filename parameter to get a unique filename.\n\nIf `false`, then the image is uploaded with the provided filename parameter, and any existing file with the same name is replaced.\n\n\n- `webhookUrl?: string`\n The final status of extensions after they have completed execution will be delivered to this endpoint as a POST request. [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) about the webhook payload structure.\n\n\n### Returns\n\n- `{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; extensionStatus?: { ai-auto-description?: 'success' | 'pending' | 'failed'; ai-tasks?: 'success' | 'pending' | 'failed'; aws-auto-tagging?: 'success' | 'pending' | 'failed'; google-auto-tagging?: 'success' | 'pending' | 'failed'; remove-bg?: 'success' | 'pending' | 'failed'; }; fileId?: string; filePath?: string; fileType?: string; height?: number; isPrivateFile?: boolean; isPublished?: boolean; metadata?: { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: object; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnailUrl?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }`\n Object containing details of a successful upload.\n\n - `AITags?: { confidence?: number; name?: string; source?: string; }[]`\n - `audioCodec?: string`\n - `bitRate?: number`\n - `customCoordinates?: string`\n - `customMetadata?: object`\n - `description?: string`\n - `duration?: number`\n - `embeddedMetadata?: object`\n - `extensionStatus?: { ai-auto-description?: 'success' | 'pending' | 'failed'; ai-tasks?: 'success' | 'pending' | 'failed'; aws-auto-tagging?: 'success' | 'pending' | 'failed'; google-auto-tagging?: 'success' | 'pending' | 'failed'; remove-bg?: 'success' | 'pending' | 'failed'; }`\n - `fileId?: string`\n - `filePath?: string`\n - `fileType?: string`\n - `height?: number`\n - `isPrivateFile?: boolean`\n - `isPublished?: boolean`\n - `metadata?: { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: { exif?: { ApertureValue?: number; ColorSpace?: number; CreateDate?: string; CustomRendered?: number; DateTimeOriginal?: string; ExifImageHeight?: number; ExifImageWidth?: number; ExifVersion?: string; ExposureCompensation?: number; ExposureMode?: number; ExposureProgram?: number; ExposureTime?: number; Flash?: number; FlashpixVersion?: string; FNumber?: number; FocalLength?: number; FocalPlaneResolutionUnit?: number; FocalPlaneXResolution?: number; FocalPlaneYResolution?: number; InteropOffset?: number; ISO?: number; MeteringMode?: number; SceneCaptureType?: number; ShutterSpeedValue?: number; SubSecTime?: string; WhiteBalance?: number; }; gps?: { GPSVersionID?: number[]; }; image?: { ExifOffset?: number; GPSInfo?: number; Make?: string; Model?: string; ModifyDate?: string; Orientation?: number; ResolutionUnit?: number; Software?: string; XResolution?: number; YCbCrPositioning?: number; YResolution?: number; }; interoperability?: { InteropIndex?: string; InteropVersion?: string; }; makernote?: object; thumbnail?: { Compression?: number; ResolutionUnit?: number; ThumbnailLength?: number; ThumbnailOffset?: number; XResolution?: number; YResolution?: number; }; }; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }`\n - `name?: string`\n - `selectedFieldsSchema?: object`\n - `size?: number`\n - `tags?: string[]`\n - `thumbnailUrl?: string`\n - `url?: string`\n - `versionInfo?: { id?: string; name?: string; }`\n - `videoCodec?: string`\n - `width?: number`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'fileName' });\n\nconsole.log(response);\n```",
|
|
246
|
+
perLanguage: {
|
|
247
|
+
cli: {
|
|
248
|
+
method: 'files upload',
|
|
249
|
+
example: "imagekit files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name fileName",
|
|
250
|
+
},
|
|
251
|
+
csharp: {
|
|
252
|
+
method: 'Files.Upload',
|
|
253
|
+
example: 'FileUploadParams parameters = new()\n{\n File = Encoding.UTF8.GetBytes("Example data"),\n FileName = "fileName",\n};\n\nvar response = await client.Files.Upload(parameters);\n\nConsole.WriteLine(response);',
|
|
254
|
+
},
|
|
255
|
+
go: {
|
|
256
|
+
method: 'client.Files.Upload',
|
|
257
|
+
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',
|
|
258
|
+
},
|
|
259
|
+
http: {
|
|
260
|
+
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"}]}\'',
|
|
261
|
+
},
|
|
262
|
+
java: {
|
|
263
|
+
method: 'files().upload',
|
|
264
|
+
example: 'package com.imagekit.api.example;\n\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\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("Example data".getBytes()))\n .fileName("fileName")\n .build();\n FileUploadResponse response = client.files().upload(params);\n }\n}',
|
|
265
|
+
},
|
|
266
|
+
php: {
|
|
267
|
+
method: 'files->upload',
|
|
268
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->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);",
|
|
269
|
+
},
|
|
270
|
+
python: {
|
|
271
|
+
method: 'files.upload',
|
|
272
|
+
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)',
|
|
273
|
+
},
|
|
274
|
+
ruby: {
|
|
275
|
+
method: 'files.upload',
|
|
276
|
+
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)',
|
|
277
|
+
},
|
|
278
|
+
typescript: {
|
|
279
|
+
method: 'client.files.upload',
|
|
280
|
+
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);",
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'get',
|
|
286
|
+
endpoint: '/v1/files/{fileId}/details',
|
|
287
|
+
httpMethod: 'get',
|
|
288
|
+
summary: 'Get file details',
|
|
289
|
+
description: 'This API returns an object with details or attributes about the current version of the file.',
|
|
290
|
+
stainlessPath: '(resource) files > (method) get',
|
|
291
|
+
qualified: 'client.files.get',
|
|
292
|
+
params: ['fileId: string;'],
|
|
293
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }",
|
|
294
|
+
markdown: "## get\n\n`client.files.get(fileId: string): { AITags?: object[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: object; videoCodec?: string; width?: number; }`\n\n**get** `/v1/files/{fileId}/details`\n\nThis API returns an object with details or attributes about the current version of the file.\n\n### Parameters\n\n- `fileId: string`\n\n### Returns\n\n- `{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }`\n Object containing details of a file or file version.\n\n - `AITags?: { confidence?: number; name?: string; source?: string; }[]`\n - `audioCodec?: string`\n - `bitRate?: number`\n - `createdAt?: string`\n - `customCoordinates?: string`\n - `customMetadata?: object`\n - `description?: string`\n - `duration?: number`\n - `embeddedMetadata?: object`\n - `fileId?: string`\n - `filePath?: string`\n - `fileType?: string`\n - `hasAlpha?: boolean`\n - `height?: number`\n - `isPrivateFile?: boolean`\n - `isPublished?: boolean`\n - `mime?: string`\n - `name?: string`\n - `selectedFieldsSchema?: object`\n - `size?: number`\n - `tags?: string[]`\n - `thumbnail?: string`\n - `type?: 'file' | 'file-version'`\n - `updatedAt?: string`\n - `url?: string`\n - `versionInfo?: { id?: string; name?: string; }`\n - `videoCodec?: string`\n - `width?: number`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.get('fileId');\n\nconsole.log(file);\n```",
|
|
295
|
+
perLanguage: {
|
|
296
|
+
cli: {
|
|
297
|
+
method: 'files get',
|
|
298
|
+
example: "imagekit files get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId",
|
|
299
|
+
},
|
|
300
|
+
csharp: {
|
|
301
|
+
method: 'Files.Get',
|
|
302
|
+
example: 'FileGetParams parameters = new() { FileID = "fileId" };\n\nvar file = await client.Files.Get(parameters);\n\nConsole.WriteLine(file);',
|
|
303
|
+
},
|
|
304
|
+
go: {
|
|
305
|
+
method: 'client.Files.Get',
|
|
306
|
+
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',
|
|
307
|
+
},
|
|
308
|
+
http: {
|
|
309
|
+
example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/details \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
310
|
+
},
|
|
311
|
+
java: {
|
|
312
|
+
method: 'files().get',
|
|
313
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.File;\nimport com.imagekit.api.models.files.FileGetParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n File file = client.files().get("fileId");\n }\n}',
|
|
314
|
+
},
|
|
315
|
+
php: {
|
|
316
|
+
method: 'files->get',
|
|
317
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$file = $client->files->get('fileId');\n\nvar_dump($file);",
|
|
318
|
+
},
|
|
319
|
+
python: {
|
|
320
|
+
method: 'files.get',
|
|
321
|
+
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)',
|
|
322
|
+
},
|
|
323
|
+
ruby: {
|
|
324
|
+
method: 'files.get',
|
|
325
|
+
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)',
|
|
326
|
+
},
|
|
327
|
+
typescript: {
|
|
328
|
+
method: 'client.files.get',
|
|
329
|
+
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);",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
name: 'update',
|
|
335
|
+
endpoint: '/v1/files/{fileId}/details',
|
|
336
|
+
httpMethod: 'patch',
|
|
337
|
+
summary: 'Update file details',
|
|
338
|
+
description: 'This API updates the details or attributes of the current version of the file. You can update `tags`, `customCoordinates`, `customMetadata`, publication status, remove existing `AITags` and apply extensions using this API.\n',
|
|
339
|
+
stainlessPath: '(resource) files > (method) update',
|
|
340
|
+
qualified: 'client.files.update',
|
|
341
|
+
params: [
|
|
342
|
+
'fileId: string;',
|
|
343
|
+
"UpdateFileRequest: { customCoordinates?: string; customMetadata?: object; description?: string; extensions?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; } | { id: string; name: 'saved-extension'; }[]; removeAITags?: string[] | 'all'; tags?: string[]; webhookUrl?: string; } | { publish?: { isPublished: boolean; includeFileVersions?: boolean; }; };",
|
|
344
|
+
],
|
|
345
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }",
|
|
346
|
+
perLanguage: {
|
|
347
|
+
cli: {
|
|
348
|
+
method: 'files update',
|
|
349
|
+
example: "imagekit files update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId",
|
|
350
|
+
},
|
|
351
|
+
csharp: {
|
|
352
|
+
method: 'Files.Update',
|
|
353
|
+
example: 'FileUpdateParams parameters = new()\n{\n FileID = "fileId",\n UpdateFileRequest = new UpdateFileDetails()\n {\n CustomCoordinates = "10,10,100,100",\n CustomMetadata = new Dictionary<string, JsonElement>()\n {\n { "brand", JsonSerializer.SerializeToElement("bar") },\n { "color", JsonSerializer.SerializeToElement("bar") },\n },\n Description = "description",\n Extensions =\n [\n new RemoveBg()\n {\n Options = new()\n {\n AddShadow = true,\n BgColor = "bg_color",\n BgImageUrl = "bg_image_url",\n Semitransparency = true,\n },\n },\n new AutoTaggingExtension()\n {\n MaxTags = 10,\n MinConfidence = 80,\n Name = Name.GoogleAutoTagging,\n },\n new AutoTaggingExtension()\n {\n MaxTags = 10,\n MinConfidence = 80,\n Name = Name.AwsAutoTagging,\n },\n new AIAutoDescription(),\n new AITasks(\n\n [\n new SelectTags()\n {\n Instruction = "What types of clothing items are visible?",\n MaxSelections = 1,\n MinSelections = 0,\n Vocabulary =\n [\n "shirt", "dress", "jacket"\n ],\n },\n ]\n ),\n new SavedExtension("ext_abc123"),\n ],\n RemoveAITags = new(\n\n [\n "car", "vehicle", "motorsports"\n ]\n ),\n Tags =\n [\n "tag1", "tag2"\n ],\n WebhookUrl = "https://webhook.site/0d6b6c7a-8e5a-4b3a-8b7c-0d6b6c7a8e5a",\n },\n};\n\nvar file = await client.Files.Update(parameters);\n\nConsole.WriteLine(file);',
|
|
354
|
+
},
|
|
355
|
+
go: {
|
|
356
|
+
method: 'client.Files.Update',
|
|
357
|
+
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',
|
|
358
|
+
},
|
|
359
|
+
http: {
|
|
360
|
+
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 }\'',
|
|
361
|
+
},
|
|
362
|
+
java: {
|
|
363
|
+
method: 'files().update',
|
|
364
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileUpdateParams;\nimport com.imagekit.api.models.files.FileUpdateResponse;\nimport com.imagekit.api.models.files.UpdateFileRequest;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FileUpdateParams params = FileUpdateParams.builder()\n .fileId("fileId")\n .updateFileRequest(UpdateFileRequest.UpdateFileDetails.builder().build())\n .build();\n FileUpdateResponse file = client.files().update(params);\n }\n}',
|
|
365
|
+
},
|
|
366
|
+
php: {
|
|
367
|
+
method: 'files->update',
|
|
368
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$file = $client->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);",
|
|
369
|
+
},
|
|
370
|
+
python: {
|
|
371
|
+
method: 'files.update',
|
|
372
|
+
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)',
|
|
373
|
+
},
|
|
374
|
+
ruby: {
|
|
375
|
+
method: 'files.update',
|
|
376
|
+
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)',
|
|
377
|
+
},
|
|
378
|
+
typescript: {
|
|
379
|
+
method: 'client.files.update',
|
|
380
|
+
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);",
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: 'delete',
|
|
386
|
+
endpoint: '/v1/files/{fileId}',
|
|
387
|
+
httpMethod: 'delete',
|
|
388
|
+
summary: 'Delete file',
|
|
389
|
+
description: 'This API deletes the file and all its file versions permanently.\n\nNote: If a file or specific transformation has been requested in the past, then the response is cached. Deleting a file does not purge the cache. You can purge the cache using purge cache API.\n',
|
|
390
|
+
stainlessPath: '(resource) files > (method) delete',
|
|
391
|
+
qualified: 'client.files.delete',
|
|
392
|
+
params: ['fileId: string;'],
|
|
393
|
+
markdown: "## delete\n\n`client.files.delete(fileId: string): void`\n\n**delete** `/v1/files/{fileId}`\n\nThis API deletes the file and all its file versions permanently.\n\nNote: If a file or specific transformation has been requested in the past, then the response is cached. Deleting a file does not purge the cache. You can purge the cache using purge cache API.\n\n\n### Parameters\n\n- `fileId: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.files.delete('fileId')\n```",
|
|
394
|
+
perLanguage: {
|
|
395
|
+
cli: {
|
|
396
|
+
method: 'files delete',
|
|
397
|
+
example: "imagekit files delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId",
|
|
398
|
+
},
|
|
399
|
+
csharp: {
|
|
400
|
+
method: 'Files.Delete',
|
|
401
|
+
example: 'FileDeleteParams parameters = new() { FileID = "fileId" };\n\nawait client.Files.Delete(parameters);',
|
|
402
|
+
},
|
|
403
|
+
go: {
|
|
404
|
+
method: 'client.Files.Delete',
|
|
405
|
+
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',
|
|
406
|
+
},
|
|
407
|
+
http: {
|
|
408
|
+
example: 'curl https://api.imagekit.io/v1/files/$FILE_ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
409
|
+
},
|
|
410
|
+
java: {
|
|
411
|
+
method: 'files().delete',
|
|
412
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileDeleteParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n client.files().delete("fileId");\n }\n}',
|
|
413
|
+
},
|
|
414
|
+
php: {
|
|
415
|
+
method: 'files->delete',
|
|
416
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$result = $client->files->delete('fileId');\n\nvar_dump($result);",
|
|
417
|
+
},
|
|
418
|
+
python: {
|
|
419
|
+
method: 'files.delete',
|
|
420
|
+
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)',
|
|
421
|
+
},
|
|
422
|
+
ruby: {
|
|
423
|
+
method: 'files.delete',
|
|
424
|
+
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)',
|
|
425
|
+
},
|
|
426
|
+
typescript: {
|
|
427
|
+
method: 'client.files.delete',
|
|
428
|
+
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');",
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
name: 'copy',
|
|
434
|
+
endpoint: '/v1/files/copy',
|
|
435
|
+
httpMethod: 'post',
|
|
436
|
+
summary: 'Copy file',
|
|
437
|
+
description: 'This will copy a file from one folder to another. \n\nNote: If any file at the destination has the same name as the source file, then the source file and its versions (if `includeFileVersions` is set to true) will be appended to the destination file version history.\n',
|
|
438
|
+
stainlessPath: '(resource) files > (method) copy',
|
|
439
|
+
qualified: 'client.files.copy',
|
|
440
|
+
params: ['destinationPath: string;', 'sourceFilePath: string;', 'includeFileVersions?: boolean;'],
|
|
441
|
+
response: '{ }',
|
|
442
|
+
markdown: "## copy\n\n`client.files.copy(destinationPath: string, sourceFilePath: string, includeFileVersions?: boolean): { }`\n\n**post** `/v1/files/copy`\n\nThis will copy a file from one folder to another. \n\nNote: If any file at the destination has the same name as the source file, then the source file and its versions (if `includeFileVersions` is set to true) will be appended to the destination file version history.\n\n\n### Parameters\n\n- `destinationPath: string`\n Full path to the folder you want to copy the above file into.\n\n\n- `sourceFilePath: string`\n The full path of the file you want to copy.\n\n\n- `includeFileVersions?: boolean`\n Option to copy all versions of a file. By default, only the current version of the file is copied. When set to true, all versions of the file will be copied. Default value - `false`.\n\n\n### Returns\n\n- `{ }`\n\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.copy({ destinationPath: '/folder/to/copy/into/', sourceFilePath: '/path/to/file.jpg' });\n\nconsole.log(response);\n```",
|
|
443
|
+
perLanguage: {
|
|
444
|
+
cli: {
|
|
445
|
+
method: 'files copy',
|
|
446
|
+
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",
|
|
447
|
+
},
|
|
448
|
+
csharp: {
|
|
449
|
+
method: 'Files.Copy',
|
|
450
|
+
example: 'FileCopyParams parameters = new()\n{\n DestinationPath = "/folder/to/copy/into/",\n SourceFilePath = "/path/to/file.jpg",\n};\n\nvar response = await client.Files.Copy(parameters);\n\nConsole.WriteLine(response);',
|
|
451
|
+
},
|
|
452
|
+
go: {
|
|
453
|
+
method: 'client.Files.Copy',
|
|
454
|
+
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',
|
|
455
|
+
},
|
|
456
|
+
http: {
|
|
457
|
+
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 }\'',
|
|
458
|
+
},
|
|
459
|
+
java: {
|
|
460
|
+
method: 'files().copy',
|
|
461
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileCopyParams;\nimport com.imagekit.api.models.files.FileCopyResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FileCopyParams params = FileCopyParams.builder()\n .destinationPath("/folder/to/copy/into/")\n .sourceFilePath("/path/to/file.jpg")\n .build();\n FileCopyResponse response = client.files().copy(params);\n }\n}',
|
|
462
|
+
},
|
|
463
|
+
php: {
|
|
464
|
+
method: 'files->copy',
|
|
465
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->files->copy(\n destinationPath: '/folder/to/copy/into/',\n sourceFilePath: '/path/to/file.jpg',\n includeFileVersions: false,\n);\n\nvar_dump($response);",
|
|
466
|
+
},
|
|
467
|
+
python: {
|
|
468
|
+
method: 'files.copy',
|
|
469
|
+
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)',
|
|
470
|
+
},
|
|
471
|
+
ruby: {
|
|
472
|
+
method: 'files.copy',
|
|
473
|
+
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)',
|
|
474
|
+
},
|
|
475
|
+
typescript: {
|
|
476
|
+
method: 'client.files.copy',
|
|
477
|
+
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);",
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
name: 'move',
|
|
483
|
+
endpoint: '/v1/files/move',
|
|
484
|
+
httpMethod: 'post',
|
|
485
|
+
summary: 'Move file',
|
|
486
|
+
description: 'This will move a file and all its versions from one folder to another. \n\nNote: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file.\n',
|
|
487
|
+
stainlessPath: '(resource) files > (method) move',
|
|
488
|
+
qualified: 'client.files.move',
|
|
489
|
+
params: ['destinationPath: string;', 'sourceFilePath: string;'],
|
|
490
|
+
response: '{ }',
|
|
491
|
+
markdown: "## move\n\n`client.files.move(destinationPath: string, sourceFilePath: string): { }`\n\n**post** `/v1/files/move`\n\nThis will move a file and all its versions from one folder to another. \n\nNote: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file.\n\n\n### Parameters\n\n- `destinationPath: string`\n Full path to the folder you want to move the above file into.\n\n\n- `sourceFilePath: string`\n The full path of the file you want to move.\n\n\n### Returns\n\n- `{ }`\n\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.move({ destinationPath: '/folder/to/move/into/', sourceFilePath: '/path/to/file.jpg' });\n\nconsole.log(response);\n```",
|
|
492
|
+
perLanguage: {
|
|
493
|
+
cli: {
|
|
494
|
+
method: 'files move',
|
|
495
|
+
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",
|
|
496
|
+
},
|
|
497
|
+
csharp: {
|
|
498
|
+
method: 'Files.Move',
|
|
499
|
+
example: 'FileMoveParams parameters = new()\n{\n DestinationPath = "/folder/to/move/into/",\n SourceFilePath = "/path/to/file.jpg",\n};\n\nvar response = await client.Files.Move(parameters);\n\nConsole.WriteLine(response);',
|
|
500
|
+
},
|
|
501
|
+
go: {
|
|
502
|
+
method: 'client.Files.Move',
|
|
503
|
+
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',
|
|
504
|
+
},
|
|
505
|
+
http: {
|
|
506
|
+
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 }\'',
|
|
507
|
+
},
|
|
508
|
+
java: {
|
|
509
|
+
method: 'files().move',
|
|
510
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileMoveParams;\nimport com.imagekit.api.models.files.FileMoveResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FileMoveParams params = FileMoveParams.builder()\n .destinationPath("/folder/to/move/into/")\n .sourceFilePath("/path/to/file.jpg")\n .build();\n FileMoveResponse response = client.files().move(params);\n }\n}',
|
|
511
|
+
},
|
|
512
|
+
php: {
|
|
513
|
+
method: 'files->move',
|
|
514
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->files->move(\n destinationPath: '/folder/to/move/into/', sourceFilePath: '/path/to/file.jpg'\n);\n\nvar_dump($response);",
|
|
515
|
+
},
|
|
516
|
+
python: {
|
|
517
|
+
method: 'files.move',
|
|
518
|
+
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)',
|
|
519
|
+
},
|
|
520
|
+
ruby: {
|
|
521
|
+
method: 'files.move',
|
|
522
|
+
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)',
|
|
523
|
+
},
|
|
524
|
+
typescript: {
|
|
525
|
+
method: 'client.files.move',
|
|
526
|
+
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);",
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
name: 'rename',
|
|
532
|
+
endpoint: '/v1/files/rename',
|
|
533
|
+
httpMethod: 'put',
|
|
534
|
+
summary: 'Rename file',
|
|
535
|
+
description: 'You can rename an already existing file in the media library using rename file API. This operation would rename all file versions of the file. \n\nNote: The old URLs will stop working. The file/file version URLs cached on CDN will continue to work unless a purge is requested.\n',
|
|
536
|
+
stainlessPath: '(resource) files > (method) rename',
|
|
537
|
+
qualified: 'client.files.rename',
|
|
538
|
+
params: ['filePath: string;', 'newFileName: string;', 'purgeCache?: boolean;'],
|
|
539
|
+
response: '{ purgeRequestId?: string; }',
|
|
540
|
+
markdown: "## rename\n\n`client.files.rename(filePath: string, newFileName: string, purgeCache?: boolean): { purgeRequestId?: string; }`\n\n**put** `/v1/files/rename`\n\nYou can rename an already existing file in the media library using rename file API. This operation would rename all file versions of the file. \n\nNote: The old URLs will stop working. The file/file version URLs cached on CDN will continue to work unless a purge is requested.\n\n\n### Parameters\n\n- `filePath: string`\n The full path of the file you want to rename.\n\n\n- `newFileName: string`\n The new name of the file. A filename can contain:\n\nAlphanumeric Characters: `a-z`, `A-Z`, `0-9` (including Unicode letters, marks, and numerals in other languages).\nSpecial Characters: `.`, `_`, and `-`.\n\nAny other character, including space, will be replaced by `_`.\n\n\n- `purgeCache?: boolean`\n Option to purge cache for the old file and its versions' URLs.\n\nWhen set to true, it will internally issue a purge cache request on CDN to remove cached content of old file and its versions. This purge request is counted against your monthly purge quota.\n\nNote: If the old file were accessible at `https://ik.imagekit.io/demo/old-filename.jpg`, a purge cache request would be issued against `https://ik.imagekit.io/demo/old-filename.jpg*` (with a wildcard at the end). It will remove the file and its versions' URLs and any transformations made using query parameters on this file or its versions. However, the cache for file transformations made using path parameters will persist. You can purge them using the purge API. For more details, refer to the purge API documentation.\n\n\n\nDefault value - `false`\n\n\n### Returns\n\n- `{ purgeRequestId?: string; }`\n\n - `purgeRequestId?: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.rename({ filePath: '/path/to/file.jpg', newFileName: 'newFileName.jpg' });\n\nconsole.log(response);\n```",
|
|
541
|
+
perLanguage: {
|
|
542
|
+
cli: {
|
|
543
|
+
method: 'files rename',
|
|
544
|
+
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",
|
|
545
|
+
},
|
|
546
|
+
csharp: {
|
|
547
|
+
method: 'Files.Rename',
|
|
548
|
+
example: 'FileRenameParams parameters = new()\n{\n FilePath = "/path/to/file.jpg",\n NewFileName = "newFileName.jpg",\n};\n\nvar response = await client.Files.Rename(parameters);\n\nConsole.WriteLine(response);',
|
|
549
|
+
},
|
|
550
|
+
go: {
|
|
551
|
+
method: 'client.Files.Rename',
|
|
552
|
+
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',
|
|
553
|
+
},
|
|
554
|
+
http: {
|
|
555
|
+
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 }\'',
|
|
556
|
+
},
|
|
557
|
+
java: {
|
|
558
|
+
method: 'files().rename',
|
|
559
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.FileRenameParams;\nimport com.imagekit.api.models.files.FileRenameResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FileRenameParams params = FileRenameParams.builder()\n .filePath("/path/to/file.jpg")\n .newFileName("newFileName.jpg")\n .build();\n FileRenameResponse response = client.files().rename(params);\n }\n}',
|
|
560
|
+
},
|
|
561
|
+
php: {
|
|
562
|
+
method: 'files->rename',
|
|
563
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->files->rename(\n filePath: '/path/to/file.jpg',\n newFileName: 'newFileName.jpg',\n purgeCache: true,\n);\n\nvar_dump($response);",
|
|
564
|
+
},
|
|
565
|
+
python: {
|
|
566
|
+
method: 'files.rename',
|
|
567
|
+
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)',
|
|
568
|
+
},
|
|
569
|
+
ruby: {
|
|
570
|
+
method: 'files.rename',
|
|
571
|
+
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)',
|
|
572
|
+
},
|
|
573
|
+
typescript: {
|
|
574
|
+
method: 'client.files.rename',
|
|
575
|
+
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);",
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
name: 'delete',
|
|
581
|
+
endpoint: '/v1/files/batch/deleteByFileIds',
|
|
582
|
+
httpMethod: 'post',
|
|
583
|
+
summary: 'Delete multiple files',
|
|
584
|
+
description: 'This API deletes multiple files and all their file versions permanently.\n\nNote: If a file or specific transformation has been requested in the past, then the response is cached. Deleting a file does not purge the cache. You can purge the cache using purge cache API.\n\nA maximum of 100 files can be deleted at a time.\n',
|
|
585
|
+
stainlessPath: '(resource) files.bulk > (method) delete',
|
|
586
|
+
qualified: 'client.files.bulk.delete',
|
|
587
|
+
params: ['fileIds: string[];'],
|
|
588
|
+
response: '{ successfullyDeletedFileIds?: string[]; }',
|
|
589
|
+
markdown: "## delete\n\n`client.files.bulk.delete(fileIds: string[]): { successfullyDeletedFileIds?: string[]; }`\n\n**post** `/v1/files/batch/deleteByFileIds`\n\nThis API deletes multiple files and all their file versions permanently.\n\nNote: If a file or specific transformation has been requested in the past, then the response is cached. Deleting a file does not purge the cache. You can purge the cache using purge cache API.\n\nA maximum of 100 files can be deleted at a time.\n\n\n### Parameters\n\n- `fileIds: string[]`\n An array of fileIds which you want to delete.\n\n\n### Returns\n\n- `{ successfullyDeletedFileIds?: string[]; }`\n\n - `successfullyDeletedFileIds?: string[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst bulk = await client.files.bulk.delete({ fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'] });\n\nconsole.log(bulk);\n```",
|
|
590
|
+
perLanguage: {
|
|
591
|
+
cli: {
|
|
592
|
+
method: 'bulk delete',
|
|
593
|
+
example: "imagekit files:bulk delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id 598821f949c0a938d57563bd \\\n --file-id 598821f949c0a938d57563be",
|
|
594
|
+
},
|
|
595
|
+
csharp: {
|
|
596
|
+
method: 'Files.Bulk.Delete',
|
|
597
|
+
example: 'BulkDeleteParams parameters = new()\n{\n FileIds =\n [\n "598821f949c0a938d57563bd", "598821f949c0a938d57563be"\n ],\n};\n\nvar bulk = await client.Files.Bulk.Delete(parameters);\n\nConsole.WriteLine(bulk);',
|
|
598
|
+
},
|
|
599
|
+
go: {
|
|
600
|
+
method: 'client.Files.Bulk.Delete',
|
|
601
|
+
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',
|
|
602
|
+
},
|
|
603
|
+
http: {
|
|
604
|
+
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 }\'',
|
|
605
|
+
},
|
|
606
|
+
java: {
|
|
607
|
+
method: 'files().bulk().delete',
|
|
608
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.bulk.BulkDeleteParams;\nimport com.imagekit.api.models.files.bulk.BulkDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n BulkDeleteParams params = BulkDeleteParams.builder()\n .addFileId("598821f949c0a938d57563bd")\n .addFileId("598821f949c0a938d57563be")\n .build();\n BulkDeleteResponse bulk = client.files().bulk().delete(params);\n }\n}',
|
|
609
|
+
},
|
|
610
|
+
php: {
|
|
611
|
+
method: 'files->bulk->delete',
|
|
612
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$bulk = $client->files->bulk->delete(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be']\n);\n\nvar_dump($bulk);",
|
|
613
|
+
},
|
|
614
|
+
python: {
|
|
615
|
+
method: 'files.bulk.delete',
|
|
616
|
+
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)',
|
|
617
|
+
},
|
|
618
|
+
ruby: {
|
|
619
|
+
method: 'files.bulk.delete',
|
|
620
|
+
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)',
|
|
621
|
+
},
|
|
622
|
+
typescript: {
|
|
623
|
+
method: 'client.files.bulk.delete',
|
|
624
|
+
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);",
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: 'addTags',
|
|
630
|
+
endpoint: '/v1/files/addTags',
|
|
631
|
+
httpMethod: 'post',
|
|
632
|
+
summary: 'Add tags (bulk)',
|
|
633
|
+
description: 'This API adds tags to multiple files in bulk. A maximum of 50 files can be specified at a time.\n',
|
|
634
|
+
stainlessPath: '(resource) files.bulk > (method) addTags',
|
|
635
|
+
qualified: 'client.files.bulk.addTags',
|
|
636
|
+
params: ['fileIds: string[];', 'tags: string[];'],
|
|
637
|
+
response: '{ successfullyUpdatedFileIds?: string[]; }',
|
|
638
|
+
markdown: "## addTags\n\n`client.files.bulk.addTags(fileIds: string[], tags: string[]): { successfullyUpdatedFileIds?: string[]; }`\n\n**post** `/v1/files/addTags`\n\nThis API adds tags to multiple files in bulk. A maximum of 50 files can be specified at a time.\n\n\n### Parameters\n\n- `fileIds: string[]`\n An array of fileIds to which you want to add tags.\n\n\n- `tags: string[]`\n An array of tags that you want to add to the files.\n\n\n### Returns\n\n- `{ successfullyUpdatedFileIds?: string[]; }`\n\n - `successfullyUpdatedFileIds?: string[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.addTags({ fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'], tags: ['t-shirt', 'round-neck', 'sale2019'] });\n\nconsole.log(response);\n```",
|
|
639
|
+
perLanguage: {
|
|
640
|
+
cli: {
|
|
641
|
+
method: 'bulk addTags',
|
|
642
|
+
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",
|
|
643
|
+
},
|
|
644
|
+
csharp: {
|
|
645
|
+
method: 'Files.Bulk.AddTags',
|
|
646
|
+
example: 'BulkAddTagsParams parameters = new()\n{\n FileIds =\n [\n "598821f949c0a938d57563bd", "598821f949c0a938d57563be"\n ],\n Tags =\n [\n "t-shirt", "round-neck", "sale2019"\n ],\n};\n\nvar response = await client.Files.Bulk.AddTags(parameters);\n\nConsole.WriteLine(response);',
|
|
647
|
+
},
|
|
648
|
+
go: {
|
|
649
|
+
method: 'client.Files.Bulk.AddTags',
|
|
650
|
+
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',
|
|
651
|
+
},
|
|
652
|
+
http: {
|
|
653
|
+
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 }\'',
|
|
654
|
+
},
|
|
655
|
+
java: {
|
|
656
|
+
method: 'files().bulk().addTags',
|
|
657
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.bulk.BulkAddTagsParams;\nimport com.imagekit.api.models.files.bulk.BulkAddTagsResponse;\nimport java.util.List;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n BulkAddTagsParams params = BulkAddTagsParams.builder()\n .addFileId("598821f949c0a938d57563bd")\n .addFileId("598821f949c0a938d57563be")\n .tags(List.of(\n "t-shirt",\n "round-neck",\n "sale2019"\n ))\n .build();\n BulkAddTagsResponse response = client.files().bulk().addTags(params);\n }\n}',
|
|
658
|
+
},
|
|
659
|
+
php: {
|
|
660
|
+
method: 'files->bulk->addTags',
|
|
661
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->files->bulk->addTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);",
|
|
662
|
+
},
|
|
663
|
+
python: {
|
|
664
|
+
method: 'files.bulk.add_tags',
|
|
665
|
+
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)',
|
|
666
|
+
},
|
|
667
|
+
ruby: {
|
|
668
|
+
method: 'files.bulk.add_tags',
|
|
669
|
+
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)',
|
|
670
|
+
},
|
|
671
|
+
typescript: {
|
|
672
|
+
method: 'client.files.bulk.addTags',
|
|
673
|
+
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);",
|
|
674
|
+
},
|
|
675
|
+
},
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: 'removeTags',
|
|
679
|
+
endpoint: '/v1/files/removeTags',
|
|
680
|
+
httpMethod: 'post',
|
|
681
|
+
summary: 'Remove tags (bulk)',
|
|
682
|
+
description: 'This API removes tags from multiple files in bulk. A maximum of 50 files can be specified at a time.\n',
|
|
683
|
+
stainlessPath: '(resource) files.bulk > (method) removeTags',
|
|
684
|
+
qualified: 'client.files.bulk.removeTags',
|
|
685
|
+
params: ['fileIds: string[];', 'tags: string[];'],
|
|
686
|
+
response: '{ successfullyUpdatedFileIds?: string[]; }',
|
|
687
|
+
markdown: "## removeTags\n\n`client.files.bulk.removeTags(fileIds: string[], tags: string[]): { successfullyUpdatedFileIds?: string[]; }`\n\n**post** `/v1/files/removeTags`\n\nThis API removes tags from multiple files in bulk. A maximum of 50 files can be specified at a time.\n\n\n### Parameters\n\n- `fileIds: string[]`\n An array of fileIds from which you want to remove tags.\n\n\n- `tags: string[]`\n An array of tags that you want to remove from the files.\n\n\n### Returns\n\n- `{ successfullyUpdatedFileIds?: string[]; }`\n\n - `successfullyUpdatedFileIds?: string[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.removeTags({ fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'], tags: ['t-shirt', 'round-neck', 'sale2019'] });\n\nconsole.log(response);\n```",
|
|
688
|
+
perLanguage: {
|
|
689
|
+
cli: {
|
|
690
|
+
method: 'bulk removeTags',
|
|
691
|
+
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",
|
|
692
|
+
},
|
|
693
|
+
csharp: {
|
|
694
|
+
method: 'Files.Bulk.RemoveTags',
|
|
695
|
+
example: 'BulkRemoveTagsParams parameters = new()\n{\n FileIds =\n [\n "598821f949c0a938d57563bd", "598821f949c0a938d57563be"\n ],\n Tags =\n [\n "t-shirt", "round-neck", "sale2019"\n ],\n};\n\nvar response = await client.Files.Bulk.RemoveTags(parameters);\n\nConsole.WriteLine(response);',
|
|
696
|
+
},
|
|
697
|
+
go: {
|
|
698
|
+
method: 'client.Files.Bulk.RemoveTags',
|
|
699
|
+
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',
|
|
700
|
+
},
|
|
701
|
+
http: {
|
|
702
|
+
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 }\'',
|
|
703
|
+
},
|
|
704
|
+
java: {
|
|
705
|
+
method: 'files().bulk().removeTags',
|
|
706
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.bulk.BulkRemoveTagsParams;\nimport com.imagekit.api.models.files.bulk.BulkRemoveTagsResponse;\nimport java.util.List;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n BulkRemoveTagsParams params = BulkRemoveTagsParams.builder()\n .addFileId("598821f949c0a938d57563bd")\n .addFileId("598821f949c0a938d57563be")\n .tags(List.of(\n "t-shirt",\n "round-neck",\n "sale2019"\n ))\n .build();\n BulkRemoveTagsResponse response = client.files().bulk().removeTags(params);\n }\n}',
|
|
707
|
+
},
|
|
708
|
+
php: {
|
|
709
|
+
method: 'files->bulk->removeTags',
|
|
710
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->files->bulk->removeTags(\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n tags: ['t-shirt', 'round-neck', 'sale2019'],\n);\n\nvar_dump($response);",
|
|
711
|
+
},
|
|
712
|
+
python: {
|
|
713
|
+
method: 'files.bulk.remove_tags',
|
|
714
|
+
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)',
|
|
715
|
+
},
|
|
716
|
+
ruby: {
|
|
717
|
+
method: 'files.bulk.remove_tags',
|
|
718
|
+
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)',
|
|
719
|
+
},
|
|
720
|
+
typescript: {
|
|
721
|
+
method: 'client.files.bulk.removeTags',
|
|
722
|
+
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);",
|
|
723
|
+
},
|
|
724
|
+
},
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
name: 'removeAiTags',
|
|
728
|
+
endpoint: '/v1/files/removeAITags',
|
|
729
|
+
httpMethod: 'post',
|
|
730
|
+
summary: 'Remove AI tags (bulk)',
|
|
731
|
+
description: 'This API removes AITags from multiple files in bulk. A maximum of 50 files can be specified at a time.\n',
|
|
732
|
+
stainlessPath: '(resource) files.bulk > (method) removeAiTags',
|
|
733
|
+
qualified: 'client.files.bulk.removeAITags',
|
|
734
|
+
params: ['AITags: string[];', 'fileIds: string[];'],
|
|
735
|
+
response: '{ successfullyUpdatedFileIds?: string[]; }',
|
|
736
|
+
markdown: "## removeAiTags\n\n`client.files.bulk.removeAITags(AITags: string[], fileIds: string[]): { successfullyUpdatedFileIds?: string[]; }`\n\n**post** `/v1/files/removeAITags`\n\nThis API removes AITags from multiple files in bulk. A maximum of 50 files can be specified at a time.\n\n\n### Parameters\n\n- `AITags: string[]`\n An array of AITags that you want to remove from the files.\n\n\n- `fileIds: string[]`\n An array of fileIds from which you want to remove AITags.\n\n\n### Returns\n\n- `{ successfullyUpdatedFileIds?: string[]; }`\n\n - `successfullyUpdatedFileIds?: string[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.files.bulk.removeAITags({ AITags: ['t-shirt', 'round-neck', 'sale2019'], fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'] });\n\nconsole.log(response);\n```",
|
|
737
|
+
perLanguage: {
|
|
738
|
+
cli: {
|
|
739
|
+
method: 'bulk removeAiTags',
|
|
740
|
+
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",
|
|
741
|
+
},
|
|
742
|
+
csharp: {
|
|
743
|
+
method: 'Files.Bulk.RemoveAITags',
|
|
744
|
+
example: 'BulkRemoveAITagsParams parameters = new()\n{\n AITags =\n [\n "t-shirt", "round-neck", "sale2019"\n ],\n FileIds =\n [\n "598821f949c0a938d57563bd", "598821f949c0a938d57563be"\n ],\n};\n\nvar response = await client.Files.Bulk.RemoveAITags(parameters);\n\nConsole.WriteLine(response);',
|
|
745
|
+
},
|
|
746
|
+
go: {
|
|
747
|
+
method: 'client.Files.Bulk.RemoveAITags',
|
|
748
|
+
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',
|
|
749
|
+
},
|
|
750
|
+
http: {
|
|
751
|
+
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 }\'',
|
|
752
|
+
},
|
|
753
|
+
java: {
|
|
754
|
+
method: 'files().bulk().removeAiTags',
|
|
755
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.bulk.BulkRemoveAiTagsParams;\nimport com.imagekit.api.models.files.bulk.BulkRemoveAiTagsResponse;\nimport java.util.List;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n BulkRemoveAiTagsParams params = BulkRemoveAiTagsParams.builder()\n .aiTags(List.of(\n "t-shirt",\n "round-neck",\n "sale2019"\n ))\n .addFileId("598821f949c0a938d57563bd")\n .addFileId("598821f949c0a938d57563be")\n .build();\n BulkRemoveAiTagsResponse response = client.files().bulk().removeAiTags(params);\n }\n}',
|
|
756
|
+
},
|
|
757
|
+
php: {
|
|
758
|
+
method: 'files->bulk->removeAITags',
|
|
759
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->files->bulk->removeAITags(\n aiTags: ['t-shirt', 'round-neck', 'sale2019'],\n fileIDs: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],\n);\n\nvar_dump($response);",
|
|
760
|
+
},
|
|
761
|
+
python: {
|
|
762
|
+
method: 'files.bulk.remove_ai_tags',
|
|
763
|
+
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)',
|
|
764
|
+
},
|
|
765
|
+
ruby: {
|
|
766
|
+
method: 'files.bulk.remove_ai_tags',
|
|
767
|
+
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)',
|
|
768
|
+
},
|
|
769
|
+
typescript: {
|
|
770
|
+
method: 'client.files.bulk.removeAITags',
|
|
771
|
+
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);",
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: 'list',
|
|
777
|
+
endpoint: '/v1/files/{fileId}/versions',
|
|
778
|
+
httpMethod: 'get',
|
|
779
|
+
summary: 'List file versions',
|
|
780
|
+
description: 'This API returns details of all versions of a file.\n',
|
|
781
|
+
stainlessPath: '(resource) files.versions > (method) list',
|
|
782
|
+
qualified: 'client.files.versions.list',
|
|
783
|
+
params: ['fileId: string;'],
|
|
784
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }[]",
|
|
785
|
+
markdown: "## list\n\n`client.files.versions.list(fileId: string): object[]`\n\n**get** `/v1/files/{fileId}/versions`\n\nThis API returns details of all versions of a file.\n\n\n### Parameters\n\n- `fileId: string`\n\n### Returns\n\n- `{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst files = await client.files.versions.list('fileId');\n\nconsole.log(files);\n```",
|
|
786
|
+
perLanguage: {
|
|
787
|
+
cli: {
|
|
788
|
+
method: 'versions list',
|
|
789
|
+
example: "imagekit files:versions list \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId",
|
|
790
|
+
},
|
|
791
|
+
csharp: {
|
|
792
|
+
method: 'Files.Versions.List',
|
|
793
|
+
example: 'VersionListParams parameters = new() { FileID = "fileId" };\n\nvar files = await client.Files.Versions.List(parameters);\n\nConsole.WriteLine(files);',
|
|
794
|
+
},
|
|
795
|
+
go: {
|
|
796
|
+
method: 'client.Files.Versions.List',
|
|
797
|
+
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',
|
|
798
|
+
},
|
|
799
|
+
http: {
|
|
800
|
+
example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
801
|
+
},
|
|
802
|
+
java: {
|
|
803
|
+
method: 'files().versions().list',
|
|
804
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.File;\nimport com.imagekit.api.models.files.versions.VersionListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n List<File> files = client.files().versions().list("fileId");\n }\n}',
|
|
805
|
+
},
|
|
806
|
+
php: {
|
|
807
|
+
method: 'files->versions->list',
|
|
808
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$files = $client->files->versions->list('fileId');\n\nvar_dump($files);",
|
|
809
|
+
},
|
|
810
|
+
python: {
|
|
811
|
+
method: 'files.versions.list',
|
|
812
|
+
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)',
|
|
813
|
+
},
|
|
814
|
+
ruby: {
|
|
815
|
+
method: 'files.versions.list',
|
|
816
|
+
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)',
|
|
817
|
+
},
|
|
818
|
+
typescript: {
|
|
819
|
+
method: 'client.files.versions.list',
|
|
820
|
+
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);",
|
|
821
|
+
},
|
|
822
|
+
},
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: 'get',
|
|
826
|
+
endpoint: '/v1/files/{fileId}/versions/{versionId}',
|
|
827
|
+
httpMethod: 'get',
|
|
828
|
+
summary: 'Get file version details',
|
|
829
|
+
description: 'This API returns an object with details or attributes of a file version.',
|
|
830
|
+
stainlessPath: '(resource) files.versions > (method) get',
|
|
831
|
+
qualified: 'client.files.versions.get',
|
|
832
|
+
params: ['fileId: string;', 'versionId: string;'],
|
|
833
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }",
|
|
834
|
+
markdown: "## get\n\n`client.files.versions.get(fileId: string, versionId: string): { AITags?: object[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: object; videoCodec?: string; width?: number; }`\n\n**get** `/v1/files/{fileId}/versions/{versionId}`\n\nThis API returns an object with details or attributes of a file version.\n\n### Parameters\n\n- `fileId: string`\n\n- `versionId: string`\n\n### Returns\n\n- `{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }`\n Object containing details of a file or file version.\n\n - `AITags?: { confidence?: number; name?: string; source?: string; }[]`\n - `audioCodec?: string`\n - `bitRate?: number`\n - `createdAt?: string`\n - `customCoordinates?: string`\n - `customMetadata?: object`\n - `description?: string`\n - `duration?: number`\n - `embeddedMetadata?: object`\n - `fileId?: string`\n - `filePath?: string`\n - `fileType?: string`\n - `hasAlpha?: boolean`\n - `height?: number`\n - `isPrivateFile?: boolean`\n - `isPublished?: boolean`\n - `mime?: string`\n - `name?: string`\n - `selectedFieldsSchema?: object`\n - `size?: number`\n - `tags?: string[]`\n - `thumbnail?: string`\n - `type?: 'file' | 'file-version'`\n - `updatedAt?: string`\n - `url?: string`\n - `versionInfo?: { id?: string; name?: string; }`\n - `videoCodec?: string`\n - `width?: number`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.versions.get('versionId', { fileId: 'fileId' });\n\nconsole.log(file);\n```",
|
|
835
|
+
perLanguage: {
|
|
836
|
+
cli: {
|
|
837
|
+
method: 'versions get',
|
|
838
|
+
example: "imagekit files:versions get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId",
|
|
839
|
+
},
|
|
840
|
+
csharp: {
|
|
841
|
+
method: 'Files.Versions.Get',
|
|
842
|
+
example: 'VersionGetParams parameters = new()\n{\n FileID = "fileId",\n VersionID = "versionId",\n};\n\nvar file = await client.Files.Versions.Get(parameters);\n\nConsole.WriteLine(file);',
|
|
843
|
+
},
|
|
844
|
+
go: {
|
|
845
|
+
method: 'client.Files.Versions.Get',
|
|
846
|
+
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',
|
|
847
|
+
},
|
|
848
|
+
http: {
|
|
849
|
+
example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/versions/$VERSION_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
850
|
+
},
|
|
851
|
+
java: {
|
|
852
|
+
method: 'files().versions().get',
|
|
853
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.File;\nimport com.imagekit.api.models.files.versions.VersionGetParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n VersionGetParams params = VersionGetParams.builder()\n .fileId("fileId")\n .versionId("versionId")\n .build();\n File file = client.files().versions().get(params);\n }\n}',
|
|
854
|
+
},
|
|
855
|
+
php: {
|
|
856
|
+
method: 'files->versions->get',
|
|
857
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$file = $client->files->versions->get('versionId', fileID: 'fileId');\n\nvar_dump($file);",
|
|
858
|
+
},
|
|
859
|
+
python: {
|
|
860
|
+
method: 'files.versions.get',
|
|
861
|
+
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)',
|
|
862
|
+
},
|
|
863
|
+
ruby: {
|
|
864
|
+
method: 'files.versions.get',
|
|
865
|
+
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)',
|
|
866
|
+
},
|
|
867
|
+
typescript: {
|
|
868
|
+
method: 'client.files.versions.get',
|
|
869
|
+
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);",
|
|
870
|
+
},
|
|
871
|
+
},
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
name: 'delete',
|
|
875
|
+
endpoint: '/v1/files/{fileId}/versions/{versionId}',
|
|
876
|
+
httpMethod: 'delete',
|
|
877
|
+
summary: 'Delete file version',
|
|
878
|
+
description: 'This API deletes a non-current file version permanently. The API returns an empty response.\n\nNote: If you want to delete all versions of a file, use the delete file API.\n',
|
|
879
|
+
stainlessPath: '(resource) files.versions > (method) delete',
|
|
880
|
+
qualified: 'client.files.versions.delete',
|
|
881
|
+
params: ['fileId: string;', 'versionId: string;'],
|
|
882
|
+
response: '{ }',
|
|
883
|
+
markdown: "## delete\n\n`client.files.versions.delete(fileId: string, versionId: string): { }`\n\n**delete** `/v1/files/{fileId}/versions/{versionId}`\n\nThis API deletes a non-current file version permanently. The API returns an empty response.\n\nNote: If you want to delete all versions of a file, use the delete file API.\n\n\n### Parameters\n\n- `fileId: string`\n\n- `versionId: string`\n\n### Returns\n\n- `{ }`\n\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst version = await client.files.versions.delete('versionId', { fileId: 'fileId' });\n\nconsole.log(version);\n```",
|
|
884
|
+
perLanguage: {
|
|
885
|
+
cli: {
|
|
886
|
+
method: 'versions delete',
|
|
887
|
+
example: "imagekit files:versions delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId",
|
|
888
|
+
},
|
|
889
|
+
csharp: {
|
|
890
|
+
method: 'Files.Versions.Delete',
|
|
891
|
+
example: 'VersionDeleteParams parameters = new()\n{\n FileID = "fileId",\n VersionID = "versionId",\n};\n\nvar version = await client.Files.Versions.Delete(parameters);\n\nConsole.WriteLine(version);',
|
|
892
|
+
},
|
|
893
|
+
go: {
|
|
894
|
+
method: 'client.Files.Versions.Delete',
|
|
895
|
+
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',
|
|
896
|
+
},
|
|
897
|
+
http: {
|
|
898
|
+
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"',
|
|
899
|
+
},
|
|
900
|
+
java: {
|
|
901
|
+
method: 'files().versions().delete',
|
|
902
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.versions.VersionDeleteParams;\nimport com.imagekit.api.models.files.versions.VersionDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n VersionDeleteParams params = VersionDeleteParams.builder()\n .fileId("fileId")\n .versionId("versionId")\n .build();\n VersionDeleteResponse version = client.files().versions().delete(params);\n }\n}',
|
|
903
|
+
},
|
|
904
|
+
php: {
|
|
905
|
+
method: 'files->versions->delete',
|
|
906
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$version = $client->files->versions->delete('versionId', fileID: 'fileId');\n\nvar_dump($version);",
|
|
907
|
+
},
|
|
908
|
+
python: {
|
|
909
|
+
method: 'files.versions.delete',
|
|
910
|
+
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)',
|
|
911
|
+
},
|
|
912
|
+
ruby: {
|
|
913
|
+
method: 'files.versions.delete',
|
|
914
|
+
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)',
|
|
915
|
+
},
|
|
916
|
+
typescript: {
|
|
917
|
+
method: 'client.files.versions.delete',
|
|
918
|
+
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);",
|
|
919
|
+
},
|
|
920
|
+
},
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: 'restore',
|
|
924
|
+
endpoint: '/v1/files/{fileId}/versions/{versionId}/restore',
|
|
925
|
+
httpMethod: 'put',
|
|
926
|
+
summary: 'Restore file version',
|
|
927
|
+
description: 'This API restores a file version as the current file version.\n',
|
|
928
|
+
stainlessPath: '(resource) files.versions > (method) restore',
|
|
929
|
+
qualified: 'client.files.versions.restore',
|
|
930
|
+
params: ['fileId: string;', 'versionId: string;'],
|
|
931
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }",
|
|
932
|
+
markdown: "## restore\n\n`client.files.versions.restore(fileId: string, versionId: string): { AITags?: object[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: object; videoCodec?: string; width?: number; }`\n\n**put** `/v1/files/{fileId}/versions/{versionId}/restore`\n\nThis API restores a file version as the current file version.\n\n\n### Parameters\n\n- `fileId: string`\n\n- `versionId: string`\n\n### Returns\n\n- `{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }`\n Object containing details of a file or file version.\n\n - `AITags?: { confidence?: number; name?: string; source?: string; }[]`\n - `audioCodec?: string`\n - `bitRate?: number`\n - `createdAt?: string`\n - `customCoordinates?: string`\n - `customMetadata?: object`\n - `description?: string`\n - `duration?: number`\n - `embeddedMetadata?: object`\n - `fileId?: string`\n - `filePath?: string`\n - `fileType?: string`\n - `hasAlpha?: boolean`\n - `height?: number`\n - `isPrivateFile?: boolean`\n - `isPublished?: boolean`\n - `mime?: string`\n - `name?: string`\n - `selectedFieldsSchema?: object`\n - `size?: number`\n - `tags?: string[]`\n - `thumbnail?: string`\n - `type?: 'file' | 'file-version'`\n - `updatedAt?: string`\n - `url?: string`\n - `versionInfo?: { id?: string; name?: string; }`\n - `videoCodec?: string`\n - `width?: number`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst file = await client.files.versions.restore('versionId', { fileId: 'fileId' });\n\nconsole.log(file);\n```",
|
|
933
|
+
perLanguage: {
|
|
934
|
+
cli: {
|
|
935
|
+
method: 'versions restore',
|
|
936
|
+
example: "imagekit files:versions restore \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId \\\n --version-id versionId",
|
|
937
|
+
},
|
|
938
|
+
csharp: {
|
|
939
|
+
method: 'Files.Versions.Restore',
|
|
940
|
+
example: 'VersionRestoreParams parameters = new()\n{\n FileID = "fileId",\n VersionID = "versionId",\n};\n\nvar file = await client.Files.Versions.Restore(parameters);\n\nConsole.WriteLine(file);',
|
|
941
|
+
},
|
|
942
|
+
go: {
|
|
943
|
+
method: 'client.Files.Versions.Restore',
|
|
944
|
+
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',
|
|
945
|
+
},
|
|
946
|
+
http: {
|
|
947
|
+
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"',
|
|
948
|
+
},
|
|
949
|
+
java: {
|
|
950
|
+
method: 'files().versions().restore',
|
|
951
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.File;\nimport com.imagekit.api.models.files.versions.VersionRestoreParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n VersionRestoreParams params = VersionRestoreParams.builder()\n .fileId("fileId")\n .versionId("versionId")\n .build();\n File file = client.files().versions().restore(params);\n }\n}',
|
|
952
|
+
},
|
|
953
|
+
php: {
|
|
954
|
+
method: 'files->versions->restore',
|
|
955
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$file = $client->files->versions->restore('versionId', fileID: 'fileId');\n\nvar_dump($file);",
|
|
956
|
+
},
|
|
957
|
+
python: {
|
|
958
|
+
method: 'files.versions.restore',
|
|
959
|
+
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)',
|
|
960
|
+
},
|
|
961
|
+
ruby: {
|
|
962
|
+
method: 'files.versions.restore',
|
|
963
|
+
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)',
|
|
964
|
+
},
|
|
965
|
+
typescript: {
|
|
966
|
+
method: 'client.files.versions.restore',
|
|
967
|
+
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);",
|
|
968
|
+
},
|
|
969
|
+
},
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
name: 'get',
|
|
973
|
+
endpoint: '/v1/files/{fileId}/metadata',
|
|
974
|
+
httpMethod: 'get',
|
|
975
|
+
summary: 'Get uploaded file metadata',
|
|
976
|
+
description: 'You can programmatically get image EXIF, pHash, and other metadata for uploaded files in the ImageKit.io media library using this API.\n\nYou can also get the metadata in upload API response by passing `metadata` in `responseFields` parameter.\n',
|
|
977
|
+
stainlessPath: '(resource) files.metadata > (method) get',
|
|
978
|
+
qualified: 'client.files.metadata.get',
|
|
979
|
+
params: ['fileId: string;'],
|
|
980
|
+
response: '{ audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: { exif?: object; gps?: object; image?: object; interoperability?: object; makernote?: object; thumbnail?: object; }; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }',
|
|
981
|
+
markdown: "## get\n\n`client.files.metadata.get(fileId: string): { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: object; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }`\n\n**get** `/v1/files/{fileId}/metadata`\n\nYou can programmatically get image EXIF, pHash, and other metadata for uploaded files in the ImageKit.io media library using this API.\n\nYou can also get the metadata in upload API response by passing `metadata` in `responseFields` parameter.\n\n\n### Parameters\n\n- `fileId: string`\n\n### Returns\n\n- `{ audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: { exif?: { ApertureValue?: number; ColorSpace?: number; CreateDate?: string; CustomRendered?: number; DateTimeOriginal?: string; ExifImageHeight?: number; ExifImageWidth?: number; ExifVersion?: string; ExposureCompensation?: number; ExposureMode?: number; ExposureProgram?: number; ExposureTime?: number; Flash?: number; FlashpixVersion?: string; FNumber?: number; FocalLength?: number; FocalPlaneResolutionUnit?: number; FocalPlaneXResolution?: number; FocalPlaneYResolution?: number; InteropOffset?: number; ISO?: number; MeteringMode?: number; SceneCaptureType?: number; ShutterSpeedValue?: number; SubSecTime?: string; WhiteBalance?: number; }; gps?: { GPSVersionID?: number[]; }; image?: { ExifOffset?: number; GPSInfo?: number; Make?: string; Model?: string; ModifyDate?: string; Orientation?: number; ResolutionUnit?: number; Software?: string; XResolution?: number; YCbCrPositioning?: number; YResolution?: number; }; interoperability?: { InteropIndex?: string; InteropVersion?: string; }; makernote?: object; thumbnail?: { Compression?: number; ResolutionUnit?: number; ThumbnailLength?: number; ThumbnailOffset?: number; XResolution?: number; YResolution?: number; }; }; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }`\n JSON object containing metadata.\n\n - `audioCodec?: string`\n - `bitRate?: number`\n - `density?: number`\n - `duration?: number`\n - `exif?: { exif?: { ApertureValue?: number; ColorSpace?: number; CreateDate?: string; CustomRendered?: number; DateTimeOriginal?: string; ExifImageHeight?: number; ExifImageWidth?: number; ExifVersion?: string; ExposureCompensation?: number; ExposureMode?: number; ExposureProgram?: number; ExposureTime?: number; Flash?: number; FlashpixVersion?: string; FNumber?: number; FocalLength?: number; FocalPlaneResolutionUnit?: number; FocalPlaneXResolution?: number; FocalPlaneYResolution?: number; InteropOffset?: number; ISO?: number; MeteringMode?: number; SceneCaptureType?: number; ShutterSpeedValue?: number; SubSecTime?: string; WhiteBalance?: number; }; gps?: { GPSVersionID?: number[]; }; image?: { ExifOffset?: number; GPSInfo?: number; Make?: string; Model?: string; ModifyDate?: string; Orientation?: number; ResolutionUnit?: number; Software?: string; XResolution?: number; YCbCrPositioning?: number; YResolution?: number; }; interoperability?: { InteropIndex?: string; InteropVersion?: string; }; makernote?: object; thumbnail?: { Compression?: number; ResolutionUnit?: number; ThumbnailLength?: number; ThumbnailOffset?: number; XResolution?: number; YResolution?: number; }; }`\n - `format?: string`\n - `hasColorProfile?: boolean`\n - `hasTransparency?: boolean`\n - `height?: number`\n - `pHash?: string`\n - `quality?: number`\n - `size?: number`\n - `videoCodec?: string`\n - `width?: number`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst metadata = await client.files.metadata.get('fileId');\n\nconsole.log(metadata);\n```",
|
|
982
|
+
perLanguage: {
|
|
983
|
+
cli: {
|
|
984
|
+
method: 'metadata get',
|
|
985
|
+
example: "imagekit files:metadata get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file-id fileId",
|
|
986
|
+
},
|
|
987
|
+
csharp: {
|
|
988
|
+
method: 'Files.Metadata.Get',
|
|
989
|
+
example: 'MetadataGetParams parameters = new() { FileID = "fileId" };\n\nvar metadata = await client.Files.Metadata.Get(parameters);\n\nConsole.WriteLine(metadata);',
|
|
990
|
+
},
|
|
991
|
+
go: {
|
|
992
|
+
method: 'client.Files.Metadata.Get',
|
|
993
|
+
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',
|
|
994
|
+
},
|
|
995
|
+
http: {
|
|
996
|
+
example: 'curl https://api.imagekit.io/v1/files/$FILE_ID/metadata \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
997
|
+
},
|
|
998
|
+
java: {
|
|
999
|
+
method: 'files().metadata().get',
|
|
1000
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.Metadata;\nimport com.imagekit.api.models.files.metadata.MetadataGetParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n Metadata metadata = client.files().metadata().get("fileId");\n }\n}',
|
|
1001
|
+
},
|
|
1002
|
+
php: {
|
|
1003
|
+
method: 'files->metadata->get',
|
|
1004
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$metadata = $client->files->metadata->get('fileId');\n\nvar_dump($metadata);",
|
|
1005
|
+
},
|
|
1006
|
+
python: {
|
|
1007
|
+
method: 'files.metadata.get',
|
|
1008
|
+
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)',
|
|
1009
|
+
},
|
|
1010
|
+
ruby: {
|
|
1011
|
+
method: 'files.metadata.get',
|
|
1012
|
+
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)',
|
|
1013
|
+
},
|
|
1014
|
+
typescript: {
|
|
1015
|
+
method: 'client.files.metadata.get',
|
|
1016
|
+
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);",
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
name: 'getFromURL',
|
|
1022
|
+
endpoint: '/v1/metadata',
|
|
1023
|
+
httpMethod: 'get',
|
|
1024
|
+
summary: 'Get metadata from remote URL',
|
|
1025
|
+
description: 'Get image EXIF, pHash, and other metadata from ImageKit.io powered remote URL using this API.\n',
|
|
1026
|
+
stainlessPath: '(resource) files.metadata > (method) getFromURL',
|
|
1027
|
+
qualified: 'client.files.metadata.getFromURL',
|
|
1028
|
+
params: ['url: string;'],
|
|
1029
|
+
response: '{ audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: { exif?: object; gps?: object; image?: object; interoperability?: object; makernote?: object; thumbnail?: object; }; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }',
|
|
1030
|
+
markdown: "## getFromURL\n\n`client.files.metadata.getFromURL(url: string): { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: object; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }`\n\n**get** `/v1/metadata`\n\nGet image EXIF, pHash, and other metadata from ImageKit.io powered remote URL using this API.\n\n\n### Parameters\n\n- `url: string`\n Should be a valid file URL. It should be accessible using your ImageKit.io account.\n\n\n### Returns\n\n- `{ audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: { exif?: { ApertureValue?: number; ColorSpace?: number; CreateDate?: string; CustomRendered?: number; DateTimeOriginal?: string; ExifImageHeight?: number; ExifImageWidth?: number; ExifVersion?: string; ExposureCompensation?: number; ExposureMode?: number; ExposureProgram?: number; ExposureTime?: number; Flash?: number; FlashpixVersion?: string; FNumber?: number; FocalLength?: number; FocalPlaneResolutionUnit?: number; FocalPlaneXResolution?: number; FocalPlaneYResolution?: number; InteropOffset?: number; ISO?: number; MeteringMode?: number; SceneCaptureType?: number; ShutterSpeedValue?: number; SubSecTime?: string; WhiteBalance?: number; }; gps?: { GPSVersionID?: number[]; }; image?: { ExifOffset?: number; GPSInfo?: number; Make?: string; Model?: string; ModifyDate?: string; Orientation?: number; ResolutionUnit?: number; Software?: string; XResolution?: number; YCbCrPositioning?: number; YResolution?: number; }; interoperability?: { InteropIndex?: string; InteropVersion?: string; }; makernote?: object; thumbnail?: { Compression?: number; ResolutionUnit?: number; ThumbnailLength?: number; ThumbnailOffset?: number; XResolution?: number; YResolution?: number; }; }; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }`\n JSON object containing metadata.\n\n - `audioCodec?: string`\n - `bitRate?: number`\n - `density?: number`\n - `duration?: number`\n - `exif?: { exif?: { ApertureValue?: number; ColorSpace?: number; CreateDate?: string; CustomRendered?: number; DateTimeOriginal?: string; ExifImageHeight?: number; ExifImageWidth?: number; ExifVersion?: string; ExposureCompensation?: number; ExposureMode?: number; ExposureProgram?: number; ExposureTime?: number; Flash?: number; FlashpixVersion?: string; FNumber?: number; FocalLength?: number; FocalPlaneResolutionUnit?: number; FocalPlaneXResolution?: number; FocalPlaneYResolution?: number; InteropOffset?: number; ISO?: number; MeteringMode?: number; SceneCaptureType?: number; ShutterSpeedValue?: number; SubSecTime?: string; WhiteBalance?: number; }; gps?: { GPSVersionID?: number[]; }; image?: { ExifOffset?: number; GPSInfo?: number; Make?: string; Model?: string; ModifyDate?: string; Orientation?: number; ResolutionUnit?: number; Software?: string; XResolution?: number; YCbCrPositioning?: number; YResolution?: number; }; interoperability?: { InteropIndex?: string; InteropVersion?: string; }; makernote?: object; thumbnail?: { Compression?: number; ResolutionUnit?: number; ThumbnailLength?: number; ThumbnailOffset?: number; XResolution?: number; YResolution?: number; }; }`\n - `format?: string`\n - `hasColorProfile?: boolean`\n - `hasTransparency?: boolean`\n - `height?: number`\n - `pHash?: string`\n - `quality?: number`\n - `size?: number`\n - `videoCodec?: string`\n - `width?: number`\n\n### Example\n\n```typescript\nimport 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);\n```",
|
|
1031
|
+
perLanguage: {
|
|
1032
|
+
cli: {
|
|
1033
|
+
method: 'metadata getFromURL',
|
|
1034
|
+
example: "imagekit files:metadata get-from-url \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --url https://example.com",
|
|
1035
|
+
},
|
|
1036
|
+
csharp: {
|
|
1037
|
+
method: 'Files.Metadata.GetFromUrl',
|
|
1038
|
+
example: 'MetadataGetFromUrlParams parameters = new() { Url = "https://example.com" };\n\nvar metadata = await client.Files.Metadata.GetFromUrl(parameters);\n\nConsole.WriteLine(metadata);',
|
|
1039
|
+
},
|
|
1040
|
+
go: {
|
|
1041
|
+
method: 'client.Files.Metadata.GetFromURL',
|
|
1042
|
+
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',
|
|
1043
|
+
},
|
|
1044
|
+
http: {
|
|
1045
|
+
example: 'curl https://api.imagekit.io/v1/metadata \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1046
|
+
},
|
|
1047
|
+
java: {
|
|
1048
|
+
method: 'files().metadata().getFromUrl',
|
|
1049
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.files.Metadata;\nimport com.imagekit.api.models.files.metadata.MetadataGetFromUrlParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n MetadataGetFromUrlParams params = MetadataGetFromUrlParams.builder()\n .url("https://example.com")\n .build();\n Metadata metadata = client.files().metadata().getFromUrl(params);\n }\n}',
|
|
1050
|
+
},
|
|
1051
|
+
php: {
|
|
1052
|
+
method: 'files->metadata->getFromURL',
|
|
1053
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$metadata = $client->files->metadata->getFromURL(url: 'https://example.com');\n\nvar_dump($metadata);",
|
|
1054
|
+
},
|
|
1055
|
+
python: {
|
|
1056
|
+
method: 'files.metadata.get_from_url',
|
|
1057
|
+
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)',
|
|
1058
|
+
},
|
|
1059
|
+
ruby: {
|
|
1060
|
+
method: 'files.metadata.get_from_url',
|
|
1061
|
+
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)',
|
|
1062
|
+
},
|
|
1063
|
+
typescript: {
|
|
1064
|
+
method: 'client.files.metadata.getFromURL',
|
|
1065
|
+
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);",
|
|
1066
|
+
},
|
|
1067
|
+
},
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
name: 'list',
|
|
1071
|
+
endpoint: '/v1/saved-extensions',
|
|
1072
|
+
httpMethod: 'get',
|
|
1073
|
+
summary: 'List all saved extensions',
|
|
1074
|
+
description: 'This API returns an array of all saved extensions for your account. Saved extensions allow you to save complex extension configurations and reuse them by referencing them by ID in upload or update file APIs.\n',
|
|
1075
|
+
stainlessPath: '(resource) savedExtensions > (method) list',
|
|
1076
|
+
qualified: 'client.savedExtensions.list',
|
|
1077
|
+
response: '{ id?: string; config?: object | object | object | object; createdAt?: string; description?: string; name?: string; updatedAt?: string; }[]',
|
|
1078
|
+
markdown: "## list\n\n`client.savedExtensions.list(): object[]`\n\n**get** `/v1/saved-extensions`\n\nThis API returns an array of all saved extensions for your account. Saved extensions allow you to save complex extension configurations and reuse them by referencing them by ID in upload or update file APIs.\n\n\n### Returns\n\n- `{ id?: string; config?: object | object | object | object; createdAt?: string; description?: string; name?: string; updatedAt?: string; }[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtensions = await client.savedExtensions.list();\n\nconsole.log(savedExtensions);\n```",
|
|
1079
|
+
perLanguage: {
|
|
1080
|
+
cli: {
|
|
1081
|
+
method: 'savedExtensions list',
|
|
1082
|
+
example: "imagekit saved-extensions list \\\n --private-key 'My Private Key' \\\n --password 'My Password'",
|
|
1083
|
+
},
|
|
1084
|
+
csharp: {
|
|
1085
|
+
method: 'SavedExtensions.List',
|
|
1086
|
+
example: 'SavedExtensionListParams parameters = new();\n\nvar savedExtensions = await client.SavedExtensions.List(parameters);\n\nConsole.WriteLine(savedExtensions);',
|
|
1087
|
+
},
|
|
1088
|
+
go: {
|
|
1089
|
+
method: 'client.SavedExtensions.List',
|
|
1090
|
+
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',
|
|
1091
|
+
},
|
|
1092
|
+
http: {
|
|
1093
|
+
example: 'curl https://api.imagekit.io/v1/saved-extensions \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1094
|
+
},
|
|
1095
|
+
java: {
|
|
1096
|
+
method: 'savedExtensions().list',
|
|
1097
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.SavedExtension;\nimport com.imagekit.api.models.savedextensions.SavedExtensionListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n List<SavedExtension> savedExtensions = client.savedExtensions().list();\n }\n}',
|
|
1098
|
+
},
|
|
1099
|
+
php: {
|
|
1100
|
+
method: 'savedExtensions->list',
|
|
1101
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$savedExtensions = $client->savedExtensions->list();\n\nvar_dump($savedExtensions);",
|
|
1102
|
+
},
|
|
1103
|
+
python: {
|
|
1104
|
+
method: 'saved_extensions.list',
|
|
1105
|
+
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)',
|
|
1106
|
+
},
|
|
1107
|
+
ruby: {
|
|
1108
|
+
method: 'saved_extensions.list',
|
|
1109
|
+
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)',
|
|
1110
|
+
},
|
|
1111
|
+
typescript: {
|
|
1112
|
+
method: 'client.savedExtensions.list',
|
|
1113
|
+
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);",
|
|
1114
|
+
},
|
|
1115
|
+
},
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
name: 'create',
|
|
1119
|
+
endpoint: '/v1/saved-extensions',
|
|
1120
|
+
httpMethod: 'post',
|
|
1121
|
+
summary: 'Create saved extension',
|
|
1122
|
+
description: 'This API creates a new saved extension. Saved extensions allow you to save complex extension configurations (like AI tasks) and reuse them by referencing the ID in upload or update file APIs.\n\n**Saved extension limit** \\\nYou can create a maximum of 100 saved extensions per account.\n',
|
|
1123
|
+
stainlessPath: '(resource) savedExtensions > (method) create',
|
|
1124
|
+
qualified: 'client.savedExtensions.create',
|
|
1125
|
+
params: [
|
|
1126
|
+
"config: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; };",
|
|
1127
|
+
'description: string;',
|
|
1128
|
+
'name: string;',
|
|
1129
|
+
],
|
|
1130
|
+
response: "{ id?: string; config?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }; createdAt?: string; description?: string; name?: string; updatedAt?: string; }",
|
|
1131
|
+
markdown: "## create\n\n`client.savedExtensions.create(config: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }, description: string, name: string): { id?: string; config?: extension_config; createdAt?: string; description?: string; name?: string; updatedAt?: string; }`\n\n**post** `/v1/saved-extensions`\n\nThis API creates a new saved extension. Saved extensions allow you to save complex extension configurations (like AI tasks) and reuse them by referencing the ID in upload or update file APIs.\n\n**Saved extension limit** \\\nYou can create a maximum of 100 saved extensions per account.\n\n\n### Parameters\n\n- `config: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; }`\n Configuration object for an extension (base extensions only, not saved extension references).\n\n- `description: string`\n Description of what the saved extension does.\n\n- `name: string`\n Name of the saved extension.\n\n### Returns\n\n- `{ id?: string; config?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }; createdAt?: string; description?: string; name?: string; updatedAt?: string; }`\n Saved extension object containing extension configuration.\n\n - `id?: string`\n - `config?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; }`\n - `createdAt?: string`\n - `description?: string`\n - `name?: string`\n - `updatedAt?: string`\n\n### Example\n\n```typescript\nimport 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);\n```",
|
|
1132
|
+
perLanguage: {
|
|
1133
|
+
cli: {
|
|
1134
|
+
method: 'savedExtensions create',
|
|
1135
|
+
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'",
|
|
1136
|
+
},
|
|
1137
|
+
csharp: {
|
|
1138
|
+
method: 'SavedExtensions.Create',
|
|
1139
|
+
example: 'SavedExtensionCreateParams parameters = new()\n{\n Config = new RemoveBg()\n {\n Options = new()\n {\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 savedExtension = await client.SavedExtensions.Create(parameters);\n\nConsole.WriteLine(savedExtension);',
|
|
1140
|
+
},
|
|
1141
|
+
go: {
|
|
1142
|
+
method: 'client.SavedExtensions.New',
|
|
1143
|
+
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',
|
|
1144
|
+
},
|
|
1145
|
+
http: {
|
|
1146
|
+
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 }\'',
|
|
1147
|
+
},
|
|
1148
|
+
java: {
|
|
1149
|
+
method: 'savedExtensions().create',
|
|
1150
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.ExtensionConfig;\nimport com.imagekit.api.models.SavedExtension;\nimport com.imagekit.api.models.savedextensions.SavedExtensionCreateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n SavedExtensionCreateParams params = SavedExtensionCreateParams.builder()\n .config(ExtensionConfig.RemoveBg.builder().build())\n .description("Analyzes vehicle images for type, condition, and quality assessment")\n .name("Car Quality Analysis")\n .build();\n SavedExtension savedExtension = client.savedExtensions().create(params);\n }\n}',
|
|
1151
|
+
},
|
|
1152
|
+
php: {
|
|
1153
|
+
method: 'savedExtensions->create',
|
|
1154
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$savedExtension = $client->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);",
|
|
1155
|
+
},
|
|
1156
|
+
python: {
|
|
1157
|
+
method: 'saved_extensions.create',
|
|
1158
|
+
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)',
|
|
1159
|
+
},
|
|
1160
|
+
ruby: {
|
|
1161
|
+
method: 'saved_extensions.create',
|
|
1162
|
+
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)',
|
|
1163
|
+
},
|
|
1164
|
+
typescript: {
|
|
1165
|
+
method: 'client.savedExtensions.create',
|
|
1166
|
+
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);",
|
|
1167
|
+
},
|
|
1168
|
+
},
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
name: 'get',
|
|
1172
|
+
endpoint: '/v1/saved-extensions/{id}',
|
|
1173
|
+
httpMethod: 'get',
|
|
1174
|
+
summary: 'Get saved extension details',
|
|
1175
|
+
description: 'This API returns details of a specific saved extension by ID.\n',
|
|
1176
|
+
stainlessPath: '(resource) savedExtensions > (method) get',
|
|
1177
|
+
qualified: 'client.savedExtensions.get',
|
|
1178
|
+
params: ['id: string;'],
|
|
1179
|
+
response: "{ id?: string; config?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }; createdAt?: string; description?: string; name?: string; updatedAt?: string; }",
|
|
1180
|
+
markdown: "## get\n\n`client.savedExtensions.get(id: string): { id?: string; config?: extension_config; createdAt?: string; description?: string; name?: string; updatedAt?: string; }`\n\n**get** `/v1/saved-extensions/{id}`\n\nThis API returns details of a specific saved extension by ID.\n\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id?: string; config?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }; createdAt?: string; description?: string; name?: string; updatedAt?: string; }`\n Saved extension object containing extension configuration.\n\n - `id?: string`\n - `config?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; }`\n - `createdAt?: string`\n - `description?: string`\n - `name?: string`\n - `updatedAt?: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.get('id');\n\nconsole.log(savedExtension);\n```",
|
|
1181
|
+
perLanguage: {
|
|
1182
|
+
cli: {
|
|
1183
|
+
method: 'savedExtensions get',
|
|
1184
|
+
example: "imagekit saved-extensions get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
1185
|
+
},
|
|
1186
|
+
csharp: {
|
|
1187
|
+
method: 'SavedExtensions.Get',
|
|
1188
|
+
example: 'SavedExtensionGetParams parameters = new() { ID = "id" };\n\nvar savedExtension = await client.SavedExtensions.Get(parameters);\n\nConsole.WriteLine(savedExtension);',
|
|
1189
|
+
},
|
|
1190
|
+
go: {
|
|
1191
|
+
method: 'client.SavedExtensions.Get',
|
|
1192
|
+
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',
|
|
1193
|
+
},
|
|
1194
|
+
http: {
|
|
1195
|
+
example: 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1196
|
+
},
|
|
1197
|
+
java: {
|
|
1198
|
+
method: 'savedExtensions().get',
|
|
1199
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.SavedExtension;\nimport com.imagekit.api.models.savedextensions.SavedExtensionGetParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n SavedExtension savedExtension = client.savedExtensions().get("id");\n }\n}',
|
|
1200
|
+
},
|
|
1201
|
+
php: {
|
|
1202
|
+
method: 'savedExtensions->get',
|
|
1203
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$savedExtension = $client->savedExtensions->get('id');\n\nvar_dump($savedExtension);",
|
|
1204
|
+
},
|
|
1205
|
+
python: {
|
|
1206
|
+
method: 'saved_extensions.get',
|
|
1207
|
+
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)',
|
|
1208
|
+
},
|
|
1209
|
+
ruby: {
|
|
1210
|
+
method: 'saved_extensions.get',
|
|
1211
|
+
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)',
|
|
1212
|
+
},
|
|
1213
|
+
typescript: {
|
|
1214
|
+
method: 'client.savedExtensions.get',
|
|
1215
|
+
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);",
|
|
1216
|
+
},
|
|
1217
|
+
},
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
name: 'update',
|
|
1221
|
+
endpoint: '/v1/saved-extensions/{id}',
|
|
1222
|
+
httpMethod: 'patch',
|
|
1223
|
+
summary: 'Update saved extension',
|
|
1224
|
+
description: 'This API updates an existing saved extension. You can update the name, description, or config.\n',
|
|
1225
|
+
stainlessPath: '(resource) savedExtensions > (method) update',
|
|
1226
|
+
qualified: 'client.savedExtensions.update',
|
|
1227
|
+
params: [
|
|
1228
|
+
'id: string;',
|
|
1229
|
+
"config?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; };",
|
|
1230
|
+
'description?: string;',
|
|
1231
|
+
'name?: string;',
|
|
1232
|
+
],
|
|
1233
|
+
response: "{ id?: string; config?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }; createdAt?: string; description?: string; name?: string; updatedAt?: string; }",
|
|
1234
|
+
markdown: "## update\n\n`client.savedExtensions.update(id: string, config?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }, description?: string, name?: string): { id?: string; config?: extension_config; createdAt?: string; description?: string; name?: string; updatedAt?: string; }`\n\n**patch** `/v1/saved-extensions/{id}`\n\nThis API updates an existing saved extension. You can update the name, description, or config.\n\n\n### Parameters\n\n- `id: string`\n\n- `config?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; }`\n Configuration object for an extension (base extensions only, not saved extension references).\n\n- `description?: string`\n Updated description of the saved extension.\n\n- `name?: string`\n Updated name of the saved extension.\n\n### Returns\n\n- `{ id?: string; config?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; }; createdAt?: string; description?: string; name?: string; updatedAt?: string; }`\n Saved extension object containing extension configuration.\n\n - `id?: string`\n - `config?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; }`\n - `createdAt?: string`\n - `description?: string`\n - `name?: string`\n - `updatedAt?: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst savedExtension = await client.savedExtensions.update('id');\n\nconsole.log(savedExtension);\n```",
|
|
1235
|
+
perLanguage: {
|
|
1236
|
+
cli: {
|
|
1237
|
+
method: 'savedExtensions update',
|
|
1238
|
+
example: "imagekit saved-extensions update \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
1239
|
+
},
|
|
1240
|
+
csharp: {
|
|
1241
|
+
method: 'SavedExtensions.Update',
|
|
1242
|
+
example: 'SavedExtensionUpdateParams parameters = new() { ID = "id" };\n\nvar savedExtension = await client.SavedExtensions.Update(parameters);\n\nConsole.WriteLine(savedExtension);',
|
|
1243
|
+
},
|
|
1244
|
+
go: {
|
|
1245
|
+
method: 'client.SavedExtensions.Update',
|
|
1246
|
+
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',
|
|
1247
|
+
},
|
|
1248
|
+
http: {
|
|
1249
|
+
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 '{}'",
|
|
1250
|
+
},
|
|
1251
|
+
java: {
|
|
1252
|
+
method: 'savedExtensions().update',
|
|
1253
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.SavedExtension;\nimport com.imagekit.api.models.savedextensions.SavedExtensionUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n SavedExtension savedExtension = client.savedExtensions().update("id");\n }\n}',
|
|
1254
|
+
},
|
|
1255
|
+
php: {
|
|
1256
|
+
method: 'savedExtensions->update',
|
|
1257
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$savedExtension = $client->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);",
|
|
1258
|
+
},
|
|
1259
|
+
python: {
|
|
1260
|
+
method: 'saved_extensions.update',
|
|
1261
|
+
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)',
|
|
1262
|
+
},
|
|
1263
|
+
ruby: {
|
|
1264
|
+
method: 'saved_extensions.update',
|
|
1265
|
+
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)',
|
|
1266
|
+
},
|
|
1267
|
+
typescript: {
|
|
1268
|
+
method: 'client.savedExtensions.update',
|
|
1269
|
+
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);",
|
|
1270
|
+
},
|
|
1271
|
+
},
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
name: 'delete',
|
|
1275
|
+
endpoint: '/v1/saved-extensions/{id}',
|
|
1276
|
+
httpMethod: 'delete',
|
|
1277
|
+
summary: 'Delete saved extension',
|
|
1278
|
+
description: 'This API deletes a saved extension permanently.\n',
|
|
1279
|
+
stainlessPath: '(resource) savedExtensions > (method) delete',
|
|
1280
|
+
qualified: 'client.savedExtensions.delete',
|
|
1281
|
+
params: ['id: string;'],
|
|
1282
|
+
markdown: "## delete\n\n`client.savedExtensions.delete(id: string): void`\n\n**delete** `/v1/saved-extensions/{id}`\n\nThis API deletes a saved extension permanently.\n\n\n### Parameters\n\n- `id: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.savedExtensions.delete('id')\n```",
|
|
1283
|
+
perLanguage: {
|
|
1284
|
+
cli: {
|
|
1285
|
+
method: 'savedExtensions delete',
|
|
1286
|
+
example: "imagekit saved-extensions delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
1287
|
+
},
|
|
1288
|
+
csharp: {
|
|
1289
|
+
method: 'SavedExtensions.Delete',
|
|
1290
|
+
example: 'SavedExtensionDeleteParams parameters = new() { ID = "id" };\n\nawait client.SavedExtensions.Delete(parameters);',
|
|
1291
|
+
},
|
|
1292
|
+
go: {
|
|
1293
|
+
method: 'client.SavedExtensions.Delete',
|
|
1294
|
+
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',
|
|
1295
|
+
},
|
|
1296
|
+
http: {
|
|
1297
|
+
example: 'curl https://api.imagekit.io/v1/saved-extensions/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1298
|
+
},
|
|
1299
|
+
java: {
|
|
1300
|
+
method: 'savedExtensions().delete',
|
|
1301
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.savedextensions.SavedExtensionDeleteParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n client.savedExtensions().delete("id");\n }\n}',
|
|
1302
|
+
},
|
|
1303
|
+
php: {
|
|
1304
|
+
method: 'savedExtensions->delete',
|
|
1305
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$result = $client->savedExtensions->delete('id');\n\nvar_dump($result);",
|
|
1306
|
+
},
|
|
1307
|
+
python: {
|
|
1308
|
+
method: 'saved_extensions.delete',
|
|
1309
|
+
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)',
|
|
1310
|
+
},
|
|
1311
|
+
ruby: {
|
|
1312
|
+
method: 'saved_extensions.delete',
|
|
1313
|
+
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)',
|
|
1314
|
+
},
|
|
1315
|
+
typescript: {
|
|
1316
|
+
method: 'client.savedExtensions.delete',
|
|
1317
|
+
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');",
|
|
1318
|
+
},
|
|
1319
|
+
},
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
name: 'list',
|
|
1323
|
+
endpoint: '/v1/files',
|
|
1324
|
+
httpMethod: 'get',
|
|
1325
|
+
summary: 'List and search assets',
|
|
1326
|
+
description: 'This API can list all the uploaded files and folders in your ImageKit.io media library. In addition, you can fine-tune your query by specifying various filters by generating a query string in a Lucene-like syntax and provide this generated string as the value of the `searchQuery`.\n',
|
|
1327
|
+
stainlessPath: '(resource) assets > (method) list',
|
|
1328
|
+
qualified: 'client.assets.list',
|
|
1329
|
+
params: [
|
|
1330
|
+
"fileType?: 'all' | 'image' | 'non-image';",
|
|
1331
|
+
'limit?: number;',
|
|
1332
|
+
'path?: string;',
|
|
1333
|
+
'searchQuery?: string;',
|
|
1334
|
+
'skip?: number;',
|
|
1335
|
+
'sort?: string;',
|
|
1336
|
+
"type?: 'file' | 'file-version' | 'folder' | 'all';",
|
|
1337
|
+
],
|
|
1338
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; } | { createdAt?: string; customMetadata?: object; folderId?: string; folderPath?: string; name?: string; type?: 'folder'; updatedAt?: string; }[]",
|
|
1339
|
+
markdown: "## list\n\n`client.assets.list(fileType?: 'all' | 'image' | 'non-image', limit?: number, path?: string, searchQuery?: string, skip?: number, sort?: string, type?: 'file' | 'file-version' | 'folder' | 'all'): object | object[]`\n\n**get** `/v1/files`\n\nThis API can list all the uploaded files and folders in your ImageKit.io media library. In addition, you can fine-tune your query by specifying various filters by generating a query string in a Lucene-like syntax and provide this generated string as the value of the `searchQuery`.\n\n\n### Parameters\n\n- `fileType?: 'all' | 'image' | 'non-image'`\n Filter results by file type.\n\n- `all` — include all file types \n- `image` — include only image files \n- `non-image` — include only non-image files (e.g., JS, CSS, video)\n\n- `limit?: number`\n The maximum number of results to return in response.\n\n\n- `path?: string`\n Folder path if you want to limit the search within a specific folder. For example, `/sales-banner/` will only search in folder sales-banner.\n\nNote : If your use case involves searching within a folder as well as its subfolders, you can use `path` parameter in `searchQuery` with appropriate operator.\nCheckout [Supported parameters](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#supported-parameters) for more information.\n\n\n- `searchQuery?: string`\n Query string in a Lucene-like query language e.g. `createdAt > \"7d\"`.\n\nNote : When the searchQuery parameter is present, the following query parameters will have no effect on the result:\n\n1. `tags`\n2. `type`\n3. `name`\n\n[Learn more](/docs/api-reference/digital-asset-management-dam/list-and-search-assets#advanced-search-queries) from examples.\n\n\n- `skip?: number`\n The number of results to skip before returning results.\n\n\n- `sort?: string`\n Sort the results by one of the supported fields in ascending or descending order.\n\n- `type?: 'file' | 'file-version' | 'folder' | 'all'`\n Filter results by asset type.\n\n- `file` — returns only files \n- `file-version` — returns specific file versions \n- `folder` — returns only folders \n- `all` — returns both files and folders (excludes `file-version`)\n\n### Returns\n\n- `{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; createdAt?: string; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; fileId?: string; filePath?: string; fileType?: string; hasAlpha?: boolean; height?: number; isPrivateFile?: boolean; isPublished?: boolean; mime?: string; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnail?: string; type?: 'file' | 'file-version'; updatedAt?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; } | { createdAt?: string; customMetadata?: object; folderId?: string; folderPath?: string; name?: string; type?: 'folder'; updatedAt?: string; }[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst assets = await client.assets.list();\n\nconsole.log(assets);\n```",
|
|
1340
|
+
perLanguage: {
|
|
1341
|
+
cli: {
|
|
1342
|
+
method: 'assets list',
|
|
1343
|
+
example: "imagekit assets list \\\n --private-key 'My Private Key' \\\n --password 'My Password'",
|
|
1344
|
+
},
|
|
1345
|
+
csharp: {
|
|
1346
|
+
method: 'Assets.List',
|
|
1347
|
+
example: 'AssetListParams parameters = new();\n\nvar assets = await client.Assets.List(parameters);\n\nConsole.WriteLine(assets);',
|
|
1348
|
+
},
|
|
1349
|
+
go: {
|
|
1350
|
+
method: 'client.Assets.List',
|
|
1351
|
+
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',
|
|
1352
|
+
},
|
|
1353
|
+
http: {
|
|
1354
|
+
example: 'curl https://api.imagekit.io/v1/files \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1355
|
+
},
|
|
1356
|
+
java: {
|
|
1357
|
+
method: 'assets().list',
|
|
1358
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.assets.AssetListParams;\nimport com.imagekit.api.models.assets.AssetListResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n List<AssetListResponse> assets = client.assets().list();\n }\n}',
|
|
1359
|
+
},
|
|
1360
|
+
php: {
|
|
1361
|
+
method: 'assets->list',
|
|
1362
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$assets = $client->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);",
|
|
1363
|
+
},
|
|
1364
|
+
python: {
|
|
1365
|
+
method: 'assets.list',
|
|
1366
|
+
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)',
|
|
1367
|
+
},
|
|
1368
|
+
ruby: {
|
|
1369
|
+
method: 'assets.list',
|
|
1370
|
+
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)',
|
|
1371
|
+
},
|
|
1372
|
+
typescript: {
|
|
1373
|
+
method: 'client.assets.list',
|
|
1374
|
+
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);",
|
|
1375
|
+
},
|
|
1376
|
+
},
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
name: 'create',
|
|
1380
|
+
endpoint: '/v1/files/purge',
|
|
1381
|
+
httpMethod: 'post',
|
|
1382
|
+
summary: 'Purge cache',
|
|
1383
|
+
description: "This API will purge CDN cache and ImageKit.io's internal cache for a file. Note: Purge cache is an asynchronous process and it may take some time to reflect the changes.\n",
|
|
1384
|
+
stainlessPath: '(resource) cache.invalidation > (method) create',
|
|
1385
|
+
qualified: 'client.cache.invalidation.create',
|
|
1386
|
+
params: ['url: string;'],
|
|
1387
|
+
response: '{ requestId?: string; }',
|
|
1388
|
+
markdown: "## create\n\n`client.cache.invalidation.create(url: string): { requestId?: string; }`\n\n**post** `/v1/files/purge`\n\nThis API will purge CDN cache and ImageKit.io's internal cache for a file. Note: Purge cache is an asynchronous process and it may take some time to reflect the changes.\n\n\n### Parameters\n\n- `url: string`\n The full URL of the file to be purged.\n\n\n### Returns\n\n- `{ requestId?: string; }`\n\n - `requestId?: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst invalidation = await client.cache.invalidation.create({ url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg' });\n\nconsole.log(invalidation);\n```",
|
|
1389
|
+
perLanguage: {
|
|
1390
|
+
cli: {
|
|
1391
|
+
method: 'invalidation create',
|
|
1392
|
+
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",
|
|
1393
|
+
},
|
|
1394
|
+
csharp: {
|
|
1395
|
+
method: 'Cache.Invalidation.Create',
|
|
1396
|
+
example: 'InvalidationCreateParams parameters = new()\n{\n Url = "https://ik.imagekit.io/your_imagekit_id/default-image.jpg"\n};\n\nvar invalidation = await client.Cache.Invalidation.Create(parameters);\n\nConsole.WriteLine(invalidation);',
|
|
1397
|
+
},
|
|
1398
|
+
go: {
|
|
1399
|
+
method: 'client.Cache.Invalidation.New',
|
|
1400
|
+
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',
|
|
1401
|
+
},
|
|
1402
|
+
http: {
|
|
1403
|
+
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 }\'',
|
|
1404
|
+
},
|
|
1405
|
+
java: {
|
|
1406
|
+
method: 'cache().invalidation().create',
|
|
1407
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.cache.invalidation.InvalidationCreateParams;\nimport com.imagekit.api.models.cache.invalidation.InvalidationCreateResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n InvalidationCreateParams params = InvalidationCreateParams.builder()\n .url("https://ik.imagekit.io/your_imagekit_id/default-image.jpg")\n .build();\n InvalidationCreateResponse invalidation = client.cache().invalidation().create(params);\n }\n}',
|
|
1408
|
+
},
|
|
1409
|
+
php: {
|
|
1410
|
+
method: 'cache->invalidation->create',
|
|
1411
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$invalidation = $client->cache->invalidation->create(\n url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg'\n);\n\nvar_dump($invalidation);",
|
|
1412
|
+
},
|
|
1413
|
+
python: {
|
|
1414
|
+
method: 'cache.invalidation.create',
|
|
1415
|
+
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)',
|
|
1416
|
+
},
|
|
1417
|
+
ruby: {
|
|
1418
|
+
method: 'cache.invalidation.create',
|
|
1419
|
+
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)',
|
|
1420
|
+
},
|
|
1421
|
+
typescript: {
|
|
1422
|
+
method: 'client.cache.invalidation.create',
|
|
1423
|
+
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);",
|
|
1424
|
+
},
|
|
1425
|
+
},
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
name: 'get',
|
|
1429
|
+
endpoint: '/v1/files/purge/{requestId}',
|
|
1430
|
+
httpMethod: 'get',
|
|
1431
|
+
summary: 'Get purge status',
|
|
1432
|
+
description: 'This API returns the status of a purge cache request.\n',
|
|
1433
|
+
stainlessPath: '(resource) cache.invalidation > (method) get',
|
|
1434
|
+
qualified: 'client.cache.invalidation.get',
|
|
1435
|
+
params: ['requestId: string;'],
|
|
1436
|
+
response: "{ status?: 'Pending' | 'Completed'; }",
|
|
1437
|
+
markdown: "## get\n\n`client.cache.invalidation.get(requestId: string): { status?: 'Pending' | 'Completed'; }`\n\n**get** `/v1/files/purge/{requestId}`\n\nThis API returns the status of a purge cache request.\n\n\n### Parameters\n\n- `requestId: string`\n\n### Returns\n\n- `{ status?: 'Pending' | 'Completed'; }`\n\n - `status?: 'Pending' | 'Completed'`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst invalidation = await client.cache.invalidation.get('requestId');\n\nconsole.log(invalidation);\n```",
|
|
1438
|
+
perLanguage: {
|
|
1439
|
+
cli: {
|
|
1440
|
+
method: 'invalidation get',
|
|
1441
|
+
example: "imagekit cache:invalidation get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --request-id requestId",
|
|
1442
|
+
},
|
|
1443
|
+
csharp: {
|
|
1444
|
+
method: 'Cache.Invalidation.Get',
|
|
1445
|
+
example: 'InvalidationGetParams parameters = new() { RequestID = "requestId" };\n\nvar invalidation = await client.Cache.Invalidation.Get(parameters);\n\nConsole.WriteLine(invalidation);',
|
|
1446
|
+
},
|
|
1447
|
+
go: {
|
|
1448
|
+
method: 'client.Cache.Invalidation.Get',
|
|
1449
|
+
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',
|
|
1450
|
+
},
|
|
1451
|
+
http: {
|
|
1452
|
+
example: 'curl https://api.imagekit.io/v1/files/purge/$REQUEST_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1453
|
+
},
|
|
1454
|
+
java: {
|
|
1455
|
+
method: 'cache().invalidation().get',
|
|
1456
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.cache.invalidation.InvalidationGetParams;\nimport com.imagekit.api.models.cache.invalidation.InvalidationGetResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n InvalidationGetResponse invalidation = client.cache().invalidation().get("requestId");\n }\n}',
|
|
1457
|
+
},
|
|
1458
|
+
php: {
|
|
1459
|
+
method: 'cache->invalidation->get',
|
|
1460
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$invalidation = $client->cache->invalidation->get('requestId');\n\nvar_dump($invalidation);",
|
|
1461
|
+
},
|
|
1462
|
+
python: {
|
|
1463
|
+
method: 'cache.invalidation.get',
|
|
1464
|
+
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)',
|
|
1465
|
+
},
|
|
1466
|
+
ruby: {
|
|
1467
|
+
method: 'cache.invalidation.get',
|
|
1468
|
+
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)',
|
|
1469
|
+
},
|
|
1470
|
+
typescript: {
|
|
1471
|
+
method: 'client.cache.invalidation.get',
|
|
1472
|
+
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);",
|
|
1473
|
+
},
|
|
1474
|
+
},
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
name: 'create',
|
|
1478
|
+
endpoint: '/v1/folder',
|
|
1479
|
+
httpMethod: 'post',
|
|
1480
|
+
summary: 'Create folder',
|
|
1481
|
+
description: 'This will create a new folder. You can specify the folder name and location of the parent folder where this new folder should be created.\n',
|
|
1482
|
+
stainlessPath: '(resource) folders > (method) create',
|
|
1483
|
+
qualified: 'client.folders.create',
|
|
1484
|
+
params: ['folderName: string;', 'parentFolderPath: string;'],
|
|
1485
|
+
response: '{ }',
|
|
1486
|
+
markdown: "## create\n\n`client.folders.create(folderName: string, parentFolderPath: string): { }`\n\n**post** `/v1/folder`\n\nThis will create a new folder. You can specify the folder name and location of the parent folder where this new folder should be created.\n\n\n### Parameters\n\n- `folderName: string`\n The folder will be created with this name. \n\nAll characters except alphabets and numbers (inclusive of unicode letters, marks, and numerals in other languages) will be replaced by an underscore i.e. `_`.\n\n\n- `parentFolderPath: string`\n The folder where the new folder should be created, for root use `/` else the path e.g. `containing/folder/`.\n\nNote: If any folder(s) is not present in the parentFolderPath parameter, it will be automatically created. For example, if you pass `/product/images/summer`, then `product`, `images`, and `summer` folders will be created if they don't already exist.\n\n\n### Returns\n\n- `{ }`\n\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst folder = await client.folders.create({ folderName: 'summer', parentFolderPath: '/product/images/' });\n\nconsole.log(folder);\n```",
|
|
1487
|
+
perLanguage: {
|
|
1488
|
+
cli: {
|
|
1489
|
+
method: 'folders create',
|
|
1490
|
+
example: "imagekit folders create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-name summer \\\n --parent-folder-path /product/images/",
|
|
1491
|
+
},
|
|
1492
|
+
csharp: {
|
|
1493
|
+
method: 'Folders.Create',
|
|
1494
|
+
example: 'FolderCreateParams parameters = new()\n{\n FolderName = "summer",\n ParentFolderPath = "/product/images/",\n};\n\nvar folder = await client.Folders.Create(parameters);\n\nConsole.WriteLine(folder);',
|
|
1495
|
+
},
|
|
1496
|
+
go: {
|
|
1497
|
+
method: 'client.Folders.New',
|
|
1498
|
+
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',
|
|
1499
|
+
},
|
|
1500
|
+
http: {
|
|
1501
|
+
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 }\'',
|
|
1502
|
+
},
|
|
1503
|
+
java: {
|
|
1504
|
+
method: 'folders().create',
|
|
1505
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.folders.FolderCreateParams;\nimport com.imagekit.api.models.folders.FolderCreateResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FolderCreateParams params = FolderCreateParams.builder()\n .folderName("summer")\n .parentFolderPath("/product/images/")\n .build();\n FolderCreateResponse folder = client.folders().create(params);\n }\n}',
|
|
1506
|
+
},
|
|
1507
|
+
php: {
|
|
1508
|
+
method: 'folders->create',
|
|
1509
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$folder = $client->folders->create(\n folderName: 'summer', parentFolderPath: '/product/images/'\n);\n\nvar_dump($folder);",
|
|
1510
|
+
},
|
|
1511
|
+
python: {
|
|
1512
|
+
method: 'folders.create',
|
|
1513
|
+
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)',
|
|
1514
|
+
},
|
|
1515
|
+
ruby: {
|
|
1516
|
+
method: 'folders.create',
|
|
1517
|
+
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)',
|
|
1518
|
+
},
|
|
1519
|
+
typescript: {
|
|
1520
|
+
method: 'client.folders.create',
|
|
1521
|
+
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);",
|
|
1522
|
+
},
|
|
1523
|
+
},
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
name: 'delete',
|
|
1527
|
+
endpoint: '/v1/folder',
|
|
1528
|
+
httpMethod: 'delete',
|
|
1529
|
+
summary: 'Delete folder',
|
|
1530
|
+
description: 'This will delete a folder and all its contents permanently. The API returns an empty response.\n',
|
|
1531
|
+
stainlessPath: '(resource) folders > (method) delete',
|
|
1532
|
+
qualified: 'client.folders.delete',
|
|
1533
|
+
params: ['folderPath: string;'],
|
|
1534
|
+
response: '{ }',
|
|
1535
|
+
markdown: "## delete\n\n`client.folders.delete(folderPath: string): { }`\n\n**delete** `/v1/folder`\n\nThis will delete a folder and all its contents permanently. The API returns an empty response.\n\n\n### Parameters\n\n- `folderPath: string`\n Full path to the folder you want to delete. For example `/folder/to/delete/`.\n\n\n### Returns\n\n- `{ }`\n\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst folder = await client.folders.delete({ folderPath: '/folder/to/delete/' });\n\nconsole.log(folder);\n```",
|
|
1536
|
+
perLanguage: {
|
|
1537
|
+
cli: {
|
|
1538
|
+
method: 'folders delete',
|
|
1539
|
+
example: "imagekit folders delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --folder-path /folder/to/delete/",
|
|
1540
|
+
},
|
|
1541
|
+
csharp: {
|
|
1542
|
+
method: 'Folders.Delete',
|
|
1543
|
+
example: 'FolderDeleteParams parameters = new() { FolderPath = "/folder/to/delete/" };\n\nvar folder = await client.Folders.Delete(parameters);\n\nConsole.WriteLine(folder);',
|
|
1544
|
+
},
|
|
1545
|
+
go: {
|
|
1546
|
+
method: 'client.Folders.Delete',
|
|
1547
|
+
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',
|
|
1548
|
+
},
|
|
1549
|
+
http: {
|
|
1550
|
+
example: 'curl https://api.imagekit.io/v1/folder \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1551
|
+
},
|
|
1552
|
+
java: {
|
|
1553
|
+
method: 'folders().delete',
|
|
1554
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.folders.FolderDeleteParams;\nimport com.imagekit.api.models.folders.FolderDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FolderDeleteParams params = FolderDeleteParams.builder()\n .folderPath("/folder/to/delete/")\n .build();\n FolderDeleteResponse folder = client.folders().delete(params);\n }\n}',
|
|
1555
|
+
},
|
|
1556
|
+
php: {
|
|
1557
|
+
method: 'folders->delete',
|
|
1558
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$folder = $client->folders->delete(folderPath: '/folder/to/delete/');\n\nvar_dump($folder);",
|
|
1559
|
+
},
|
|
1560
|
+
python: {
|
|
1561
|
+
method: 'folders.delete',
|
|
1562
|
+
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)',
|
|
1563
|
+
},
|
|
1564
|
+
ruby: {
|
|
1565
|
+
method: 'folders.delete',
|
|
1566
|
+
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)',
|
|
1567
|
+
},
|
|
1568
|
+
typescript: {
|
|
1569
|
+
method: 'client.folders.delete',
|
|
1570
|
+
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);",
|
|
1571
|
+
},
|
|
1572
|
+
},
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
name: 'copy',
|
|
1576
|
+
endpoint: '/v1/bulkJobs/copyFolder',
|
|
1577
|
+
httpMethod: 'post',
|
|
1578
|
+
summary: 'Copy folder',
|
|
1579
|
+
description: 'This will copy one folder into another. The selected folder, its nested folders, files, and their versions (in `includeVersions` is set to true) are copied in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.\n',
|
|
1580
|
+
stainlessPath: '(resource) folders > (method) copy',
|
|
1581
|
+
qualified: 'client.folders.copy',
|
|
1582
|
+
params: ['destinationPath: string;', 'sourceFolderPath: string;', 'includeVersions?: boolean;'],
|
|
1583
|
+
response: '{ jobId: string; }',
|
|
1584
|
+
markdown: "## copy\n\n`client.folders.copy(destinationPath: string, sourceFolderPath: string, includeVersions?: boolean): { jobId: string; }`\n\n**post** `/v1/bulkJobs/copyFolder`\n\nThis will copy one folder into another. The selected folder, its nested folders, files, and their versions (in `includeVersions` is set to true) are copied in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.\n\n\n### Parameters\n\n- `destinationPath: string`\n Full path to the destination folder where you want to copy the source folder into.\n\n\n- `sourceFolderPath: string`\n The full path to the source folder you want to copy.\n\n\n- `includeVersions?: boolean`\n Option to copy all versions of files that are nested inside the selected folder. By default, only the current version of each file will be copied. When set to true, all versions of each file will be copied. Default value - `false`.\n\n\n### Returns\n\n- `{ jobId: string; }`\n Job submitted successfully. A `jobId` will be returned.\n\n - `jobId: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.copy({ destinationPath: '/path/of/destination/folder', sourceFolderPath: '/path/of/source/folder' });\n\nconsole.log(response);\n```",
|
|
1585
|
+
perLanguage: {
|
|
1586
|
+
cli: {
|
|
1587
|
+
method: 'folders copy',
|
|
1588
|
+
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",
|
|
1589
|
+
},
|
|
1590
|
+
csharp: {
|
|
1591
|
+
method: 'Folders.Copy',
|
|
1592
|
+
example: 'FolderCopyParams parameters = new()\n{\n DestinationPath = "/path/of/destination/folder",\n SourceFolderPath = "/path/of/source/folder",\n};\n\nvar response = await client.Folders.Copy(parameters);\n\nConsole.WriteLine(response);',
|
|
1593
|
+
},
|
|
1594
|
+
go: {
|
|
1595
|
+
method: 'client.Folders.Copy',
|
|
1596
|
+
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',
|
|
1597
|
+
},
|
|
1598
|
+
http: {
|
|
1599
|
+
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 }\'',
|
|
1600
|
+
},
|
|
1601
|
+
java: {
|
|
1602
|
+
method: 'folders().copy',
|
|
1603
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.folders.FolderCopyParams;\nimport com.imagekit.api.models.folders.FolderCopyResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FolderCopyParams params = FolderCopyParams.builder()\n .destinationPath("/path/of/destination/folder")\n .sourceFolderPath("/path/of/source/folder")\n .build();\n FolderCopyResponse response = client.folders().copy(params);\n }\n}',
|
|
1604
|
+
},
|
|
1605
|
+
php: {
|
|
1606
|
+
method: 'folders->copy',
|
|
1607
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->folders->copy(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n includeVersions: true,\n);\n\nvar_dump($response);",
|
|
1608
|
+
},
|
|
1609
|
+
python: {
|
|
1610
|
+
method: 'folders.copy',
|
|
1611
|
+
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)',
|
|
1612
|
+
},
|
|
1613
|
+
ruby: {
|
|
1614
|
+
method: 'folders.copy',
|
|
1615
|
+
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)',
|
|
1616
|
+
},
|
|
1617
|
+
typescript: {
|
|
1618
|
+
method: 'client.folders.copy',
|
|
1619
|
+
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);",
|
|
1620
|
+
},
|
|
1621
|
+
},
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
name: 'move',
|
|
1625
|
+
endpoint: '/v1/bulkJobs/moveFolder',
|
|
1626
|
+
httpMethod: 'post',
|
|
1627
|
+
summary: 'Move folder',
|
|
1628
|
+
description: 'This will move one folder into another. The selected folder, its nested folders, files, and their versions are moved in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.\n',
|
|
1629
|
+
stainlessPath: '(resource) folders > (method) move',
|
|
1630
|
+
qualified: 'client.folders.move',
|
|
1631
|
+
params: ['destinationPath: string;', 'sourceFolderPath: string;'],
|
|
1632
|
+
response: '{ jobId: string; }',
|
|
1633
|
+
markdown: "## move\n\n`client.folders.move(destinationPath: string, sourceFolderPath: string): { jobId: string; }`\n\n**post** `/v1/bulkJobs/moveFolder`\n\nThis will move one folder into another. The selected folder, its nested folders, files, and their versions are moved in this operation. Note: If any file at the destination has the same name as the source file, then the source file and its versions will be appended to the destination file version history.\n\n\n### Parameters\n\n- `destinationPath: string`\n Full path to the destination folder where you want to move the source folder into.\n\n\n- `sourceFolderPath: string`\n The full path to the source folder you want to move.\n\n\n### Returns\n\n- `{ jobId: string; }`\n Job submitted successfully. A `jobId` will be returned.\n\n - `jobId: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.move({ destinationPath: '/path/of/destination/folder', sourceFolderPath: '/path/of/source/folder' });\n\nconsole.log(response);\n```",
|
|
1634
|
+
perLanguage: {
|
|
1635
|
+
cli: {
|
|
1636
|
+
method: 'folders move',
|
|
1637
|
+
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",
|
|
1638
|
+
},
|
|
1639
|
+
csharp: {
|
|
1640
|
+
method: 'Folders.Move',
|
|
1641
|
+
example: 'FolderMoveParams parameters = new()\n{\n DestinationPath = "/path/of/destination/folder",\n SourceFolderPath = "/path/of/source/folder",\n};\n\nvar response = await client.Folders.Move(parameters);\n\nConsole.WriteLine(response);',
|
|
1642
|
+
},
|
|
1643
|
+
go: {
|
|
1644
|
+
method: 'client.Folders.Move',
|
|
1645
|
+
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',
|
|
1646
|
+
},
|
|
1647
|
+
http: {
|
|
1648
|
+
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 }\'',
|
|
1649
|
+
},
|
|
1650
|
+
java: {
|
|
1651
|
+
method: 'folders().move',
|
|
1652
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.folders.FolderMoveParams;\nimport com.imagekit.api.models.folders.FolderMoveResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FolderMoveParams params = FolderMoveParams.builder()\n .destinationPath("/path/of/destination/folder")\n .sourceFolderPath("/path/of/source/folder")\n .build();\n FolderMoveResponse response = client.folders().move(params);\n }\n}',
|
|
1653
|
+
},
|
|
1654
|
+
php: {
|
|
1655
|
+
method: 'folders->move',
|
|
1656
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->folders->move(\n destinationPath: '/path/of/destination/folder',\n sourceFolderPath: '/path/of/source/folder',\n);\n\nvar_dump($response);",
|
|
1657
|
+
},
|
|
1658
|
+
python: {
|
|
1659
|
+
method: 'folders.move',
|
|
1660
|
+
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)',
|
|
1661
|
+
},
|
|
1662
|
+
ruby: {
|
|
1663
|
+
method: 'folders.move',
|
|
1664
|
+
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)',
|
|
1665
|
+
},
|
|
1666
|
+
typescript: {
|
|
1667
|
+
method: 'client.folders.move',
|
|
1668
|
+
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);",
|
|
1669
|
+
},
|
|
1670
|
+
},
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
name: 'rename',
|
|
1674
|
+
endpoint: '/v1/bulkJobs/renameFolder',
|
|
1675
|
+
httpMethod: 'post',
|
|
1676
|
+
summary: 'Rename folder',
|
|
1677
|
+
description: 'This API allows you to rename an existing folder. The folder and all its nested assets and sub-folders will remain unchanged, but their paths will be updated to reflect the new folder name.\n',
|
|
1678
|
+
stainlessPath: '(resource) folders > (method) rename',
|
|
1679
|
+
qualified: 'client.folders.rename',
|
|
1680
|
+
params: ['folderPath: string;', 'newFolderName: string;', 'purgeCache?: boolean;'],
|
|
1681
|
+
response: '{ jobId: string; }',
|
|
1682
|
+
markdown: "## rename\n\n`client.folders.rename(folderPath: string, newFolderName: string, purgeCache?: boolean): { jobId: string; }`\n\n**post** `/v1/bulkJobs/renameFolder`\n\nThis API allows you to rename an existing folder. The folder and all its nested assets and sub-folders will remain unchanged, but their paths will be updated to reflect the new folder name.\n\n\n### Parameters\n\n- `folderPath: string`\n The full path to the folder you want to rename.\n\n\n- `newFolderName: string`\n The new name for the folder.\n\nAll characters except alphabets and numbers (inclusive of unicode letters, marks, and numerals in other languages) and `-` will be replaced by an underscore i.e. `_`.\n\n\n- `purgeCache?: boolean`\n Option to purge cache for the old nested files and their versions' URLs.\n\nWhen set to true, it will internally issue a purge cache request on CDN to remove the cached content of the old nested files and their versions. There will only be one purge request for all the nested files, which will be counted against your monthly purge quota.\n\nNote: A purge cache request will be issued against `https://ik.imagekit.io/old/folder/path*` (with a wildcard at the end). This will remove all nested files, their versions' URLs, and any transformations made using query parameters on these files or their versions. However, the cache for file transformations made using path parameters will persist. You can purge them using the purge API. For more details, refer to the purge API documentation.\n\nDefault value - `false`\n\n\n### Returns\n\n- `{ jobId: string; }`\n Job submitted successfully. A `jobId` will be returned.\n\n - `jobId: string`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.folders.rename({ folderPath: '/path/of/folder', newFolderName: 'new-folder-name' });\n\nconsole.log(response);\n```",
|
|
1683
|
+
perLanguage: {
|
|
1684
|
+
cli: {
|
|
1685
|
+
method: 'folders rename',
|
|
1686
|
+
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",
|
|
1687
|
+
},
|
|
1688
|
+
csharp: {
|
|
1689
|
+
method: 'Folders.Rename',
|
|
1690
|
+
example: 'FolderRenameParams parameters = new()\n{\n FolderPath = "/path/of/folder",\n NewFolderName = "new-folder-name",\n};\n\nvar response = await client.Folders.Rename(parameters);\n\nConsole.WriteLine(response);',
|
|
1691
|
+
},
|
|
1692
|
+
go: {
|
|
1693
|
+
method: 'client.Folders.Rename',
|
|
1694
|
+
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',
|
|
1695
|
+
},
|
|
1696
|
+
http: {
|
|
1697
|
+
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 }\'',
|
|
1698
|
+
},
|
|
1699
|
+
java: {
|
|
1700
|
+
method: 'folders().rename',
|
|
1701
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.folders.FolderRenameParams;\nimport com.imagekit.api.models.folders.FolderRenameResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FolderRenameParams params = FolderRenameParams.builder()\n .folderPath("/path/of/folder")\n .newFolderName("new-folder-name")\n .build();\n FolderRenameResponse response = client.folders().rename(params);\n }\n}',
|
|
1702
|
+
},
|
|
1703
|
+
php: {
|
|
1704
|
+
method: 'folders->rename',
|
|
1705
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->folders->rename(\n folderPath: '/path/of/folder',\n newFolderName: 'new-folder-name',\n purgeCache: true,\n);\n\nvar_dump($response);",
|
|
1706
|
+
},
|
|
1707
|
+
python: {
|
|
1708
|
+
method: 'folders.rename',
|
|
1709
|
+
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)',
|
|
1710
|
+
},
|
|
1711
|
+
ruby: {
|
|
1712
|
+
method: 'folders.rename',
|
|
1713
|
+
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)',
|
|
1714
|
+
},
|
|
1715
|
+
typescript: {
|
|
1716
|
+
method: 'client.folders.rename',
|
|
1717
|
+
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);",
|
|
1718
|
+
},
|
|
1719
|
+
},
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
name: 'get',
|
|
1723
|
+
endpoint: '/v1/bulkJobs/{jobId}',
|
|
1724
|
+
httpMethod: 'get',
|
|
1725
|
+
summary: 'Bulk job status',
|
|
1726
|
+
description: 'This API returns the status of a bulk job like copy and move folder operations.\n',
|
|
1727
|
+
stainlessPath: '(resource) folders.job > (method) get',
|
|
1728
|
+
qualified: 'client.folders.job.get',
|
|
1729
|
+
params: ['jobId: string;'],
|
|
1730
|
+
response: "{ jobId?: string; purgeRequestId?: string; status?: 'Pending' | 'Completed'; type?: 'COPY_FOLDER' | 'MOVE_FOLDER' | 'RENAME_FOLDER'; }",
|
|
1731
|
+
markdown: "## get\n\n`client.folders.job.get(jobId: string): { jobId?: string; purgeRequestId?: string; status?: 'Pending' | 'Completed'; type?: 'COPY_FOLDER' | 'MOVE_FOLDER' | 'RENAME_FOLDER'; }`\n\n**get** `/v1/bulkJobs/{jobId}`\n\nThis API returns the status of a bulk job like copy and move folder operations.\n\n\n### Parameters\n\n- `jobId: string`\n\n### Returns\n\n- `{ jobId?: string; purgeRequestId?: string; status?: 'Pending' | 'Completed'; type?: 'COPY_FOLDER' | 'MOVE_FOLDER' | 'RENAME_FOLDER'; }`\n\n - `jobId?: string`\n - `purgeRequestId?: string`\n - `status?: 'Pending' | 'Completed'`\n - `type?: 'COPY_FOLDER' | 'MOVE_FOLDER' | 'RENAME_FOLDER'`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst job = await client.folders.job.get('jobId');\n\nconsole.log(job);\n```",
|
|
1732
|
+
perLanguage: {
|
|
1733
|
+
cli: {
|
|
1734
|
+
method: 'job get',
|
|
1735
|
+
example: "imagekit folders:job get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --job-id jobId",
|
|
1736
|
+
},
|
|
1737
|
+
csharp: {
|
|
1738
|
+
method: 'Folders.Job.Get',
|
|
1739
|
+
example: 'JobGetParams parameters = new() { JobID = "jobId" };\n\nvar job = await client.Folders.Job.Get(parameters);\n\nConsole.WriteLine(job);',
|
|
1740
|
+
},
|
|
1741
|
+
go: {
|
|
1742
|
+
method: 'client.Folders.Job.Get',
|
|
1743
|
+
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',
|
|
1744
|
+
},
|
|
1745
|
+
http: {
|
|
1746
|
+
example: 'curl https://api.imagekit.io/v1/bulkJobs/$JOB_ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1747
|
+
},
|
|
1748
|
+
java: {
|
|
1749
|
+
method: 'folders().job().get',
|
|
1750
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.folders.job.JobGetParams;\nimport com.imagekit.api.models.folders.job.JobGetResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n JobGetResponse job = client.folders().job().get("jobId");\n }\n}',
|
|
1751
|
+
},
|
|
1752
|
+
php: {
|
|
1753
|
+
method: 'folders->job->get',
|
|
1754
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$job = $client->folders->job->get('jobId');\n\nvar_dump($job);",
|
|
1755
|
+
},
|
|
1756
|
+
python: {
|
|
1757
|
+
method: 'folders.job.get',
|
|
1758
|
+
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)',
|
|
1759
|
+
},
|
|
1760
|
+
ruby: {
|
|
1761
|
+
method: 'folders.job.get',
|
|
1762
|
+
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)',
|
|
1763
|
+
},
|
|
1764
|
+
typescript: {
|
|
1765
|
+
method: 'client.folders.job.get',
|
|
1766
|
+
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);",
|
|
1767
|
+
},
|
|
1768
|
+
},
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
name: 'get',
|
|
1772
|
+
endpoint: '/v1/accounts/usage',
|
|
1773
|
+
httpMethod: 'get',
|
|
1774
|
+
summary: 'Get account usage information',
|
|
1775
|
+
description: 'Get the account usage information between two dates. Note that the API response includes data from the start date while excluding data from the end date. In other words, the data covers the period starting from the specified start date up to, but not including, the end date.\n',
|
|
1776
|
+
stainlessPath: '(resource) accounts.usage > (method) get',
|
|
1777
|
+
qualified: 'client.accounts.usage.get',
|
|
1778
|
+
params: ['endDate: string;', 'startDate: string;'],
|
|
1779
|
+
response: '{ bandwidthBytes?: number; extensionUnitsCount?: number; mediaLibraryStorageBytes?: number; originalCacheStorageBytes?: number; videoProcessingUnitsCount?: number; }',
|
|
1780
|
+
markdown: "## get\n\n`client.accounts.usage.get(endDate: string, startDate: string): { bandwidthBytes?: number; extensionUnitsCount?: number; mediaLibraryStorageBytes?: number; originalCacheStorageBytes?: number; videoProcessingUnitsCount?: number; }`\n\n**get** `/v1/accounts/usage`\n\nGet the account usage information between two dates. Note that the API response includes data from the start date while excluding data from the end date. In other words, the data covers the period starting from the specified start date up to, but not including, the end date.\n\n\n### Parameters\n\n- `endDate: string`\n Specify a `endDate` in `YYYY-MM-DD` format. It should be after the `startDate`. The difference between `startDate` and `endDate` should be less than 90 days.\n\n- `startDate: string`\n Specify a `startDate` in `YYYY-MM-DD` format. It should be before the `endDate`. The difference between `startDate` and `endDate` should be less than 90 days.\n\n### Returns\n\n- `{ bandwidthBytes?: number; extensionUnitsCount?: number; mediaLibraryStorageBytes?: number; originalCacheStorageBytes?: number; videoProcessingUnitsCount?: number; }`\n\n - `bandwidthBytes?: number`\n - `extensionUnitsCount?: number`\n - `mediaLibraryStorageBytes?: number`\n - `originalCacheStorageBytes?: number`\n - `videoProcessingUnitsCount?: number`\n\n### Example\n\n```typescript\nimport 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);\n```",
|
|
1781
|
+
perLanguage: {
|
|
1782
|
+
cli: {
|
|
1783
|
+
method: 'usage get',
|
|
1784
|
+
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'\"",
|
|
1785
|
+
},
|
|
1786
|
+
csharp: {
|
|
1787
|
+
method: 'Accounts.Usage.Get',
|
|
1788
|
+
example: 'UsageGetParams parameters = new()\n{\n EndDate = "2019-12-27",\n StartDate = "2019-12-27",\n};\n\nvar usage = await client.Accounts.Usage.Get(parameters);\n\nConsole.WriteLine(usage);',
|
|
1789
|
+
},
|
|
1790
|
+
go: {
|
|
1791
|
+
method: 'client.Accounts.Usage.Get',
|
|
1792
|
+
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',
|
|
1793
|
+
},
|
|
1794
|
+
http: {
|
|
1795
|
+
example: 'curl https://api.imagekit.io/v1/accounts/usage \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1796
|
+
},
|
|
1797
|
+
java: {
|
|
1798
|
+
method: 'accounts().usage().get',
|
|
1799
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.usage.UsageGetParams;\nimport com.imagekit.api.models.accounts.usage.UsageGetResponse;\nimport java.time.LocalDate;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n UsageGetParams params = UsageGetParams.builder()\n .endDate(LocalDate.parse("2019-12-27"))\n .startDate(LocalDate.parse("2019-12-27"))\n .build();\n UsageGetResponse usage = client.accounts().usage().get(params);\n }\n}',
|
|
1800
|
+
},
|
|
1801
|
+
php: {
|
|
1802
|
+
method: 'accounts->usage->get',
|
|
1803
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$usage = $client->accounts->usage->get(\n endDate: '2019-12-27', startDate: '2019-12-27'\n);\n\nvar_dump($usage);",
|
|
1804
|
+
},
|
|
1805
|
+
python: {
|
|
1806
|
+
method: 'accounts.usage.get',
|
|
1807
|
+
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)',
|
|
1808
|
+
},
|
|
1809
|
+
ruby: {
|
|
1810
|
+
method: 'accounts.usage.get',
|
|
1811
|
+
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)',
|
|
1812
|
+
},
|
|
1813
|
+
typescript: {
|
|
1814
|
+
method: 'client.accounts.usage.get',
|
|
1815
|
+
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);",
|
|
1816
|
+
},
|
|
1817
|
+
},
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
name: 'list',
|
|
1821
|
+
endpoint: '/v1/accounts/origins',
|
|
1822
|
+
httpMethod: 'get',
|
|
1823
|
+
summary: 'List origins',
|
|
1824
|
+
description: '**Note:** This API is currently in beta. \nReturns an array of all configured origins for the current account.\n',
|
|
1825
|
+
stainlessPath: '(resource) accounts.origins > (method) list',
|
|
1826
|
+
qualified: 'client.accounts.origins.list',
|
|
1827
|
+
response: 'object | object | object | object | object | object | object | object[]',
|
|
1828
|
+
markdown: "## list\n\n`client.accounts.origins.list(): object | object | object | object | object | object | object | object[]`\n\n**get** `/v1/accounts/origins`\n\n**Note:** This API is currently in beta. \nReturns an array of all configured origins for the current account.\n\n\n### Returns\n\n- `{ id: string; bucket: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'S3'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; endpoint: string; includeCanonicalHeader: boolean; name: string; prefix: string; s3ForcePathStyle: boolean; type: 'S3_COMPATIBLE'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'CLOUDINARY_BACKUP'; baseUrlForCanonicalHeader?: string; } | { id: string; baseUrl: string; forwardHostHeaderToOrigin: boolean; includeCanonicalHeader: boolean; name: string; type: 'WEB_FOLDER'; baseUrlForCanonicalHeader?: string; } | { id: string; includeCanonicalHeader: boolean; name: string; type: 'WEB_PROXY'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; clientEmail: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'GCS'; baseUrlForCanonicalHeader?: string; } | { id: string; accountName: string; container: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'AZURE_BLOB'; baseUrlForCanonicalHeader?: string; } | { id: string; baseUrl: string; includeCanonicalHeader: boolean; name: string; type: 'AKENEO_PIM'; baseUrlForCanonicalHeader?: string; }[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponses = await client.accounts.origins.list();\n\nconsole.log(originResponses);\n```",
|
|
1829
|
+
perLanguage: {
|
|
1830
|
+
cli: {
|
|
1831
|
+
method: 'origins list',
|
|
1832
|
+
example: "imagekit accounts:origins list \\\n --private-key 'My Private Key' \\\n --password 'My Password'",
|
|
1833
|
+
},
|
|
1834
|
+
csharp: {
|
|
1835
|
+
method: 'Accounts.Origins.List',
|
|
1836
|
+
example: 'OriginListParams parameters = new();\n\nvar originResponses = await client.Accounts.Origins.List(parameters);\n\nConsole.WriteLine(originResponses);',
|
|
1837
|
+
},
|
|
1838
|
+
go: {
|
|
1839
|
+
method: 'client.Accounts.Origins.List',
|
|
1840
|
+
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',
|
|
1841
|
+
},
|
|
1842
|
+
http: {
|
|
1843
|
+
example: 'curl https://api.imagekit.io/v1/accounts/origins \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1844
|
+
},
|
|
1845
|
+
java: {
|
|
1846
|
+
method: 'accounts().origins().list',
|
|
1847
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.origins.OriginListParams;\nimport com.imagekit.api.models.accounts.origins.OriginResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n List<OriginResponse> originResponses = client.accounts().origins().list();\n }\n}',
|
|
1848
|
+
},
|
|
1849
|
+
php: {
|
|
1850
|
+
method: 'accounts->origins->list',
|
|
1851
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$originResponses = $client->accounts->origins->list();\n\nvar_dump($originResponses);",
|
|
1852
|
+
},
|
|
1853
|
+
python: {
|
|
1854
|
+
method: 'accounts.origins.list',
|
|
1855
|
+
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)',
|
|
1856
|
+
},
|
|
1857
|
+
ruby: {
|
|
1858
|
+
method: 'accounts.origins.list',
|
|
1859
|
+
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)',
|
|
1860
|
+
},
|
|
1861
|
+
typescript: {
|
|
1862
|
+
method: 'client.accounts.origins.list',
|
|
1863
|
+
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);",
|
|
1864
|
+
},
|
|
1865
|
+
},
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
name: 'create',
|
|
1869
|
+
endpoint: '/v1/accounts/origins',
|
|
1870
|
+
httpMethod: 'post',
|
|
1871
|
+
summary: 'Create origin',
|
|
1872
|
+
description: '**Note:** This API is currently in beta. \nCreates a new origin and returns the origin object.\n',
|
|
1873
|
+
stainlessPath: '(resource) accounts.origins > (method) create',
|
|
1874
|
+
qualified: 'client.accounts.origins.create',
|
|
1875
|
+
params: [
|
|
1876
|
+
"OriginRequest: { accessKey: string; bucket: string; name: string; secretKey: string; type: 'S3'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { accessKey: string; bucket: string; endpoint: string; name: string; secretKey: string; type: 'S3_COMPATIBLE'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; s3ForcePathStyle?: boolean; } | { accessKey: string; bucket: string; name: string; secretKey: string; type: 'CLOUDINARY_BACKUP'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { baseUrl: string; name: string; type: 'WEB_FOLDER'; baseUrlForCanonicalHeader?: string; forwardHostHeaderToOrigin?: boolean; includeCanonicalHeader?: boolean; } | { name: string; type: 'WEB_PROXY'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; } | { bucket: string; clientEmail: string; name: string; privateKey: string; type: 'GCS'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { accountName: string; container: string; name: string; sasToken: string; type: 'AZURE_BLOB'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { baseUrl: string; clientId: string; clientSecret: string; name: string; password: string; type: 'AKENEO_PIM'; username: string; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; };",
|
|
1877
|
+
],
|
|
1878
|
+
response: 'object | object | object | object | object | object | object | object',
|
|
1879
|
+
perLanguage: {
|
|
1880
|
+
cli: {
|
|
1881
|
+
method: 'origins create',
|
|
1882
|
+
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",
|
|
1883
|
+
},
|
|
1884
|
+
csharp: {
|
|
1885
|
+
method: 'Accounts.Origins.Create',
|
|
1886
|
+
example: 'OriginCreateParams parameters = new()\n{\n OriginRequest = new S3()\n {\n AccessKey = "AKIATEST123",\n Bucket = "test-bucket",\n Name = "My S3 Origin",\n SecretKey = "secrettest123",\n BaseUrlForCanonicalHeader = "https://cdn.example.com",\n IncludeCanonicalHeader = false,\n Prefix = "images",\n },\n};\n\nvar originResponse = await client.Accounts.Origins.Create(parameters);\n\nConsole.WriteLine(originResponse);',
|
|
1887
|
+
},
|
|
1888
|
+
go: {
|
|
1889
|
+
method: 'client.Accounts.Origins.New',
|
|
1890
|
+
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',
|
|
1891
|
+
},
|
|
1892
|
+
http: {
|
|
1893
|
+
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 }\'',
|
|
1894
|
+
},
|
|
1895
|
+
java: {
|
|
1896
|
+
method: 'accounts().origins().create',
|
|
1897
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.origins.OriginCreateParams;\nimport com.imagekit.api.models.accounts.origins.OriginRequest;\nimport com.imagekit.api.models.accounts.origins.OriginResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n OriginRequest.S3 params = OriginRequest.S3.builder()\n .accessKey("AKIATEST123")\n .bucket("test-bucket")\n .name("My S3 Origin")\n .secretKey("secrettest123")\n .build();\n OriginResponse originResponse = client.accounts().origins().create(params);\n }\n}',
|
|
1898
|
+
},
|
|
1899
|
+
php: {
|
|
1900
|
+
method: 'accounts->origins->create',
|
|
1901
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$originResponse = $client->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);",
|
|
1902
|
+
},
|
|
1903
|
+
python: {
|
|
1904
|
+
method: 'accounts.origins.create',
|
|
1905
|
+
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)',
|
|
1906
|
+
},
|
|
1907
|
+
ruby: {
|
|
1908
|
+
method: 'accounts.origins.create',
|
|
1909
|
+
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)',
|
|
1910
|
+
},
|
|
1911
|
+
typescript: {
|
|
1912
|
+
method: 'client.accounts.origins.create',
|
|
1913
|
+
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);",
|
|
1914
|
+
},
|
|
1915
|
+
},
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
name: 'get',
|
|
1919
|
+
endpoint: '/v1/accounts/origins/{id}',
|
|
1920
|
+
httpMethod: 'get',
|
|
1921
|
+
summary: 'Get origin',
|
|
1922
|
+
description: '**Note:** This API is currently in beta. \nRetrieves the origin identified by `id`.\n',
|
|
1923
|
+
stainlessPath: '(resource) accounts.origins > (method) get',
|
|
1924
|
+
qualified: 'client.accounts.origins.get',
|
|
1925
|
+
params: ['id: string;'],
|
|
1926
|
+
response: 'object | object | object | object | object | object | object | object',
|
|
1927
|
+
markdown: "## get\n\n`client.accounts.origins.get(id: string): { id: string; bucket: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'S3'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; endpoint: string; includeCanonicalHeader: boolean; name: string; prefix: string; s3ForcePathStyle: boolean; type: 'S3_COMPATIBLE'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'CLOUDINARY_BACKUP'; baseUrlForCanonicalHeader?: string; } | { id: string; baseUrl: string; forwardHostHeaderToOrigin: boolean; includeCanonicalHeader: boolean; name: string; type: 'WEB_FOLDER'; baseUrlForCanonicalHeader?: string; } | { id: string; includeCanonicalHeader: boolean; name: string; type: 'WEB_PROXY'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; clientEmail: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'GCS'; baseUrlForCanonicalHeader?: string; } | { id: string; accountName: string; container: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'AZURE_BLOB'; baseUrlForCanonicalHeader?: string; } | { id: string; baseUrl: string; includeCanonicalHeader: boolean; name: string; type: 'AKENEO_PIM'; baseUrlForCanonicalHeader?: string; }`\n\n**get** `/v1/accounts/origins/{id}`\n\n**Note:** This API is currently in beta. \nRetrieves the origin identified by `id`.\n\n\n### Parameters\n\n- `id: string`\n Unique identifier for the origin. This is generated by ImageKit when you create a new origin.\n\n### Returns\n\n- `{ id: string; bucket: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'S3'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; endpoint: string; includeCanonicalHeader: boolean; name: string; prefix: string; s3ForcePathStyle: boolean; type: 'S3_COMPATIBLE'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'CLOUDINARY_BACKUP'; baseUrlForCanonicalHeader?: string; } | { id: string; baseUrl: string; forwardHostHeaderToOrigin: boolean; includeCanonicalHeader: boolean; name: string; type: 'WEB_FOLDER'; baseUrlForCanonicalHeader?: string; } | { id: string; includeCanonicalHeader: boolean; name: string; type: 'WEB_PROXY'; baseUrlForCanonicalHeader?: string; } | { id: string; bucket: string; clientEmail: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'GCS'; baseUrlForCanonicalHeader?: string; } | { id: string; accountName: string; container: string; includeCanonicalHeader: boolean; name: string; prefix: string; type: 'AZURE_BLOB'; baseUrlForCanonicalHeader?: string; } | { id: string; baseUrl: string; includeCanonicalHeader: boolean; name: string; type: 'AKENEO_PIM'; baseUrlForCanonicalHeader?: string; }`\n Origin object as returned by the API (sensitive fields removed).\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst originResponse = await client.accounts.origins.get('id');\n\nconsole.log(originResponse);\n```",
|
|
1928
|
+
perLanguage: {
|
|
1929
|
+
cli: {
|
|
1930
|
+
method: 'origins get',
|
|
1931
|
+
example: "imagekit accounts:origins get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
1932
|
+
},
|
|
1933
|
+
csharp: {
|
|
1934
|
+
method: 'Accounts.Origins.Get',
|
|
1935
|
+
example: 'OriginGetParams parameters = new() { ID = "id" };\n\nvar originResponse = await client.Accounts.Origins.Get(parameters);\n\nConsole.WriteLine(originResponse);',
|
|
1936
|
+
},
|
|
1937
|
+
go: {
|
|
1938
|
+
method: 'client.Accounts.Origins.Get',
|
|
1939
|
+
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',
|
|
1940
|
+
},
|
|
1941
|
+
http: {
|
|
1942
|
+
example: 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
1943
|
+
},
|
|
1944
|
+
java: {
|
|
1945
|
+
method: 'accounts().origins().get',
|
|
1946
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.origins.OriginGetParams;\nimport com.imagekit.api.models.accounts.origins.OriginResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n OriginResponse originResponse = client.accounts().origins().get("id");\n }\n}',
|
|
1947
|
+
},
|
|
1948
|
+
php: {
|
|
1949
|
+
method: 'accounts->origins->get',
|
|
1950
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$originResponse = $client->accounts->origins->get('id');\n\nvar_dump($originResponse);",
|
|
1951
|
+
},
|
|
1952
|
+
python: {
|
|
1953
|
+
method: 'accounts.origins.get',
|
|
1954
|
+
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)',
|
|
1955
|
+
},
|
|
1956
|
+
ruby: {
|
|
1957
|
+
method: 'accounts.origins.get',
|
|
1958
|
+
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)',
|
|
1959
|
+
},
|
|
1960
|
+
typescript: {
|
|
1961
|
+
method: 'client.accounts.origins.get',
|
|
1962
|
+
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);",
|
|
1963
|
+
},
|
|
1964
|
+
},
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
name: 'update',
|
|
1968
|
+
endpoint: '/v1/accounts/origins/{id}',
|
|
1969
|
+
httpMethod: 'put',
|
|
1970
|
+
summary: 'Update origin',
|
|
1971
|
+
description: '**Note:** This API is currently in beta. \nUpdates the origin identified by `id` and returns the updated origin object.\n',
|
|
1972
|
+
stainlessPath: '(resource) accounts.origins > (method) update',
|
|
1973
|
+
qualified: 'client.accounts.origins.update',
|
|
1974
|
+
params: [
|
|
1975
|
+
'id: string;',
|
|
1976
|
+
"OriginRequest: { accessKey: string; bucket: string; name: string; secretKey: string; type: 'S3'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { accessKey: string; bucket: string; endpoint: string; name: string; secretKey: string; type: 'S3_COMPATIBLE'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; s3ForcePathStyle?: boolean; } | { accessKey: string; bucket: string; name: string; secretKey: string; type: 'CLOUDINARY_BACKUP'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { baseUrl: string; name: string; type: 'WEB_FOLDER'; baseUrlForCanonicalHeader?: string; forwardHostHeaderToOrigin?: boolean; includeCanonicalHeader?: boolean; } | { name: string; type: 'WEB_PROXY'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; } | { bucket: string; clientEmail: string; name: string; privateKey: string; type: 'GCS'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { accountName: string; container: string; name: string; sasToken: string; type: 'AZURE_BLOB'; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; prefix?: string; } | { baseUrl: string; clientId: string; clientSecret: string; name: string; password: string; type: 'AKENEO_PIM'; username: string; baseUrlForCanonicalHeader?: string; includeCanonicalHeader?: boolean; };",
|
|
1977
|
+
],
|
|
1978
|
+
response: 'object | object | object | object | object | object | object | object',
|
|
1979
|
+
perLanguage: {
|
|
1980
|
+
cli: {
|
|
1981
|
+
method: 'origins update',
|
|
1982
|
+
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",
|
|
1983
|
+
},
|
|
1984
|
+
csharp: {
|
|
1985
|
+
method: 'Accounts.Origins.Update',
|
|
1986
|
+
example: 'OriginUpdateParams parameters = new()\n{\n ID = "id",\n OriginRequest = new S3()\n {\n AccessKey = "AKIATEST123",\n Bucket = "test-bucket",\n Name = "My S3 Origin",\n SecretKey = "secrettest123",\n BaseUrlForCanonicalHeader = "https://cdn.example.com",\n IncludeCanonicalHeader = false,\n Prefix = "images",\n },\n};\n\nvar originResponse = await client.Accounts.Origins.Update(parameters);\n\nConsole.WriteLine(originResponse);',
|
|
1987
|
+
},
|
|
1988
|
+
go: {
|
|
1989
|
+
method: 'client.Accounts.Origins.Update',
|
|
1990
|
+
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',
|
|
1991
|
+
},
|
|
1992
|
+
http: {
|
|
1993
|
+
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 }\'',
|
|
1994
|
+
},
|
|
1995
|
+
java: {
|
|
1996
|
+
method: 'accounts().origins().update',
|
|
1997
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.origins.OriginRequest;\nimport com.imagekit.api.models.accounts.origins.OriginResponse;\nimport com.imagekit.api.models.accounts.origins.OriginUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n OriginUpdateParams params = OriginUpdateParams.builder()\n .id("id")\n .originRequest(OriginRequest.S3.builder()\n .accessKey("AKIATEST123")\n .bucket("test-bucket")\n .name("My S3 Origin")\n .secretKey("secrettest123")\n .build())\n .build();\n OriginResponse originResponse = client.accounts().origins().update(params);\n }\n}',
|
|
1998
|
+
},
|
|
1999
|
+
php: {
|
|
2000
|
+
method: 'accounts->origins->update',
|
|
2001
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$originResponse = $client->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);",
|
|
2002
|
+
},
|
|
2003
|
+
python: {
|
|
2004
|
+
method: 'accounts.origins.update',
|
|
2005
|
+
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)',
|
|
2006
|
+
},
|
|
2007
|
+
ruby: {
|
|
2008
|
+
method: 'accounts.origins.update',
|
|
2009
|
+
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)',
|
|
2010
|
+
},
|
|
2011
|
+
typescript: {
|
|
2012
|
+
method: 'client.accounts.origins.update',
|
|
2013
|
+
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);",
|
|
2014
|
+
},
|
|
2015
|
+
},
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
name: 'delete',
|
|
2019
|
+
endpoint: '/v1/accounts/origins/{id}',
|
|
2020
|
+
httpMethod: 'delete',
|
|
2021
|
+
summary: 'Delete origin',
|
|
2022
|
+
description: '**Note:** This API is currently in beta. \nPermanently removes the origin identified by `id`. If the origin is in use by any URL‑endpoints, the API will return an error.\n',
|
|
2023
|
+
stainlessPath: '(resource) accounts.origins > (method) delete',
|
|
2024
|
+
qualified: 'client.accounts.origins.delete',
|
|
2025
|
+
params: ['id: string;'],
|
|
2026
|
+
markdown: "## delete\n\n`client.accounts.origins.delete(id: string): void`\n\n**delete** `/v1/accounts/origins/{id}`\n\n**Note:** This API is currently in beta. \nPermanently removes the origin identified by `id`. If the origin is in use by any URL‑endpoints, the API will return an error.\n\n\n### Parameters\n\n- `id: string`\n Unique identifier for the origin. This is generated by ImageKit when you create a new origin.\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.accounts.origins.delete('id')\n```",
|
|
2027
|
+
perLanguage: {
|
|
2028
|
+
cli: {
|
|
2029
|
+
method: 'origins delete',
|
|
2030
|
+
example: "imagekit accounts:origins delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
2031
|
+
},
|
|
2032
|
+
csharp: {
|
|
2033
|
+
method: 'Accounts.Origins.Delete',
|
|
2034
|
+
example: 'OriginDeleteParams parameters = new() { ID = "id" };\n\nawait client.Accounts.Origins.Delete(parameters);',
|
|
2035
|
+
},
|
|
2036
|
+
go: {
|
|
2037
|
+
method: 'client.Accounts.Origins.Delete',
|
|
2038
|
+
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',
|
|
2039
|
+
},
|
|
2040
|
+
http: {
|
|
2041
|
+
example: 'curl https://api.imagekit.io/v1/accounts/origins/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
2042
|
+
},
|
|
2043
|
+
java: {
|
|
2044
|
+
method: 'accounts().origins().delete',
|
|
2045
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.origins.OriginDeleteParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n client.accounts().origins().delete("id");\n }\n}',
|
|
2046
|
+
},
|
|
2047
|
+
php: {
|
|
2048
|
+
method: 'accounts->origins->delete',
|
|
2049
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$result = $client->accounts->origins->delete('id');\n\nvar_dump($result);",
|
|
2050
|
+
},
|
|
2051
|
+
python: {
|
|
2052
|
+
method: 'accounts.origins.delete',
|
|
2053
|
+
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)',
|
|
2054
|
+
},
|
|
2055
|
+
ruby: {
|
|
2056
|
+
method: 'accounts.origins.delete',
|
|
2057
|
+
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)',
|
|
2058
|
+
},
|
|
2059
|
+
typescript: {
|
|
2060
|
+
method: 'client.accounts.origins.delete',
|
|
2061
|
+
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');",
|
|
2062
|
+
},
|
|
2063
|
+
},
|
|
2064
|
+
},
|
|
2065
|
+
{
|
|
2066
|
+
name: 'list',
|
|
2067
|
+
endpoint: '/v1/accounts/url-endpoints',
|
|
2068
|
+
httpMethod: 'get',
|
|
2069
|
+
summary: 'List URL‑endpoints',
|
|
2070
|
+
description: '**Note:** This API is currently in beta. \nReturns an array of all URL‑endpoints configured including the default URL-endpoint generated by ImageKit during account creation.\n',
|
|
2071
|
+
stainlessPath: '(resource) accounts.urlEndpoints > (method) list',
|
|
2072
|
+
qualified: 'client.accounts.urlEndpoints.list',
|
|
2073
|
+
response: "{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }[]",
|
|
2074
|
+
markdown: "## list\n\n`client.accounts.urlEndpoints.list(): object[]`\n\n**get** `/v1/accounts/url-endpoints`\n\n**Note:** This API is currently in beta. \nReturns an array of all URL‑endpoints configured including the default URL-endpoint generated by ImageKit during account creation.\n\n\n### Returns\n\n- `{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }[]`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponses = await client.accounts.urlEndpoints.list();\n\nconsole.log(urlEndpointResponses);\n```",
|
|
2075
|
+
perLanguage: {
|
|
2076
|
+
cli: {
|
|
2077
|
+
method: 'urlEndpoints list',
|
|
2078
|
+
example: "imagekit accounts:url-endpoints list \\\n --private-key 'My Private Key' \\\n --password 'My Password'",
|
|
2079
|
+
},
|
|
2080
|
+
csharp: {
|
|
2081
|
+
method: 'Accounts.UrlEndpoints.List',
|
|
2082
|
+
example: 'UrlEndpointListParams parameters = new();\n\nvar urlEndpointResponses = await client.Accounts.UrlEndpoints.List(parameters);\n\nConsole.WriteLine(urlEndpointResponses);',
|
|
2083
|
+
},
|
|
2084
|
+
go: {
|
|
2085
|
+
method: 'client.Accounts.URLEndpoints.List',
|
|
2086
|
+
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',
|
|
2087
|
+
},
|
|
2088
|
+
http: {
|
|
2089
|
+
example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
2090
|
+
},
|
|
2091
|
+
java: {
|
|
2092
|
+
method: 'accounts().urlEndpoints().list',
|
|
2093
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointListParams;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n List<UrlEndpointResponse> urlEndpointResponses = client.accounts().urlEndpoints().list();\n }\n}',
|
|
2094
|
+
},
|
|
2095
|
+
php: {
|
|
2096
|
+
method: 'accounts->urlEndpoints->list',
|
|
2097
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$urlEndpointResponses = $client->accounts->urlEndpoints->list();\n\nvar_dump($urlEndpointResponses);",
|
|
2098
|
+
},
|
|
2099
|
+
python: {
|
|
2100
|
+
method: 'accounts.url_endpoints.list',
|
|
2101
|
+
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)',
|
|
2102
|
+
},
|
|
2103
|
+
ruby: {
|
|
2104
|
+
method: 'accounts.url_endpoints.list',
|
|
2105
|
+
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)',
|
|
2106
|
+
},
|
|
2107
|
+
typescript: {
|
|
2108
|
+
method: 'client.accounts.urlEndpoints.list',
|
|
2109
|
+
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);",
|
|
2110
|
+
},
|
|
2111
|
+
},
|
|
2112
|
+
},
|
|
2113
|
+
{
|
|
2114
|
+
name: 'create',
|
|
2115
|
+
endpoint: '/v1/accounts/url-endpoints',
|
|
2116
|
+
httpMethod: 'post',
|
|
2117
|
+
summary: 'Create URL‑endpoint',
|
|
2118
|
+
description: '**Note:** This API is currently in beta. \nCreates a new URL‑endpoint and returns the resulting object.\n',
|
|
2119
|
+
stainlessPath: '(resource) accounts.urlEndpoints > (method) create',
|
|
2120
|
+
qualified: 'client.accounts.urlEndpoints.create',
|
|
2121
|
+
params: [
|
|
2122
|
+
'description: string;',
|
|
2123
|
+
'origins?: string[];',
|
|
2124
|
+
'urlPrefix?: string;',
|
|
2125
|
+
"urlRewriter?: { type: 'CLOUDINARY'; preserveAssetDeliveryTypes?: boolean; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; };",
|
|
2126
|
+
],
|
|
2127
|
+
response: "{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }",
|
|
2128
|
+
markdown: "## create\n\n`client.accounts.urlEndpoints.create(description: string, origins?: string[], urlPrefix?: string, urlRewriter?: { type: 'CLOUDINARY'; preserveAssetDeliveryTypes?: boolean; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }): { id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: object | object | object; }`\n\n**post** `/v1/accounts/url-endpoints`\n\n**Note:** This API is currently in beta. \nCreates a new URL‑endpoint and returns the resulting object.\n\n\n### Parameters\n\n- `description: string`\n Description of the URL endpoint.\n\n- `origins?: string[]`\n Ordered list of origin IDs to try when the file isn’t in the Media Library; ImageKit checks them in the sequence provided. Origin must be created before it can be used in a URL endpoint.\n\n- `urlPrefix?: string`\n Path segment appended to your base URL to form the endpoint (letters, digits, and hyphens only — or empty for the default endpoint).\n\n- `urlRewriter?: { type: 'CLOUDINARY'; preserveAssetDeliveryTypes?: boolean; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }`\n Configuration for third-party URL rewriting.\n\n### Returns\n\n- `{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }`\n URL‑endpoint object as returned by the API.\n\n - `id: string`\n - `description: string`\n - `origins: string[]`\n - `urlPrefix: string`\n - `urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.create({ description: 'My custom URL endpoint' });\n\nconsole.log(urlEndpointResponse);\n```",
|
|
2129
|
+
perLanguage: {
|
|
2130
|
+
cli: {
|
|
2131
|
+
method: 'urlEndpoints create',
|
|
2132
|
+
example: "imagekit accounts:url-endpoints create \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --description 'My custom URL endpoint'",
|
|
2133
|
+
},
|
|
2134
|
+
csharp: {
|
|
2135
|
+
method: 'Accounts.UrlEndpoints.Create',
|
|
2136
|
+
example: 'UrlEndpointCreateParams parameters = new()\n{\n Description = "My custom URL endpoint"\n};\n\nvar urlEndpointResponse = await client.Accounts.UrlEndpoints.Create(parameters);\n\nConsole.WriteLine(urlEndpointResponse);',
|
|
2137
|
+
},
|
|
2138
|
+
go: {
|
|
2139
|
+
method: 'client.Accounts.URLEndpoints.New',
|
|
2140
|
+
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',
|
|
2141
|
+
},
|
|
2142
|
+
http: {
|
|
2143
|
+
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 }\'',
|
|
2144
|
+
},
|
|
2145
|
+
java: {
|
|
2146
|
+
method: 'accounts().urlEndpoints().create',
|
|
2147
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointCreateParams;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointRequest;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n UrlEndpointRequest params = UrlEndpointRequest.builder()\n .description("My custom URL endpoint")\n .build();\n UrlEndpointResponse urlEndpointResponse = client.accounts().urlEndpoints().create(params);\n }\n}',
|
|
2148
|
+
},
|
|
2149
|
+
php: {
|
|
2150
|
+
method: 'accounts->urlEndpoints->create',
|
|
2151
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$urlEndpointResponse = $client->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);",
|
|
2152
|
+
},
|
|
2153
|
+
python: {
|
|
2154
|
+
method: 'accounts.url_endpoints.create',
|
|
2155
|
+
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)',
|
|
2156
|
+
},
|
|
2157
|
+
ruby: {
|
|
2158
|
+
method: 'accounts.url_endpoints.create',
|
|
2159
|
+
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)',
|
|
2160
|
+
},
|
|
2161
|
+
typescript: {
|
|
2162
|
+
method: 'client.accounts.urlEndpoints.create',
|
|
2163
|
+
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);",
|
|
2164
|
+
},
|
|
2165
|
+
},
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
name: 'get',
|
|
2169
|
+
endpoint: '/v1/accounts/url-endpoints/{id}',
|
|
2170
|
+
httpMethod: 'get',
|
|
2171
|
+
summary: 'Get URL‑endpoint',
|
|
2172
|
+
description: '**Note:** This API is currently in beta. \nRetrieves the URL‑endpoint identified by `id`.\n',
|
|
2173
|
+
stainlessPath: '(resource) accounts.urlEndpoints > (method) get',
|
|
2174
|
+
qualified: 'client.accounts.urlEndpoints.get',
|
|
2175
|
+
params: ['id: string;'],
|
|
2176
|
+
response: "{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }",
|
|
2177
|
+
markdown: "## get\n\n`client.accounts.urlEndpoints.get(id: string): { id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: object | object | object; }`\n\n**get** `/v1/accounts/url-endpoints/{id}`\n\n**Note:** This API is currently in beta. \nRetrieves the URL‑endpoint identified by `id`.\n\n\n### Parameters\n\n- `id: string`\n Unique identifier for the URL-endpoint. This is generated by ImageKit when you create a new URL-endpoint. For the default URL-endpoint, this is always `default`.\n\n### Returns\n\n- `{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }`\n URL‑endpoint object as returned by the API.\n\n - `id: string`\n - `description: string`\n - `origins: string[]`\n - `urlPrefix: string`\n - `urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.get('id');\n\nconsole.log(urlEndpointResponse);\n```",
|
|
2178
|
+
perLanguage: {
|
|
2179
|
+
cli: {
|
|
2180
|
+
method: 'urlEndpoints get',
|
|
2181
|
+
example: "imagekit accounts:url-endpoints get \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
2182
|
+
},
|
|
2183
|
+
csharp: {
|
|
2184
|
+
method: 'Accounts.UrlEndpoints.Get',
|
|
2185
|
+
example: 'UrlEndpointGetParams parameters = new() { ID = "id" };\n\nvar urlEndpointResponse = await client.Accounts.UrlEndpoints.Get(parameters);\n\nConsole.WriteLine(urlEndpointResponse);',
|
|
2186
|
+
},
|
|
2187
|
+
go: {
|
|
2188
|
+
method: 'client.Accounts.URLEndpoints.Get',
|
|
2189
|
+
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',
|
|
2190
|
+
},
|
|
2191
|
+
http: {
|
|
2192
|
+
example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
2193
|
+
},
|
|
2194
|
+
java: {
|
|
2195
|
+
method: 'accounts().urlEndpoints().get',
|
|
2196
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointGetParams;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n UrlEndpointResponse urlEndpointResponse = client.accounts().urlEndpoints().get("id");\n }\n}',
|
|
2197
|
+
},
|
|
2198
|
+
php: {
|
|
2199
|
+
method: 'accounts->urlEndpoints->get',
|
|
2200
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$urlEndpointResponse = $client->accounts->urlEndpoints->get('id');\n\nvar_dump($urlEndpointResponse);",
|
|
2201
|
+
},
|
|
2202
|
+
python: {
|
|
2203
|
+
method: 'accounts.url_endpoints.get',
|
|
2204
|
+
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)',
|
|
2205
|
+
},
|
|
2206
|
+
ruby: {
|
|
2207
|
+
method: 'accounts.url_endpoints.get',
|
|
2208
|
+
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)',
|
|
2209
|
+
},
|
|
2210
|
+
typescript: {
|
|
2211
|
+
method: 'client.accounts.urlEndpoints.get',
|
|
2212
|
+
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);",
|
|
2213
|
+
},
|
|
2214
|
+
},
|
|
2215
|
+
},
|
|
2216
|
+
{
|
|
2217
|
+
name: 'update',
|
|
2218
|
+
endpoint: '/v1/accounts/url-endpoints/{id}',
|
|
2219
|
+
httpMethod: 'put',
|
|
2220
|
+
summary: 'Update URL‑endpoint',
|
|
2221
|
+
description: '**Note:** This API is currently in beta. \nUpdates the URL‑endpoint identified by `id` and returns the updated object.\n',
|
|
2222
|
+
stainlessPath: '(resource) accounts.urlEndpoints > (method) update',
|
|
2223
|
+
qualified: 'client.accounts.urlEndpoints.update',
|
|
2224
|
+
params: [
|
|
2225
|
+
'id: string;',
|
|
2226
|
+
'description: string;',
|
|
2227
|
+
'origins?: string[];',
|
|
2228
|
+
'urlPrefix?: string;',
|
|
2229
|
+
"urlRewriter?: { type: 'CLOUDINARY'; preserveAssetDeliveryTypes?: boolean; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; };",
|
|
2230
|
+
],
|
|
2231
|
+
response: "{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }",
|
|
2232
|
+
markdown: "## update\n\n`client.accounts.urlEndpoints.update(id: string, description: string, origins?: string[], urlPrefix?: string, urlRewriter?: { type: 'CLOUDINARY'; preserveAssetDeliveryTypes?: boolean; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }): { id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: object | object | object; }`\n\n**put** `/v1/accounts/url-endpoints/{id}`\n\n**Note:** This API is currently in beta. \nUpdates the URL‑endpoint identified by `id` and returns the updated object.\n\n\n### Parameters\n\n- `id: string`\n Unique identifier for the URL-endpoint. This is generated by ImageKit when you create a new URL-endpoint. For the default URL-endpoint, this is always `default`.\n\n- `description: string`\n Description of the URL endpoint.\n\n- `origins?: string[]`\n Ordered list of origin IDs to try when the file isn’t in the Media Library; ImageKit checks them in the sequence provided. Origin must be created before it can be used in a URL endpoint.\n\n- `urlPrefix?: string`\n Path segment appended to your base URL to form the endpoint (letters, digits, and hyphens only — or empty for the default endpoint).\n\n- `urlRewriter?: { type: 'CLOUDINARY'; preserveAssetDeliveryTypes?: boolean; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }`\n Configuration for third-party URL rewriting.\n\n### Returns\n\n- `{ id: string; description: string; origins: string[]; urlPrefix: string; urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }; }`\n URL‑endpoint object as returned by the API.\n\n - `id: string`\n - `description: string`\n - `origins: string[]`\n - `urlPrefix: string`\n - `urlRewriter?: { preserveAssetDeliveryTypes: boolean; type: 'CLOUDINARY'; } | { type: 'IMGIX'; } | { type: 'AKAMAI'; }`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst urlEndpointResponse = await client.accounts.urlEndpoints.update('id', { description: 'My custom URL endpoint' });\n\nconsole.log(urlEndpointResponse);\n```",
|
|
2233
|
+
perLanguage: {
|
|
2234
|
+
cli: {
|
|
2235
|
+
method: 'urlEndpoints update',
|
|
2236
|
+
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'",
|
|
2237
|
+
},
|
|
2238
|
+
csharp: {
|
|
2239
|
+
method: 'Accounts.UrlEndpoints.Update',
|
|
2240
|
+
example: 'UrlEndpointUpdateParams parameters = new()\n{\n ID = "id",\n Description = "My custom URL endpoint",\n};\n\nvar urlEndpointResponse = await client.Accounts.UrlEndpoints.Update(parameters);\n\nConsole.WriteLine(urlEndpointResponse);',
|
|
2241
|
+
},
|
|
2242
|
+
go: {
|
|
2243
|
+
method: 'client.Accounts.URLEndpoints.Update',
|
|
2244
|
+
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',
|
|
2245
|
+
},
|
|
2246
|
+
http: {
|
|
2247
|
+
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 }\'',
|
|
2248
|
+
},
|
|
2249
|
+
java: {
|
|
2250
|
+
method: 'accounts().urlEndpoints().update',
|
|
2251
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointRequest;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointResponse;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n UrlEndpointUpdateParams params = UrlEndpointUpdateParams.builder()\n .id("id")\n .urlEndpointRequest(UrlEndpointRequest.builder()\n .description("My custom URL endpoint")\n .build())\n .build();\n UrlEndpointResponse urlEndpointResponse = client.accounts().urlEndpoints().update(params);\n }\n}',
|
|
2252
|
+
},
|
|
2253
|
+
php: {
|
|
2254
|
+
method: 'accounts->urlEndpoints->update',
|
|
2255
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$urlEndpointResponse = $client->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);",
|
|
2256
|
+
},
|
|
2257
|
+
python: {
|
|
2258
|
+
method: 'accounts.url_endpoints.update',
|
|
2259
|
+
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)',
|
|
2260
|
+
},
|
|
2261
|
+
ruby: {
|
|
2262
|
+
method: 'accounts.url_endpoints.update',
|
|
2263
|
+
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)',
|
|
2264
|
+
},
|
|
2265
|
+
typescript: {
|
|
2266
|
+
method: 'client.accounts.urlEndpoints.update',
|
|
2267
|
+
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);",
|
|
2268
|
+
},
|
|
2269
|
+
},
|
|
2270
|
+
},
|
|
2271
|
+
{
|
|
2272
|
+
name: 'delete',
|
|
2273
|
+
endpoint: '/v1/accounts/url-endpoints/{id}',
|
|
2274
|
+
httpMethod: 'delete',
|
|
2275
|
+
summary: 'Delete URL‑endpoint',
|
|
2276
|
+
description: '**Note:** This API is currently in beta. \nDeletes the URL‑endpoint identified by `id`. You cannot delete the default URL‑endpoint created by ImageKit during account creation.\n',
|
|
2277
|
+
stainlessPath: '(resource) accounts.urlEndpoints > (method) delete',
|
|
2278
|
+
qualified: 'client.accounts.urlEndpoints.delete',
|
|
2279
|
+
params: ['id: string;'],
|
|
2280
|
+
markdown: "## delete\n\n`client.accounts.urlEndpoints.delete(id: string): void`\n\n**delete** `/v1/accounts/url-endpoints/{id}`\n\n**Note:** This API is currently in beta. \nDeletes the URL‑endpoint identified by `id`. You cannot delete the default URL‑endpoint created by ImageKit during account creation.\n\n\n### Parameters\n\n- `id: string`\n Unique identifier for the URL-endpoint. This is generated by ImageKit when you create a new URL-endpoint. For the default URL-endpoint, this is always `default`.\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nawait client.accounts.urlEndpoints.delete('id')\n```",
|
|
2281
|
+
perLanguage: {
|
|
2282
|
+
cli: {
|
|
2283
|
+
method: 'urlEndpoints delete',
|
|
2284
|
+
example: "imagekit accounts:url-endpoints delete \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --id id",
|
|
2285
|
+
},
|
|
2286
|
+
csharp: {
|
|
2287
|
+
method: 'Accounts.UrlEndpoints.Delete',
|
|
2288
|
+
example: 'UrlEndpointDeleteParams parameters = new() { ID = "id" };\n\nawait client.Accounts.UrlEndpoints.Delete(parameters);',
|
|
2289
|
+
},
|
|
2290
|
+
go: {
|
|
2291
|
+
method: 'client.Accounts.URLEndpoints.Delete',
|
|
2292
|
+
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',
|
|
2293
|
+
},
|
|
2294
|
+
http: {
|
|
2295
|
+
example: 'curl https://api.imagekit.io/v1/accounts/url-endpoints/$ID \\\n -X DELETE \\\n -u "$IMAGEKIT_PRIVATE_KEY:OPTIONAL_IMAGEKIT_IGNORES_THIS"',
|
|
2296
|
+
},
|
|
2297
|
+
java: {
|
|
2298
|
+
method: 'accounts().urlEndpoints().delete',
|
|
2299
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.accounts.urlendpoints.UrlEndpointDeleteParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n client.accounts().urlEndpoints().delete("id");\n }\n}',
|
|
2300
|
+
},
|
|
2301
|
+
php: {
|
|
2302
|
+
method: 'accounts->urlEndpoints->delete',
|
|
2303
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$result = $client->accounts->urlEndpoints->delete('id');\n\nvar_dump($result);",
|
|
2304
|
+
},
|
|
2305
|
+
python: {
|
|
2306
|
+
method: 'accounts.url_endpoints.delete',
|
|
2307
|
+
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)',
|
|
2308
|
+
},
|
|
2309
|
+
ruby: {
|
|
2310
|
+
method: 'accounts.url_endpoints.delete',
|
|
2311
|
+
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)',
|
|
2312
|
+
},
|
|
2313
|
+
typescript: {
|
|
2314
|
+
method: 'client.accounts.urlEndpoints.delete',
|
|
2315
|
+
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');",
|
|
2316
|
+
},
|
|
2317
|
+
},
|
|
2318
|
+
},
|
|
2319
|
+
{
|
|
2320
|
+
name: 'upload',
|
|
2321
|
+
endpoint: '/api/v2/files/upload',
|
|
2322
|
+
httpMethod: 'post',
|
|
2323
|
+
summary: 'Upload file V2',
|
|
2324
|
+
description: 'The V2 API enhances security by verifying the entire payload using JWT. This API is in beta.\n\nImageKit.io allows you to upload files directly from both the server and client sides. For server-side uploads, private API key authentication is used. For client-side uploads, generate a one-time `token` from your secure backend using private API. [Learn more](/docs/api-reference/upload-file/upload-file-v2#how-to-implement-secure-client-side-file-upload) about how to implement secure client-side file upload.\n\n**File size limit** \\\nOn the free plan, the maximum upload file sizes are 25MB for images, audio, and raw files, and 100MB for videos. On the Lite paid plan, these limits increase to 40MB for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan, these limits increase to 50MB for images, audio, and raw files and 2GB for videos. These limits can be further increased with enterprise plans.\n\n**Version limit** \\\nA file can have a maximum of 100 versions.\n\n**Demo applications**\n\n- A full-fledged [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), supporting file selections from local storage, URL, Dropbox, Google Drive, Instagram, and more.\n- [Quick start guides](/docs/quick-start-guides) for various frameworks and technologies.\n',
|
|
2325
|
+
stainlessPath: '(resource) beta.v2.files > (method) upload',
|
|
2326
|
+
qualified: 'client.beta.v2.files.upload',
|
|
2327
|
+
params: [
|
|
2328
|
+
'file: string;',
|
|
2329
|
+
'fileName: string;',
|
|
2330
|
+
'token?: string;',
|
|
2331
|
+
'checks?: string;',
|
|
2332
|
+
'customCoordinates?: string;',
|
|
2333
|
+
'customMetadata?: object;',
|
|
2334
|
+
'description?: string;',
|
|
2335
|
+
"extensions?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; } | { id: string; name: 'saved-extension'; }[];",
|
|
2336
|
+
'folder?: string;',
|
|
2337
|
+
'isPrivateFile?: boolean;',
|
|
2338
|
+
'isPublished?: boolean;',
|
|
2339
|
+
'overwriteAITags?: boolean;',
|
|
2340
|
+
'overwriteCustomMetadata?: boolean;',
|
|
2341
|
+
'overwriteFile?: boolean;',
|
|
2342
|
+
'overwriteTags?: boolean;',
|
|
2343
|
+
'responseFields?: string[];',
|
|
2344
|
+
'tags?: string[];',
|
|
2345
|
+
"transformation?: { post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]; pre?: string; };",
|
|
2346
|
+
'useUniqueFileName?: boolean;',
|
|
2347
|
+
'webhookUrl?: string;',
|
|
2348
|
+
],
|
|
2349
|
+
response: "{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; extensionStatus?: { ai-auto-description?: 'success' | 'pending' | 'failed'; ai-tasks?: 'success' | 'pending' | 'failed'; aws-auto-tagging?: 'success' | 'pending' | 'failed'; google-auto-tagging?: 'success' | 'pending' | 'failed'; remove-bg?: 'success' | 'pending' | 'failed'; }; fileId?: string; filePath?: string; fileType?: string; height?: number; isPrivateFile?: boolean; isPublished?: boolean; metadata?: { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: object; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnailUrl?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }",
|
|
2350
|
+
markdown: "## upload\n\n`client.beta.v2.files.upload(file: string, fileName: string, token?: string, checks?: string, customCoordinates?: string, customMetadata?: object, description?: string, extensions?: { name: 'remove-bg'; options?: object; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: object | object | object[]; } | { id: string; name: 'saved-extension'; }[], folder?: string, isPrivateFile?: boolean, isPublished?: boolean, overwriteAITags?: boolean, overwriteCustomMetadata?: boolean, overwriteFile?: boolean, overwriteTags?: boolean, responseFields?: string[], tags?: string[], transformation?: { post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]; pre?: string; }, useUniqueFileName?: boolean, webhookUrl?: string): { AITags?: object[]; audioCodec?: string; bitRate?: number; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; extensionStatus?: object; fileId?: string; filePath?: string; fileType?: string; height?: number; isPrivateFile?: boolean; isPublished?: boolean; metadata?: metadata; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnailUrl?: string; url?: string; versionInfo?: object; videoCodec?: string; width?: number; }`\n\n**post** `/api/v2/files/upload`\n\nThe V2 API enhances security by verifying the entire payload using JWT. This API is in beta.\n\nImageKit.io allows you to upload files directly from both the server and client sides. For server-side uploads, private API key authentication is used. For client-side uploads, generate a one-time `token` from your secure backend using private API. [Learn more](/docs/api-reference/upload-file/upload-file-v2#how-to-implement-secure-client-side-file-upload) about how to implement secure client-side file upload.\n\n**File size limit** \\\nOn the free plan, the maximum upload file sizes are 25MB for images, audio, and raw files, and 100MB for videos. On the Lite paid plan, these limits increase to 40MB for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan, these limits increase to 50MB for images, audio, and raw files and 2GB for videos. These limits can be further increased with enterprise plans.\n\n**Version limit** \\\nA file can have a maximum of 100 versions.\n\n**Demo applications**\n\n- A full-fledged [upload widget using Uppy](https://github.com/imagekit-samples/uppy-uploader), supporting file selections from local storage, URL, Dropbox, Google Drive, Instagram, and more.\n- [Quick start guides](/docs/quick-start-guides) for various frameworks and technologies.\n\n\n### Parameters\n\n- `file: string`\n The API accepts any of the following:\n\n- **Binary data** – send the raw bytes as `multipart/form-data`.\n- **HTTP / HTTPS URL** – a publicly reachable URL that ImageKit’s servers can fetch.\n- **Base64 string** – the file encoded as a Base64 data URI or plain Base64.\n\nWhen supplying a URL, the server must receive the response headers within 8 seconds; otherwise the request fails with 400 Bad Request.\n\n\n- `fileName: string`\n The name with which the file has to be uploaded.\n\n\n- `token?: string`\n This is the client-generated JSON Web Token (JWT). The ImageKit.io server uses it to authenticate and check that the upload request parameters have not been tampered with after the token has been generated. Learn how to create the token on the page below. This field is only required for authentication when uploading a file from the client side.\n\n\n**Note**: Sending a JWT that has been used in the past will result in a validation error. Even if your previous request resulted in an error, you should always send a new token.\n\n\n**⚠️Warning**: JWT must be generated on the server-side because it is generated using your account's private API key. This field is required for authentication when uploading a file from the client-side.\n\n\n- `checks?: string`\n Server-side checks to run on the asset.\nRead more about [Upload API checks](/docs/api-reference/upload-file/upload-file-v2#upload-api-checks).\n\n\n- `customCoordinates?: string`\n Define an important area in the image. This is only relevant for image type files.\n\n - To be passed as a string with the x and y coordinates of the top-left corner, and width and height of the area of interest in the format `x,y,width,height`. For example - `10,10,100,100`\n - Can be used with fo-customtransformation.\n - If this field is not specified and the file is overwritten, then customCoordinates will be removed.\n\n\n- `customMetadata?: object`\n JSON key-value pairs to associate with the asset. Create the custom metadata fields before setting these values.\n\n\n- `description?: string`\n Optional text to describe the contents of the file.\n\n\n- `extensions?: { name: 'remove-bg'; options?: { add_shadow?: boolean; bg_color?: string; bg_image_url?: string; semitransparency?: boolean; }; } | { maxTags: number; minConfidence: number; name: 'google-auto-tagging' | 'aws-auto-tagging'; } | { name: 'ai-auto-description'; } | { name: 'ai-tasks'; tasks: { instruction: string; type: 'select_tags'; max_selections?: number; min_selections?: number; vocabulary?: string[]; } | { field: string; instruction: string; type: 'select_metadata'; max_selections?: number; min_selections?: number; vocabulary?: string | number | boolean[]; } | { instruction: string; type: 'yes_no'; on_no?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_unknown?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; on_yes?: { add_tags?: string[]; remove_tags?: string[]; set_metadata?: object[]; unset_metadata?: object[]; }; }[]; } | { id: string; name: 'saved-extension'; }[]`\n Array of extensions to be applied to the asset. Each extension can be configured with specific parameters based on the extension type.\n\n\n- `folder?: string`\n The folder path in which the image has to be uploaded. If the folder(s) didn't exist before, a new folder(s) is created. Using multiple `/` creates a nested folder.\n\n\n- `isPrivateFile?: boolean`\n Whether to mark the file as private or not.\n\nIf `true`, the file is marked as private and is accessible only using named transformation or signed URL.\n\n\n- `isPublished?: boolean`\n Whether to upload file as published or not.\n\nIf `false`, the file is marked as unpublished, which restricts access to the file only via the media library. Files in draft or unpublished state can only be publicly accessed after being published.\n\nThe option to upload in draft state is only available in custom enterprise pricing plans.\n\n\n- `overwriteAITags?: boolean`\n If set to `true` and a file already exists at the exact location, its AITags will be removed. Set `overwriteAITags` to `false` to preserve AITags.\n\n\n- `overwriteCustomMetadata?: boolean`\n If the request does not have `customMetadata`, and a file already exists at the exact location, existing customMetadata will be removed.\n\n\n- `overwriteFile?: boolean`\n If `false` and `useUniqueFileName` is also `false`, and a file already exists at the exact location, upload API will return an error immediately.\n\n\n- `overwriteTags?: boolean`\n If the request does not have `tags`, and a file already exists at the exact location, existing tags will be removed.\n\n\n- `responseFields?: string[]`\n Array of response field keys to include in the API response body.\n\n\n- `tags?: string[]`\n Set the tags while uploading the file.\nProvide an array of tag strings (e.g. `[\"tag1\", \"tag2\", \"tag3\"]`). The combined length of all tag characters must not exceed 500, and the `%` character is not allowed.\nIf this field is not specified and the file is overwritten, the existing tags will be removed.\n\n\n- `transformation?: { post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]; pre?: string; }`\n Configure pre-processing (`pre`) and post-processing (`post`) transformations.\n\n- `pre` — applied before the file is uploaded to the Media Library. \n Useful for reducing file size or applying basic optimizations upfront (e.g., resize, compress).\n\n- `post` — applied immediately after upload. \n Ideal for generating transformed versions (like video encodes or thumbnails) in advance, so they're ready for delivery without delay.\n\nYou can mix and match any combination of post-processing types.\n\n - `post?: { type: 'transformation'; value: string; } | { type: 'gif-to-video'; value?: string; } | { type: 'thumbnail'; value?: string; } | { protocol: 'hls' | 'dash'; type: 'abs'; value: string; }[]`\n List of transformations to apply *after* the file is uploaded. \nEach item must match one of the following types:\n`transformation`, `gif-to-video`, `thumbnail`, `abs`.\n\n - `pre?: string`\n Transformation string to apply before uploading the file to the Media Library. Useful for optimizing files at ingestion.\n\n\n- `useUniqueFileName?: boolean`\n Whether to use a unique filename for this file or not.\n\nIf `true`, ImageKit.io will add a unique suffix to the filename parameter to get a unique filename.\n\nIf `false`, then the image is uploaded with the provided filename parameter, and any existing file with the same name is replaced.\n\n\n- `webhookUrl?: string`\n The final status of extensions after they have completed execution will be delivered to this endpoint as a POST request. [Learn more](/docs/api-reference/digital-asset-management-dam/managing-assets/update-file-details#webhook-payload-structure) about the webhook payload structure.\n\n\n### Returns\n\n- `{ AITags?: { confidence?: number; name?: string; source?: string; }[]; audioCodec?: string; bitRate?: number; customCoordinates?: string; customMetadata?: object; description?: string; duration?: number; embeddedMetadata?: object; extensionStatus?: { ai-auto-description?: 'success' | 'pending' | 'failed'; ai-tasks?: 'success' | 'pending' | 'failed'; aws-auto-tagging?: 'success' | 'pending' | 'failed'; google-auto-tagging?: 'success' | 'pending' | 'failed'; remove-bg?: 'success' | 'pending' | 'failed'; }; fileId?: string; filePath?: string; fileType?: string; height?: number; isPrivateFile?: boolean; isPublished?: boolean; metadata?: { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: object; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }; name?: string; selectedFieldsSchema?: object; size?: number; tags?: string[]; thumbnailUrl?: string; url?: string; versionInfo?: { id?: string; name?: string; }; videoCodec?: string; width?: number; }`\n Object containing details of a successful upload.\n\n - `AITags?: { confidence?: number; name?: string; source?: string; }[]`\n - `audioCodec?: string`\n - `bitRate?: number`\n - `customCoordinates?: string`\n - `customMetadata?: object`\n - `description?: string`\n - `duration?: number`\n - `embeddedMetadata?: object`\n - `extensionStatus?: { ai-auto-description?: 'success' | 'pending' | 'failed'; ai-tasks?: 'success' | 'pending' | 'failed'; aws-auto-tagging?: 'success' | 'pending' | 'failed'; google-auto-tagging?: 'success' | 'pending' | 'failed'; remove-bg?: 'success' | 'pending' | 'failed'; }`\n - `fileId?: string`\n - `filePath?: string`\n - `fileType?: string`\n - `height?: number`\n - `isPrivateFile?: boolean`\n - `isPublished?: boolean`\n - `metadata?: { audioCodec?: string; bitRate?: number; density?: number; duration?: number; exif?: { exif?: { ApertureValue?: number; ColorSpace?: number; CreateDate?: string; CustomRendered?: number; DateTimeOriginal?: string; ExifImageHeight?: number; ExifImageWidth?: number; ExifVersion?: string; ExposureCompensation?: number; ExposureMode?: number; ExposureProgram?: number; ExposureTime?: number; Flash?: number; FlashpixVersion?: string; FNumber?: number; FocalLength?: number; FocalPlaneResolutionUnit?: number; FocalPlaneXResolution?: number; FocalPlaneYResolution?: number; InteropOffset?: number; ISO?: number; MeteringMode?: number; SceneCaptureType?: number; ShutterSpeedValue?: number; SubSecTime?: string; WhiteBalance?: number; }; gps?: { GPSVersionID?: number[]; }; image?: { ExifOffset?: number; GPSInfo?: number; Make?: string; Model?: string; ModifyDate?: string; Orientation?: number; ResolutionUnit?: number; Software?: string; XResolution?: number; YCbCrPositioning?: number; YResolution?: number; }; interoperability?: { InteropIndex?: string; InteropVersion?: string; }; makernote?: object; thumbnail?: { Compression?: number; ResolutionUnit?: number; ThumbnailLength?: number; ThumbnailOffset?: number; XResolution?: number; YResolution?: number; }; }; format?: string; hasColorProfile?: boolean; hasTransparency?: boolean; height?: number; pHash?: string; quality?: number; size?: number; videoCodec?: string; width?: number; }`\n - `name?: string`\n - `selectedFieldsSchema?: object`\n - `size?: number`\n - `tags?: string[]`\n - `thumbnailUrl?: string`\n - `url?: string`\n - `versionInfo?: { id?: string; name?: string; }`\n - `videoCodec?: string`\n - `width?: number`\n\n### Example\n\n```typescript\nimport ImageKit from '@imagekit/nodejs';\n\nconst client = new ImageKit();\n\nconst response = await client.beta.v2.files.upload({ file: fs.createReadStream('path/to/file'), fileName: 'fileName' });\n\nconsole.log(response);\n```",
|
|
2351
|
+
perLanguage: {
|
|
2352
|
+
cli: {
|
|
2353
|
+
method: 'files upload',
|
|
2354
|
+
example: "imagekit beta:v2:files upload \\\n --private-key 'My Private Key' \\\n --password 'My Password' \\\n --file 'Example data' \\\n --file-name fileName",
|
|
2355
|
+
},
|
|
2356
|
+
csharp: {
|
|
2357
|
+
method: 'Beta.V2.Files.Upload',
|
|
2358
|
+
example: 'FileUploadParams parameters = new()\n{\n File = Encoding.UTF8.GetBytes("Example data"),\n FileName = "fileName",\n};\n\nvar response = await client.Beta.V2.Files.Upload(parameters);\n\nConsole.WriteLine(response);',
|
|
2359
|
+
},
|
|
2360
|
+
go: {
|
|
2361
|
+
method: 'client.Beta.V2.Files.Upload',
|
|
2362
|
+
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',
|
|
2363
|
+
},
|
|
2364
|
+
http: {
|
|
2365
|
+
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"}]}\'',
|
|
2366
|
+
},
|
|
2367
|
+
java: {
|
|
2368
|
+
method: 'beta().v2().files().upload',
|
|
2369
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.beta.v2.files.FileUploadParams;\nimport com.imagekit.api.models.beta.v2.files.FileUploadResponse;\nimport java.io.ByteArrayInputStream;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n FileUploadParams params = FileUploadParams.builder()\n .file(new ByteArrayInputStream("Example data".getBytes()))\n .fileName("fileName")\n .build();\n FileUploadResponse response = client.beta().v2().files().upload(params);\n }\n}',
|
|
2370
|
+
},
|
|
2371
|
+
php: {
|
|
2372
|
+
method: 'beta->v2->files->upload',
|
|
2373
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$response = $client->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);",
|
|
2374
|
+
},
|
|
2375
|
+
python: {
|
|
2376
|
+
method: 'beta.v2.files.upload',
|
|
2377
|
+
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)',
|
|
2378
|
+
},
|
|
2379
|
+
ruby: {
|
|
2380
|
+
method: 'beta.v2.files.upload',
|
|
2381
|
+
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)',
|
|
2382
|
+
},
|
|
2383
|
+
typescript: {
|
|
2384
|
+
method: 'client.beta.v2.files.upload',
|
|
2385
|
+
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);",
|
|
2386
|
+
},
|
|
2387
|
+
},
|
|
2388
|
+
},
|
|
2389
|
+
{
|
|
2390
|
+
name: 'unwrap',
|
|
2391
|
+
endpoint: '',
|
|
2392
|
+
httpMethod: '',
|
|
2393
|
+
summary: '',
|
|
2394
|
+
description: '',
|
|
2395
|
+
stainlessPath: '(resource) webhooks > (method) unwrap',
|
|
2396
|
+
qualified: 'client.webhooks.unwrap',
|
|
2397
|
+
perLanguage: {
|
|
2398
|
+
cli: {
|
|
2399
|
+
example: "imagekit webhooks unwrap \\\n --private-key 'My Private Key' \\\n --password 'My Password'",
|
|
2400
|
+
},
|
|
2401
|
+
csharp: {
|
|
2402
|
+
example: 'WebhookUnwrapParams parameters = new();\n\nawait client.Webhooks.Unwrap(parameters);',
|
|
2403
|
+
},
|
|
2404
|
+
go: {
|
|
2405
|
+
method: 'client.Webhooks.Unwrap',
|
|
2406
|
+
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',
|
|
2407
|
+
},
|
|
2408
|
+
java: {
|
|
2409
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.webhooks.WebhookUnwrapParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n client.webhooks().unwrap();\n }\n}',
|
|
2410
|
+
},
|
|
2411
|
+
php: {
|
|
2412
|
+
method: 'webhooks->unwrap',
|
|
2413
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$result = $client->webhooks->unwrap();\n\nvar_dump($result);",
|
|
2414
|
+
},
|
|
2415
|
+
python: {
|
|
2416
|
+
method: 'webhooks.unwrap',
|
|
2417
|
+
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()',
|
|
2418
|
+
},
|
|
2419
|
+
ruby: {
|
|
2420
|
+
method: 'webhooks.unwrap',
|
|
2421
|
+
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)',
|
|
2422
|
+
},
|
|
2423
|
+
typescript: {
|
|
2424
|
+
method: 'client.webhooks.unwrap',
|
|
2425
|
+
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();",
|
|
2426
|
+
},
|
|
2427
|
+
},
|
|
2428
|
+
},
|
|
2429
|
+
{
|
|
2430
|
+
name: 'unsafe_unwrap',
|
|
2431
|
+
endpoint: '',
|
|
2432
|
+
httpMethod: '',
|
|
2433
|
+
summary: '',
|
|
2434
|
+
description: '',
|
|
2435
|
+
stainlessPath: '(resource) webhooks > (method) unsafe_unwrap',
|
|
2436
|
+
qualified: 'client.webhooks.unsafeUnwrap',
|
|
2437
|
+
perLanguage: {
|
|
2438
|
+
cli: {
|
|
2439
|
+
example: "imagekit webhooks unsafe-unwrap \\\n --private-key 'My Private Key' \\\n --password 'My Password'",
|
|
2440
|
+
},
|
|
2441
|
+
csharp: {
|
|
2442
|
+
example: 'WebhookUnsafeUnwrapParams parameters = new();\n\nawait client.Webhooks.UnsafeUnwrap(parameters);',
|
|
2443
|
+
},
|
|
2444
|
+
go: {
|
|
2445
|
+
method: 'client.Webhooks.UnsafeUnwrap',
|
|
2446
|
+
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',
|
|
2447
|
+
},
|
|
2448
|
+
java: {
|
|
2449
|
+
example: 'package com.imagekit.api.example;\n\nimport com.imagekit.api.client.ImageKitClient;\nimport com.imagekit.api.client.okhttp.ImageKitOkHttpClient;\nimport com.imagekit.api.models.webhooks.WebhookUnsafeUnwrapParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n ImageKitClient client = ImageKitOkHttpClient.fromEnv();\n\n client.webhooks().unsafeUnwrap();\n }\n}',
|
|
2450
|
+
},
|
|
2451
|
+
php: {
|
|
2452
|
+
method: 'webhooks->unsafeUnwrap',
|
|
2453
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(privateKey: 'My Private Key', password: 'My Password');\n\n$result = $client->webhooks->unsafeUnwrap();\n\nvar_dump($result);",
|
|
2454
|
+
},
|
|
2455
|
+
python: {
|
|
2456
|
+
method: 'webhooks.unsafe_unwrap',
|
|
2457
|
+
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()',
|
|
2458
|
+
},
|
|
2459
|
+
ruby: {
|
|
2460
|
+
method: 'webhooks.unsafe_unwrap',
|
|
2461
|
+
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)',
|
|
2462
|
+
},
|
|
2463
|
+
typescript: {
|
|
2464
|
+
method: 'client.webhooks.unsafeUnwrap',
|
|
2465
|
+
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();",
|
|
2466
|
+
},
|
|
2467
|
+
},
|
|
2468
|
+
},
|
|
2469
|
+
];
|
|
2470
|
+
const EMBEDDED_READMES = [
|
|
2471
|
+
{
|
|
2472
|
+
language: 'python',
|
|
2473
|
+
content: '# Image Kit Python API library\n\n<!-- prettier-ignore -->\n[)](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[](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[](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',
|
|
2474
|
+
},
|
|
2475
|
+
{
|
|
2476
|
+
language: 'go',
|
|
2477
|
+
content: '# Image Kit Go API Library\n\n<a href="https://pkg.go.dev/github.com/imagekit-developer/imagekit-go"><img src="https://pkg.go.dev/badge/github.com/imagekit-developer/imagekit-go.svg" alt="Go Reference"></a>\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[](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[](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<!-- x-release-please-start-version -->\n\n```go\nimport (\n\t"github.com/imagekit-developer/imagekit-go" // imported as SDK_PackageName\n)\n```\n\n<!-- x-release-please-end -->\n\nOr to pin the version:\n\n<!-- x-release-please-start-version -->\n\n```sh\ngo get -u \'github.com/imagekit-developer/imagekit-go@v0.0.1\'\n```\n\n<!-- x-release-please-end -->\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',
|
|
2478
|
+
},
|
|
2479
|
+
{
|
|
2480
|
+
language: 'terraform',
|
|
2481
|
+
content: '# Image Kit Terraform Provider\n\nThe [Image Kit Terraform provider](https://registry.terraform.io/providers/stainless-sdks/imagekit/latest/docs) provides convenient access to\nthe [Image Kit REST API](https://imagekit.io/docs/api-reference) from Terraform.\n\n\n\n## Requirements\n\nThis provider requires Terraform CLI 1.0 or later. You can [install it for your system](https://developer.hashicorp.com/terraform/install)\non Hashicorp\'s website.\n\n## Usage\n\nAdd the following to your `main.tf` file:\n\n\n\n```hcl\n# Declare the provider and version\nterraform {\n required_providers {\n SDK_ProviderTypeName = {\n source = "stainless-sdks/imagekit"\n version = "~> 0.0.1"\n }\n }\n}\n\n# Initialize the provider\nprovider "imagekit" {\n # Your ImageKit private API key (starts with `private_`).\n You can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n private_key = "My Private Key" # or set IMAGEKIT_PRIVATE_KEY env variable\n # ImageKit uses your API key as username and ignores the password. \n The SDK sets a dummy value. You can ignore this field.\n password = "My Password" # or set OPTIONAL_IMAGEKIT_IGNORES_THIS env variable\n # Your ImageKit webhook secret for verifying webhook signatures (starts with `whsec_`).\n You can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks).\n Only required if you\'re using webhooks.\n webhook_secret = "My Webhook Secret" # or set IMAGEKIT_WEBHOOK_SECRET env variable\n}\n\n# Configure a resource\nresource "imagekit_account_origin" "example_account_origin" {\n access_key = "AKIAIOSFODNN7EXAMPLE"\n bucket = "product-images"\n name = "US S3 Storage"\n secret_key = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"\n type = "S3"\n base_url_for_canonical_header = "https://cdn.example.com"\n include_canonical_header = false\n prefix = "raw-assets"\n}\n```\n\n\n\nInitialize your project by running `terraform init` in the directory.\n\nAdditional examples can be found in the [./examples](./examples) folder within this repository, and you can\nrefer to the full documentation on [the Terraform Registry](https://registry.terraform.io/providers/stainless-sdks/imagekit/latest/docs).\n\n### Provider Options\nWhen you initialize the provider, the following options are supported. It is recommended to use environment variables for sensitive values like access tokens.\nIf an environment variable is provided, then the option does not need to be set in the terraform source.\n\n| Property | Environment variable | Required | Default value |\n| -------------- | -------------------------------- | -------- | -------------- |\n| private_key | `IMAGEKIT_PRIVATE_KEY` | true | — |\n| webhook_secret | `IMAGEKIT_WEBHOOK_SECRET` | false | — |\n| password | `OPTIONAL_IMAGEKIT_IGNORES_THIS` | false | `"do_not_set"` |\n\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-terraform/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
2482
|
+
},
|
|
2483
|
+
{
|
|
2484
|
+
language: 'typescript',
|
|
2485
|
+
content: "# Image Kit TypeScript API Library\n\n[)](https://npmjs.org/package/@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[](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[](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<!-- prettier-ignore -->\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<!-- prettier-ignore -->\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<!-- prettier-ignore -->\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<!-- prettier-ignore -->\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<!-- prettier-ignore -->\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<!-- prettier-ignore -->\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<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>\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<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>\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<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>\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",
|
|
2486
|
+
},
|
|
2487
|
+
{
|
|
2488
|
+
language: 'ruby',
|
|
2489
|
+
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[](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[](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<!-- x-release-please-start-version -->\n\n```ruby\ngem "imagekitio", "~> 0.0.1"\n```\n\n<!-- x-release-please-end -->\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',
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
language: 'java',
|
|
2493
|
+
content: '# Image Kit Java API Library\n\n\n[](https://central.sonatype.com/artifact/com.imagekit.api/image-kit-java/0.0.1)\n[](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[](https://cursor.com/en-US/install-mcp?name=%40imagekit%2Fapi-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBpbWFnZWtpdC9hcGktbWNwIl0sImVudiI6eyJJTUFHRUtJVF9QUklWQVRFX0tFWSI6Ik15IFByaXZhdGUgS2V5IiwiT1BUSU9OQUxfSU1BR0VLSVRfSUdOT1JFU19USElTIjoiTXkgUGFzc3dvcmQiLCJJTUFHRUtJVF9XRUJIT09LX1NFQ1JFVCI6Ik15IFdlYmhvb2sgU2VjcmV0In19)\n[](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<dependency>\n <groupId>com.imagekit.api</groupId>\n <artifactId>image-kit-java</artifactId>\n <version>0.0.1</version>\n</dependency>\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<FileUploadResponse> 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<FileUploadResponse> 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.<InputStream>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<FileUploadResponse> 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<String, JsonValue> 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<InputStream> 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<String> 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<T>` instead of just plain `T`?\n\nUsing `JsonField<T>` 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',
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
language: 'csharp',
|
|
2497
|
+
content: '# Image Kit C# API Library\n\nThe Image Kit C# SDK provides convenient access to the [Image Kit REST API](https://imagekit.io/docs/api-reference) from applications written in C#.\n\n## Installation\n\n```bash\ngit clone git@github.com:stainless-sdks/imagekit-csharp.git\ndotnet add reference imagekit-csharp/src/ImageKit\n```\n\n## Requirements\n\nThis library requires .NET Standard 2.0 or later.\n\n## Usage\n\nSee the [`examples`](examples) directory for complete and runnable examples.\n\n```csharp\nImageKitClient client = new();\n\nFileUploadParams parameters = new()\n{\n File = Encoding.UTF8.GetBytes("https://www.example.com/public-url.jpg"),\n FileName = "file-name.jpg",\n};\n\nvar response = await client.Files.Upload(parameters);\n\nConsole.WriteLine(response);\n```',
|
|
2498
|
+
},
|
|
2499
|
+
{
|
|
2500
|
+
language: 'cli',
|
|
2501
|
+
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] <command> [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 <command> --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\nimagekit <command> --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nimagekit <command> <<YAML\narg:\n image: \"@abe.jpg\"\nYAML\n~~~\n\nIf you need to pass a string literal that begins with an `@` sign, you can\nescape the `@` sign to avoid accidentally passing a file.\n\n~~~bash\nimagekit <command> --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 <command> --arg @data://file.txt\n~~~\n",
|
|
2502
|
+
},
|
|
2503
|
+
{
|
|
2504
|
+
language: 'php',
|
|
2505
|
+
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\n<?php\n\n$client = new Client(\n privateKey: getenv(\'IMAGEKIT_PRIVATE_KEY\') ?: \'My Private Key\',\n password: getenv(\'OPTIONAL_IMAGEKIT_IGNORES_THIS\') ?: \'do_not_set\',\n);\n\n$response = $client->files->upload(file: \'file\', fileName: \'file-name.jpg\');\n\nvar_dump($response->videoCodec);\n```',
|
|
2506
|
+
},
|
|
2507
|
+
];
|
|
2508
|
+
const INDEX_OPTIONS = {
|
|
2509
|
+
fields: [
|
|
2510
|
+
'name',
|
|
2511
|
+
'endpoint',
|
|
2512
|
+
'summary',
|
|
2513
|
+
'description',
|
|
2514
|
+
'qualified',
|
|
2515
|
+
'stainlessPath',
|
|
2516
|
+
'content',
|
|
2517
|
+
'sectionContext',
|
|
2518
|
+
],
|
|
2519
|
+
storeFields: ['kind', '_original'],
|
|
2520
|
+
searchOptions: {
|
|
2521
|
+
prefix: true,
|
|
2522
|
+
fuzzy: 0.1,
|
|
2523
|
+
boost: {
|
|
2524
|
+
name: 5,
|
|
2525
|
+
stainlessPath: 3,
|
|
2526
|
+
endpoint: 3,
|
|
2527
|
+
qualified: 3,
|
|
2528
|
+
summary: 2,
|
|
2529
|
+
content: 1,
|
|
2530
|
+
description: 1,
|
|
2531
|
+
},
|
|
2532
|
+
},
|
|
2533
|
+
};
|
|
2534
|
+
/**
|
|
2535
|
+
* Self-contained local search engine backed by MiniSearch.
|
|
2536
|
+
* Method data is embedded at SDK build time; prose documents
|
|
2537
|
+
* can be loaded from an optional docs directory at runtime.
|
|
2538
|
+
*/
|
|
2539
|
+
export class LocalDocsSearch {
|
|
2540
|
+
methodIndex;
|
|
2541
|
+
proseIndex;
|
|
2542
|
+
constructor() {
|
|
2543
|
+
this.methodIndex = new MiniSearch(INDEX_OPTIONS);
|
|
2544
|
+
this.proseIndex = new MiniSearch(INDEX_OPTIONS);
|
|
2545
|
+
}
|
|
2546
|
+
static async create(opts) {
|
|
2547
|
+
const instance = new LocalDocsSearch();
|
|
2548
|
+
instance.indexMethods(EMBEDDED_METHODS);
|
|
2549
|
+
for (const readme of EMBEDDED_READMES) {
|
|
2550
|
+
instance.indexProse(readme.content, `readme:${readme.language}`);
|
|
2551
|
+
}
|
|
2552
|
+
if (opts?.docsDir) {
|
|
2553
|
+
await instance.loadDocsDirectory(opts.docsDir);
|
|
2554
|
+
}
|
|
2555
|
+
return instance;
|
|
2556
|
+
}
|
|
2557
|
+
search(props) {
|
|
2558
|
+
const { query, language = 'typescript', detail = 'default', maxResults = 5, maxLength = 100_000 } = props;
|
|
2559
|
+
const useMarkdown = detail === 'verbose' || detail === 'high';
|
|
2560
|
+
// Search both indices and merge results by score.
|
|
2561
|
+
// Filter prose hits so language-tagged content (READMEs and docs with
|
|
2562
|
+
// frontmatter) only matches the requested language.
|
|
2563
|
+
const methodHits = this.methodIndex
|
|
2564
|
+
.search(query)
|
|
2565
|
+
.map((hit) => ({ ...hit, _kind: 'http_method' }));
|
|
2566
|
+
const proseHits = this.proseIndex
|
|
2567
|
+
.search(query)
|
|
2568
|
+
.filter((hit) => {
|
|
2569
|
+
const source = hit['_original']?.source;
|
|
2570
|
+
if (!source)
|
|
2571
|
+
return true;
|
|
2572
|
+
// Check for language-tagged sources: "readme:<lang>" or "lang:<lang>:<filename>"
|
|
2573
|
+
let taggedLang;
|
|
2574
|
+
if (source.startsWith('readme:'))
|
|
2575
|
+
taggedLang = source.slice('readme:'.length);
|
|
2576
|
+
else if (source.startsWith('lang:'))
|
|
2577
|
+
taggedLang = source.split(':')[1];
|
|
2578
|
+
if (!taggedLang)
|
|
2579
|
+
return true;
|
|
2580
|
+
return taggedLang === language || (language === 'javascript' && taggedLang === 'typescript');
|
|
2581
|
+
})
|
|
2582
|
+
.map((hit) => ({ ...hit, _kind: 'prose' }));
|
|
2583
|
+
const merged = [...methodHits, ...proseHits].sort((a, b) => b.score - a.score);
|
|
2584
|
+
const top = merged.slice(0, maxResults);
|
|
2585
|
+
const fullResults = [];
|
|
2586
|
+
for (const hit of top) {
|
|
2587
|
+
const original = hit['_original'];
|
|
2588
|
+
if (hit._kind === 'http_method') {
|
|
2589
|
+
const m = original;
|
|
2590
|
+
if (useMarkdown && m.markdown) {
|
|
2591
|
+
fullResults.push(m.markdown);
|
|
2592
|
+
}
|
|
2593
|
+
else {
|
|
2594
|
+
// Use per-language data when available, falling back to the
|
|
2595
|
+
// top-level fields (which are TypeScript-specific in the
|
|
2596
|
+
// legacy codepath).
|
|
2597
|
+
const langData = m.perLanguage?.[language];
|
|
2598
|
+
fullResults.push({
|
|
2599
|
+
method: langData?.method ?? m.qualified,
|
|
2600
|
+
summary: m.summary,
|
|
2601
|
+
description: m.description,
|
|
2602
|
+
endpoint: `${m.httpMethod.toUpperCase()} ${m.endpoint}`,
|
|
2603
|
+
...(langData?.example ? { example: langData.example } : {}),
|
|
2604
|
+
...(m.params ? { params: m.params } : {}),
|
|
2605
|
+
...(m.response ? { response: m.response } : {}),
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
else {
|
|
2610
|
+
const c = original;
|
|
2611
|
+
fullResults.push({
|
|
2612
|
+
content: c.content,
|
|
2613
|
+
...(c.source ? { source: c.source } : {}),
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
let totalLength = 0;
|
|
2618
|
+
const results = [];
|
|
2619
|
+
for (const result of fullResults) {
|
|
2620
|
+
const len = typeof result === 'string' ? result.length : JSON.stringify(result).length;
|
|
2621
|
+
totalLength += len;
|
|
2622
|
+
if (totalLength > maxLength)
|
|
2623
|
+
break;
|
|
2624
|
+
results.push(result);
|
|
2625
|
+
}
|
|
2626
|
+
if (results.length < fullResults.length) {
|
|
2627
|
+
results.unshift(`Truncated; showing ${results.length} of ${fullResults.length} results.`);
|
|
2628
|
+
}
|
|
2629
|
+
return { results };
|
|
2630
|
+
}
|
|
2631
|
+
indexMethods(methods) {
|
|
2632
|
+
const docs = methods.map((m, i) => ({
|
|
2633
|
+
id: `method-${i}`,
|
|
2634
|
+
kind: 'http_method',
|
|
2635
|
+
name: m.name,
|
|
2636
|
+
endpoint: m.endpoint,
|
|
2637
|
+
summary: m.summary,
|
|
2638
|
+
description: m.description,
|
|
2639
|
+
qualified: m.qualified,
|
|
2640
|
+
stainlessPath: m.stainlessPath,
|
|
2641
|
+
_original: m,
|
|
2642
|
+
}));
|
|
2643
|
+
if (docs.length > 0) {
|
|
2644
|
+
this.methodIndex.addAll(docs);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
async loadDocsDirectory(docsDir) {
|
|
2648
|
+
let entries;
|
|
2649
|
+
try {
|
|
2650
|
+
entries = await fs.readdir(docsDir, { withFileTypes: true });
|
|
2651
|
+
}
|
|
2652
|
+
catch (err) {
|
|
2653
|
+
getLogger().warn({ err, docsDir }, 'Could not read docs directory');
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
const files = entries
|
|
2657
|
+
.filter((e) => e.isFile())
|
|
2658
|
+
.filter((e) => e.name.endsWith('.md') || e.name.endsWith('.markdown') || e.name.endsWith('.json'));
|
|
2659
|
+
for (const file of files) {
|
|
2660
|
+
try {
|
|
2661
|
+
const filePath = path.join(docsDir, file.name);
|
|
2662
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
2663
|
+
if (file.name.endsWith('.json')) {
|
|
2664
|
+
const texts = extractTexts(JSON.parse(content));
|
|
2665
|
+
if (texts.length > 0) {
|
|
2666
|
+
this.indexProse(texts.join('\n\n'), file.name);
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
else {
|
|
2670
|
+
// Parse optional YAML frontmatter for language tagging.
|
|
2671
|
+
// Files with a "language" field in frontmatter will only
|
|
2672
|
+
// surface in searches for that language.
|
|
2673
|
+
//
|
|
2674
|
+
// Example:
|
|
2675
|
+
// ---
|
|
2676
|
+
// language: python
|
|
2677
|
+
// ---
|
|
2678
|
+
// # Error handling in Python
|
|
2679
|
+
// ...
|
|
2680
|
+
const frontmatter = parseFrontmatter(content);
|
|
2681
|
+
const source = frontmatter.language ? `lang:${frontmatter.language}:${file.name}` : file.name;
|
|
2682
|
+
this.indexProse(content, source);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
catch (err) {
|
|
2686
|
+
getLogger().warn({ err, file: file.name }, 'Failed to index docs file');
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
indexProse(markdown, source) {
|
|
2691
|
+
const chunks = chunkMarkdown(markdown);
|
|
2692
|
+
const baseId = this.proseIndex.documentCount;
|
|
2693
|
+
const docs = chunks.map((chunk, i) => ({
|
|
2694
|
+
id: `prose-${baseId + i}`,
|
|
2695
|
+
kind: 'prose',
|
|
2696
|
+
content: chunk.content,
|
|
2697
|
+
...(chunk.sectionContext != null ? { sectionContext: chunk.sectionContext } : {}),
|
|
2698
|
+
_original: { ...chunk, source },
|
|
2699
|
+
}));
|
|
2700
|
+
if (docs.length > 0) {
|
|
2701
|
+
this.proseIndex.addAll(docs);
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
/** Lightweight markdown chunker — splits on headers, chunks by word count. */
|
|
2706
|
+
function chunkMarkdown(markdown) {
|
|
2707
|
+
// Strip YAML frontmatter
|
|
2708
|
+
const stripped = markdown.replace(/^---\n[\s\S]*?\n---\n?/, '');
|
|
2709
|
+
const lines = stripped.split('\n');
|
|
2710
|
+
const chunks = [];
|
|
2711
|
+
const headers = [];
|
|
2712
|
+
let current = [];
|
|
2713
|
+
const flush = () => {
|
|
2714
|
+
const text = current.join('\n').trim();
|
|
2715
|
+
if (!text)
|
|
2716
|
+
return;
|
|
2717
|
+
const sectionContext = headers.length > 0 ? headers.join(' > ') : undefined;
|
|
2718
|
+
// Split into ~200-word chunks
|
|
2719
|
+
const words = text.split(/\s+/);
|
|
2720
|
+
for (let i = 0; i < words.length; i += 200) {
|
|
2721
|
+
const slice = words.slice(i, i + 200).join(' ');
|
|
2722
|
+
if (slice) {
|
|
2723
|
+
chunks.push({ content: slice, tag: 'p', ...(sectionContext != null ? { sectionContext } : {}) });
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
current = [];
|
|
2727
|
+
};
|
|
2728
|
+
for (const line of lines) {
|
|
2729
|
+
const headerMatch = line.match(/^(#{1,6})\s+(.+)/);
|
|
2730
|
+
if (headerMatch) {
|
|
2731
|
+
flush();
|
|
2732
|
+
const level = headerMatch[1].length;
|
|
2733
|
+
const text = headerMatch[2].trim();
|
|
2734
|
+
while (headers.length >= level)
|
|
2735
|
+
headers.pop();
|
|
2736
|
+
headers.push(text);
|
|
2737
|
+
}
|
|
2738
|
+
else {
|
|
2739
|
+
current.push(line);
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
flush();
|
|
2743
|
+
return chunks;
|
|
2744
|
+
}
|
|
2745
|
+
/** Recursively extracts string values from a JSON structure. */
|
|
2746
|
+
function extractTexts(data, depth = 0) {
|
|
2747
|
+
if (depth > 10)
|
|
2748
|
+
return [];
|
|
2749
|
+
if (typeof data === 'string')
|
|
2750
|
+
return data.trim() ? [data] : [];
|
|
2751
|
+
if (Array.isArray(data))
|
|
2752
|
+
return data.flatMap((item) => extractTexts(item, depth + 1));
|
|
2753
|
+
if (typeof data === 'object' && data !== null) {
|
|
2754
|
+
return Object.values(data).flatMap((v) => extractTexts(v, depth + 1));
|
|
2755
|
+
}
|
|
2756
|
+
return [];
|
|
2757
|
+
}
|
|
2758
|
+
/** Parses YAML frontmatter from a markdown string, extracting the language field if present. */
|
|
2759
|
+
function parseFrontmatter(markdown) {
|
|
2760
|
+
const match = markdown.match(/^---\n([\s\S]*?)\n---/);
|
|
2761
|
+
if (!match)
|
|
2762
|
+
return {};
|
|
2763
|
+
const body = match[1] ?? '';
|
|
2764
|
+
const langMatch = body.match(/^language:\s*(.+)$/m);
|
|
2765
|
+
return langMatch ? { language: langMatch[1].trim() } : {};
|
|
2766
|
+
}
|
|
2767
|
+
//# sourceMappingURL=local-docs-search.mjs.map
|