@gr4vy/sdk 0.18.12 → 0.18.14

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 (140) hide show
  1. package/README.md +11 -0
  2. package/bin/mcp-server.js +1775 -629
  3. package/bin/mcp-server.js.map +29 -9
  4. package/docs/sdks/merchantaccounts/README.md +454 -0
  5. package/funcs/merchantAccountsCreate.d.ts +17 -0
  6. package/funcs/merchantAccountsCreate.d.ts.map +1 -0
  7. package/funcs/merchantAccountsCreate.js +133 -0
  8. package/funcs/merchantAccountsCreate.js.map +1 -0
  9. package/funcs/merchantAccountsGet.d.ts +17 -0
  10. package/funcs/merchantAccountsGet.d.ts.map +1 -0
  11. package/funcs/merchantAccountsGet.js +137 -0
  12. package/funcs/merchantAccountsGet.js.map +1 -0
  13. package/funcs/merchantAccountsList.d.ts +20 -0
  14. package/funcs/merchantAccountsList.d.ts.map +1 -0
  15. package/funcs/merchantAccountsList.js +162 -0
  16. package/funcs/merchantAccountsList.js.map +1 -0
  17. package/funcs/merchantAccountsUpdate.d.ts +17 -0
  18. package/funcs/merchantAccountsUpdate.d.ts.map +1 -0
  19. package/funcs/merchantAccountsUpdate.js +137 -0
  20. package/funcs/merchantAccountsUpdate.js.map +1 -0
  21. package/jsr.json +1 -1
  22. package/lib/config.d.ts +3 -3
  23. package/lib/config.js +3 -3
  24. package/mcp-server/mcp-server.js +1 -1
  25. package/mcp-server/server.d.ts.map +1 -1
  26. package/mcp-server/server.js +9 -1
  27. package/mcp-server/server.js.map +1 -1
  28. package/mcp-server/tools/merchantAccountsCreate.d.ts +10 -0
  29. package/mcp-server/tools/merchantAccountsCreate.d.ts.map +1 -0
  30. package/mcp-server/tools/merchantAccountsCreate.js +56 -0
  31. package/mcp-server/tools/merchantAccountsCreate.js.map +1 -0
  32. package/mcp-server/tools/merchantAccountsGet.d.ts +8 -0
  33. package/mcp-server/tools/merchantAccountsGet.d.ts.map +1 -0
  34. package/mcp-server/tools/merchantAccountsGet.js +54 -0
  35. package/mcp-server/tools/merchantAccountsGet.js.map +1 -0
  36. package/mcp-server/tools/merchantAccountsList.d.ts +10 -0
  37. package/mcp-server/tools/merchantAccountsList.d.ts.map +1 -0
  38. package/mcp-server/tools/merchantAccountsList.js +56 -0
  39. package/mcp-server/tools/merchantAccountsList.js.map +1 -0
  40. package/mcp-server/tools/merchantAccountsUpdate.d.ts +11 -0
  41. package/mcp-server/tools/merchantAccountsUpdate.d.ts.map +1 -0
  42. package/mcp-server/tools/merchantAccountsUpdate.js +57 -0
  43. package/mcp-server/tools/merchantAccountsUpdate.js.map +1 -0
  44. package/models/components/collectionmerchantaccount.d.ts +48 -0
  45. package/models/components/collectionmerchantaccount.d.ts.map +1 -0
  46. package/models/components/collectionmerchantaccount.js +77 -0
  47. package/models/components/collectionmerchantaccount.js.map +1 -0
  48. package/models/components/index.d.ts +4 -0
  49. package/models/components/index.d.ts.map +1 -1
  50. package/models/components/index.js +4 -0
  51. package/models/components/index.js.map +1 -1
  52. package/models/components/merchantaccount.d.ts +148 -0
  53. package/models/components/merchantaccount.d.ts.map +1 -0
  54. package/models/components/merchantaccount.js +159 -0
  55. package/models/components/merchantaccount.js.map +1 -0
  56. package/models/components/merchantaccountcreate.d.ts +133 -0
  57. package/models/components/merchantaccountcreate.d.ts.map +1 -0
  58. package/models/components/merchantaccountcreate.js +149 -0
  59. package/models/components/merchantaccountcreate.js.map +1 -0
  60. package/models/components/merchantaccountupdate.d.ts +128 -0
  61. package/models/components/merchantaccountupdate.d.ts.map +1 -0
  62. package/models/components/merchantaccountupdate.js +147 -0
  63. package/models/components/merchantaccountupdate.js.map +1 -0
  64. package/models/errors/createmerchantaccount.d.ts +31 -0
  65. package/models/errors/createmerchantaccount.d.ts.map +1 -0
  66. package/models/errors/createmerchantaccount.js +66 -0
  67. package/models/errors/createmerchantaccount.js.map +1 -0
  68. package/models/errors/getmerchantaccount.d.ts +31 -0
  69. package/models/errors/getmerchantaccount.d.ts.map +1 -0
  70. package/models/errors/getmerchantaccount.js +66 -0
  71. package/models/errors/getmerchantaccount.js.map +1 -0
  72. package/models/errors/index.d.ts +4 -0
  73. package/models/errors/index.d.ts.map +1 -1
  74. package/models/errors/index.js +4 -0
  75. package/models/errors/index.js.map +1 -1
  76. package/models/errors/listmerchantaccounts.d.ts +31 -0
  77. package/models/errors/listmerchantaccounts.d.ts.map +1 -0
  78. package/models/errors/listmerchantaccounts.js +66 -0
  79. package/models/errors/listmerchantaccounts.js.map +1 -0
  80. package/models/errors/updatemerchantaccount.d.ts +31 -0
  81. package/models/errors/updatemerchantaccount.d.ts.map +1 -0
  82. package/models/errors/updatemerchantaccount.js +66 -0
  83. package/models/errors/updatemerchantaccount.js.map +1 -0
  84. package/models/operations/createmerchantaccount.d.ts +32 -0
  85. package/models/operations/createmerchantaccount.d.ts.map +1 -0
  86. package/models/operations/createmerchantaccount.js +73 -0
  87. package/models/operations/createmerchantaccount.js.map +1 -0
  88. package/models/operations/getmerchantaccount.d.ts +29 -0
  89. package/models/operations/getmerchantaccount.d.ts.map +1 -0
  90. package/models/operations/getmerchantaccount.js +68 -0
  91. package/models/operations/getmerchantaccount.js.map +1 -0
  92. package/models/operations/index.d.ts +4 -0
  93. package/models/operations/index.d.ts.map +1 -1
  94. package/models/operations/index.js +4 -0
  95. package/models/operations/index.js.map +1 -1
  96. package/models/operations/listmerchantaccounts.d.ts +59 -0
  97. package/models/operations/listmerchantaccounts.d.ts.map +1 -0
  98. package/models/operations/listmerchantaccounts.js +100 -0
  99. package/models/operations/listmerchantaccounts.js.map +1 -0
  100. package/models/operations/updatemerchantaccount.d.ts +34 -0
  101. package/models/operations/updatemerchantaccount.d.ts.map +1 -0
  102. package/models/operations/updatemerchantaccount.js +77 -0
  103. package/models/operations/updatemerchantaccount.js.map +1 -0
  104. package/package.json +1 -1
  105. package/sdk/merchantaccounts.d.ts +37 -0
  106. package/sdk/merchantaccounts.d.ts.map +1 -0
  107. package/sdk/merchantaccounts.js +53 -0
  108. package/sdk/merchantaccounts.js.map +1 -0
  109. package/sdk/sdk.d.ts +3 -0
  110. package/sdk/sdk.d.ts.map +1 -1
  111. package/sdk/sdk.js +4 -0
  112. package/sdk/sdk.js.map +1 -1
  113. package/src/funcs/merchantAccountsCreate.ts +243 -0
  114. package/src/funcs/merchantAccountsGet.ts +249 -0
  115. package/src/funcs/merchantAccountsList.ts +326 -0
  116. package/src/funcs/merchantAccountsUpdate.ts +257 -0
  117. package/src/lib/config.ts +3 -3
  118. package/src/mcp-server/mcp-server.ts +1 -1
  119. package/src/mcp-server/server.ts +9 -1
  120. package/src/mcp-server/tools/merchantAccountsCreate.ts +40 -0
  121. package/src/mcp-server/tools/merchantAccountsGet.ts +37 -0
  122. package/src/mcp-server/tools/merchantAccountsList.ts +41 -0
  123. package/src/mcp-server/tools/merchantAccountsUpdate.ts +42 -0
  124. package/src/models/components/collectionmerchantaccount.ts +107 -0
  125. package/src/models/components/index.ts +4 -0
  126. package/src/models/components/merchantaccount.ts +296 -0
  127. package/src/models/components/merchantaccountcreate.ts +273 -0
  128. package/src/models/components/merchantaccountupdate.ts +266 -0
  129. package/src/models/errors/createmerchantaccount.ts +107 -0
  130. package/src/models/errors/getmerchantaccount.ts +107 -0
  131. package/src/models/errors/index.ts +4 -0
  132. package/src/models/errors/listmerchantaccounts.ts +107 -0
  133. package/src/models/errors/updatemerchantaccount.ts +107 -0
  134. package/src/models/operations/createmerchantaccount.ts +84 -0
  135. package/src/models/operations/getmerchantaccount.ts +75 -0
  136. package/src/models/operations/index.ts +4 -0
  137. package/src/models/operations/listmerchantaccounts.ts +146 -0
  138. package/src/models/operations/updatemerchantaccount.ts +90 -0
  139. package/src/sdk/merchantaccounts.ts +95 -0
  140. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,257 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { Gr4vyCore } from "../core.js";
