@moovio/sdk 0.16.3 → 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.
Files changed (201) hide show
  1. package/README.md +62 -44
  2. package/bin/mcp-server.js +1897 -591
  3. package/bin/mcp-server.js.map +41 -12
  4. package/docs/sdks/products/README.md +592 -0
  5. package/examples/package-lock.json +1 -1
  6. package/funcs/productsCreate.d.ts +15 -0
  7. package/funcs/productsCreate.d.ts.map +1 -0
  8. package/funcs/productsCreate.js +138 -0
  9. package/funcs/productsCreate.js.map +1 -0
  10. package/funcs/productsDisable.d.ts +17 -0
  11. package/funcs/productsDisable.d.ts.map +1 -0
  12. package/funcs/productsDisable.js +139 -0
  13. package/funcs/productsDisable.js.map +1 -0
  14. package/funcs/productsGet.d.ts +14 -0
  15. package/funcs/productsGet.d.ts.map +1 -0
  16. package/funcs/productsGet.js +126 -0
  17. package/funcs/productsGet.js.map +1 -0
  18. package/funcs/productsList.d.ts +14 -0
  19. package/funcs/productsList.d.ts.map +1 -0
  20. package/funcs/productsList.js +127 -0
  21. package/funcs/productsList.js.map +1 -0
  22. package/funcs/productsUpdate.d.ts +15 -0
  23. package/funcs/productsUpdate.d.ts.map +1 -0
  24. package/funcs/productsUpdate.js +142 -0
  25. package/funcs/productsUpdate.js.map +1 -0
  26. package/jsr.json +1 -1
  27. package/lib/config.d.ts +2 -2
  28. package/lib/config.js +2 -2
  29. package/mcp-server/mcp-server.js +1 -1
  30. package/mcp-server/server.d.ts.map +1 -1
  31. package/mcp-server/server.js +11 -1
  32. package/mcp-server/server.js.map +1 -1
  33. package/mcp-server/tools/productsCreate.d.ts +8 -0
  34. package/mcp-server/tools/productsCreate.d.ts.map +1 -0
  35. package/mcp-server/tools/productsCreate.js +62 -0
  36. package/mcp-server/tools/productsCreate.js.map +1 -0
  37. package/mcp-server/tools/productsDisable.d.ts +8 -0
  38. package/mcp-server/tools/productsDisable.d.ts.map +1 -0
  39. package/mcp-server/tools/productsDisable.js +63 -0
  40. package/mcp-server/tools/productsDisable.js.map +1 -0
  41. package/mcp-server/tools/productsGet.d.ts +8 -0
  42. package/mcp-server/tools/productsGet.d.ts.map +1 -0
  43. package/mcp-server/tools/productsGet.js +62 -0
  44. package/mcp-server/tools/productsGet.js.map +1 -0
  45. package/mcp-server/tools/productsList.d.ts +8 -0
  46. package/mcp-server/tools/productsList.d.ts.map +1 -0
  47. package/mcp-server/tools/productsList.js +62 -0
  48. package/mcp-server/tools/productsList.js.map +1 -0
  49. package/mcp-server/tools/productsUpdate.d.ts +8 -0
  50. package/mcp-server/tools/productsUpdate.d.ts.map +1 -0
  51. package/mcp-server/tools/productsUpdate.js +62 -0
  52. package/mcp-server/tools/productsUpdate.js.map +1 -0
  53. package/models/components/amountdecimalvalidationerror.d.ts +31 -0
  54. package/models/components/amountdecimalvalidationerror.d.ts.map +1 -0
  55. package/models/components/amountdecimalvalidationerror.js +71 -0
  56. package/models/components/amountdecimalvalidationerror.js.map +1 -0
  57. package/models/components/assignproductimage.d.ts +32 -0
  58. package/models/components/assignproductimage.d.ts.map +1 -0
  59. package/models/components/assignproductimage.js +69 -0
  60. package/models/components/assignproductimage.js.map +1 -0
  61. package/models/components/assignproductimagevalidationerror.d.ts +29 -0
  62. package/models/components/assignproductimagevalidationerror.d.ts.map +1 -0
  63. package/models/components/assignproductimagevalidationerror.js +69 -0
  64. package/models/components/assignproductimagevalidationerror.js.map +1 -0
  65. package/models/components/createproductoption.d.ts +54 -0
  66. package/models/components/createproductoption.d.ts.map +1 -0
  67. package/models/components/createproductoption.js +76 -0
  68. package/models/components/createproductoption.js.map +1 -0
  69. package/models/components/createproductoptiongroup.d.ts +60 -0
  70. package/models/components/createproductoptiongroup.d.ts.map +1 -0
  71. package/models/components/createproductoptiongroup.js +78 -0
  72. package/models/components/createproductoptiongroup.js.map +1 -0
  73. package/models/components/feeproperties.d.ts +6 -0
  74. package/models/components/feeproperties.d.ts.map +1 -1
  75. package/models/components/feeproperties.js +3 -0
  76. package/models/components/feeproperties.js.map +1 -1
  77. package/models/components/index.d.ts +13 -0
  78. package/models/components/index.d.ts.map +1 -1
  79. package/models/components/index.js +13 -0
  80. package/models/components/index.js.map +1 -1
  81. package/models/components/partnerpricing.d.ts +8 -4
  82. package/models/components/partnerpricing.d.ts.map +1 -1
  83. package/models/components/partnerpricing.js +2 -2
  84. package/models/components/partnerpricing.js.map +1 -1
  85. package/models/components/partnerpricingagreement.d.ts +7 -3
  86. package/models/components/partnerpricingagreement.d.ts.map +1 -1
  87. package/models/components/partnerpricingagreement.js +2 -2
  88. package/models/components/partnerpricingagreement.js.map +1 -1
  89. package/models/components/product.d.ts +81 -0
  90. package/models/components/product.d.ts.map +1 -0
  91. package/models/components/product.js +88 -0
  92. package/models/components/product.js.map +1 -0
  93. package/models/components/productimagemetadata.d.ts +42 -0
  94. package/models/components/productimagemetadata.d.ts.map +1 -0
  95. package/models/components/productimagemetadata.js +73 -0
  96. package/models/components/productimagemetadata.js.map +1 -0
  97. package/models/components/productoption.d.ts +57 -0
  98. package/models/components/productoption.d.ts.map +1 -0
  99. package/models/components/productoption.js +76 -0
  100. package/models/components/productoption.js.map +1 -0
  101. package/models/components/productoptiongroup.d.ts +63 -0
  102. package/models/components/productoptiongroup.d.ts.map +1 -0
  103. package/models/components/productoptiongroup.js +78 -0
  104. package/models/components/productoptiongroup.js.map +1 -0
  105. package/models/components/productoptiongroupvalidationerror.d.ts +42 -0
  106. package/models/components/productoptiongroupvalidationerror.d.ts.map +1 -0
  107. package/models/components/productoptiongroupvalidationerror.js +78 -0
  108. package/models/components/productoptiongroupvalidationerror.js.map +1 -0
  109. package/models/components/productoptionvalidationerror.d.ts +40 -0
  110. package/models/components/productoptionvalidationerror.d.ts.map +1 -0
  111. package/models/components/productoptionvalidationerror.js +76 -0
  112. package/models/components/productoptionvalidationerror.js.map +1 -0
  113. package/models/components/productrequest.d.ts +61 -0
  114. package/models/components/productrequest.d.ts.map +1 -0
  115. package/models/components/productrequest.js +80 -0
  116. package/models/components/productrequest.js.map +1 -0
  117. package/models/components/volumerange.d.ts +51 -0
  118. package/models/components/volumerange.d.ts.map +1 -0
  119. package/models/components/volumerange.js +76 -0
  120. package/models/components/volumerange.js.map +1 -0
  121. package/models/errors/index.d.ts +1 -0
  122. package/models/errors/index.d.ts.map +1 -1
  123. package/models/errors/index.js +1 -0
  124. package/models/errors/index.js.map +1 -1
  125. package/models/errors/productrequestvalidationerror.d.ts +61 -0
  126. package/models/errors/productrequestvalidationerror.d.ts.map +1 -0
  127. package/models/errors/productrequestvalidationerror.js +105 -0
  128. package/models/errors/productrequestvalidationerror.js.map +1 -0
  129. package/models/operations/createproduct.d.ts +101 -0
  130. package/models/operations/createproduct.d.ts.map +1 -0
  131. package/models/operations/createproduct.js +155 -0
  132. package/models/operations/createproduct.js.map +1 -0
  133. package/models/operations/disableproduct.d.ts +98 -0
  134. package/models/operations/disableproduct.d.ts.map +1 -0
  135. package/models/operations/disableproduct.js +142 -0
  136. package/models/operations/disableproduct.js.map +1 -0
  137. package/models/operations/getproduct.d.ts +101 -0
  138. package/models/operations/getproduct.d.ts.map +1 -0
  139. package/models/operations/getproduct.js +147 -0
  140. package/models/operations/getproduct.js.map +1 -0
  141. package/models/operations/index.d.ts +5 -0
  142. package/models/operations/index.d.ts.map +1 -1
  143. package/models/operations/index.js +5 -0
  144. package/models/operations/index.js.map +1 -1
  145. package/models/operations/listproducts.d.ts +103 -0
  146. package/models/operations/listproducts.d.ts.map +1 -0
  147. package/models/operations/listproducts.js +149 -0
  148. package/models/operations/listproducts.js.map +1 -0
  149. package/models/operations/updateproduct.d.ts +103 -0
  150. package/models/operations/updateproduct.d.ts.map +1 -0
  151. package/models/operations/updateproduct.js +157 -0
  152. package/models/operations/updateproduct.js.map +1 -0
  153. package/package.json +1 -1
  154. package/sdk/products.d.ts +27 -0
  155. package/sdk/products.d.ts.map +1 -0
  156. package/sdk/products.js +49 -0
  157. package/sdk/products.js.map +1 -0
  158. package/sdk/sdk.d.ts +3 -0
  159. package/sdk/sdk.d.ts.map +1 -1
  160. package/sdk/sdk.js +4 -0
  161. package/sdk/sdk.js.map +1 -1
  162. package/src/funcs/productsCreate.ts +200 -0
  163. package/src/funcs/productsDisable.ts +199 -0
  164. package/src/funcs/productsGet.ts +182 -0
  165. package/src/funcs/productsList.ts +182 -0
  166. package/src/funcs/productsUpdate.ts +206 -0
  167. package/src/lib/config.ts +2 -2
  168. package/src/mcp-server/mcp-server.ts +1 -1
  169. package/src/mcp-server/server.ts +11 -1
  170. package/src/mcp-server/tools/productsCreate.ts +35 -0
  171. package/src/mcp-server/tools/productsDisable.ts +35 -0
  172. package/src/mcp-server/tools/productsGet.ts +35 -0
  173. package/src/mcp-server/tools/productsList.ts +35 -0
  174. package/src/mcp-server/tools/productsUpdate.ts +35 -0
  175. package/src/models/components/amountdecimalvalidationerror.ts +72 -0
  176. package/src/models/components/assignproductimage.ts +69 -0
  177. package/src/models/components/assignproductimagevalidationerror.ts +69 -0
  178. package/src/models/components/createproductoption.ts +102 -0
  179. package/src/models/components/createproductoptiongroup.ts +110 -0
  180. package/src/models/components/feeproperties.ts +13 -0
  181. package/src/models/components/index.ts +13 -0
  182. package/src/models/components/partnerpricing.ts +10 -6
  183. package/src/models/components/partnerpricingagreement.ts +9 -5
  184. package/src/models/components/product.ts +148 -0
  185. package/src/models/components/productimagemetadata.ts +83 -0
  186. package/src/models/components/productoption.ts +101 -0
  187. package/src/models/components/productoptiongroup.ts +113 -0
  188. package/src/models/components/productoptiongroupvalidationerror.ts +91 -0
  189. package/src/models/components/productoptionvalidationerror.ts +88 -0
  190. package/src/models/components/productrequest.ts +117 -0
  191. package/src/models/components/volumerange.ts +95 -0
  192. package/src/models/errors/index.ts +1 -0
  193. package/src/models/errors/productrequestvalidationerror.ts +124 -0
  194. package/src/models/operations/createproduct.ts +231 -0
  195. package/src/models/operations/disableproduct.ts +216 -0
  196. package/src/models/operations/getproduct.ts +223 -0
  197. package/src/models/operations/index.ts +5 -0
  198. package/src/models/operations/listproducts.ts +227 -0
  199. package/src/models/operations/updateproduct.ts +235 -0
  200. package/src/sdk/products.ts +86 -0
  201. package/src/sdk/sdk.ts +6 -0
