@moovio/sdk 0.16.4 → 0.16.5
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 +62 -44
- package/bin/mcp-server.js +1864 -585
- package/bin/mcp-server.js.map +37 -9
- package/docs/sdks/products/README.md +592 -0
- package/examples/package-lock.json +1 -1
- package/funcs/productsCreate.d.ts +15 -0
- package/funcs/productsCreate.d.ts.map +1 -0
- package/funcs/productsCreate.js +138 -0
- package/funcs/productsCreate.js.map +1 -0
- package/funcs/productsDisable.d.ts +17 -0
- package/funcs/productsDisable.d.ts.map +1 -0
- package/funcs/productsDisable.js +139 -0
- package/funcs/productsDisable.js.map +1 -0
- package/funcs/productsGet.d.ts +14 -0
- package/funcs/productsGet.d.ts.map +1 -0
- package/funcs/productsGet.js +126 -0
- package/funcs/productsGet.js.map +1 -0
- package/funcs/productsList.d.ts +14 -0
- package/funcs/productsList.d.ts.map +1 -0
- package/funcs/productsList.js +127 -0
- package/funcs/productsList.js.map +1 -0
- package/funcs/productsUpdate.d.ts +15 -0
- package/funcs/productsUpdate.d.ts.map +1 -0
- package/funcs/productsUpdate.js +142 -0
- package/funcs/productsUpdate.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +11 -1
- package/mcp-server/server.js.map +1 -1
- package/mcp-server/tools/productsCreate.d.ts +8 -0
- package/mcp-server/tools/productsCreate.d.ts.map +1 -0
- package/mcp-server/tools/productsCreate.js +62 -0
- package/mcp-server/tools/productsCreate.js.map +1 -0
- package/mcp-server/tools/productsDisable.d.ts +8 -0
- package/mcp-server/tools/productsDisable.d.ts.map +1 -0
- package/mcp-server/tools/productsDisable.js +63 -0
- package/mcp-server/tools/productsDisable.js.map +1 -0
- package/mcp-server/tools/productsGet.d.ts +8 -0
- package/mcp-server/tools/productsGet.d.ts.map +1 -0
- package/mcp-server/tools/productsGet.js +62 -0
- package/mcp-server/tools/productsGet.js.map +1 -0
- package/mcp-server/tools/productsList.d.ts +8 -0
- package/mcp-server/tools/productsList.d.ts.map +1 -0
- package/mcp-server/tools/productsList.js +62 -0
- package/mcp-server/tools/productsList.js.map +1 -0
- package/mcp-server/tools/productsUpdate.d.ts +8 -0
- package/mcp-server/tools/productsUpdate.d.ts.map +1 -0
- package/mcp-server/tools/productsUpdate.js +62 -0
- package/mcp-server/tools/productsUpdate.js.map +1 -0
- package/models/components/amountdecimalvalidationerror.d.ts +31 -0
- package/models/components/amountdecimalvalidationerror.d.ts.map +1 -0
- package/models/components/amountdecimalvalidationerror.js +71 -0
- package/models/components/amountdecimalvalidationerror.js.map +1 -0
- package/models/components/assignproductimage.d.ts +32 -0
- package/models/components/assignproductimage.d.ts.map +1 -0
- package/models/components/assignproductimage.js +69 -0
- package/models/components/assignproductimage.js.map +1 -0
- package/models/components/assignproductimagevalidationerror.d.ts +29 -0
- package/models/components/assignproductimagevalidationerror.d.ts.map +1 -0
- package/models/components/assignproductimagevalidationerror.js +69 -0
- package/models/components/assignproductimagevalidationerror.js.map +1 -0
- package/models/components/createproductoption.d.ts +54 -0
- package/models/components/createproductoption.d.ts.map +1 -0
- package/models/components/createproductoption.js +76 -0
- package/models/components/createproductoption.js.map +1 -0
- package/models/components/createproductoptiongroup.d.ts +60 -0
- package/models/components/createproductoptiongroup.d.ts.map +1 -0
- package/models/components/createproductoptiongroup.js +78 -0
- package/models/components/createproductoptiongroup.js.map +1 -0
- package/models/components/index.d.ts +12 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +12 -0
- package/models/components/index.js.map +1 -1
- package/models/components/product.d.ts +81 -0
- package/models/components/product.d.ts.map +1 -0
- package/models/components/product.js +88 -0
- package/models/components/product.js.map +1 -0
- package/models/components/productimagemetadata.d.ts +42 -0
- package/models/components/productimagemetadata.d.ts.map +1 -0
- package/models/components/productimagemetadata.js +73 -0
- package/models/components/productimagemetadata.js.map +1 -0
- package/models/components/productoption.d.ts +57 -0
- package/models/components/productoption.d.ts.map +1 -0
- package/models/components/productoption.js +76 -0
- package/models/components/productoption.js.map +1 -0
- package/models/components/productoptiongroup.d.ts +63 -0
- package/models/components/productoptiongroup.d.ts.map +1 -0
- package/models/components/productoptiongroup.js +78 -0
- package/models/components/productoptiongroup.js.map +1 -0
- package/models/components/productoptiongroupvalidationerror.d.ts +42 -0
- package/models/components/productoptiongroupvalidationerror.d.ts.map +1 -0
- package/models/components/productoptiongroupvalidationerror.js +78 -0
- package/models/components/productoptiongroupvalidationerror.js.map +1 -0
- package/models/components/productoptionvalidationerror.d.ts +40 -0
- package/models/components/productoptionvalidationerror.d.ts.map +1 -0
- package/models/components/productoptionvalidationerror.js +76 -0
- package/models/components/productoptionvalidationerror.js.map +1 -0
- package/models/components/productrequest.d.ts +61 -0
- package/models/components/productrequest.d.ts.map +1 -0
- package/models/components/productrequest.js +80 -0
- package/models/components/productrequest.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/errors/productrequestvalidationerror.d.ts +61 -0
- package/models/errors/productrequestvalidationerror.d.ts.map +1 -0
- package/models/errors/productrequestvalidationerror.js +105 -0
- package/models/errors/productrequestvalidationerror.js.map +1 -0
- package/models/operations/createproduct.d.ts +101 -0
- package/models/operations/createproduct.d.ts.map +1 -0
- package/models/operations/createproduct.js +155 -0
- package/models/operations/createproduct.js.map +1 -0
- package/models/operations/disableproduct.d.ts +98 -0
- package/models/operations/disableproduct.d.ts.map +1 -0
- package/models/operations/disableproduct.js +142 -0
- package/models/operations/disableproduct.js.map +1 -0
- package/models/operations/getproduct.d.ts +101 -0
- package/models/operations/getproduct.d.ts.map +1 -0
- package/models/operations/getproduct.js +147 -0
- package/models/operations/getproduct.js.map +1 -0
- package/models/operations/index.d.ts +5 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +5 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/listproducts.d.ts +103 -0
- package/models/operations/listproducts.d.ts.map +1 -0
- package/models/operations/listproducts.js +149 -0
- package/models/operations/listproducts.js.map +1 -0
- package/models/operations/updateproduct.d.ts +103 -0
- package/models/operations/updateproduct.d.ts.map +1 -0
- package/models/operations/updateproduct.js +157 -0
- package/models/operations/updateproduct.js.map +1 -0
- package/package.json +1 -1
- package/sdk/products.d.ts +27 -0
- package/sdk/products.d.ts.map +1 -0
- package/sdk/products.js +49 -0
- package/sdk/products.js.map +1 -0
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +4 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/productsCreate.ts +200 -0
- package/src/funcs/productsDisable.ts +199 -0
- package/src/funcs/productsGet.ts +182 -0
- package/src/funcs/productsList.ts +182 -0
- package/src/funcs/productsUpdate.ts +206 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +11 -1
- package/src/mcp-server/tools/productsCreate.ts +35 -0
- package/src/mcp-server/tools/productsDisable.ts +35 -0
- package/src/mcp-server/tools/productsGet.ts +35 -0
- package/src/mcp-server/tools/productsList.ts +35 -0
- package/src/mcp-server/tools/productsUpdate.ts +35 -0
- package/src/models/components/amountdecimalvalidationerror.ts +72 -0
- package/src/models/components/assignproductimage.ts +69 -0
- package/src/models/components/assignproductimagevalidationerror.ts +69 -0
- package/src/models/components/createproductoption.ts +102 -0
- package/src/models/components/createproductoptiongroup.ts +110 -0
- package/src/models/components/index.ts +12 -0
- package/src/models/components/product.ts +148 -0
- package/src/models/components/productimagemetadata.ts +83 -0
- package/src/models/components/productoption.ts +101 -0
- package/src/models/components/productoptiongroup.ts +113 -0
- package/src/models/components/productoptiongroupvalidationerror.ts +91 -0
- package/src/models/components/productoptionvalidationerror.ts +88 -0
- package/src/models/components/productrequest.ts +117 -0
- package/src/models/errors/index.ts +1 -0
- package/src/models/errors/productrequestvalidationerror.ts +124 -0
- package/src/models/operations/createproduct.ts +231 -0
- package/src/models/operations/disableproduct.ts +216 -0
- package/src/models/operations/getproduct.ts +223 -0
- package/src/models/operations/index.ts +5 -0
- package/src/models/operations/listproducts.ts +227 -0
- package/src/models/operations/updateproduct.ts +235 -0
- package/src/sdk/products.ts +86 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { MoovCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import { MoovError } from "../models/errors/mooverror.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* List active (non-disabled) products for an account.
|
|
29
|
+
*/
|
|
30
|
+
export function productsList(
|
|
31
|
+
client: MoovCore,
|
|
32
|
+
request: operations.ListProductsRequest,
|
|
33
|
+
options?: RequestOptions,
|
|
34
|
+
): APIPromise<
|
|
35
|
+
Result<
|
|
36
|
+
operations.ListProductsResponse,
|
|
37
|
+
| MoovError
|
|
38
|
+
| ResponseValidationError
|
|
39
|
+
| ConnectionError
|
|
40
|
+
| RequestAbortedError
|
|
41
|
+
| RequestTimeoutError
|
|
42
|
+
| InvalidRequestError
|
|
43
|
+
| UnexpectedClientError
|
|
44
|
+
| SDKValidationError
|
|
45
|
+
>
|
|
46
|
+
> {
|
|
47
|
+
return new APIPromise($do(
|
|
48
|
+
client,
|
|
49
|
+
request,
|
|
50
|
+
options,
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function $do(
|
|
55
|
+
client: MoovCore,
|
|
56
|
+
request: operations.ListProductsRequest,
|
|
57
|
+
options?: RequestOptions,
|
|
58
|
+
): Promise<
|
|
59
|
+
[
|
|
60
|
+
Result<
|
|
61
|
+
operations.ListProductsResponse,
|
|
62
|
+
| MoovError
|
|
63
|
+
| ResponseValidationError
|
|
64
|
+
| ConnectionError
|
|
65
|
+
| RequestAbortedError
|
|
66
|
+
| RequestTimeoutError
|
|
67
|
+
| InvalidRequestError
|
|
68
|
+
| UnexpectedClientError
|
|
69
|
+
| SDKValidationError
|
|
70
|
+
>,
|
|
71
|
+
APICall,
|
|
72
|
+
]
|
|
73
|
+
> {
|
|
74
|
+
const parsed = safeParse(
|
|
75
|
+
request,
|
|
76
|
+
(value) => operations.ListProductsRequest$outboundSchema.parse(value),
|
|
77
|
+
"Input validation failed",
|
|
78
|
+
);
|
|
79
|
+
if (!parsed.ok) {
|
|
80
|
+
return [parsed, { status: "invalid" }];
|
|
81
|
+
}
|
|
82
|
+
const payload = parsed.value;
|
|
83
|
+
const body = null;
|
|
84
|
+
|
|
85
|
+
const pathParams = {
|
|
86
|
+
accountID: encodeSimple("accountID", payload.accountID, {
|
|
87
|
+
explode: false,
|
|
88
|
+
charEncoding: "percent",
|
|
89
|
+
}),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const path = pathToFunc("/accounts/{accountID}/products")(pathParams);
|
|
93
|
+
|
|
94
|
+
const query = encodeFormQuery({
|
|
95
|
+
"count": payload.count,
|
|
96
|
+
"skip": payload.skip,
|
|
97
|
+
}, { explode: false });
|
|
98
|
+
|
|
99
|
+
const headers = new Headers(compactMap({
|
|
100
|
+
Accept: "application/json",
|
|
101
|
+
"x-moov-version": encodeSimple(
|
|
102
|
+
"x-moov-version",
|
|
103
|
+
client._options.xMoovVersion,
|
|
104
|
+
{ explode: false, charEncoding: "none" },
|
|
105
|
+
),
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
109
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
110
|
+
|
|
111
|
+
const context = {
|
|
112
|
+
options: client._options,
|
|
113
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
114
|
+
operationID: "listProducts",
|
|
115
|
+
oAuth2Scopes: null,
|
|
116
|
+
|
|
117
|
+
resolvedSecurity: requestSecurity,
|
|
118
|
+
|
|
119
|
+
securitySource: client._options.security,
|
|
120
|
+
retryConfig: options?.retries
|
|
121
|
+
|| client._options.retryConfig
|
|
122
|
+
|| { strategy: "none" },
|
|
123
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const requestRes = client._createRequest(context, {
|
|
127
|
+
security: requestSecurity,
|
|
128
|
+
method: "GET",
|
|
129
|
+
baseURL: options?.serverURL,
|
|
130
|
+
path: path,
|
|
131
|
+
headers: headers,
|
|
132
|
+
query: query,
|
|
133
|
+
body: body,
|
|
134
|
+
userAgent: client._options.userAgent,
|
|
135
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
136
|
+
}, options);
|
|
137
|
+
if (!requestRes.ok) {
|
|
138
|
+
return [requestRes, { status: "invalid" }];
|
|
139
|
+
}
|
|
140
|
+
const req = requestRes.value;
|
|
141
|
+
|
|
142
|
+
const doResult = await client._do(req, {
|
|
143
|
+
context,
|
|
144
|
+
errorCodes: ["401", "403", "429", "4XX", "500", "504", "5XX"],
|
|
145
|
+
retryConfig: context.retryConfig,
|
|
146
|
+
retryCodes: context.retryCodes,
|
|
147
|
+
});
|
|
148
|
+
if (!doResult.ok) {
|
|
149
|
+
return [doResult, { status: "request-error", request: req }];
|
|
150
|
+
}
|
|
151
|
+
const response = doResult.value;
|
|
152
|
+
|
|
153
|
+
const responseFields = {
|
|
154
|
+
HttpMeta: { Response: response, Request: req },
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const [result] = await M.match<
|
|
158
|
+
operations.ListProductsResponse,
|
|
159
|
+
| MoovError
|
|
160
|
+
| ResponseValidationError
|
|
161
|
+
| ConnectionError
|
|
162
|
+
| RequestAbortedError
|
|
163
|
+
| RequestTimeoutError
|
|
164
|
+
| InvalidRequestError
|
|
165
|
+
| UnexpectedClientError
|
|
166
|
+
| SDKValidationError
|
|
167
|
+
>(
|
|
168
|
+
M.json(200, operations.ListProductsResponse$inboundSchema, {
|
|
169
|
+
hdrs: true,
|
|
170
|
+
key: "Result",
|
|
171
|
+
}),
|
|
172
|
+
M.fail([401, 403, 429]),
|
|
173
|
+
M.fail([500, 504]),
|
|
174
|
+
M.fail("4XX"),
|
|
175
|
+
M.fail("5XX"),
|
|
176
|
+
)(response, req, { extraFields: responseFields });
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { MoovCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { MoovError } from "../models/errors/mooverror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Update a product and its options.
|
|
30
|
+
*/
|
|
31
|
+
export function productsUpdate(
|
|
32
|
+
client: MoovCore,
|
|
33
|
+
request: operations.UpdateProductRequest,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<
|
|
36
|
+
Result<
|
|
37
|
+
operations.UpdateProductResponse,
|
|
38
|
+
| errors.GenericError
|
|
39
|
+
| errors.ProductRequestValidationError
|
|
40
|
+
| MoovError
|
|
41
|
+
| ResponseValidationError
|
|
42
|
+
| ConnectionError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| UnexpectedClientError
|
|
47
|
+
| SDKValidationError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
request,
|
|
53
|
+
options,
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function $do(
|
|
58
|
+
client: MoovCore,
|
|
59
|
+
request: operations.UpdateProductRequest,
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<
|
|
62
|
+
[
|
|
63
|
+
Result<
|
|
64
|
+
operations.UpdateProductResponse,
|
|
65
|
+
| errors.GenericError
|
|
66
|
+
| errors.ProductRequestValidationError
|
|
67
|
+
| MoovError
|
|
68
|
+
| ResponseValidationError
|
|
69
|
+
| ConnectionError
|
|
70
|
+
| RequestAbortedError
|
|
71
|
+
| RequestTimeoutError
|
|
72
|
+
| InvalidRequestError
|
|
73
|
+
| UnexpectedClientError
|
|
74
|
+
| SDKValidationError
|
|
75
|
+
>,
|
|
76
|
+
APICall,
|
|
77
|
+
]
|
|
78
|
+
> {
|
|
79
|
+
const parsed = safeParse(
|
|
80
|
+
request,
|
|
81
|
+
(value) => operations.UpdateProductRequest$outboundSchema.parse(value),
|
|
82
|
+
"Input validation failed",
|
|
83
|
+
);
|
|
84
|
+
if (!parsed.ok) {
|
|
85
|
+
return [parsed, { status: "invalid" }];
|
|
86
|
+
}
|
|
87
|
+
const payload = parsed.value;
|
|
88
|
+
const body = encodeJSON("body", payload.ProductRequest, { explode: true });
|
|
89
|
+
|
|
90
|
+
const pathParams = {
|
|
91
|
+
accountID: encodeSimple("accountID", payload.accountID, {
|
|
92
|
+
explode: false,
|
|
93
|
+
charEncoding: "percent",
|
|
94
|
+
}),
|
|
95
|
+
productID: encodeSimple("productID", payload.productID, {
|
|
96
|
+
explode: false,
|
|
97
|
+
charEncoding: "percent",
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const path = pathToFunc("/accounts/{accountID}/products/{productID}")(
|
|
102
|
+
pathParams,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const headers = new Headers(compactMap({
|
|
106
|
+
"Content-Type": "application/json",
|
|
107
|
+
Accept: "application/json",
|
|
108
|
+
"x-moov-version": encodeSimple(
|
|
109
|
+
"x-moov-version",
|
|
110
|
+
client._options.xMoovVersion,
|
|
111
|
+
{ explode: false, charEncoding: "none" },
|
|
112
|
+
),
|
|
113
|
+
}));
|
|
114
|
+
|
|
115
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
116
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
117
|
+
|
|
118
|
+
const context = {
|
|
119
|
+
options: client._options,
|
|
120
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
121
|
+
operationID: "updateProduct",
|
|
122
|
+
oAuth2Scopes: null,
|
|
123
|
+
|
|
124
|
+
resolvedSecurity: requestSecurity,
|
|
125
|
+
|
|
126
|
+
securitySource: client._options.security,
|
|
127
|
+
retryConfig: options?.retries
|
|
128
|
+
|| client._options.retryConfig
|
|
129
|
+
|| { strategy: "none" },
|
|
130
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const requestRes = client._createRequest(context, {
|
|
134
|
+
security: requestSecurity,
|
|
135
|
+
method: "PUT",
|
|
136
|
+
baseURL: options?.serverURL,
|
|
137
|
+
path: path,
|
|
138
|
+
headers: headers,
|
|
139
|
+
body: body,
|
|
140
|
+
userAgent: client._options.userAgent,
|
|
141
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
142
|
+
}, options);
|
|
143
|
+
if (!requestRes.ok) {
|
|
144
|
+
return [requestRes, { status: "invalid" }];
|
|
145
|
+
}
|
|
146
|
+
const req = requestRes.value;
|
|
147
|
+
|
|
148
|
+
const doResult = await client._do(req, {
|
|
149
|
+
context,
|
|
150
|
+
errorCodes: [
|
|
151
|
+
"400",
|
|
152
|
+
"401",
|
|
153
|
+
"403",
|
|
154
|
+
"404",
|
|
155
|
+
"409",
|
|
156
|
+
"422",
|
|
157
|
+
"429",
|
|
158
|
+
"4XX",
|
|
159
|
+
"500",
|
|
160
|
+
"504",
|
|
161
|
+
"5XX",
|
|
162
|
+
],
|
|
163
|
+
retryConfig: context.retryConfig,
|
|
164
|
+
retryCodes: context.retryCodes,
|
|
165
|
+
});
|
|
166
|
+
if (!doResult.ok) {
|
|
167
|
+
return [doResult, { status: "request-error", request: req }];
|
|
168
|
+
}
|
|
169
|
+
const response = doResult.value;
|
|
170
|
+
|
|
171
|
+
const responseFields = {
|
|
172
|
+
HttpMeta: { Response: response, Request: req },
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const [result] = await M.match<
|
|
176
|
+
operations.UpdateProductResponse,
|
|
177
|
+
| errors.GenericError
|
|
178
|
+
| errors.ProductRequestValidationError
|
|
179
|
+
| MoovError
|
|
180
|
+
| ResponseValidationError
|
|
181
|
+
| ConnectionError
|
|
182
|
+
| RequestAbortedError
|
|
183
|
+
| RequestTimeoutError
|
|
184
|
+
| InvalidRequestError
|
|
185
|
+
| UnexpectedClientError
|
|
186
|
+
| SDKValidationError
|
|
187
|
+
>(
|
|
188
|
+
M.json(200, operations.UpdateProductResponse$inboundSchema, {
|
|
189
|
+
hdrs: true,
|
|
190
|
+
key: "Result",
|
|
191
|
+
}),
|
|
192
|
+
M.jsonErr([400, 409], errors.GenericError$inboundSchema, { hdrs: true }),
|
|
193
|
+
M.jsonErr(422, errors.ProductRequestValidationError$inboundSchema, {
|
|
194
|
+
hdrs: true,
|
|
195
|
+
}),
|
|
196
|
+
M.fail([401, 403, 404, 429]),
|
|
197
|
+
M.fail([500, 504]),
|
|
198
|
+
M.fail("4XX"),
|
|
199
|
+
M.fail("5XX"),
|
|
200
|
+
)(response, req, { extraFields: responseFields });
|
|
201
|
+
if (!result.ok) {
|
|
202
|
+
return [result, { status: "complete", request: req, response }];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return [result, { status: "complete", request: req, response }];
|
|
206
|
+
}
|
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.16.
|
|
76
|
+
sdkVersion: "0.16.5",
|
|
77
77
|
genVersion: "2.723.11",
|
|
78
|
-
userAgent: "speakeasy-sdk/typescript 0.16.
|
|
78
|
+
userAgent: "speakeasy-sdk/typescript 0.16.5 2.723.11 latest @moovio/sdk",
|
|
79
79
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -113,6 +113,11 @@ import { tool$paymentLinksUpdate } from "./tools/paymentLinksUpdate.js";
|
|
|
113
113
|
import { tool$paymentMethodsGet } from "./tools/paymentMethodsGet.js";
|
|
114
114
|
import { tool$paymentMethodsList } from "./tools/paymentMethodsList.js";
|
|
115
115
|
import { tool$pingPing } from "./tools/pingPing.js";
|
|
116
|
+
import { tool$productsCreate } from "./tools/productsCreate.js";
|
|
117
|
+
import { tool$productsDisable } from "./tools/productsDisable.js";
|
|
118
|
+
import { tool$productsGet } from "./tools/productsGet.js";
|
|
119
|
+
import { tool$productsList } from "./tools/productsList.js";
|
|
120
|
+
import { tool$productsUpdate } from "./tools/productsUpdate.js";
|
|
116
121
|
import { tool$receiptsCreate } from "./tools/receiptsCreate.js";
|
|
117
122
|
import { tool$receiptsList } from "./tools/receiptsList.js";
|
|
118
123
|
import { tool$representativesCreate } from "./tools/representativesCreate.js";
|
|
@@ -176,7 +181,7 @@ export function createMCPServer(deps: {
|
|
|
176
181
|
}) {
|
|
177
182
|
const server = new McpServer({
|
|
178
183
|
name: "Moov",
|
|
179
|
-
version: "0.16.
|
|
184
|
+
version: "0.16.5",
|
|
180
185
|
});
|
|
181
186
|
|
|
182
187
|
const client = new MoovCore({
|
|
@@ -278,6 +283,11 @@ export function createMCPServer(deps: {
|
|
|
278
283
|
tool(tool$paymentLinksGetQRCode);
|
|
279
284
|
tool(tool$paymentMethodsList);
|
|
280
285
|
tool(tool$paymentMethodsGet);
|
|
286
|
+
tool(tool$productsList);
|
|
287
|
+
tool(tool$productsCreate);
|
|
288
|
+
tool(tool$productsGet);
|
|
289
|
+
tool(tool$productsUpdate);
|
|
290
|
+
tool(tool$productsDisable);
|
|
281
291
|
tool(tool$representativesCreate);
|
|
282
292
|
tool(tool$representativesList);
|
|
283
293
|
tool(tool$representativesDelete);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { productsCreate } from "../../funcs/productsCreate.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.CreateProductRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$productsCreate: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "products-create",
|
|
15
|
+
description: `Creates a new product for the specified account.`,
|
|
16
|
+
args,
|
|
17
|
+
tool: async (client, args, ctx) => {
|
|
18
|
+
const [result, apiCall] = await productsCreate(
|
|
19
|
+
client,
|
|
20
|
+
args.request,
|
|
21
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
22
|
+
).$inspect();
|
|
23
|
+
|
|
24
|
+
if (!result.ok) {
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: result.error.message }],
|
|
27
|
+
isError: true,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const value = result.value.result;
|
|
32
|
+
|
|
33
|
+
return formatResult(value, apiCall);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { productsDisable } from "../../funcs/productsDisable.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.DisableProductRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$productsDisable: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "products-disable",
|
|
15
|
+
description: `Disable a product by ID.
|
|
16
|
+
|
|
17
|
+
The product will no longer be available, but will remain in the system for historical and reporting purposes.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await productsDisable(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return formatResult(void 0, apiCall);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { productsGet } from "../../funcs/productsGet.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.GetProductRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$productsGet: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "products-get",
|
|
15
|
+
description: `Retrieve a product by ID.`,
|
|
16
|
+
args,
|
|
17
|
+
tool: async (client, args, ctx) => {
|
|
18
|
+
const [result, apiCall] = await productsGet(
|
|
19
|
+
client,
|
|
20
|
+
args.request,
|
|
21
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
22
|
+
).$inspect();
|
|
23
|
+
|
|
24
|
+
if (!result.ok) {
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: result.error.message }],
|
|
27
|
+
isError: true,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const value = result.value.result;
|
|
32
|
+
|
|
33
|
+
return formatResult(value, apiCall);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { productsList } from "../../funcs/productsList.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.ListProductsRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$productsList: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "products-list",
|
|
15
|
+
description: `List active (non-disabled) products for an account.`,
|
|
16
|
+
args,
|
|
17
|
+
tool: async (client, args, ctx) => {
|
|
18
|
+
const [result, apiCall] = await productsList(
|
|
19
|
+
client,
|
|
20
|
+
args.request,
|
|
21
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
22
|
+
).$inspect();
|
|
23
|
+
|
|
24
|
+
if (!result.ok) {
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: result.error.message }],
|
|
27
|
+
isError: true,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const value = result.value.result;
|
|
32
|
+
|
|
33
|
+
return formatResult(value, apiCall);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { productsUpdate } from "../../funcs/productsUpdate.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.UpdateProductRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$productsUpdate: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "products-update",
|
|
15
|
+
description: `Update a product and its options.`,
|
|
16
|
+
args,
|
|
17
|
+
tool: async (client, args, ctx) => {
|
|
18
|
+
const [result, apiCall] = await productsUpdate(
|
|
19
|
+
client,
|
|
20
|
+
args.request,
|
|
21
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
22
|
+
).$inspect();
|
|
23
|
+
|
|
24
|
+
if (!result.ok) {
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: result.error.message }],
|
|
27
|
+
isError: true,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const value = result.value.result;
|
|
32
|
+
|
|
33
|
+
return formatResult(value, apiCall);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type AmountDecimalValidationError = {
|
|
11
|
+
currency?: string | undefined;
|
|
12
|
+
valueDecimal?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const AmountDecimalValidationError$inboundSchema: z.ZodType<
|
|
17
|
+
AmountDecimalValidationError,
|
|
18
|
+
z.ZodTypeDef,
|
|
19
|
+
unknown
|
|
20
|
+
> = z.object({
|
|
21
|
+
currency: z.string().optional(),
|
|
22
|
+
valueDecimal: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export type AmountDecimalValidationError$Outbound = {
|
|
27
|
+
currency?: string | undefined;
|
|
28
|
+
valueDecimal?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const AmountDecimalValidationError$outboundSchema: z.ZodType<
|
|
33
|
+
AmountDecimalValidationError$Outbound,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
AmountDecimalValidationError
|
|
36
|
+
> = z.object({
|
|
37
|
+
currency: z.string().optional(),
|
|
38
|
+
valueDecimal: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
44
|
+
*/
|
|
45
|
+
export namespace AmountDecimalValidationError$ {
|
|
46
|
+
/** @deprecated use `AmountDecimalValidationError$inboundSchema` instead. */
|
|
47
|
+
export const inboundSchema = AmountDecimalValidationError$inboundSchema;
|
|
48
|
+
/** @deprecated use `AmountDecimalValidationError$outboundSchema` instead. */
|
|
49
|
+
export const outboundSchema = AmountDecimalValidationError$outboundSchema;
|
|
50
|
+
/** @deprecated use `AmountDecimalValidationError$Outbound` instead. */
|
|
51
|
+
export type Outbound = AmountDecimalValidationError$Outbound;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function amountDecimalValidationErrorToJSON(
|
|
55
|
+
amountDecimalValidationError: AmountDecimalValidationError,
|
|
56
|
+
): string {
|
|
57
|
+
return JSON.stringify(
|
|
58
|
+
AmountDecimalValidationError$outboundSchema.parse(
|
|
59
|
+
amountDecimalValidationError,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function amountDecimalValidationErrorFromJSON(
|
|
65
|
+
jsonString: string,
|
|
66
|
+
): SafeParseResult<AmountDecimalValidationError, SDKValidationError> {
|
|
67
|
+
return safeParse(
|
|
68
|
+
jsonString,
|
|
69
|
+
(x) => AmountDecimalValidationError$inboundSchema.parse(JSON.parse(x)),
|
|
70
|
+
`Failed to parse 'AmountDecimalValidationError' from JSON`,
|
|
71
|
+
);
|
|
72
|
+
}
|