6
+ import { encodeFormQuery, 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 * as components from "../models/components/index.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKError } from "../models/errors/sdkerror.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 merchant account
30
+ *
31
+ * @remarks
32
+ * Update info for a merchant account in an instance.
33
+ */
34
+ export function merchantAccountsUpdate(
35
+ client: Gr4vyCore,
36
+ merchantAccountUpdate: components.MerchantAccountUpdate,
37
+ merchantAccountId: string,
38
+ timeoutInSeconds?: number | undefined,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ components.MerchantAccount,
43
+ | errors.Error400
44
+ | errors.Error401
45
+ | errors.UpdateMerchantAccountResponse403UpdateMerchantAccount
46
+ | errors.Error404
47
+ | errors.Error405
48
+ | errors.Error409
49
+ | errors.HTTPValidationError
50
+ | errors.Error425
51
+ | errors.Error429
52
+ | errors.Error500
53
+ | errors.Error502
54
+ | errors.Error504
55
+ | SDKError
56
+ | SDKValidationError
57
+ | UnexpectedClientError
58
+ | InvalidRequestError
59
+ | RequestAbortedError
60
+ | RequestTimeoutError
61
+ | ConnectionError
62
+ >
63
+ > {
64
+ return new APIPromise($do(
65
+ client,
66
+ merchantAccountUpdate,
67
+ merchantAccountId,
68
+ timeoutInSeconds,
69
+ options,
70
+ ));
71
+ }
72
+
73
+ async function $do(
74
+ client: Gr4vyCore,
75
+ merchantAccountUpdate: components.MerchantAccountUpdate,
76
+ merchantAccountId: string,
77
+ timeoutInSeconds?: number | undefined,
78
+ options?: RequestOptions,
79
+ ): Promise<
80
+ [
81
+ Result<
82
+ components.MerchantAccount,
83
+ | errors.Error400
84
+ | errors.Error401
85
+ | errors.UpdateMerchantAccountResponse403UpdateMerchantAccount
86
+ | errors.Error404
87
+ | errors.Error405
88
+ | errors.Error409
89
+ | errors.HTTPValidationError
90
+ | errors.Error425
91
+ | errors.Error429
92
+ | errors.Error500
93
+ | errors.Error502
94
+ | errors.Error504
95
+ | SDKError
96
+ | SDKValidationError
97
+ | UnexpectedClientError
98
+ | InvalidRequestError
99
+ | RequestAbortedError
100
+ | RequestTimeoutError
101
+ | ConnectionError
102
+ >,
103
+ APICall,
104
+ ]
105
+ > {
106
+ const input: operations.UpdateMerchantAccountRequest = {
107
+ merchantAccountUpdate: merchantAccountUpdate,
108
+ merchantAccountId: merchantAccountId,
109
+ timeoutInSeconds: timeoutInSeconds,
110
+ };
111
+
112
+ const parsed = safeParse(
113
+ input,
114
+ (value) =>
115
+ operations.UpdateMerchantAccountRequest$outboundSchema.parse(value),
116
+ "Input validation failed",
117
+ );
118
+ if (!parsed.ok) {
119
+ return [parsed, { status: "invalid" }];
120
+ }
121
+ const payload = parsed.value;
122
+ const body = encodeJSON("body", payload.MerchantAccountUpdate, {
123
+ explode: true,
124
+ });
125
+
126
+ const pathParams = {
127
+ merchant_account_id: encodeSimple(
128
+ "merchant_account_id",
129
+ payload.merchant_account_id,
130
+ { explode: false, charEncoding: "percent" },
131
+ ),
132
+ };
133
+
134
+ const path = pathToFunc("/merchant-accounts/{merchant_account_id}")(
135
+ pathParams,
136
+ );
137
+
138
+ const query = encodeFormQuery({
139
+ "timeout_in_seconds": payload.timeout_in_seconds,
140
+ });
141
+
142
+ const headers = new Headers(compactMap({
143
+ "Content-Type": "application/json",
144
+ Accept: "application/json",
145
+ }));
146
+
147
+ const secConfig = await extractSecurity(client._options.bearerAuth);
148
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
149
+ const requestSecurity = resolveGlobalSecurity(securityInput);
150
+
151
+ const context = {
152
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
153
+ operationID: "update_merchant_account",
154
+ oAuth2Scopes: [],
155
+
156
+ resolvedSecurity: requestSecurity,
157
+
158
+ securitySource: client._options.bearerAuth,
159
+ retryConfig: options?.retries
160
+ || client._options.retryConfig
161
+ || { strategy: "none" },
162
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
163
+ };
164
+
165
+ const requestRes = client._createRequest(context, {
166
+ security: requestSecurity,
167
+ method: "PUT",
168
+ baseURL: options?.serverURL,
169
+ path: path,
170
+ headers: headers,
171
+ query: query,
172
+ body: body,
173
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
174
+ }, options);
175
+ if (!requestRes.ok) {
176
+ return [requestRes, { status: "invalid" }];
177
+ }
178
+ const req = requestRes.value;
179
+
180
+ const doResult = await client._do(req, {
181
+ context,
182
+ errorCodes: [
183
+ "400",
184
+ "401",
185
+ "403",
186
+ "404",
187
+ "405",
188
+ "409",
189
+ "422",
190
+ "425",
191
+ "429",
192
+ "4XX",
193
+ "500",
194
+ "502",
195
+ "504",
196
+ "5XX",
197
+ ],
198
+ retryConfig: context.retryConfig,
199
+ retryCodes: context.retryCodes,
200
+ });
201
+ if (!doResult.ok) {
202
+ return [doResult, { status: "request-error", request: req }];
203
+ }
204
+ const response = doResult.value;
205
+
206
+ const responseFields = {
207
+ HttpMeta: { Response: response, Request: req },
208
+ };
209
+
210
+ const [result] = await M.match<
211
+ components.MerchantAccount,
212
+ | errors.Error400
213
+ | errors.Error401
214
+ | errors.UpdateMerchantAccountResponse403UpdateMerchantAccount
215
+ | errors.Error404
216
+ | errors.Error405
217
+ | errors.Error409
218
+ | errors.HTTPValidationError
219
+ | errors.Error425
220
+ | errors.Error429
221
+ | errors.Error500
222
+ | errors.Error502
223
+ | errors.Error504
224
+ | SDKError
225
+ | SDKValidationError
226
+ | UnexpectedClientError
227
+ | InvalidRequestError
228
+ | RequestAbortedError
229
+ | RequestTimeoutError
230
+ | ConnectionError
231
+ >(
232
+ M.json(200, components.MerchantAccount$inboundSchema),
233
+ M.jsonErr(400, errors.Error400$inboundSchema),
234
+ M.jsonErr(401, errors.Error401$inboundSchema),
235
+ M.jsonErr(
236
+ 403,
237
+ errors
238
+ .UpdateMerchantAccountResponse403UpdateMerchantAccount$inboundSchema,
239
+ ),
240
+ M.jsonErr(404, errors.Error404$inboundSchema),
241
+ M.jsonErr(405, errors.Error405$inboundSchema),
242
+ M.jsonErr(409, errors.Error409$inboundSchema),
243
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
244
+ M.jsonErr(425, errors.Error425$inboundSchema),
245
+ M.jsonErr(429, errors.Error429$inboundSchema),
246
+ M.jsonErr(500, errors.Error500$inboundSchema),
247
+ M.jsonErr(502, errors.Error502$inboundSchema),
248
+ M.jsonErr(504, errors.Error504$inboundSchema),
249
+ M.fail("4XX"),
250
+ M.fail("5XX"),
251
+ )(response, { extraFields: responseFields });
252
+ if (!result.ok) {
253
+ return [result, { status: "complete", request: req, response }];
254
+ }
255
+
256
+ return [result, { status: "complete", request: req, response }];
257
+ }
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: "1.0.0",
76
- sdkVersion: "0.18.12",
77
- genVersion: "2.593.3",
78
- userAgent: "speakeasy-sdk/typescript 0.18.12 2.593.3 1.0.0 @gr4vy/sdk",
76
+ sdkVersion: "0.18.14",
77
+ genVersion: "2.593.4",
78
+ userAgent: "speakeasy-sdk/typescript 0.18.14 2.593.4 1.0.0 @gr4vy/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.18.12",
22
+ currentVersion: "0.18.14",
23
23
  },
24
24
  });
