@maesn/typescript-sdk 0.8.25 → 0.8.26

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 (56) hide show
  1. package/README.md +4 -0
  2. package/esm/funcs/accounting-get-currencies.d.ts +11 -0
  3. package/esm/funcs/accounting-get-currencies.d.ts.map +1 -0
  4. package/esm/funcs/accounting-get-currencies.js +89 -0
  5. package/esm/funcs/accounting-get-currencies.js.map +1 -0
  6. package/esm/funcs/accounting-get-reason-codes.d.ts +11 -0
  7. package/esm/funcs/accounting-get-reason-codes.d.ts.map +1 -0
  8. package/esm/funcs/accounting-get-reason-codes.js +89 -0
  9. package/esm/funcs/accounting-get-reason-codes.js.map +1 -0
  10. package/esm/lib/config.d.ts +2 -2
  11. package/esm/lib/config.js +2 -2
  12. package/esm/models/credit-note-response-dto.d.ts +1 -0
  13. package/esm/models/credit-note-response-dto.d.ts.map +1 -1
  14. package/esm/models/credit-note-response-dto.js +1 -0
  15. package/esm/models/credit-note-response-dto.js.map +1 -1
  16. package/esm/models/currency-response-dto.d.ts +15 -0
  17. package/esm/models/currency-response-dto.d.ts.map +1 -0
  18. package/esm/models/currency-response-dto.js +19 -0
  19. package/esm/models/currency-response-dto.js.map +1 -0
  20. package/esm/models/index.d.ts +2 -0
  21. package/esm/models/index.d.ts.map +1 -1
  22. package/esm/models/index.js +2 -0
  23. package/esm/models/index.js.map +1 -1
  24. package/esm/models/operations/get-currencies.d.ts +98 -0
  25. package/esm/models/operations/get-currencies.d.ts.map +1 -0
  26. package/esm/models/operations/get-currencies.js +69 -0
  27. package/esm/models/operations/get-currencies.js.map +1 -0
  28. package/esm/models/operations/get-reason-codes.d.ts +98 -0
  29. package/esm/models/operations/get-reason-codes.d.ts.map +1 -0
  30. package/esm/models/operations/get-reason-codes.js +69 -0
  31. package/esm/models/operations/get-reason-codes.js.map +1 -0
  32. package/esm/models/operations/index.d.ts +2 -0
  33. package/esm/models/operations/index.d.ts.map +1 -1
  34. package/esm/models/operations/index.js +2 -0
  35. package/esm/models/operations/index.js.map +1 -1
  36. package/esm/models/reason-code-response-dto.d.ts +12 -0
  37. package/esm/models/reason-code-response-dto.d.ts.map +1 -0
  38. package/esm/models/reason-code-response-dto.js +16 -0
  39. package/esm/models/reason-code-response-dto.js.map +1 -0
  40. package/esm/sdk/accounting.d.ts +2 -0
  41. package/esm/sdk/accounting.d.ts.map +1 -1
  42. package/esm/sdk/accounting.js +8 -0
  43. package/esm/sdk/accounting.js.map +1 -1
  44. package/jsr.json +1 -1
  45. package/package.json +1 -1
  46. package/src/funcs/accounting-get-currencies.ts +184 -0
  47. package/src/funcs/accounting-get-reason-codes.ts +184 -0
  48. package/src/lib/config.ts +2 -2
  49. package/src/models/credit-note-response-dto.ts +2 -0
  50. package/src/models/currency-response-dto.ts +41 -0
  51. package/src/models/index.ts +2 -0
  52. package/src/models/operations/get-currencies.ts +215 -0
  53. package/src/models/operations/get-reason-codes.ts +215 -0
  54. package/src/models/operations/index.ts +2 -0
  55. package/src/models/reason-code-response-dto.ts +35 -0
  56. package/src/sdk/accounting.ts +24 -0
