@gr4vy/sdk 2.3.14 → 2.3.15

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 (160) hide show
  1. package/README.md +14 -1
  2. package/funcs/apiKeyPairsCreate.d.ts +18 -0
  3. package/funcs/apiKeyPairsCreate.d.ts.map +1 -0
  4. package/funcs/apiKeyPairsCreate.js +119 -0
  5. package/funcs/apiKeyPairsCreate.js.map +1 -0
  6. package/funcs/apiKeyPairsDelete.d.ts +17 -0
  7. package/funcs/apiKeyPairsDelete.d.ts.map +1 -0
  8. package/funcs/apiKeyPairsDelete.js +128 -0
  9. package/funcs/apiKeyPairsDelete.js.map +1 -0
  10. package/funcs/apiKeyPairsGet.d.ts +18 -0
  11. package/funcs/apiKeyPairsGet.d.ts.map +1 -0
  12. package/funcs/apiKeyPairsGet.js +138 -0
  13. package/funcs/apiKeyPairsGet.js.map +1 -0
  14. package/funcs/apiKeyPairsList.d.ts +21 -0
  15. package/funcs/apiKeyPairsList.d.ts.map +1 -0
  16. package/funcs/apiKeyPairsList.js +160 -0
  17. package/funcs/apiKeyPairsList.js.map +1 -0
  18. package/funcs/apiKeyPairsUpdate.d.ts +18 -0
  19. package/funcs/apiKeyPairsUpdate.d.ts.map +1 -0
  20. package/funcs/apiKeyPairsUpdate.js +130 -0
  21. package/funcs/apiKeyPairsUpdate.js.map +1 -0
  22. package/funcs/merchantAccountsCreate.d.ts +1 -1
  23. package/funcs/merchantAccountsCreate.d.ts.map +1 -1
  24. package/funcs/merchantAccountsCreate.js +1 -1
  25. package/funcs/merchantAccountsCreate.js.map +1 -1
  26. package/funcs/merchantAccountsGet.d.ts +1 -1
  27. package/funcs/merchantAccountsGet.d.ts.map +1 -1
  28. package/funcs/merchantAccountsGet.js +1 -1
  29. package/funcs/merchantAccountsGet.js.map +1 -1
  30. package/funcs/merchantAccountsUpdate.d.ts +1 -1
  31. package/funcs/merchantAccountsUpdate.d.ts.map +1 -1
  32. package/funcs/merchantAccountsUpdate.js +1 -1
  33. package/funcs/merchantAccountsUpdate.js.map +1 -1
  34. package/jsr.json +1 -1
  35. package/lib/config.d.ts +3 -3
  36. package/lib/config.js +3 -3
  37. package/models/components/apicommonschemascreator.d.ts +12 -0
  38. package/models/components/apicommonschemascreator.d.ts.map +1 -0
  39. package/models/components/{creator.js → apicommonschemascreator.js} +6 -6
  40. package/models/components/apicommonschemascreator.js.map +1 -0
  41. package/models/components/apicommonschemasmerchantaccount.d.ts +16 -0
  42. package/models/components/apicommonschemasmerchantaccount.d.ts.map +1 -0
  43. package/models/components/apicommonschemasmerchantaccount.js +65 -0
  44. package/models/components/apicommonschemasmerchantaccount.js.map +1 -0
  45. package/models/components/apikeypair.d.ts +58 -0
  46. package/models/components/apikeypair.d.ts.map +1 -0
  47. package/models/components/apikeypair.js +76 -0
  48. package/models/components/apikeypair.js.map +1 -0
  49. package/models/components/apikeypaircreate.d.ts +38 -0
  50. package/models/components/apikeypaircreate.d.ts.map +1 -0
  51. package/models/components/apikeypaircreate.js +63 -0
  52. package/models/components/apikeypaircreate.js.map +1 -0
  53. package/models/components/apikeypairupdate.d.ts +27 -0
  54. package/models/components/apikeypairupdate.d.ts.map +1 -0
  55. package/models/components/apikeypairupdate.js +59 -0
  56. package/models/components/apikeypairupdate.js.map +1 -0
  57. package/models/components/apiroutersapikeypairsschemascreator.d.ts +25 -0
  58. package/models/components/apiroutersapikeypairsschemascreator.d.ts.map +1 -0
  59. package/models/components/apiroutersapikeypairsschemascreator.js +58 -0
  60. package/models/components/apiroutersapikeypairsschemascreator.js.map +1 -0
  61. package/models/components/{merchantaccount.d.ts → apiroutersmerchantaccountsschemasmerchantaccount.d.ts} +4 -4
  62. package/models/components/apiroutersmerchantaccountsschemasmerchantaccount.d.ts.map +1 -0
  63. package/models/components/{merchantaccount.js → apiroutersmerchantaccountsschemasmerchantaccount.js} +10 -8
  64. package/models/components/apiroutersmerchantaccountsschemasmerchantaccount.js.map +1 -0
  65. package/models/components/certificatealgorithm.d.ts +12 -0
  66. package/models/components/certificatealgorithm.d.ts.map +1 -0
  67. package/models/components/certificatealgorithm.js +49 -0
  68. package/models/components/certificatealgorithm.js.map +1 -0
  69. package/models/components/collectionapikeypair.d.ts +26 -0
  70. package/models/components/collectionapikeypair.d.ts.map +1 -0
  71. package/models/components/collectionapikeypair.js +60 -0
  72. package/models/components/collectionapikeypair.js.map +1 -0
  73. package/models/components/index.d.ts +11 -2
  74. package/models/components/index.d.ts.map +1 -1
  75. package/models/components/index.js +11 -2
  76. package/models/components/index.js.map +1 -1
  77. package/models/components/merchantaccounts.d.ts +2 -2
  78. package/models/components/merchantaccounts.d.ts.map +1 -1
  79. package/models/components/merchantaccounts.js +2 -2
  80. package/models/components/merchantaccounts.js.map +1 -1
  81. package/models/components/permissionset.d.ts +10 -0
  82. package/models/components/permissionset.d.ts.map +1 -0
  83. package/models/components/permissionset.js +50 -0
  84. package/models/components/permissionset.js.map +1 -0
  85. package/models/components/refund.d.ts +2 -2
  86. package/models/components/refund.d.ts.map +1 -1
  87. package/models/components/refund.js +2 -2
  88. package/models/components/refund.js.map +1 -1
  89. package/models/components/role.d.ts +15 -0
  90. package/models/components/role.d.ts.map +1 -0
  91. package/models/components/role.js +56 -0
  92. package/models/components/role.js.map +1 -0
  93. package/models/operations/deleteapikeypair.d.ts +15 -0
  94. package/models/operations/deleteapikeypair.d.ts.map +1 -0
  95. package/models/operations/deleteapikeypair.js +54 -0
  96. package/models/operations/deleteapikeypair.js.map +1 -0
  97. package/models/operations/getapikeypair.d.ts +15 -0
  98. package/models/operations/getapikeypair.d.ts.map +1 -0
  99. package/models/operations/getapikeypair.js +54 -0
  100. package/models/operations/getapikeypair.js.map +1 -0
  101. package/models/operations/index.d.ts +4 -0
  102. package/models/operations/index.d.ts.map +1 -1
  103. package/models/operations/index.js +4 -0
  104. package/models/operations/index.js.map +1 -1
  105. package/models/operations/listapikeypairs.d.ts +29 -0
  106. package/models/operations/listapikeypairs.d.ts.map +1 -0
  107. package/models/operations/listapikeypairs.js +65 -0
  108. package/models/operations/listapikeypairs.js.map +1 -0
  109. package/models/operations/updateapikeypair.d.ts +18 -0
  110. package/models/operations/updateapikeypair.d.ts.map +1 -0
  111. package/models/operations/updateapikeypair.js +57 -0
  112. package/models/operations/updateapikeypair.js.map +1 -0
  113. package/package.json +1 -1
  114. package/sdk/apikeypairs.d.ts +44 -0
  115. package/sdk/apikeypairs.d.ts.map +1 -0
  116. package/sdk/apikeypairs.js +63 -0
  117. package/sdk/apikeypairs.js.map +1 -0
  118. package/sdk/merchantaccounts.d.ts +3 -3
  119. package/sdk/merchantaccounts.d.ts.map +1 -1
  120. package/sdk/sdk.d.ts +3 -0
  121. package/sdk/sdk.d.ts.map +1 -1
  122. package/sdk/sdk.js +4 -0
  123. package/sdk/sdk.js.map +1 -1
  124. package/src/funcs/apiKeyPairsCreate.ts +215 -0
  125. package/src/funcs/apiKeyPairsDelete.ts +225 -0
  126. package/src/funcs/apiKeyPairsGet.ts +235 -0
  127. package/src/funcs/apiKeyPairsList.ts +312 -0
  128. package/src/funcs/apiKeyPairsUpdate.ts +230 -0
  129. package/src/funcs/merchantAccountsCreate.ts +7 -4
  130. package/src/funcs/merchantAccountsGet.ts +7 -4
  131. package/src/funcs/merchantAccountsUpdate.ts +7 -4
  132. package/src/lib/config.ts +3 -3
  133. package/src/models/components/apicommonschemascreator.ts +40 -0
  134. package/src/models/components/apicommonschemasmerchantaccount.ts +52 -0
  135. package/src/models/components/apikeypair.ts +110 -0
  136. package/src/models/components/apikeypaircreate.ts +73 -0
  137. package/src/models/components/apikeypairupdate.ts +56 -0
  138. package/src/models/components/apiroutersapikeypairsschemascreator.ts +55 -0
  139. package/src/models/components/{merchantaccount.ts → apiroutersmerchantaccountsschemasmerchantaccount.ts} +79 -65
  140. package/src/models/components/certificatealgorithm.ts +26 -0
  141. package/src/models/components/collectionapikeypair.ts +56 -0
  142. package/src/models/components/index.ts +11 -2
  143. package/src/models/components/merchantaccounts.ts +7 -5
  144. package/src/models/components/permissionset.ts +31 -0
  145. package/src/models/components/refund.ts +6 -3
  146. package/src/models/components/role.ts +37 -0
  147. package/src/models/operations/deleteapikeypair.ts +39 -0
  148. package/src/models/operations/getapikeypair.ts +39 -0
  149. package/src/models/operations/index.ts +4 -0
  150. package/src/models/operations/listapikeypairs.ts +72 -0
  151. package/src/models/operations/updateapikeypair.ts +44 -0
  152. package/src/sdk/apikeypairs.ts +107 -0
  153. package/src/sdk/merchantaccounts.ts +3 -3
  154. package/src/sdk/sdk.ts +6 -0
  155. package/models/components/creator.d.ts +0 -12
  156. package/models/components/creator.d.ts.map +0 -1
  157. package/models/components/creator.js.map +0 -1
  158. package/models/components/merchantaccount.d.ts.map +0 -1
  159. package/models/components/merchantaccount.js.map +0 -1
  160. package/src/models/components/creator.ts +0 -37