@@ -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.3",
76
+ sdkVersion: "0.16.5",
77
77
  genVersion: "2.723.11",
78
- userAgent: "speakeasy-sdk/typescript 0.16.3 2.723.11 latest @moovio/sdk",
78
+ userAgent: "speakeasy-sdk/typescript 0.16.5 2.723.11 latest @moovio/sdk",
79
79
  } as const;
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "0.16.3",
22
+ currentVersion: "0.16.5",
23
23
  },
24
24
  });
25
25
 
@@ -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.3",
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
+ }
@@ -0,0 +1,69 @@
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 AssignProductImage = {
11
+ /**
12
+ * Unique identifier for a product or product option image resource.
13
+ */
14
+ imageID: string;
15
+ };
16
+
17
+ /** @internal */
18
+ export const AssignProductImage$inboundSchema: z.ZodType<
19
+ AssignProductImage,
20
+ z.ZodTypeDef,
21
+ unknown
22
+ > = z.object({
23
+ imageID: z.string(),
24
+ });
25
+
26
+ /** @internal */
27
+ export type AssignProductImage$Outbound = {
28
+ imageID: string;
29
+ };
30
+
31
+ /** @internal */
32
+ export const AssignProductImage$outboundSchema: z.ZodType<
33
+ AssignProductImage$Outbound,
34
+ z.ZodTypeDef,
35
+ AssignProductImage
36
+ > = z.object({
37
+ imageID: z.string(),
38
+ });
39
+
40
+ /**
41
+ * @internal
42
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
43
+ */
44
+ export namespace AssignProductImage$ {
45
+ /** @deprecated use `AssignProductImage$inboundSchema` instead. */
46
+ export const inboundSchema = AssignProductImage$inboundSchema;
47
+ /** @deprecated use `AssignProductImage$outboundSchema` instead. */
48
+ export const outboundSchema = AssignProductImage$outboundSchema;
49
+ /** @deprecated use `AssignProductImage$Outbound` instead. */
50
+ export type Outbound = AssignProductImage$Outbound;
51
+ }
52
+
53
+ export function assignProductImageToJSON(
54
+ assignProductImage: AssignProductImage,
55
+ ): string {
56
+ return JSON.stringify(
57
+ AssignProductImage$outboundSchema.parse(assignProductImage),
58
+ );
59
+ }
60
+
61
+ export function assignProductImageFromJSON(
62
+ jsonString: string,
63
+ ): SafeParseResult<AssignProductImage, SDKValidationError> {
64
+ return safeParse(
65
+ jsonString,
66
+ (x) => AssignProductImage$inboundSchema.parse(JSON.parse(x)),
67
+ `Failed to parse 'AssignProductImage' from JSON`,
68
+ );
69
+ }
@@ -0,0 +1,69 @@
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 AssignProductImageValidationError = {
11
+ imageID?: string | undefined;
12
+ };
13
+
14
+ /** @internal */
15
+ export const AssignProductImageValidationError$inboundSchema: z.ZodType<
16
+ AssignProductImageValidationError,
17
+ z.ZodTypeDef,
18
+ unknown
19
+ > = z.object({
20
+ imageID: z.string().optional(),
21
+ });
22
+
23
+ /** @internal */
24
+ export type AssignProductImageValidationError$Outbound = {
25
+ imageID?: string | undefined;
26
+ };
27
+
28
+ /** @internal */
29
+ export const AssignProductImageValidationError$outboundSchema: z.ZodType<
30
+ AssignProductImageValidationError$Outbound,
31
+ z.ZodTypeDef,
32
+ AssignProductImageValidationError
33
+ > = z.object({
34
+ imageID: z.string().optional(),
35
+ });
36
+
37
+ /**
38
+ * @internal
39
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
40
+ */
41
+ export namespace AssignProductImageValidationError$ {
42
+ /** @deprecated use `AssignProductImageValidationError$inboundSchema` instead. */
43
+ export const inboundSchema = AssignProductImageValidationError$inboundSchema;
44
+ /** @deprecated use `AssignProductImageValidationError$outboundSchema` instead. */
45
+ export const outboundSchema =
46
+ AssignProductImageValidationError$outboundSchema;
47
+ /** @deprecated use `AssignProductImageValidationError$Outbound` instead. */
48
+ export type Outbound = AssignProductImageValidationError$Outbound;
49
+ }
50
+
51
+ export function assignProductImageValidationErrorToJSON(
52
+ assignProductImageValidationError: AssignProductImageValidationError,
53
+ ): string {
54
+ return JSON.stringify(
55
+ AssignProductImageValidationError$outboundSchema.parse(
56
+ assignProductImageValidationError,
57
+ ),
58
+ );
59
+ }
60
+
61
+ export function assignProductImageValidationErrorFromJSON(
62
+ jsonString: string,
63
+ ): SafeParseResult<AssignProductImageValidationError, SDKValidationError> {
64
+ return safeParse(
65
+ jsonString,
66
+ (x) => AssignProductImageValidationError$inboundSchema.parse(JSON.parse(x)),
67
+ `Failed to parse 'AssignProductImageValidationError' from JSON`,
68
+ );
69
+ }