@@ -0,0 +1,184 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { MaesnCore } from "../core.js";
7
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/http-client-errors.js";
21
+ import { MaesnError } from "../models/errors/maesn-error.js";
22
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
23
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.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
+ export function accountingGetCurrencies(
29
+ client: MaesnCore,
30
+ request?: operations.GetCurrenciesRequest | undefined,
31
+ options?: RequestOptions,
32
+ ): APIPromise<
33
+ Result<
34
+ operations.GetCurrenciesResponse,
35
+ | MaesnError
36
+ | ResponseValidationError
37
+ | ConnectionError
38
+ | RequestAbortedError
39
+ | RequestTimeoutError
40
+ | InvalidRequestError
41
+ | UnexpectedClientError
42
+ | SDKValidationError
43
+ >
44
+ > {
45
+ return new APIPromise($do(
46
+ client,
47
+ request,
48
+ options,
49
+ ));
50
+ }
51
+
52
+ async function $do(
53
+ client: MaesnCore,
54
+ request?: operations.GetCurrenciesRequest | undefined,
55
+ options?: RequestOptions,
56
+ ): Promise<
57
+ [
58
+ Result<
59
+ operations.GetCurrenciesResponse,
60
+ | MaesnError
61
+ | ResponseValidationError
62
+ | ConnectionError
63
+ | RequestAbortedError
64
+ | RequestTimeoutError
65
+ | InvalidRequestError
66
+ | UnexpectedClientError
67
+ | SDKValidationError
68
+ >,
69
+ APICall,
70
+ ]
71
+ > {
72
+ const parsed = safeParse(
73
+ request,
74
+ (value) =>
75
+ z.parse(
76
+ z.optional(operations.GetCurrenciesRequest$outboundSchema),
77
+ value,
78
+ ),
79
+ "Input validation failed",
80
+ );
81
+ if (!parsed.ok) {
82
+ return [parsed, { status: "invalid" }];
83
+ }
84
+ const payload = parsed.value;
85
+ const body = null;
86
+
87
+ const path = pathToFunc("/accounting/currencies")();
88
+
89
+ const query = encodeFormQuery({
90
+ "companyId": payload?.companyId,
91
+ "environmentName": payload?.environmentName,
92
+ "lastModifiedAt": payload?.lastModifiedAt,
93
+ "limit": payload?.limit,
94
+ "page": payload?.page,
95
+ "rawData": payload?.rawData,
96
+ });
97
+
98
+ const headers = new Headers(compactMap({
99
+ Accept: "application/json",
100
+ "X-ACCOUNT-KEY": encodeSimple(
101
+ "X-ACCOUNT-KEY",
102
+ payload?.accountKey ?? client._options.accountKey,
103
+ { explode: false, charEncoding: "none" },
104
+ ),
105
+ "X-API-KEY": encodeSimple(
106
+ "X-API-KEY",
107
+ payload?.apiKey ?? client._options.apiKey,
108
+ { explode: false, charEncoding: "none" },
109
+ ),
110
+ }));
111
+
112
+ const context = {
113
+ options: client._options,
114
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
115
+ operationID: "getCurrencies",
116
+ oAuth2Scopes: null,
117
+
118
+ resolvedSecurity: null,
119
+
120
+ securitySource: null,
121
+ retryConfig: options?.retries
122
+ || client._options.retryConfig
123
+ || {
124
+ strategy: "backoff",
125
+ backoff: {
126
+ initialInterval: 500,
127
+ maxInterval: 60000,
128
+ exponent: 1.5,
129
+ maxElapsedTime: 3600000,
130
+ },
131
+ retryConnectionErrors: true,
132
+ }
133
+ || { strategy: "none" },
134
+ retryCodes: options?.retryCodes || ["5XX"],
135
+ };
136
+
137
+ const requestRes = client._createRequest(context, {
138
+ method: "GET",
139
+ baseURL: options?.serverURL,
140
+ path: path,
141
+ headers: headers,
142
+ query: query,
143
+ body: body,
144
+ userAgent: client._options.userAgent,
145
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
146
+ }, options);
147
+ if (!requestRes.ok) {
148
+ return [requestRes, { status: "invalid" }];
149
+ }
150
+ const req = requestRes.value;
151
+
152
+ const doResult = await client._do(req, {
153
+ context,
154
+ isErrorStatusCode: (statusCode: number) =>
155
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
156
+ retryConfig: context.retryConfig,
157
+ retryCodes: context.retryCodes,
158
+ });
159
+ if (!doResult.ok) {
160
+ return [doResult, { status: "request-error", request: req }];
161
+ }
162
+ const response = doResult.value;
163
+
164
+ const [result] = await M.match<
165
+ operations.GetCurrenciesResponse,
166
+ | MaesnError
167
+ | ResponseValidationError
168
+ | ConnectionError
169
+ | RequestAbortedError
170
+ | RequestTimeoutError
171
+ | InvalidRequestError
172
+ | UnexpectedClientError
173
+ | SDKValidationError
174
+ >(
175
+ M.json(200, operations.GetCurrenciesResponse$inboundSchema),
176
+ M.fail("4XX"),
177
+ M.fail("5XX"),
178
+ )(response, req);
179
+ if (!result.ok) {
180
+ return [result, { status: "complete", request: req, response }];
181
+ }
182
+
183
+ return [result, { status: "complete", request: req, response }];
184
+ }
@@ -0,0 +1,184 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { MaesnCore } from "../core.js";
7
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/http-client-errors.js";
21
+ import { MaesnError } from "../models/errors/maesn-error.js";
22
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
23
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.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
+ export function accountingGetReasonCodes(
29
+ client: MaesnCore,
30
+ request?: operations.GetReasonCodesRequest | undefined,
31
+ options?: RequestOptions,
32
+ ): APIPromise<
33
+ Result<
34
+ operations.GetReasonCodesResponse,
35
+ | MaesnError
36
+ | ResponseValidationError
37
+ | ConnectionError
38
+ | RequestAbortedError
39
+ | RequestTimeoutError
40
+ | InvalidRequestError
41
+ | UnexpectedClientError
42
+ | SDKValidationError
43
+ >
44
+ > {
45
+ return new APIPromise($do(
46
+ client,
47
+ request,
48
+ options,
49
+ ));
50
+ }
51
+
52
+ async function $do(
53
+ client: MaesnCore,
54
+ request?: operations.GetReasonCodesRequest | undefined,
55
+ options?: RequestOptions,
56
+ ): Promise<
57
+ [
58
+ Result<
59
+ operations.GetReasonCodesResponse,
60
+ | MaesnError
61
+ | ResponseValidationError
62
+ | ConnectionError
63
+ | RequestAbortedError
64
+ | RequestTimeoutError
65
+ | InvalidRequestError
66
+ | UnexpectedClientError
67
+ | SDKValidationError
68
+ >,
69
+ APICall,
70
+ ]
71
+ > {
72
+ const parsed = safeParse(
73
+ request,
74
+ (value) =>
75
+ z.parse(
76
+ z.optional(operations.GetReasonCodesRequest$outboundSchema),
77
+ value,
78
+ ),
79
+ "Input validation failed",
80
+ );
81
+ if (!parsed.ok) {
82
+ return [parsed, { status: "invalid" }];
83
+ }
84
+ const payload = parsed.value;
85
+ const body = null;
86
+
87
+ const path = pathToFunc("/accounting/reasonCodes")();
88
+
89
+ const query = encodeFormQuery({
90
+ "companyId": payload?.companyId,
91
+ "environmentName": payload?.environmentName,
92
+ "lastModifiedAt": payload?.lastModifiedAt,
93
+ "limit": payload?.limit,
94
+ "page": payload?.page,
95
+ "rawData": payload?.rawData,
96
+ });
97
+
98
+ const headers = new Headers(compactMap({
99
+ Accept: "application/json",
100
+ "X-ACCOUNT-KEY": encodeSimple(
101
+ "X-ACCOUNT-KEY",
102
+ payload?.accountKey ?? client._options.accountKey,
103
+ { explode: false, charEncoding: "none" },
104
+ ),
105
+ "X-API-KEY": encodeSimple(
106
+ "X-API-KEY",
107
+ payload?.apiKey ?? client._options.apiKey,
108
+ { explode: false, charEncoding: "none" },
109
+ ),
110
+ }));
111
+
112
+ const context = {
113
+ options: client._options,
114
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
115
+ operationID: "getReasonCodes",
116
+ oAuth2Scopes: null,
117
+
118
+ resolvedSecurity: null,
119
+
120
+ securitySource: null,
121
+ retryConfig: options?.retries
122
+ || client._options.retryConfig
123
+ || {
124
+ strategy: "backoff",
125
+ backoff: {
126
+ initialInterval: 500,
127
+ maxInterval: 60000,
128
+ exponent: 1.5,
129
+ maxElapsedTime: 3600000,
130
+ },
131
+ retryConnectionErrors: true,
132
+ }
133
+ || { strategy: "none" },
134
+ retryCodes: options?.retryCodes || ["5XX"],
135
+ };
136
+
137
+ const requestRes = client._createRequest(context, {
138
+ method: "GET",
139
+ baseURL: options?.serverURL,
140
+ path: path,
141
+ headers: headers,
142
+ query: query,
143
+ body: body,
144
+ userAgent: client._options.userAgent,
145
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
146
+ }, options);
147
+ if (!requestRes.ok) {
148
+ return [requestRes, { status: "invalid" }];
149
+ }
150
+ const req = requestRes.value;
151
+
152
+ const doResult = await client._do(req, {
153
+ context,
154
+ isErrorStatusCode: (statusCode: number) =>
155
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
156
+ retryConfig: context.retryConfig,
157
+ retryCodes: context.retryCodes,
158
+ });
159
+ if (!doResult.ok) {
160
+ return [doResult, { status: "request-error", request: req }];
161
+ }
162
+ const response = doResult.value;
163
+
164
+ const [result] = await M.match<
165
+ operations.GetReasonCodesResponse,
166
+ | MaesnError
167
+ | ResponseValidationError
168
+ | ConnectionError
169
+ | RequestAbortedError
170
+ | RequestTimeoutError
171
+ | InvalidRequestError
172
+ | UnexpectedClientError
173
+ | SDKValidationError
174
+ >(
175
+ M.json(200, operations.GetReasonCodesResponse$inboundSchema),
176
+ M.fail("4XX"),
177
+ M.fail("5XX"),
178
+ )(response, req);
179
+ if (!result.ok) {
180
+ return [result, { status: "complete", request: req, response }];
181
+ }
182
+
183
+ return [result, { status: "complete", request: req, response }];
184
+ }
package/src/lib/config.ts CHANGED
@@ -51,8 +51,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
51
51
  export const SDK_METADATA = {
52
52
  language: "typescript",
53
53
  openapiDocVersion: "1.0",
54
- sdkVersion: "0.8.25",
54
+ sdkVersion: "0.8.26",
55
55
  genVersion: "2.948.4",
56
56
  userAgent:
57
- "speakeasy-sdk/typescript 0.8.25 2.948.4 1.0 @maesn/typescript-sdk",
57
+ "speakeasy-sdk/typescript 0.8.26 2.948.4 1.0 @maesn/typescript-sdk",
58
58
  } as const;
