@moovio/sdk 0.16.6 → 0.17.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/README.md +60 -45
- package/bin/mcp-server.js +1158 -545
- package/bin/mcp-server.js.map +20 -9
- package/docs/sdks/images/README.md +190 -0
- package/examples/package-lock.json +1 -1
- package/funcs/imagesUpdate.d.ts +19 -0
- package/funcs/imagesUpdate.d.ts.map +1 -0
- package/funcs/imagesUpdate.js +170 -0
- package/funcs/imagesUpdate.js.map +1 -0
- package/funcs/imagesUpload.d.ts +16 -0
- package/funcs/imagesUpload.d.ts.map +1 -0
- package/funcs/imagesUpload.js +161 -0
- package/funcs/imagesUpload.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +5 -1
- package/mcp-server/server.js.map +1 -1
- package/mcp-server/tools/imagesUpdate.d.ts +8 -0
- package/mcp-server/tools/imagesUpdate.d.ts.map +1 -0
- package/mcp-server/tools/imagesUpdate.js +66 -0
- package/mcp-server/tools/imagesUpdate.js.map +1 -0
- package/mcp-server/tools/imagesUpload.d.ts +8 -0
- package/mcp-server/tools/imagesUpload.d.ts.map +1 -0
- package/mcp-server/tools/imagesUpload.js +63 -0
- package/mcp-server/tools/imagesUpload.js.map +1 -0
- package/models/components/imagemetadatarequest.d.ts +35 -0
- package/models/components/imagemetadatarequest.d.ts.map +1 -0
- package/models/components/imagemetadatarequest.js +69 -0
- package/models/components/imagemetadatarequest.js.map +1 -0
- package/models/components/imagemetadatavalidationerror.d.ts +29 -0
- package/models/components/imagemetadatavalidationerror.d.ts.map +1 -0
- package/models/components/imagemetadatavalidationerror.js +69 -0
- package/models/components/imagemetadatavalidationerror.js.map +1 -0
- package/models/components/imageupdaterequestmultipart.d.ts +103 -0
- package/models/components/imageupdaterequestmultipart.d.ts.map +1 -0
- package/models/components/imageupdaterequestmultipart.js +139 -0
- package/models/components/imageupdaterequestmultipart.js.map +1 -0
- package/models/components/imageuploadrequestmultipart.d.ts +65 -0
- package/models/components/imageuploadrequestmultipart.d.ts.map +1 -0
- package/models/components/imageuploadrequestmultipart.js +113 -0
- package/models/components/imageuploadrequestmultipart.js.map +1 -0
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/errors/imagerequestvalidationerror.d.ts +40 -0
- package/models/errors/imagerequestvalidationerror.d.ts.map +1 -0
- package/models/errors/imagerequestvalidationerror.js +91 -0
- package/models/errors/imagerequestvalidationerror.js.map +1 -0
- package/models/errors/index.d.ts +1 -0
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +1 -0
- package/models/errors/index.js.map +1 -1
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/updateimage.d.ts +103 -0
- package/models/operations/updateimage.d.ts.map +1 -0
- package/models/operations/updateimage.js +157 -0
- package/models/operations/updateimage.js.map +1 -0
- package/models/operations/uploadimage.d.ts +101 -0
- package/models/operations/uploadimage.d.ts.map +1 -0
- package/models/operations/uploadimage.js +155 -0
- package/models/operations/uploadimage.js.map +1 -0
- package/package.json +1 -1
- package/sdk/images.d.ts +13 -0
- package/sdk/images.d.ts.map +1 -1
- package/sdk/images.js +19 -0
- package/sdk/images.js.map +1 -1
- package/src/funcs/imagesUpdate.ts +258 -0
- package/src/funcs/imagesUpload.ts +249 -0
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/imagesUpdate.ts +39 -0
- package/src/mcp-server/tools/imagesUpload.ts +36 -0
- package/src/models/components/imagemetadatarequest.ts +72 -0
- package/src/models/components/imagemetadatavalidationerror.ts +68 -0
- package/src/models/components/imageupdaterequestmultipart.ts +224 -0
- package/src/models/components/imageuploadrequestmultipart.ts +150 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/errors/imagerequestvalidationerror.ts +86 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/updateimage.ts +237 -0
- package/src/models/operations/uploadimage.ts +233 -0
- package/src/sdk/images.ts +35 -0
package/sdk/images.d.ts
CHANGED
|
@@ -7,10 +7,23 @@ export declare class Images extends ClientSDK {
|
|
|
7
7
|
* List metadata for all images in the specified account.
|
|
8
8
|
*/
|
|
9
9
|
list(request: operations.ListImageMetadataRequest, options?: RequestOptions): Promise<operations.ListImageMetadataResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Upload a new PNG, JPEG, or WebP image with optional metadata.
|
|
12
|
+
* Duplicate images, and requests larger than 16MB will be rejected.
|
|
13
|
+
*/
|
|
14
|
+
upload(request: operations.UploadImageRequest, options?: RequestOptions): Promise<operations.UploadImageResponse>;
|
|
10
15
|
/**
|
|
11
16
|
* Retrieve metadata for a specific image by its ID.
|
|
12
17
|
*/
|
|
13
18
|
getMetadata(request: operations.GetImageMetadataRequest, options?: RequestOptions): Promise<operations.GetImageMetadataResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Update an existing image and/or its metadata.
|
|
21
|
+
*
|
|
22
|
+
* Duplicate images, and requests larger than 16MB will be rejected. Omit any
|
|
23
|
+
* form parts you do not wish to update. Existing metadata can be cleared by
|
|
24
|
+
* sending `null` for the `metadata` form part.
|
|
25
|
+
*/
|
|
26
|
+
update(request: operations.UpdateImageRequest, options?: RequestOptions): Promise<operations.UpdateImageResponse>;
|
|
14
27
|
/**
|
|
15
28
|
* Permanently delete an image by its ID.
|
|
16
29
|
*/
|
package/sdk/images.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../src/sdk/images.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EAEpB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../src/sdk/images.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EAEpB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBAAa,MAAO,SAAQ,SAAS;IACnC;;OAEG;IACG,IAAI,CACR,OAAO,EAAE,UAAU,CAAC,wBAAwB,EAC5C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,yBAAyB,CAAC;IAQhD;;;OAGG;IACG,MAAM,CACV,OAAO,EAAE,UAAU,CAAC,kBAAkB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;IAQ1C;;OAEG;IACG,WAAW,CACf,OAAO,EAAE,UAAU,CAAC,uBAAuB,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC;IAQ/C;;;;;;OAMG;IACG,MAAM,CACV,OAAO,EAAE,UAAU,CAAC,kBAAkB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC;IAQ1C;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,UAAU,CAAC,kBAAkB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAQtD;;OAEG;IACG,SAAS,CACb,OAAO,EAAE,UAAU,CAAC,qBAAqB,EACzC,OAAO,CAAC,EAAE,cAAc,GAAG;QAAE,oBAAoB,CAAC,EAAE,mBAAmB,CAAA;KAAE,GACxE,OAAO,CAAC,UAAU,CAAC,sBAAsB,GAAG,SAAS,CAAC;CAO1D"}
|
package/sdk/images.js
CHANGED
|
@@ -8,6 +8,8 @@ const imagesDelete_js_1 = require("../funcs/imagesDelete.js");
|
|
|
8
8
|
const imagesGetMetadata_js_1 = require("../funcs/imagesGetMetadata.js");
|
|
9
9
|
const imagesGetPublic_js_1 = require("../funcs/imagesGetPublic.js");
|
|
10
10
|
const imagesList_js_1 = require("../funcs/imagesList.js");
|
|
11
|
+
const imagesUpdate_js_1 = require("../funcs/imagesUpdate.js");
|
|
12
|
+
const imagesUpload_js_1 = require("../funcs/imagesUpload.js");
|
|
11
13
|
const sdks_js_1 = require("../lib/sdks.js");
|
|
12
14
|
const fp_js_1 = require("../types/fp.js");
|
|
13
15
|
var imagesGetPublic_js_2 = require("../funcs/imagesGetPublic.js");
|
|
@@ -19,12 +21,29 @@ class Images extends sdks_js_1.ClientSDK {
|
|
|
19
21
|
async list(request, options) {
|
|
20
22
|
return (0, fp_js_1.unwrapAsync)((0, imagesList_js_1.imagesList)(this, request, options));
|
|
21
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Upload a new PNG, JPEG, or WebP image with optional metadata.
|
|
26
|
+
* Duplicate images, and requests larger than 16MB will be rejected.
|
|
27
|
+
*/
|
|
28
|
+
async upload(request, options) {
|
|
29
|
+
return (0, fp_js_1.unwrapAsync)((0, imagesUpload_js_1.imagesUpload)(this, request, options));
|
|
30
|
+
}
|
|
22
31
|
/**
|
|
23
32
|
* Retrieve metadata for a specific image by its ID.
|
|
24
33
|
*/
|
|
25
34
|
async getMetadata(request, options) {
|
|
26
35
|
return (0, fp_js_1.unwrapAsync)((0, imagesGetMetadata_js_1.imagesGetMetadata)(this, request, options));
|
|
27
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Update an existing image and/or its metadata.
|
|
39
|
+
*
|
|
40
|
+
* Duplicate images, and requests larger than 16MB will be rejected. Omit any
|
|
41
|
+
* form parts you do not wish to update. Existing metadata can be cleared by
|
|
42
|
+
* sending `null` for the `metadata` form part.
|
|
43
|
+
*/
|
|
44
|
+
async update(request, options) {
|
|
45
|
+
return (0, fp_js_1.unwrapAsync)((0, imagesUpdate_js_1.imagesUpdate)(this, request, options));
|
|
46
|
+
}
|
|
28
47
|
/**
|
|
29
48
|
* Permanently delete an image by its ID.
|
|
30
49
|
*/
|
package/sdk/images.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.js","sourceRoot":"","sources":["../src/sdk/images.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8DAAwD;AACxD,wEAAkE;AAClE,oEAGqC;AACrC,0DAAoD;AACpD,4CAA2D;AAE3D,0CAA6C;AAE7C,kEAAkE;AAAzD,yHAAA,mBAAmB,OAAA;AAE5B,MAAa,MAAO,SAAQ,mBAAS;IACnC;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,OAA4C,EAC5C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,0BAAU,EAC3B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,OAA2C,EAC3C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,wCAAiB,EAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAAsC,EACtC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,8BAAY,EAC7B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,OAAyC,EACzC,OAAyE;QAEzE,OAAO,IAAA,mBAAW,EAAC,IAAA,oCAAe,EAChC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"images.js","sourceRoot":"","sources":["../src/sdk/images.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8DAAwD;AACxD,wEAAkE;AAClE,oEAGqC;AACrC,0DAAoD;AACpD,8DAAwD;AACxD,8DAAwD;AACxD,4CAA2D;AAE3D,0CAA6C;AAE7C,kEAAkE;AAAzD,yHAAA,mBAAmB,OAAA;AAE5B,MAAa,MAAO,SAAQ,mBAAS;IACnC;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,OAA4C,EAC5C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,0BAAU,EAC3B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CACV,OAAsC,EACtC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,8BAAY,EAC7B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,OAA2C,EAC3C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,wCAAiB,EAClC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,OAAsC,EACtC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,8BAAY,EAC7B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,OAAsC,EACtC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,8BAAY,EAC7B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,OAAyC,EACzC,OAAyE;QAEzE,OAAO,IAAA,mBAAW,EAAC,IAAA,oCAAe,EAChC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AAzFD,wBAyFC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { MoovCore } from "../core.js";
|
|
6
|
+
import { appendForm, encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import {
|
|
8
|
+
getContentTypeFromFileName,
|
|
9
|
+
readableStreamToArrayBuffer,
|
|
10
|
+
} from "../lib/files.js";
|
|
11
|
+
import * as M from "../lib/matchers.js";
|
|
12
|
+
import { compactMap } from "../lib/primitives.js";
|
|
13
|
+
import { safeParse } from "../lib/schemas.js";
|
|
14
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
15
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
16
|
+
import { pathToFunc } from "../lib/url.js";
|
|
17
|
+
import {
|
|
18
|
+
ConnectionError,
|
|
19
|
+
InvalidRequestError,
|
|
20
|
+
RequestAbortedError,
|
|
21
|
+
RequestTimeoutError,
|
|
22
|
+
UnexpectedClientError,
|
|
23
|
+
} from "../models/errors/httpclienterrors.js";
|
|
24
|
+
import * as errors from "../models/errors/index.js";
|
|
25
|
+
import { MoovError } from "../models/errors/mooverror.js";
|
|
26
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
27
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
28
|
+
import * as operations from "../models/operations/index.js";
|
|
29
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
30
|
+
import { isBlobLike } from "../types/blobs.js";
|
|
31
|
+
import { Result } from "../types/fp.js";
|
|
32
|
+
import { isReadableStream } from "../types/streams.js";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Update an existing image and/or its metadata.
|
|
36
|
+
*
|
|
37
|
+
* Duplicate images, and requests larger than 16MB will be rejected. Omit any
|
|
38
|
+
* form parts you do not wish to update. Existing metadata can be cleared by
|
|
39
|
+
* sending `null` for the `metadata` form part.
|
|
40
|
+
*/
|
|
41
|
+
export function imagesUpdate(
|
|
42
|
+
client: MoovCore,
|
|
43
|
+
request: operations.UpdateImageRequest,
|
|
44
|
+
options?: RequestOptions,
|
|
45
|
+
): APIPromise<
|
|
46
|
+
Result<
|
|
47
|
+
operations.UpdateImageResponse,
|
|
48
|
+
| errors.GenericError
|
|
49
|
+
| errors.ImageRequestValidationError
|
|
50
|
+
| MoovError
|
|
51
|
+
| ResponseValidationError
|
|
52
|
+
| ConnectionError
|
|
53
|
+
| RequestAbortedError
|
|
54
|
+
| RequestTimeoutError
|
|
55
|
+
| InvalidRequestError
|
|
56
|
+
| UnexpectedClientError
|
|
57
|
+
| SDKValidationError
|
|
58
|
+
>
|
|
59
|
+
> {
|
|
60
|
+
return new APIPromise($do(
|
|
61
|
+
client,
|
|
62
|
+
request,
|
|
63
|
+
options,
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function $do(
|
|
68
|
+
client: MoovCore,
|
|
69
|
+
request: operations.UpdateImageRequest,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
operations.UpdateImageResponse,
|
|
75
|
+
| errors.GenericError
|
|
76
|
+
| errors.ImageRequestValidationError
|
|
77
|
+
| MoovError
|
|
78
|
+
| ResponseValidationError
|
|
79
|
+
| ConnectionError
|
|
80
|
+
| RequestAbortedError
|
|
81
|
+
| RequestTimeoutError
|
|
82
|
+
| InvalidRequestError
|
|
83
|
+
| UnexpectedClientError
|
|
84
|
+
| SDKValidationError
|
|
85
|
+
>,
|
|
86
|
+
APICall,
|
|
87
|
+
]
|
|
88
|
+
> {
|
|
89
|
+
const parsed = safeParse(
|
|
90
|
+
request,
|
|
91
|
+
(value) => operations.UpdateImageRequest$outboundSchema.parse(value),
|
|
92
|
+
"Input validation failed",
|
|
93
|
+
);
|
|
94
|
+
if (!parsed.ok) {
|
|
95
|
+
return [parsed, { status: "invalid" }];
|
|
96
|
+
}
|
|
97
|
+
const payload = parsed.value;
|
|
98
|
+
const body = new FormData();
|
|
99
|
+
|
|
100
|
+
if (payload.ImageUpdateRequestMultiPart.image !== undefined) {
|
|
101
|
+
if (isBlobLike(payload.ImageUpdateRequestMultiPart.image)) {
|
|
102
|
+
appendForm(body, "image", payload.ImageUpdateRequestMultiPart.image);
|
|
103
|
+
} else if (
|
|
104
|
+
isReadableStream(payload.ImageUpdateRequestMultiPart.image.content)
|
|
105
|
+
) {
|
|
106
|
+
const buffer = await readableStreamToArrayBuffer(
|
|
107
|
+
payload.ImageUpdateRequestMultiPart.image.content,
|
|
108
|
+
);
|
|
109
|
+
const contentType =
|
|
110
|
+
getContentTypeFromFileName(
|
|
111
|
+
payload.ImageUpdateRequestMultiPart.image.fileName,
|
|
112
|
+
) || "application/octet-stream";
|
|
113
|
+
const blob = new Blob([buffer], { type: contentType });
|
|
114
|
+
appendForm(
|
|
115
|
+
body,
|
|
116
|
+
"image",
|
|
117
|
+
blob,
|
|
118
|
+
payload.ImageUpdateRequestMultiPart.image.fileName,
|
|
119
|
+
);
|
|
120
|
+
} else {
|
|
121
|
+
const contentType =
|
|
122
|
+
getContentTypeFromFileName(
|
|
123
|
+
payload.ImageUpdateRequestMultiPart.image.fileName,
|
|
124
|
+
) || "application/octet-stream";
|
|
125
|
+
appendForm(
|
|
126
|
+
body,
|
|
127
|
+
"image",
|
|
128
|
+
new Blob([payload.ImageUpdateRequestMultiPart.image.content], {
|
|
129
|
+
type: contentType,
|
|
130
|
+
}),
|
|
131
|
+
payload.ImageUpdateRequestMultiPart.image.fileName,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (payload.ImageUpdateRequestMultiPart.metadata !== undefined) {
|
|
136
|
+
appendForm(
|
|
137
|
+
body,
|
|
138
|
+
"metadata",
|
|
139
|
+
encodeJSON("metadata", payload.ImageUpdateRequestMultiPart.metadata, {
|
|
140
|
+
explode: true,
|
|
141
|
+
}),
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const pathParams = {
|
|
146
|
+
accountID: encodeSimple("accountID", payload.accountID, {
|
|
147
|
+
explode: false,
|
|
148
|
+
charEncoding: "percent",
|
|
149
|
+
}),
|
|
150
|
+
imageID: encodeSimple("imageID", payload.imageID, {
|
|
151
|
+
explode: false,
|
|
152
|
+
charEncoding: "percent",
|
|
153
|
+
}),
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const path = pathToFunc("/accounts/{accountID}/images/{imageID}")(pathParams);
|
|
157
|
+
|
|
158
|
+
const headers = new Headers(compactMap({
|
|
159
|
+
Accept: "application/json",
|
|
160
|
+
"x-moov-version": encodeSimple(
|
|
161
|
+
"x-moov-version",
|
|
162
|
+
client._options.xMoovVersion,
|
|
163
|
+
{ explode: false, charEncoding: "none" },
|
|
164
|
+
),
|
|
165
|
+
}));
|
|
166
|
+
|
|
167
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
168
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
169
|
+
|
|
170
|
+
const context = {
|
|
171
|
+
options: client._options,
|
|
172
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
173
|
+
operationID: "updateImage",
|
|
174
|
+
oAuth2Scopes: null,
|
|
175
|
+
|
|
176
|
+
resolvedSecurity: requestSecurity,
|
|
177
|
+
|
|
178
|
+
securitySource: client._options.security,
|
|
179
|
+
retryConfig: options?.retries
|
|
180
|
+
|| client._options.retryConfig
|
|
181
|
+
|| { strategy: "none" },
|
|
182
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const requestRes = client._createRequest(context, {
|
|
186
|
+
security: requestSecurity,
|
|
187
|
+
method: "PATCH",
|
|
188
|
+
baseURL: options?.serverURL,
|
|
189
|
+
path: path,
|
|
190
|
+
headers: headers,
|
|
191
|
+
body: body,
|
|
192
|
+
userAgent: client._options.userAgent,
|
|
193
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
194
|
+
}, options);
|
|
195
|
+
if (!requestRes.ok) {
|
|
196
|
+
return [requestRes, { status: "invalid" }];
|
|
197
|
+
}
|
|
198
|
+
const req = requestRes.value;
|
|
199
|
+
|
|
200
|
+
const doResult = await client._do(req, {
|
|
201
|
+
context,
|
|
202
|
+
errorCodes: [
|
|
203
|
+
"400",
|
|
204
|
+
"401",
|
|
205
|
+
"403",
|
|
206
|
+
"404",
|
|
207
|
+
"409",
|
|
208
|
+
"422",
|
|
209
|
+
"429",
|
|
210
|
+
"4XX",
|
|
211
|
+
"500",
|
|
212
|
+
"504",
|
|
213
|
+
"5XX",
|
|
214
|
+
],
|
|
215
|
+
retryConfig: context.retryConfig,
|
|
216
|
+
retryCodes: context.retryCodes,
|
|
217
|
+
});
|
|
218
|
+
if (!doResult.ok) {
|
|
219
|
+
return [doResult, { status: "request-error", request: req }];
|
|
220
|
+
}
|
|
221
|
+
const response = doResult.value;
|
|
222
|
+
|
|
223
|
+
const responseFields = {
|
|
224
|
+
HttpMeta: { Response: response, Request: req },
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const [result] = await M.match<
|
|
228
|
+
operations.UpdateImageResponse,
|
|
229
|
+
| errors.GenericError
|
|
230
|
+
| errors.ImageRequestValidationError
|
|
231
|
+
| MoovError
|
|
232
|
+
| ResponseValidationError
|
|
233
|
+
| ConnectionError
|
|
234
|
+
| RequestAbortedError
|
|
235
|
+
| RequestTimeoutError
|
|
236
|
+
| InvalidRequestError
|
|
237
|
+
| UnexpectedClientError
|
|
238
|
+
| SDKValidationError
|
|
239
|
+
>(
|
|
240
|
+
M.json(200, operations.UpdateImageResponse$inboundSchema, {
|
|
241
|
+
hdrs: true,
|
|
242
|
+
key: "Result",
|
|
243
|
+
}),
|
|
244
|
+
M.jsonErr([400, 409], errors.GenericError$inboundSchema, { hdrs: true }),
|
|
245
|
+
M.jsonErr(422, errors.ImageRequestValidationError$inboundSchema, {
|
|
246
|
+
hdrs: true,
|
|
247
|
+
}),
|
|
248
|
+
M.fail([401, 403, 404, 429]),
|
|
249
|
+
M.fail([500, 504]),
|
|
250
|
+
M.fail("4XX"),
|
|
251
|
+
M.fail("5XX"),
|
|
252
|
+
)(response, req, { extraFields: responseFields });
|
|
253
|
+
if (!result.ok) {
|
|
254
|
+
return [result, { status: "complete", request: req, response }];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return [result, { status: "complete", request: req, response }];
|
|
258
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { MoovCore } from "../core.js";
|
|
6
|
+
import { appendForm, encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import {
|
|
8
|
+
getContentTypeFromFileName,
|
|
9
|
+
readableStreamToArrayBuffer,
|
|
10
|
+
} from "../lib/files.js";
|
|
11
|
+
import * as M from "../lib/matchers.js";
|
|
12
|
+
import { compactMap } from "../lib/primitives.js";
|
|
13
|
+
import { safeParse } from "../lib/schemas.js";
|
|
14
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
15
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
16
|
+
import { pathToFunc } from "../lib/url.js";
|
|
17
|
+
import {
|
|
18
|
+
ConnectionError,
|
|
19
|
+
InvalidRequestError,
|
|
20
|
+
RequestAbortedError,
|
|
21
|
+
RequestTimeoutError,
|
|
22
|
+
UnexpectedClientError,
|
|
23
|
+
} from "../models/errors/httpclienterrors.js";
|
|
24
|
+
import * as errors from "../models/errors/index.js";
|
|
25
|
+
import { MoovError } from "../models/errors/mooverror.js";
|
|
26
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
27
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
28
|
+
import * as operations from "../models/operations/index.js";
|
|
29
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
30
|
+
import { isBlobLike } from "../types/blobs.js";
|
|
31
|
+
import { Result } from "../types/fp.js";
|
|
32
|
+
import { isReadableStream } from "../types/streams.js";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Upload a new PNG, JPEG, or WebP image with optional metadata.
|
|
36
|
+
* Duplicate images, and requests larger than 16MB will be rejected.
|
|
37
|
+
*/
|
|
38
|
+
export function imagesUpload(
|
|
39
|
+
client: MoovCore,
|
|
40
|
+
request: operations.UploadImageRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
operations.UploadImageResponse,
|
|
45
|
+
| errors.GenericError
|
|
46
|
+
| errors.ImageRequestValidationError
|
|
47
|
+
| MoovError
|
|
48
|
+
| ResponseValidationError
|
|
49
|
+
| ConnectionError
|
|
50
|
+
| RequestAbortedError
|
|
51
|
+
| RequestTimeoutError
|
|
52
|
+
| InvalidRequestError
|
|
53
|
+
| UnexpectedClientError
|
|
54
|
+
| SDKValidationError
|
|
55
|
+
>
|
|
56
|
+
> {
|
|
57
|
+
return new APIPromise($do(
|
|
58
|
+
client,
|
|
59
|
+
request,
|
|
60
|
+
options,
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function $do(
|
|
65
|
+
client: MoovCore,
|
|
66
|
+
request: operations.UploadImageRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.UploadImageResponse,
|
|
72
|
+
| errors.GenericError
|
|
73
|
+
| errors.ImageRequestValidationError
|
|
74
|
+
| MoovError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) => operations.UploadImageRequest$outboundSchema.parse(value),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = new FormData();
|
|
96
|
+
|
|
97
|
+
if (isBlobLike(payload.ImageUploadRequestMultiPart.image)) {
|
|
98
|
+
appendForm(body, "image", payload.ImageUploadRequestMultiPart.image);
|
|
99
|
+
} else if (
|
|
100
|
+
isReadableStream(payload.ImageUploadRequestMultiPart.image.content)
|
|
101
|
+
) {
|
|
102
|
+
const buffer = await readableStreamToArrayBuffer(
|
|
103
|
+
payload.ImageUploadRequestMultiPart.image.content,
|
|
104
|
+
);
|
|
105
|
+
const contentType =
|
|
106
|
+
getContentTypeFromFileName(
|
|
107
|
+
payload.ImageUploadRequestMultiPart.image.fileName,
|
|
108
|
+
) || "application/octet-stream";
|
|
109
|
+
const blob = new Blob([buffer], { type: contentType });
|
|
110
|
+
appendForm(
|
|
111
|
+
body,
|
|
112
|
+
"image",
|
|
113
|
+
blob,
|
|
114
|
+
payload.ImageUploadRequestMultiPart.image.fileName,
|
|
115
|
+
);
|
|
116
|
+
} else {
|
|
117
|
+
const contentType =
|
|
118
|
+
getContentTypeFromFileName(
|
|
119
|
+
payload.ImageUploadRequestMultiPart.image.fileName,
|
|
120
|
+
) || "application/octet-stream";
|
|
121
|
+
appendForm(
|
|
122
|
+
body,
|
|
123
|
+
"image",
|
|
124
|
+
new Blob([payload.ImageUploadRequestMultiPart.image.content], {
|
|
125
|
+
type: contentType,
|
|
126
|
+
}),
|
|
127
|
+
payload.ImageUploadRequestMultiPart.image.fileName,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (payload.ImageUploadRequestMultiPart.metadata !== undefined) {
|
|
131
|
+
appendForm(
|
|
132
|
+
body,
|
|
133
|
+
"metadata",
|
|
134
|
+
encodeJSON("metadata", payload.ImageUploadRequestMultiPart.metadata, {
|
|
135
|
+
explode: true,
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const pathParams = {
|
|
141
|
+
accountID: encodeSimple("accountID", payload.accountID, {
|
|
142
|
+
explode: false,
|
|
143
|
+
charEncoding: "percent",
|
|
144
|
+
}),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const path = pathToFunc("/accounts/{accountID}/images")(pathParams);
|
|
148
|
+
|
|
149
|
+
const headers = new Headers(compactMap({
|
|
150
|
+
Accept: "application/json",
|
|
151
|
+
"x-moov-version": encodeSimple(
|
|
152
|
+
"x-moov-version",
|
|
153
|
+
client._options.xMoovVersion,
|
|
154
|
+
{ explode: false, charEncoding: "none" },
|
|
155
|
+
),
|
|
156
|
+
}));
|
|
157
|
+
|
|
158
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
159
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
160
|
+
|
|
161
|
+
const context = {
|
|
162
|
+
options: client._options,
|
|
163
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
164
|
+
operationID: "uploadImage",
|
|
165
|
+
oAuth2Scopes: null,
|
|
166
|
+
|
|
167
|
+
resolvedSecurity: requestSecurity,
|
|
168
|
+
|
|
169
|
+
securitySource: client._options.security,
|
|
170
|
+
retryConfig: options?.retries
|
|
171
|
+
|| client._options.retryConfig
|
|
172
|
+
|| { strategy: "none" },
|
|
173
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const requestRes = client._createRequest(context, {
|
|
177
|
+
security: requestSecurity,
|
|
178
|
+
method: "POST",
|
|
179
|
+
baseURL: options?.serverURL,
|
|
180
|
+
path: path,
|
|
181
|
+
headers: headers,
|
|
182
|
+
body: body,
|
|
183
|
+
userAgent: client._options.userAgent,
|
|
184
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
185
|
+
}, options);
|
|
186
|
+
if (!requestRes.ok) {
|
|
187
|
+
return [requestRes, { status: "invalid" }];
|
|
188
|
+
}
|
|
189
|
+
const req = requestRes.value;
|
|
190
|
+
|
|
191
|
+
const doResult = await client._do(req, {
|
|
192
|
+
context,
|
|
193
|
+
errorCodes: [
|
|
194
|
+
"400",
|
|
195
|
+
"401",
|
|
196
|
+
"403",
|
|
197
|
+
"404",
|
|
198
|
+
"409",
|
|
199
|
+
"422",
|
|
200
|
+
"429",
|
|
201
|
+
"4XX",
|
|
202
|
+
"500",
|
|
203
|
+
"504",
|
|
204
|
+
"5XX",
|
|
205
|
+
],
|
|
206
|
+
retryConfig: context.retryConfig,
|
|
207
|
+
retryCodes: context.retryCodes,
|
|
208
|
+
});
|
|
209
|
+
if (!doResult.ok) {
|
|
210
|
+
return [doResult, { status: "request-error", request: req }];
|
|
211
|
+
}
|
|
212
|
+
const response = doResult.value;
|
|
213
|
+
|
|
214
|
+
const responseFields = {
|
|
215
|
+
HttpMeta: { Response: response, Request: req },
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const [result] = await M.match<
|
|
219
|
+
operations.UploadImageResponse,
|
|
220
|
+
| errors.GenericError
|
|
221
|
+
| errors.ImageRequestValidationError
|
|
222
|
+
| MoovError
|
|
223
|
+
| ResponseValidationError
|
|
224
|
+
| ConnectionError
|
|
225
|
+
| RequestAbortedError
|
|
226
|
+
| RequestTimeoutError
|
|
227
|
+
| InvalidRequestError
|
|
228
|
+
| UnexpectedClientError
|
|
229
|
+
| SDKValidationError
|
|
230
|
+
>(
|
|
231
|
+
M.json(201, operations.UploadImageResponse$inboundSchema, {
|
|
232
|
+
hdrs: true,
|
|
233
|
+
key: "Result",
|
|
234
|
+
}),
|
|
235
|
+
M.jsonErr([400, 409], errors.GenericError$inboundSchema, { hdrs: true }),
|
|
236
|
+
M.jsonErr(422, errors.ImageRequestValidationError$inboundSchema, {
|
|
237
|
+
hdrs: true,
|
|
238
|
+
}),
|
|
239
|
+
M.fail([401, 403, 404, 429]),
|
|
240
|
+
M.fail([500, 504]),
|
|
241
|
+
M.fail("4XX"),
|
|
242
|
+
M.fail("5XX"),
|
|
243
|
+
)(response, req, { extraFields: responseFields });
|
|
244
|
+
if (!result.ok) {
|
|
245
|
+
return [result, { status: "complete", request: req, response }];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return [result, { status: "complete", request: req, response }];
|
|
249
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -73,7 +73,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
73
73
|
export const SDK_METADATA = {
|
|
74
74
|
language: "typescript",
|
|
75
75
|
openapiDocVersion: "latest",
|
|
76
|
-
sdkVersion: "0.
|
|
77
|
-
genVersion: "2.
|
|
78
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
76
|
+
sdkVersion: "0.17.0",
|
|
77
|
+
genVersion: "2.727.4",
|
|
78
|
+
userAgent: "speakeasy-sdk/typescript 0.17.0 2.727.4 latest @moovio/sdk",
|
|
79
79
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -92,6 +92,8 @@ import { tool$imagesDelete } from "./tools/imagesDelete.js";
|
|
|
92
92
|
import { tool$imagesGetMetadata } from "./tools/imagesGetMetadata.js";
|
|
93
93
|
import { tool$imagesGetPublic } from "./tools/imagesGetPublic.js";
|
|
94
94
|
import { tool$imagesList } from "./tools/imagesList.js";
|
|
95
|
+
import { tool$imagesUpdate } from "./tools/imagesUpdate.js";
|
|
96
|
+
import { tool$imagesUpload } from "./tools/imagesUpload.js";
|
|
95
97
|
import { tool$industriesList } from "./tools/industriesList.js";
|
|
96
98
|
import { tool$institutionsSearch } from "./tools/institutionsSearch.js";
|
|
97
99
|
import { tool$institutionsSearchInstitutions } from "./tools/institutionsSearchInstitutions.js";
|
|
@@ -181,7 +183,7 @@ export function createMCPServer(deps: {
|
|
|
181
183
|
}) {
|
|
182
184
|
const server = new McpServer({
|
|
183
185
|
name: "Moov",
|
|
184
|
-
version: "0.
|
|
186
|
+
version: "0.17.0",
|
|
185
187
|
});
|
|
186
188
|
|
|
187
189
|
const client = new MoovCore({
|
|
@@ -272,7 +274,9 @@ export function createMCPServer(deps: {
|
|
|
272
274
|
tool(tool$filesList);
|
|
273
275
|
tool(tool$filesGet);
|
|
274
276
|
tool(tool$imagesList);
|
|
277
|
+
tool(tool$imagesUpload);
|
|
275
278
|
tool(tool$imagesGetMetadata);
|
|
279
|
+
tool(tool$imagesUpdate);
|
|
276
280
|
tool(tool$imagesDelete);
|
|
277
281
|
tool(tool$imagesGetPublic);
|
|
278
282
|
tool(tool$paymentLinksCreate);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { imagesUpdate } from "../../funcs/imagesUpdate.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.UpdateImageRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$imagesUpdate: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "images-update",
|
|
15
|
+
description: `Update an existing image and/or its metadata.
|
|
16
|
+
|
|
17
|
+
Duplicate images, and requests larger than 16MB will be rejected. Omit any
|
|
18
|
+
form parts you do not wish to update. Existing metadata can be cleared by
|
|
19
|
+
sending \`null\` for the \`metadata\` form part.`,
|
|
20
|
+
args,
|
|
21
|
+
tool: async (client, args, ctx) => {
|
|
22
|
+
const [result, apiCall] = await imagesUpdate(
|
|
23
|
+
client,
|
|
24
|
+
args.request,
|
|
25
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
26
|
+
).$inspect();
|
|
27
|
+
|
|
28
|
+
if (!result.ok) {
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: "text", text: result.error.message }],
|
|
31
|
+
isError: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const value = result.value.result;
|
|
36
|
+
|
|
37
|
+
return formatResult(value, apiCall);
|
|
38
|
+
},
|
|
39
|
+
};
|