25
25
 
@@ -47,6 +47,10 @@ import { tool$giftCardsCreate } from "./tools/giftCardsCreate.js";
47
47
  import { tool$giftCardsDelete } from "./tools/giftCardsDelete.js";
48
48
  import { tool$giftCardsGet } from "./tools/giftCardsGet.js";
49
49
  import { tool$giftCardsList } from "./tools/giftCardsList.js";
50
+ import { tool$merchantAccountsCreate } from "./tools/merchantAccountsCreate.js";
51
+ import { tool$merchantAccountsGet } from "./tools/merchantAccountsGet.js";
52
+ import { tool$merchantAccountsList } from "./tools/merchantAccountsList.js";
53
+ import { tool$merchantAccountsUpdate } from "./tools/merchantAccountsUpdate.js";
50
54
  import { tool$paymentMethodsCreate } from "./tools/paymentMethodsCreate.js";
51
55
  import { tool$paymentMethodsDelete } from "./tools/paymentMethodsDelete.js";
52
56
  import { tool$paymentMethodsGet } from "./tools/paymentMethodsGet.js";
@@ -89,7 +93,7 @@ export function createMCPServer(deps: {
89
93
  }) {
90
94
  const server = new McpServer({
91
95
  name: "Gr4vy",
92
- version: "0.18.12",
96
+ version: "0.18.14",
93
97
  });
94
98
 
95
99
  const client = new Gr4vyCore({
@@ -154,6 +158,10 @@ export function createMCPServer(deps: {
154
158
  tool(tool$checkoutSessionsUpdate);
155
159
  tool(tool$checkoutSessionsGet);
156
160
  tool(tool$checkoutSessionsDelete);
161
+ tool(tool$merchantAccountsList);
162
+ tool(tool$merchantAccountsCreate);
163
+ tool(tool$merchantAccountsGet);
164
+ tool(tool$merchantAccountsUpdate);
157
165
  tool(tool$payoutsList);
158
166
  tool(tool$payoutsCreate);
159
167
  tool(tool$payoutsGet);
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { merchantAccountsCreate } from "../../funcs/merchantAccountsCreate.js";
7
+ import * as components from "../../models/components/index.js";
8
+ import { formatResult, ToolDefinition } from "../tools.js";
9
+
10
+ const args = {
11
+ merchantAccountCreate: components.MerchantAccountCreate$inboundSchema,
12
+ timeoutInSeconds: z.number().default(1),
13
+ };
14
+
15
+ export const tool$merchantAccountsCreate: ToolDefinition<typeof args> = {
16
+ name: "merchant-accounts-create",
17
+ description: `Create a merchant account
18
+
19
+ Create a new merchant account in an instance.`,
20
+ args,
21
+ tool: async (client, args, ctx) => {
22
+ const [result, apiCall] = await merchantAccountsCreate(
23
+ client,
24
+ args.merchantAccountCreate,
25
+ args.timeoutInSeconds,
26
+ { fetchOptions: { signal: ctx.signal } },
27
+ ).$inspect();
28
+
29
+ if (!result.ok) {
30
+ return {
31
+ content: [{ type: "text", text: result.error.message }],
32
+ isError: true,
33
+ };
34
+ }
35
+
36
+ const value = result.value;
37
+
38
+ return formatResult(value, apiCall);
39
+ },
40
+ };
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { merchantAccountsGet } from "../../funcs/merchantAccountsGet.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ merchantAccountId: z.string(),
11
+ };
12
+
13
+ export const tool$merchantAccountsGet: ToolDefinition<typeof args> = {
14
+ name: "merchant-accounts-get",
15
+ description: `Get a merchant account
16
+
17
+ Get info about a merchant account in an instance.`,
18
+ args,
19
+ tool: async (client, args, ctx) => {
20
+ const [result, apiCall] = await merchantAccountsGet(
21
+ client,
22
+ args.merchantAccountId,
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
+ const value = result.value;
34
+
35
+ return formatResult(value, apiCall);
36
+ },
37
+ };
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { merchantAccountsList } from "../../funcs/merchantAccountsList.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ cursor: z.nullable(z.string()).optional(),
11
+ limit: z.number().int().default(20),
12
+ search: z.nullable(z.string()).optional(),
13
+ };
14
+
15
+ export const tool$merchantAccountsList: ToolDefinition<typeof args> = {
16
+ name: "merchant-accounts-list",
17
+ description: `List all merchant accounts
18
+
19
+ List all merchant accounts in an instance.`,
20
+ args,
21
+ tool: async (client, args, ctx) => {
22
+ const [result, apiCall] = await merchantAccountsList(
23
+ client,
24
+ args.cursor,
25
+ args.limit,
26
+ args.search,
27
+ { fetchOptions: { signal: ctx.signal } },
28
+ ).$inspect();
29
+
30
+ if (!result.ok) {
31
+ return {
32
+ content: [{ type: "text", text: result.error.message }],
33
+ isError: true,
34
+ };
35
+ }
36
+
37
+ const value = result.value.result;
38
+
39
+ return formatResult(value, apiCall);
40
+ },
41
+ };
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { merchantAccountsUpdate } from "../../funcs/merchantAccountsUpdate.js";
7
+ import * as components from "../../models/components/index.js";
8
+ import { formatResult, ToolDefinition } from "../tools.js";
9
+
10
+ const args = {
11
+ merchantAccountUpdate: components.MerchantAccountUpdate$inboundSchema,
12
+ merchantAccountId: z.string(),
13
+ timeoutInSeconds: z.number().default(1),
14
+ };
15
+
16
+ export const tool$merchantAccountsUpdate: ToolDefinition<typeof args> = {
17
+ name: "merchant-accounts-update",
18
+ description: `Update a merchant account
19
+
20
+ Update info for a merchant account in an instance.`,
21
+ args,
22
+ tool: async (client, args, ctx) => {
23
+ const [result, apiCall] = await merchantAccountsUpdate(
24
+ client,
25
+ args.merchantAccountUpdate,
26
+ args.merchantAccountId,
27
+ args.timeoutInSeconds,
28
+ { fetchOptions: { signal: ctx.signal } },
29
+ ).$inspect();
30
+
31
+ if (!result.ok) {
32
+ return {
33
+ content: [{ type: "text", text: result.error.message }],
34
+ isError: true,
35
+ };
36
+ }
37
+
38
+ const value = result.value;
39
+
40
+ return formatResult(value, apiCall);
41
+ },
42
+ };
@@ -0,0 +1,107 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ MerchantAccount,
12
+ MerchantAccount$inboundSchema,
13
+ MerchantAccount$Outbound,
14
+ MerchantAccount$outboundSchema,
15
+ } from "./merchantaccount.js";
16
+
17
+ export type CollectionMerchantAccount = {
18
+ /**
19
+ * A list of items returned for this request.
20
+ */
21
+ items: Array<MerchantAccount>;
22
+ /**
23
+ * The number of items for this page.
24
+ */
25
+ limit?: number | undefined;
26
+ /**
27
+ * The cursor pointing at the next page of items.
28
+ */
29
+ nextCursor?: string | null | undefined;
30
+ /**
31
+ * The cursor pointing at the previous page of items.
32
+ */
33
+ previousCursor?: string | null | undefined;
34
+ };
35
+
36
+ /** @internal */
37
+ export const CollectionMerchantAccount$inboundSchema: z.ZodType<
38
+ CollectionMerchantAccount,
39
+ z.ZodTypeDef,
40
+ unknown
41
+ > = z.object({
42
+ items: z.array(MerchantAccount$inboundSchema),
43
+ limit: z.number().int().default(20),
44
+ next_cursor: z.nullable(z.string()).optional(),
45
+ previous_cursor: z.nullable(z.string()).optional(),
46
+ }).transform((v) => {
47
+ return remap$(v, {
48
+ "next_cursor": "nextCursor",
49
+ "previous_cursor": "previousCursor",
50
+ });
51
+ });
52
+
53
+ /** @internal */
54
+ export type CollectionMerchantAccount$Outbound = {
55
+ items: Array<MerchantAccount$Outbound>;
56
+ limit: number;
57
+ next_cursor?: string | null | undefined;
58
+ previous_cursor?: string | null | undefined;
59
+ };
60
+
61
+ /** @internal */
62
+ export const CollectionMerchantAccount$outboundSchema: z.ZodType<
63
+ CollectionMerchantAccount$Outbound,
64
+ z.ZodTypeDef,
65
+ CollectionMerchantAccount
66
+ > = z.object({
67
+ items: z.array(MerchantAccount$outboundSchema),
68
+ limit: z.number().int().default(20),
69
+ nextCursor: z.nullable(z.string()).optional(),
70
+ previousCursor: z.nullable(z.string()).optional(),
71
+ }).transform((v) => {
72
+ return remap$(v, {
73
+ nextCursor: "next_cursor",
74
+ previousCursor: "previous_cursor",
75
+ });
76
+ });
77
+
78
+ /**
79
+ * @internal
80
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
81
+ */
82
+ export namespace CollectionMerchantAccount$ {
83
+ /** @deprecated use `CollectionMerchantAccount$inboundSchema` instead. */
84
+ export const inboundSchema = CollectionMerchantAccount$inboundSchema;
85
+ /** @deprecated use `CollectionMerchantAccount$outboundSchema` instead. */
86
+ export const outboundSchema = CollectionMerchantAccount$outboundSchema;
87
+ /** @deprecated use `CollectionMerchantAccount$Outbound` instead. */
88
+ export type Outbound = CollectionMerchantAccount$Outbound;
89
+ }
90
+
91
+ export function collectionMerchantAccountToJSON(
92
+ collectionMerchantAccount: CollectionMerchantAccount,
93
+ ): string {
94
+ return JSON.stringify(
95
+ CollectionMerchantAccount$outboundSchema.parse(collectionMerchantAccount),
96
+ );
97
+ }
98
+
99
+ export function collectionMerchantAccountFromJSON(
100
+ jsonString: string,
101
+ ): SafeParseResult<CollectionMerchantAccount, SDKValidationError> {
102
+ return safeParse(
103
+ jsonString,
104
+ (x) => CollectionMerchantAccount$inboundSchema.parse(JSON.parse(x)),
105
+ `Failed to parse 'CollectionMerchantAccount' from JSON`,
106
+ );
107
+ }
@@ -45,6 +45,7 @@ export * from "./clicktopaysessionrequest.js";
45
45
  export * from "./collectionauditlogentry.js";
46
46
  export * from "./collectionbuyer.js";
47
47
  export * from "./collectiongiftcard.js";
48
+ export * from "./collectionmerchantaccount.js";
48
49
  export * from "./collectionnocursorcardschemedefinition.js";
49
50
  export * from "./collectionnocursordigitalwallet.js";
50
51
  export * from "./collectionnocursorgiftcardsummary.js";
@@ -92,6 +93,9 @@ export * from "./googlepaysessionrequest.js";
92
93
  export * from "./guestbuyerinput.js";
93
94
  export * from "./guestbuyeroutput.js";
94
95
  export * from "./instrumenttype.js";
96
+ export * from "./merchantaccount.js";
97
+ export * from "./merchantaccountcreate.js";
98
+ export * from "./merchantaccountupdate.js";
95
99
  export * from "./method.js";
96
100
  export * from "./mode.js";
97
101
  export * from "./networktoken.js";