@@ -79,6 +79,7 @@ export type CreditNoteResponseDto = {
79
79
  currency: string | null;
80
80
  paymentStatus: CreditNoteResponseDtoPaymentStatus | null;
81
81
  paymentTermId: string | null;
82
+ reasonCodeId: string | null;
82
83
  reference: string | null;
83
84
  status: CreditNoteResponseDtoStatus | null;
84
85
  taxRatePercentage: number | null;
@@ -123,6 +124,7 @@ export const CreditNoteResponseDto$inboundSchema: z.ZodMiniType<
123
124
  CreditNoteResponseDtoPaymentStatus$inboundSchema,
124
125
  ),
125
126
  paymentTermId: types.nullable(types.string()),
127
+ reasonCodeId: types.nullable(types.string()),
126
128
  reference: types.nullable(types.string()),
127
129
  status: types.nullable(CreditNoteResponseDtoStatus$inboundSchema),
128
130
  taxRatePercentage: types.nullable(types.number()),
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import * as types from "../types/primitives.js";
9
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
10
+
11
+ export type CurrencyResponseDto = {
12
+ id: string | null;
13
+ code: string | null;
14
+ decimalPlaces: number | null;
15
+ name: string | null;
16
+ roundingPrecision: number | null;
17
+ updatedDate: string | null;
18
+ };
19
+
20
+ /** @internal */
21
+ export const CurrencyResponseDto$inboundSchema: z.ZodMiniType<
22
+ CurrencyResponseDto,
23
+ unknown
24
+ > = z.object({
25
+ id: types.nullable(types.string()),
26
+ code: types.nullable(types.string()),
27
+ decimalPlaces: types.nullable(types.number()),
28
+ name: types.nullable(types.string()),
29
+ roundingPrecision: types.nullable(types.number()),
30
+ updatedDate: types.nullable(types.string()),
31
+ });
32
+
33
+ export function currencyResponseDtoFromJSON(
34
+ jsonString: string,
35
+ ): SafeParseResult<CurrencyResponseDto, SDKValidationError> {
36
+ return safeParse(
37
+ jsonString,
38
+ (x) => CurrencyResponseDto$inboundSchema.parse(JSON.parse(x)),
39
+ `Failed to parse 'CurrencyResponseDto' from JSON`,
40
+ );
41
+ }
@@ -80,6 +80,7 @@ export * from "./create-vendor-credit-line-item-request-dto.js";
80
80
  export * from "./create-vendor-credit-request-dto.js";
