@imagekit/nodejs 7.1.0 → 7.2.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/CHANGELOG.md +120 -0
- package/LICENSE +1 -1
- package/README.md +73 -8
- package/client.d.mts +8 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +8 -1
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/lib/crypto-utils.d.mts.map +1 -1
- package/lib/crypto-utils.d.ts.map +1 -1
- package/lib/crypto-utils.js +6 -5
- package/lib/crypto-utils.js.map +1 -1
- package/lib/crypto-utils.mjs +4 -5
- package/lib/crypto-utils.mjs.map +1 -1
- package/lib/transformation-utils.d.mts.map +1 -1
- package/lib/transformation-utils.d.ts.map +1 -1
- package/lib/transformation-utils.js +3 -0
- package/lib/transformation-utils.js.map +1 -1
- package/lib/transformation-utils.mjs +3 -0
- package/lib/transformation-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/v2/files.d.mts +1 -0
- package/resources/beta/v2/files.d.mts.map +1 -1
- package/resources/beta/v2/files.d.ts +1 -0
- package/resources/beta/v2/files.d.ts.map +1 -1
- package/resources/custom-metadata-fields.d.mts +1 -5
- package/resources/custom-metadata-fields.d.mts.map +1 -1
- package/resources/custom-metadata-fields.d.ts +1 -5
- package/resources/custom-metadata-fields.d.ts.map +1 -1
- package/resources/custom-metadata-fields.js +1 -5
- package/resources/custom-metadata-fields.js.map +1 -1
- package/resources/custom-metadata-fields.mjs +1 -5
- package/resources/custom-metadata-fields.mjs.map +1 -1
- package/resources/files/files.d.mts +2 -0
- package/resources/files/files.d.mts.map +1 -1
- package/resources/files/files.d.ts +2 -0
- package/resources/files/files.d.ts.map +1 -1
- package/resources/files/files.js.map +1 -1
- package/resources/files/files.mjs.map +1 -1
- package/resources/files/metadata.js +1 -1
- package/resources/files/metadata.js.map +1 -1
- package/resources/files/metadata.mjs +1 -1
- package/resources/files/metadata.mjs.map +1 -1
- package/resources/helper.d.mts.map +1 -1
- package/resources/helper.d.ts.map +1 -1
- package/resources/helper.js +26 -20
- package/resources/helper.js.map +1 -1
- package/resources/helper.mjs +26 -20
- package/resources/helper.mjs.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/saved-extensions.d.mts +112 -0
- package/resources/saved-extensions.d.mts.map +1 -0
- package/resources/saved-extensions.d.ts +112 -0
- package/resources/saved-extensions.d.ts.map +1 -0
- package/resources/saved-extensions.js +95 -0
- package/resources/saved-extensions.js.map +1 -0
- package/resources/saved-extensions.mjs +91 -0
- package/resources/saved-extensions.mjs.map +1 -0
- package/resources/shared.d.mts +703 -23
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +703 -23
- package/resources/shared.d.ts.map +1 -1
- package/resources/webhooks.d.mts +1 -0
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +1 -0
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +20 -1
- package/src/internal/to-file.ts +1 -1
- package/src/lib/crypto-utils.ts +7 -5
- package/src/lib/transformation-utils.ts +3 -0
- package/src/resources/beta/v2/files.ts +2 -0
- package/src/resources/custom-metadata-fields.ts +1 -5
- package/src/resources/files/files.ts +4 -0
- package/src/resources/files/metadata.ts +1 -1
- package/src/resources/helper.ts +33 -19
- package/src/resources/index.ts +6 -0
- package/src/resources/saved-extensions.ts +149 -0
- package/src/resources/shared.ts +819 -23
- package/src/resources/webhooks.ts +2 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saved-extensions.d.mts","sourceRoot":"","sources":["../src/resources/saved-extensions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC;IAIrG;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC;IAIpC;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAItE;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO9D;;;;;;;;;OASG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC;CAG7E;AAED,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAEtE,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC;IAE/B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;IAEhC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC;IACvC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import * as Shared from "./shared.js";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
export declare class SavedExtensions extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* This API creates a new saved extension. Saved extensions allow you to save
|
|
8
|
+
* complex extension configurations (like AI tasks) and reuse them by referencing
|
|
9
|
+
* the ID in upload or update file APIs.
|
|
10
|
+
*
|
|
11
|
+
* **Saved extension limit** \
|
|
12
|
+
* You can create a maximum of 100 saved extensions per account.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const savedExtension = await client.savedExtensions.create({
|
|
17
|
+
* config: {
|
|
18
|
+
* name: 'ai-tasks',
|
|
19
|
+
* tasks: [
|
|
20
|
+
* {
|
|
21
|
+
* instruction: 'What types of clothing items are visible in this image?',
|
|
22
|
+
* type: 'select_tags',
|
|
23
|
+
* vocabulary: ['shirt', 'dress', 'pants', 'jacket', 'shoes'],
|
|
24
|
+
* max_selections: 3,
|
|
25
|
+
* },
|
|
26
|
+
* ],
|
|
27
|
+
* },
|
|
28
|
+
* description: 'Automatically categorizes clothing items in fashion images',
|
|
29
|
+
* name: 'Fashion Item Categorization',
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
create(body: SavedExtensionCreateParams, options?: RequestOptions): APIPromise<Shared.SavedExtension>;
|
|
34
|
+
/**
|
|
35
|
+
* This API updates an existing saved extension. You can update the name,
|
|
36
|
+
* description, or config.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const savedExtension = await client.savedExtensions.update(
|
|
41
|
+
* 'id',
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
update(id: string, body: SavedExtensionUpdateParams, options?: RequestOptions): APIPromise<Shared.SavedExtension>;
|
|
46
|
+
/**
|
|
47
|
+
* This API returns an array of all saved extensions for your account. Saved
|
|
48
|
+
* extensions allow you to save complex extension configurations and reuse them by
|
|
49
|
+
* referencing them by ID in upload or update file APIs.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const savedExtensions = await client.savedExtensions.list();
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
list(options?: RequestOptions): APIPromise<SavedExtensionListResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* This API deletes a saved extension permanently.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await client.savedExtensions.delete('id');
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
delete(id: string, options?: RequestOptions): APIPromise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* This API returns details of a specific saved extension by ID.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const savedExtension = await client.savedExtensions.get(
|
|
72
|
+
* 'id',
|
|
73
|
+
* );
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
get(id: string, options?: RequestOptions): APIPromise<Shared.SavedExtension>;
|
|
77
|
+
}
|
|
78
|
+
export type SavedExtensionListResponse = Array<Shared.SavedExtension>;
|
|
79
|
+
export interface SavedExtensionCreateParams {
|
|
80
|
+
/**
|
|
81
|
+
* Configuration object for an extension (base extensions only, not saved extension
|
|
82
|
+
* references).
|
|
83
|
+
*/
|
|
84
|
+
config: Shared.ExtensionConfig;
|
|
85
|
+
/**
|
|
86
|
+
* Description of what the saved extension does.
|
|
87
|
+
*/
|
|
88
|
+
description: string;
|
|
89
|
+
/**
|
|
90
|
+
* Name of the saved extension.
|
|
91
|
+
*/
|
|
92
|
+
name: string;
|
|
93
|
+
}
|
|
94
|
+
export interface SavedExtensionUpdateParams {
|
|
95
|
+
/**
|
|
96
|
+
* Configuration object for an extension (base extensions only, not saved extension
|
|
97
|
+
* references).
|
|
98
|
+
*/
|
|
99
|
+
config?: Shared.ExtensionConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Updated description of the saved extension.
|
|
102
|
+
*/
|
|
103
|
+
description?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Updated name of the saved extension.
|
|
106
|
+
*/
|
|
107
|
+
name?: string;
|
|
108
|
+
}
|
|
109
|
+
export declare namespace SavedExtensions {
|
|
110
|
+
export { type SavedExtensionListResponse as SavedExtensionListResponse, type SavedExtensionCreateParams as SavedExtensionCreateParams, type SavedExtensionUpdateParams as SavedExtensionUpdateParams, };
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=saved-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saved-extensions.d.ts","sourceRoot":"","sources":["../src/resources/saved-extensions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC;IAIrG;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC;IAIpC;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAItE;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO9D;;;;;;;;;OASG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC;CAG7E;AAED,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAEtE,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC;IAE/B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC;IAEhC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC;IACvC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SavedExtensions = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const headers_1 = require("../internal/headers.js");
|
|
7
|
+
const path_1 = require("../internal/utils/path.js");
|
|
8
|
+
class SavedExtensions extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* This API creates a new saved extension. Saved extensions allow you to save
|
|
11
|
+
* complex extension configurations (like AI tasks) and reuse them by referencing
|
|
12
|
+
* the ID in upload or update file APIs.
|
|
13
|
+
*
|
|
14
|
+
* **Saved extension limit** \
|
|
15
|
+
* You can create a maximum of 100 saved extensions per account.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const savedExtension = await client.savedExtensions.create({
|
|
20
|
+
* config: {
|
|
21
|
+
* name: 'ai-tasks',
|
|
22
|
+
* tasks: [
|
|
23
|
+
* {
|
|
24
|
+
* instruction: 'What types of clothing items are visible in this image?',
|
|
25
|
+
* type: 'select_tags',
|
|
26
|
+
* vocabulary: ['shirt', 'dress', 'pants', 'jacket', 'shoes'],
|
|
27
|
+
* max_selections: 3,
|
|
28
|
+
* },
|
|
29
|
+
* ],
|
|
30
|
+
* },
|
|
31
|
+
* description: 'Automatically categorizes clothing items in fashion images',
|
|
32
|
+
* name: 'Fashion Item Categorization',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
create(body, options) {
|
|
37
|
+
return this._client.post('/v1/saved-extensions', { body, ...options });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* This API updates an existing saved extension. You can update the name,
|
|
41
|
+
* description, or config.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const savedExtension = await client.savedExtensions.update(
|
|
46
|
+
* 'id',
|
|
47
|
+
* );
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
update(id, body, options) {
|
|
51
|
+
return this._client.patch((0, path_1.path) `/v1/saved-extensions/${id}`, { body, ...options });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* This API returns an array of all saved extensions for your account. Saved
|
|
55
|
+
* extensions allow you to save complex extension configurations and reuse them by
|
|
56
|
+
* referencing them by ID in upload or update file APIs.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const savedExtensions = await client.savedExtensions.list();
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
list(options) {
|
|
64
|
+
return this._client.get('/v1/saved-extensions', options);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* This API deletes a saved extension permanently.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* await client.savedExtensions.delete('id');
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
delete(id, options) {
|
|
75
|
+
return this._client.delete((0, path_1.path) `/v1/saved-extensions/${id}`, {
|
|
76
|
+
...options,
|
|
77
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* This API returns details of a specific saved extension by ID.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const savedExtension = await client.savedExtensions.get(
|
|
86
|
+
* 'id',
|
|
87
|
+
* );
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
get(id, options) {
|
|
91
|
+
return this._client.get((0, path_1.path) `/v1/saved-extensions/${id}`, options);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.SavedExtensions = SavedExtensions;
|
|
95
|
+
//# sourceMappingURL=saved-extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saved-extensions.js","sourceRoot":"","sources":["../src/resources/saved-extensions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,eAAgB,SAAQ,sBAAW;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,IAAgC,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAU,EACV,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,wBAAwB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,wBAAwB,EAAE,EAAE,EAAE;YAC3D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,GAAG,CAAC,EAAU,EAAE,OAAwB;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,wBAAwB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;CACF;AA7FD,0CA6FC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
|
+
import { path } from "../internal/utils/path.mjs";
|
|
5
|
+
export class SavedExtensions extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* This API creates a new saved extension. Saved extensions allow you to save
|
|
8
|
+
* complex extension configurations (like AI tasks) and reuse them by referencing
|
|
9
|
+
* the ID in upload or update file APIs.
|
|
10
|
+
*
|
|
11
|
+
* **Saved extension limit** \
|
|
12
|
+
* You can create a maximum of 100 saved extensions per account.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const savedExtension = await client.savedExtensions.create({
|
|
17
|
+
* config: {
|
|
18
|
+
* name: 'ai-tasks',
|
|
19
|
+
* tasks: [
|
|
20
|
+
* {
|
|
21
|
+
* instruction: 'What types of clothing items are visible in this image?',
|
|
22
|
+
* type: 'select_tags',
|
|
23
|
+
* vocabulary: ['shirt', 'dress', 'pants', 'jacket', 'shoes'],
|
|
24
|
+
* max_selections: 3,
|
|
25
|
+
* },
|
|
26
|
+
* ],
|
|
27
|
+
* },
|
|
28
|
+
* description: 'Automatically categorizes clothing items in fashion images',
|
|
29
|
+
* name: 'Fashion Item Categorization',
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
create(body, options) {
|
|
34
|
+
return this._client.post('/v1/saved-extensions', { body, ...options });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This API updates an existing saved extension. You can update the name,
|
|
38
|
+
* description, or config.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const savedExtension = await client.savedExtensions.update(
|
|
43
|
+
* 'id',
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
update(id, body, options) {
|
|
48
|
+
return this._client.patch(path `/v1/saved-extensions/${id}`, { body, ...options });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* This API returns an array of all saved extensions for your account. Saved
|
|
52
|
+
* extensions allow you to save complex extension configurations and reuse them by
|
|
53
|
+
* referencing them by ID in upload or update file APIs.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const savedExtensions = await client.savedExtensions.list();
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
list(options) {
|
|
61
|
+
return this._client.get('/v1/saved-extensions', options);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* This API deletes a saved extension permanently.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* await client.savedExtensions.delete('id');
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
delete(id, options) {
|
|
72
|
+
return this._client.delete(path `/v1/saved-extensions/${id}`, {
|
|
73
|
+
...options,
|
|
74
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* This API returns details of a specific saved extension by ID.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const savedExtension = await client.savedExtensions.get(
|
|
83
|
+
* 'id',
|
|
84
|
+
* );
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
get(id, options) {
|
|
88
|
+
return this._client.get(path `/v1/saved-extensions/${id}`, options);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=saved-extensions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saved-extensions.mjs","sourceRoot":"","sources":["../src/resources/saved-extensions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,IAAgC,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CACJ,EAAU,EACV,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,wBAAwB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,wBAAwB,EAAE,EAAE,EAAE;YAC3D,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,GAAG,CAAC,EAAU,EAAE,OAAwB;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,wBAAwB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;CACF"}
|