@@ -0,0 +1,312 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { Gr4vyCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { Gr4vyError } from "../models/errors/gr4vyerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+ import {
29
+ createPageIterator,
30
+ haltIterator,
31
+ PageIterator,
32
+ Paginator,
33
+ } from "../types/operations.js";
34
+
35
+ /**
36
+ * List all API key pairs
37
+ *
38
+ * @remarks
39
+ * List all API key pairs.
40
+ */
41
+ export function apiKeyPairsList(
42
+ client: Gr4vyCore,
43
+ cursor?: string | null | undefined,
44
+ limit?: number | undefined,
45
+ options?: RequestOptions,
46
+ ): APIPromise<
47
+ PageIterator<
48
+ Result<
49
+ operations.ListApiKeyPairsResponse,
50
+ | errors.Error400
51
+ | errors.Error401
52
+ | errors.Error403
53
+ | errors.Error404
54
+ | errors.Error405
55
+ | errors.Error409
56
+ | errors.HTTPValidationError
57
+ | errors.Error425
58
+ | errors.Error429
59
+ | errors.Error500
60
+ | errors.Error502
61
+ | errors.Error504
62
+ | Gr4vyError
63
+ | ResponseValidationError
64
+ | ConnectionError
65
+ | RequestAbortedError
66
+ | RequestTimeoutError
67
+ | InvalidRequestError
68
+ | UnexpectedClientError
69
+ | SDKValidationError
70
+ >,
71
+ { cursor: string }
72
+ >
73
+ > {
74
+ return new APIPromise($do(
75
+ client,
76
+ cursor,
77
+ limit,
78
+ options,
79
+ ));
80
+ }
81
+
82
+ async function $do(
83
+ client: Gr4vyCore,
84
+ cursor?: string | null | undefined,
85
+ limit?: number | undefined,
86
+ options?: RequestOptions,
87
+ ): Promise<
88
+ [
89
+ PageIterator<
90
+ Result<
91
+ operations.ListApiKeyPairsResponse,
92
+ | errors.Error400
93
+ | errors.Error401
94
+ | errors.Error403
95
+ | errors.Error404
96
+ | errors.Error405
97
+ | errors.Error409
98
+ | errors.HTTPValidationError
99
+ | errors.Error425
100
+ | errors.Error429
101
+ | errors.Error500
102
+ | errors.Error502
103
+ | errors.Error504
104
+ | Gr4vyError
105
+ | ResponseValidationError
106
+ | ConnectionError
107
+ | RequestAbortedError
108
+ | RequestTimeoutError
109
+ | InvalidRequestError
110
+ | UnexpectedClientError
111
+ | SDKValidationError
112
+ >,
113
+ { cursor: string }
114
+ >,
115
+ APICall,
116
+ ]
117
+ > {
118
+ const input: operations.ListApiKeyPairsRequest | undefined = {
119
+ cursor: cursor,
120
+ limit: limit,
121
+ };
122
+
123
+ const parsed = safeParse(
124
+ input,
125
+ (value) =>
126
+ operations.ListApiKeyPairsRequest$outboundSchema.optional().parse(value),
127
+ "Input validation failed",
128
+ );
129
+ if (!parsed.ok) {
130
+ return [haltIterator(parsed), { status: "invalid" }];
131
+ }
132
+ const payload = parsed.value;
133
+ const body = null;
134
+
135
+ const path = pathToFunc("/api-key-pairs")();
136
+
137
+ const query = encodeFormQuery({
138
+ "cursor": payload?.cursor,
139
+ "limit": payload?.limit,
140
+ });
141
+
142
+ const headers = new Headers(compactMap({
143
+ Accept: "application/json",
144
+ }));
145
+
146
+ const secConfig = await extractSecurity(client._options.bearerAuth);
147
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
148
+ const requestSecurity = resolveGlobalSecurity(securityInput);
149
+
150
+ const context = {
151
+ options: client._options,
152
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
153
+ operationID: "list_api_key_pairs",
154
+ oAuth2Scopes: null,
155
+
156
+ resolvedSecurity: requestSecurity,
157
+
158
+ securitySource: client._options.bearerAuth,
159
+ retryConfig: options?.retries
160
+ || client._options.retryConfig
161
+ || {
162
+ strategy: "backoff",
163
+ backoff: {
164
+ initialInterval: 200,
165
+ maxInterval: 200,
166
+ exponent: 1,
167
+ maxElapsedTime: 1000,
168
+ },
169
+ retryConnectionErrors: true,
170
+ }
171
+ || { strategy: "none" },
172
+ retryCodes: options?.retryCodes || ["5XX"],
173
+ };
174
+
175
+ const requestRes = client._createRequest(context, {
176
+ security: requestSecurity,
177
+ method: "GET",
178
+ baseURL: options?.serverURL,
179
+ path: path,
180
+ headers: headers,
181
+ query: query,
182
+ body: body,
183
+ userAgent: client._options.userAgent,
184
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
185
+ }, options);
186
+ if (!requestRes.ok) {
187
+ return [haltIterator(requestRes), { status: "invalid" }];
188
+ }
189
+ const req = requestRes.value;
190
+
191
+ const doResult = await client._do(req, {
192
+ context,
193
+ isErrorStatusCode: (statusCode: number) =>
194
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
195
+ retryConfig: context.retryConfig,
196
+ retryCodes: context.retryCodes,
197
+ });
198
+ if (!doResult.ok) {
199
+ return [haltIterator(doResult), { status: "request-error", request: req }];
200
+ }
201
+ const response = doResult.value;
202
+
203
+ const responseFields = {
204
+ HttpMeta: { Response: response, Request: req },
205
+ };
206
+
207
+ const [result, raw] = await M.match<
208
+ operations.ListApiKeyPairsResponse,
209
+ | errors.Error400
210
+ | errors.Error401
211
+ | errors.Error403
212
+ | errors.Error404
213
+ | errors.Error405
214
+ | errors.Error409
215
+ | errors.HTTPValidationError
216
+ | errors.Error425
217
+ | errors.Error429
218
+ | errors.Error500
219
+ | errors.Error502
220
+ | errors.Error504
221
+ | Gr4vyError
222
+ | ResponseValidationError
223
+ | ConnectionError
224
+ | RequestAbortedError
225
+ | RequestTimeoutError
226
+ | InvalidRequestError
227
+ | UnexpectedClientError
228
+ | SDKValidationError
229
+ >(
230
+ M.json(200, operations.ListApiKeyPairsResponse$inboundSchema, {
231
+ key: "Result",
232
+ }),
233
+ M.jsonErr(400, errors.Error400$inboundSchema),
234
+ M.jsonErr(401, errors.Error401$inboundSchema),
235
+ M.jsonErr(403, errors.Error403$inboundSchema),
236
+ M.jsonErr(404, errors.Error404$inboundSchema),
237
+ M.jsonErr(405, errors.Error405$inboundSchema),
238
+ M.jsonErr(409, errors.Error409$inboundSchema),
239
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
240
+ M.jsonErr(425, errors.Error425$inboundSchema),
241
+ M.jsonErr(429, errors.Error429$inboundSchema),
242
+ M.jsonErr(500, errors.Error500$inboundSchema),
243
+ M.jsonErr(502, errors.Error502$inboundSchema),
244
+ M.jsonErr(504, errors.Error504$inboundSchema),
245
+ M.fail("4XX"),
246
+ M.fail("5XX"),
247
+ )(response, req, { extraFields: responseFields });
248
+ if (!result.ok) {
249
+ return [haltIterator(result), {
250
+ status: "complete",
251
+ request: req,
252
+ response,
253
+ }];
254
+ }
255
+
256
+ const nextFunc = (
257
+ responseData: unknown,
258
+ ): {
259
+ next: Paginator<
260
+ Result<
261
+ operations.ListApiKeyPairsResponse,
262
+ | errors.Error400
263
+ | errors.Error401
264
+ | errors.Error403
265
+ | errors.Error404
266
+ | errors.Error405
267
+ | errors.Error409
268
+ | errors.HTTPValidationError
269
+ | errors.Error425
270
+ | errors.Error429
271
+ | errors.Error500
272
+ | errors.Error502
273
+ | errors.Error504
274
+ | Gr4vyError
275
+ | ResponseValidationError
276
+ | ConnectionError
277
+ | RequestAbortedError
278
+ | RequestTimeoutError
279
+ | InvalidRequestError
280
+ | UnexpectedClientError
281
+ | SDKValidationError
282
+ >
283
+ >;
284
+ "~next"?: { cursor: string };
285
+ } => {
286
+ const nextCursor =
287
+ (responseData as { next_cursor?: unknown | null }).next_cursor;
288
+ if (typeof nextCursor !== "string") {
289
+ return { next: () => null };
290
+ }
291
+ if (nextCursor.trim() === "") {
292
+ return { next: () => null };
293
+ }
294
+
295
+ const nextVal = () =>
296
+ apiKeyPairsList(
297
+ client,
298
+ nextCursor,
299
+ limit,
300
+ options,
301
+ );
302
+
303
+ return { next: nextVal, "~next": { cursor: nextCursor } };
304
+ };
305
+
306
+ const page = { ...result, ...nextFunc(raw) };
307
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
308
+ status: "complete",
309
+ request: req,
310
+ response,
311
+ }];
312
+ }
@@ -0,0 +1,230 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { Gr4vyCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { Gr4vyError } from "../models/errors/gr4vyerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Update an API key pair
32
+ *
33
+ * @remarks
34
+ * Updates an API key pair.
35
+ */
36
+ export function apiKeyPairsUpdate(
37
+ client: Gr4vyCore,
38
+ apiKeyPairUpdate: components.APIKeyPairUpdate,
39
+ apiKeyPairId: string,
40
+ options?: RequestOptions,
41
+ ): APIPromise<
42
+ Result<
43
+ components.APIKeyPair,
44
+ | errors.Error400
45
+ | errors.Error401
46
+ | errors.Error403
47
+ | errors.Error404
48
+ | errors.Error405
49
+ | errors.Error409
50
+ | errors.HTTPValidationError
51
+ | errors.Error425
52
+ | errors.Error429
53
+ | errors.Error500
54
+ | errors.Error502
55
+ | errors.Error504
56
+ | Gr4vyError
57
+ | ResponseValidationError
58
+ | ConnectionError
59
+ | RequestAbortedError
60
+ | RequestTimeoutError
61
+ | InvalidRequestError
62
+ | UnexpectedClientError
63
+ | SDKValidationError
64
+ >
65
+ > {
66
+ return new APIPromise($do(
67
+ client,
68
+ apiKeyPairUpdate,
69
+ apiKeyPairId,
70
+ options,
71
+ ));
72
+ }
73
+
74
+ async function $do(
75
+ client: Gr4vyCore,
76
+ apiKeyPairUpdate: components.APIKeyPairUpdate,
77
+ apiKeyPairId: string,
78
+ options?: RequestOptions,
79
+ ): Promise<
80
+ [
81
+ Result<
82
+ components.APIKeyPair,
83
+ | errors.Error400
84
+ | errors.Error401
85
+ | errors.Error403
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
+ | Gr4vyError
96
+ | ResponseValidationError
97
+ | ConnectionError
98
+ | RequestAbortedError
99
+ | RequestTimeoutError
100
+ | InvalidRequestError
101
+ | UnexpectedClientError
102
+ | SDKValidationError
103
+ >,
104
+ APICall,
105
+ ]
106
+ > {
107
+ const input: operations.UpdateApiKeyPairRequest = {
108
+ apiKeyPairUpdate: apiKeyPairUpdate,
109
+ apiKeyPairId: apiKeyPairId,
110
+ };
111
+
112
+ const parsed = safeParse(
113
+ input,
114
+ (value) => operations.UpdateApiKeyPairRequest$outboundSchema.parse(value),
115
+ "Input validation failed",
116
+ );
117
+ if (!parsed.ok) {
118
+ return [parsed, { status: "invalid" }];
119
+ }
120
+ const payload = parsed.value;
121
+ const body = encodeJSON("body", payload.APIKeyPairUpdate, { explode: true });
122
+
123
+ const pathParams = {
124
+ api_key_pair_id: encodeSimple("api_key_pair_id", payload.api_key_pair_id, {
125
+ explode: false,
126
+ charEncoding: "percent",
127
+ }),
128
+ };
129
+ const path = pathToFunc("/api-key-pairs/{api_key_pair_id}")(pathParams);
130
+
131
+ const headers = new Headers(compactMap({
132
+ "Content-Type": "application/json",
133
+ Accept: "application/json",
134
+ }));
135
+
136
+ const secConfig = await extractSecurity(client._options.bearerAuth);
137
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
138
+ const requestSecurity = resolveGlobalSecurity(securityInput);
139
+
140
+ const context = {
141
+ options: client._options,
142
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
143
+ operationID: "update_api_key_pair",
144
+ oAuth2Scopes: null,
145
+
146
+ resolvedSecurity: requestSecurity,
147
+
148
+ securitySource: client._options.bearerAuth,
149
+ retryConfig: options?.retries
150
+ || client._options.retryConfig
151
+ || { strategy: "none" },
152
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
153
+ };
154
+
155
+ const requestRes = client._createRequest(context, {
156
+ security: requestSecurity,
157
+ method: "PUT",
158
+ baseURL: options?.serverURL,
159
+ path: path,
160
+ headers: headers,
161
+ body: body,
162
+ userAgent: client._options.userAgent,
163
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
164
+ }, options);
165
+ if (!requestRes.ok) {
166
+ return [requestRes, { status: "invalid" }];
167
+ }
168
+ const req = requestRes.value;
169
+
170
+ const doResult = await client._do(req, {
171
+ context,
172
+ isErrorStatusCode: (statusCode: number) =>
173
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
174
+ retryConfig: context.retryConfig,
175
+ retryCodes: context.retryCodes,
176
+ });
177
+ if (!doResult.ok) {
178
+ return [doResult, { status: "request-error", request: req }];
179
+ }
180
+ const response = doResult.value;
181
+
182
+ const responseFields = {
183
+ HttpMeta: { Response: response, Request: req },
184
+ };
185
+
186
+ const [result] = await M.match<
187
+ components.APIKeyPair,
188
+ | errors.Error400
189
+ | errors.Error401
190
+ | errors.Error403
191
+ | errors.Error404
192
+ | errors.Error405
193
+ | errors.Error409
194
+ | errors.HTTPValidationError
195
+ | errors.Error425
196
+ | errors.Error429
197
+ | errors.Error500
198
+ | errors.Error502
199
+ | errors.Error504
200
+ | Gr4vyError
201
+ | ResponseValidationError
202
+ | ConnectionError
203
+ | RequestAbortedError
204
+ | RequestTimeoutError
205
+ | InvalidRequestError
206
+ | UnexpectedClientError
207
+ | SDKValidationError
208
+ >(
209
+ M.json(200, components.APIKeyPair$inboundSchema),
210
+ M.jsonErr(400, errors.Error400$inboundSchema),
211
+ M.jsonErr(401, errors.Error401$inboundSchema),
212
+ M.jsonErr(403, errors.Error403$inboundSchema),
213
+ M.jsonErr(404, errors.Error404$inboundSchema),
214
+ M.jsonErr(405, errors.Error405$inboundSchema),
215
+ M.jsonErr(409, errors.Error409$inboundSchema),
216
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
217
+ M.jsonErr(425, errors.Error425$inboundSchema),
218
+ M.jsonErr(429, errors.Error429$inboundSchema),
219
+ M.jsonErr(500, errors.Error500$inboundSchema),
220
+ M.jsonErr(502, errors.Error502$inboundSchema),
221
+ M.jsonErr(504, errors.Error504$inboundSchema),
222
+ M.fail("4XX"),
223
+ M.fail("5XX"),
224
+ )(response, req, { extraFields: responseFields });
225
+ if (!result.ok) {
226
+ return [result, { status: "complete", request: req, response }];
227
+ }
228
+
229
+ return [result, { status: "complete", request: req, response }];
230
+ }
@@ -38,7 +38,7 @@ export function merchantAccountsCreate(
38
38
  options?: RequestOptions,
39
39
  ): APIPromise<
40
40
  Result<
41
- components.MerchantAccount,
41
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
42
42
  | errors.Error400
43
43
  | errors.Error401
44
44
  | errors.Error403
@@ -75,7 +75,7 @@ async function $do(
75
75
  ): Promise<
76
76
  [
77
77
  Result<
78
- components.MerchantAccount,
78
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
79
79
  | errors.Error400
80
80
  | errors.Error401
81
81
  | errors.Error403
@@ -169,7 +169,7 @@ async function $do(
169
169
  };
170
170
 
171
171
  const [result] = await M.match<
172
- components.MerchantAccount,
172
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
173
173
  | errors.Error400
174
174
  | errors.Error401
175
175
  | errors.Error403
@@ -191,7 +191,10 @@ async function $do(
191
191
  | UnexpectedClientError
192
192
  | SDKValidationError
193
193
  >(
194
- M.json(201, components.MerchantAccount$inboundSchema),
194
+ M.json(
195
+ 201,
196
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount$inboundSchema,
197
+ ),
195
198
  M.jsonErr(400, errors.Error400$inboundSchema),
196
199
  M.jsonErr(401, errors.Error401$inboundSchema),
197
200
  M.jsonErr(403, errors.Error403$inboundSchema),
@@ -39,7 +39,7 @@ export function merchantAccountsGet(
39
39
  options?: RequestOptions,
40
40
  ): APIPromise<
41
41
  Result<
42
- components.MerchantAccount,
42
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
43
43
  | errors.Error400
44
44
  | errors.Error401
45
45
  | errors.Error403
@@ -76,7 +76,7 @@ async function $do(
76
76
  ): Promise<
77
77
  [
78
78
  Result<
79
- components.MerchantAccount,
79
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
80
80
  | errors.Error400
81
81
  | errors.Error401
82
82
  | errors.Error403
@@ -192,7 +192,7 @@ async function $do(
192
192
  };
193
193
 
194
194
  const [result] = await M.match<
195
- components.MerchantAccount,
195
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
196
196
  | errors.Error400
197
197
  | errors.Error401
198
198
  | errors.Error403
@@ -214,7 +214,10 @@ async function $do(
214
214
  | UnexpectedClientError
215
215
  | SDKValidationError
216
216
  >(
217
- M.json(200, components.MerchantAccount$inboundSchema),
217
+ M.json(
218
+ 200,
219
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount$inboundSchema,
220
+ ),
218
221
  M.jsonErr(400, errors.Error400$inboundSchema),
219
222
  M.jsonErr(401, errors.Error401$inboundSchema),
220
223
  M.jsonErr(403, errors.Error403$inboundSchema),
@@ -40,7 +40,7 @@ export function merchantAccountsUpdate(
40
40
  options?: RequestOptions,
41
41
  ): APIPromise<
42
42
  Result<
43
- components.MerchantAccount,
43
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
44
44
  | errors.Error400
45
45
  | errors.Error401
46
46
  | errors.Error403
@@ -79,7 +79,7 @@ async function $do(
79
79
  ): Promise<
80
80
  [
81
81
  Result<
82
- components.MerchantAccount,
82
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
83
83
  | errors.Error400
84
84
  | errors.Error401
85
85
  | errors.Error403
@@ -190,7 +190,7 @@ async function $do(
190
190
  };
191
191
 
192
192
  const [result] = await M.match<
193
- components.MerchantAccount,
193
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount,
194
194
  | errors.Error400
195
195
  | errors.Error401
196
196
  | errors.Error403
@@ -212,7 +212,10 @@ async function $do(
212
212
  | UnexpectedClientError
213
213
  | SDKValidationError
214
214
  >(
215
- M.json(200, components.MerchantAccount$inboundSchema),
215
+ M.json(
216
+ 200,
217
+ components.ApiRoutersMerchantAccountsSchemasMerchantAccount$inboundSchema,
218
+ ),
216
219
  M.jsonErr(400, errors.Error400$inboundSchema),
217
220
  M.jsonErr(401, errors.Error401$inboundSchema),
218
221
  M.jsonErr(403, errors.Error403$inboundSchema),
package/src/lib/config.ts CHANGED
@@ -77,7 +77,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
77
77
  export const SDK_METADATA = {
78
78
  language: "typescript",
79
79
  openapiDocVersion: "1.0.0",
80
- sdkVersion: "2.3.14",
81
- genVersion: "2.914.0",
82
- userAgent: "speakeasy-sdk/typescript 2.3.14 2.914.0 1.0.0 @gr4vy/sdk",
80
+ sdkVersion: "2.3.15",
81
+ genVersion: "2.915.1",
82
+ userAgent: "speakeasy-sdk/typescript 2.3.15 2.915.1 1.0.0 @gr4vy/sdk",
83
83
  } as const;
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
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
+
11
+ export type ApiCommonSchemasCreator = {
12
+ id: string;
13
+ name: string;
14
+ emailAddress: string;
15
+ };
16
+
17
+ /** @internal */
18
+ export const ApiCommonSchemasCreator$inboundSchema: z.ZodType<
19
+ ApiCommonSchemasCreator,
20
+ z.ZodTypeDef,
21
+ unknown
22
+ > = z.object({
23
+ id: z.string(),
24
+ name: z.string(),
25
+ email_address: z.string(),
26
+ }).transform((v) => {
27
+ return remap$(v, {
28
+ "email_address": "emailAddress",
29
+ });
30
+ });
31
+
32
+ export function apiCommonSchemasCreatorFromJSON(
33
+ jsonString: string,
34
+ ): SafeParseResult<ApiCommonSchemasCreator, SDKValidationError> {
35
+ return safeParse(
36
+ jsonString,
37
+ (x) => ApiCommonSchemasCreator$inboundSchema.parse(JSON.parse(x)),
38
+ `Failed to parse 'ApiCommonSchemasCreator' from JSON`,
39
+ );
40
+ }