81
81
  export * from "./credit-note-lines-dto.js";
82
82
  export * from "./credit-note-response-dto.js";
83
+ export * from "./currency-response-dto.js";
83
84
  export * from "./custom-values.js";
84
85
  export * from "./dimension-input.js";
85
86
  export * from "./dimension-meta-response-dto.js";
@@ -134,6 +135,7 @@ export * from "./phone-number.js";
134
135
  export * from "./project-response-dto.js";
135
136
  export * from "./purchase-order-line-item-response-dto.js";
136
137
  export * from "./purchase-order-response-dto.js";
138
+ export * from "./reason-code-response-dto.js";
137
139
  export * from "./sales-order-line-item-response-dto.js";
138
140
  export * from "./sales-order-response-dto.js";
139
141
  export * from "./submission-page-localization-dto.js";
@@ -0,0 +1,215 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
11
+ import * as models from "../index.js";
12
+
13
+ export type GetCurrenciesGlobals = {
14
+ apiKey?: string | undefined;
15
+ accountKey?: string | undefined;
16
+ };
17
+
18
+ export const GetCurrenciesLimit = {
19
+ Five: 5,
20
+ Ten: 10,
21
+ Twenty: 20,
22
+ Fifty: 50,
23
+ OneHundred: 100,
24
+ } as const;
25
+ export type GetCurrenciesLimit = ClosedEnum<typeof GetCurrenciesLimit>;
26
+
27
+ export type GetCurrenciesRequest = {
28
+ page?: number | undefined;
29
+ limit?: GetCurrenciesLimit | undefined;
30
+ /**
31
+ * ISO 8601 timestamp; only records modified after this date are returned
32
+ */
33
+ lastModifiedAt?: string | undefined;
34
+ /**
35
+ * Environment name (required for multi-environment systems such as Business Central)
36
+ */
37
+ environmentName?: string | undefined;
38
+ /**
39
+ * ID of the company (required for multi-company target systems)
40
+ */
41
+ companyId?: string | undefined;
42
+ /**
43
+ * When true, returns the unprocessed response from the upstream target system
44
+ */
45
+ rawData?: boolean | undefined;
46
+ /**
47
+ * API key
48
+ */
49
+ apiKey?: string | undefined;
50
+ /**
51
+ * Account key
52
+ */
53
+ accountKey?: string | undefined;
54
+ };
55
+
56
+ export type GetCurrenciesPagination = {
57
+ total: number;
58
+ perPage: number;
59
+ currentPage: number;
60
+ totalPages: number;
61
+ };
62
+
63
+ export type GetCurrenciesMeta = {
64
+ warnings?: Array<string> | null | undefined;
65
+ pagination?: GetCurrenciesPagination | null | undefined;
66
+ };
67
+
68
+ export type GetCurrenciesErrors = {};
69
+
70
+ export type GetCurrenciesRawData = {};
71
+
72
+ /**
73
+ * List of currencies for the authenticated end user's connected target system
74
+ */
75
+ export type GetCurrenciesResponse = {
76
+ meta?: GetCurrenciesMeta | null | undefined;
77
+ data: Array<models.CurrencyResponseDto>;
78
+ errors: GetCurrenciesErrors | null;
79
+ rawData: GetCurrenciesRawData | null;
80
+ };
81
+
82
+ /** @internal */
83
+ export const GetCurrenciesLimit$outboundSchema: z.ZodMiniEnum<
84
+ typeof GetCurrenciesLimit
85
+ > = z.enum(GetCurrenciesLimit);
86
+
87
+ /** @internal */
88
+ export type GetCurrenciesRequest$Outbound = {
89
+ page?: number | undefined;
90
+ limit?: number | undefined;
91
+ lastModifiedAt?: string | undefined;
92
+ environmentName?: string | undefined;
93
+ companyId?: string | undefined;
94
+ rawData?: boolean | undefined;
95
+ apiKey?: string | undefined;
96
+ accountKey?: string | undefined;
97
+ };
98
+
99
+ /** @internal */
100
+ export const GetCurrenciesRequest$outboundSchema: z.ZodMiniType<
101
+ GetCurrenciesRequest$Outbound,
102
+ GetCurrenciesRequest
103
+ > = z.object({
104
+ page: z.optional(z.number()),
105
+ limit: z.optional(GetCurrenciesLimit$outboundSchema),
106
+ lastModifiedAt: z.optional(z.string()),
107
+ environmentName: z.optional(z.string()),
108
+ companyId: z.optional(z.string()),
109
+ rawData: z.optional(z.boolean()),
110
+ apiKey: z.optional(z.string()),
111
+ accountKey: z.optional(z.string()),
112
+ });
113
+
114
+ export function getCurrenciesRequestToJSON(
115
+ getCurrenciesRequest: GetCurrenciesRequest,
116
+ ): string {
117
+ return JSON.stringify(
118
+ GetCurrenciesRequest$outboundSchema.parse(getCurrenciesRequest),
119
+ );
120
+ }
121
+
122
+ /** @internal */
123
+ export const GetCurrenciesPagination$inboundSchema: z.ZodMiniType<
124
+ GetCurrenciesPagination,
125
+ unknown
126
+ > = z.object({
127
+ total: types.number(),
128
+ perPage: types.number(),
129
+ currentPage: types.number(),
130
+ totalPages: types.number(),
131
+ });
132
+
133
+ export function getCurrenciesPaginationFromJSON(
134
+ jsonString: string,
135
+ ): SafeParseResult<GetCurrenciesPagination, SDKValidationError> {
136
+ return safeParse(
137
+ jsonString,
138
+ (x) => GetCurrenciesPagination$inboundSchema.parse(JSON.parse(x)),
139
+ `Failed to parse 'GetCurrenciesPagination' from JSON`,
140
+ );
141
+ }
142
+
143
+ /** @internal */
144
+ export const GetCurrenciesMeta$inboundSchema: z.ZodMiniType<
145
+ GetCurrenciesMeta,
146
+ unknown
147
+ > = z.object({
148
+ warnings: z.optional(z.nullable(z.array(types.string()))),
149
+ pagination: z.optional(
150
+ z.nullable(z.lazy(() => GetCurrenciesPagination$inboundSchema)),
151
+ ),
152
+ });
153
+
154
+ export function getCurrenciesMetaFromJSON(
155
+ jsonString: string,
156
+ ): SafeParseResult<GetCurrenciesMeta, SDKValidationError> {
157
+ return safeParse(
158
+ jsonString,
159
+ (x) => GetCurrenciesMeta$inboundSchema.parse(JSON.parse(x)),
160
+ `Failed to parse 'GetCurrenciesMeta' from JSON`,
161
+ );
162
+ }
163
+
164
+ /** @internal */
165
+ export const GetCurrenciesErrors$inboundSchema: z.ZodMiniType<
166
+ GetCurrenciesErrors,
167
+ unknown
168
+ > = z.object({});
169
+
170
+ export function getCurrenciesErrorsFromJSON(
171
+ jsonString: string,
172
+ ): SafeParseResult<GetCurrenciesErrors, SDKValidationError> {
173
+ return safeParse(
174
+ jsonString,
175
+ (x) => GetCurrenciesErrors$inboundSchema.parse(JSON.parse(x)),
176
+ `Failed to parse 'GetCurrenciesErrors' from JSON`,
177
+ );
178
+ }
179
+
180
+ /** @internal */
181
+ export const GetCurrenciesRawData$inboundSchema: z.ZodMiniType<
182
+ GetCurrenciesRawData,
183
+ unknown
184
+ > = z.object({});
185
+
186
+ export function getCurrenciesRawDataFromJSON(
187
+ jsonString: string,
188
+ ): SafeParseResult<GetCurrenciesRawData, SDKValidationError> {
189
+ return safeParse(
190
+ jsonString,
191
+ (x) => GetCurrenciesRawData$inboundSchema.parse(JSON.parse(x)),
192
+ `Failed to parse 'GetCurrenciesRawData' from JSON`,
193
+ );
194
+ }
195
+
196
+ /** @internal */
197
+ export const GetCurrenciesResponse$inboundSchema: z.ZodMiniType<
198
+ GetCurrenciesResponse,
199
+ unknown
200
+ > = z.object({
201
+ meta: z.optional(z.nullable(z.lazy(() => GetCurrenciesMeta$inboundSchema))),
202
+ data: z.array(models.CurrencyResponseDto$inboundSchema),
203
+ errors: types.nullable(z.lazy(() => GetCurrenciesErrors$inboundSchema)),
204
+ rawData: types.nullable(z.lazy(() => GetCurrenciesRawData$inboundSchema)),
205
+ });
206
+
207
+ export function getCurrenciesResponseFromJSON(
208
+ jsonString: string,
209
+ ): SafeParseResult<GetCurrenciesResponse, SDKValidationError> {
210
+ return safeParse(
211
+ jsonString,
212
+ (x) => GetCurrenciesResponse$inboundSchema.parse(JSON.parse(x)),
213
+ `Failed to parse 'GetCurrenciesResponse' from JSON`,
214
+ );
215
+ }