@codat/lending 7.1.0 → 7.2.0

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 (61) hide show
  1. package/README.md +2 -0
  2. package/docs/sdks/companies/README.md +97 -7
  3. package/funcs/companiesReplace.d.ts +20 -0
  4. package/funcs/companiesReplace.d.ts.map +1 -0
  5. package/funcs/companiesReplace.js +122 -0
  6. package/funcs/companiesReplace.js.map +1 -0
  7. package/funcs/companiesUpdate.d.ts +3 -2
  8. package/funcs/companiesUpdate.d.ts.map +1 -1
  9. package/funcs/companiesUpdate.js +5 -4
  10. package/funcs/companiesUpdate.js.map +1 -1
  11. package/lib/config.d.ts +3 -3
  12. package/lib/config.js +3 -3
  13. package/package.json +1 -1
  14. package/sdk/companies.d.ts +13 -2
  15. package/sdk/companies.d.ts.map +1 -1
  16. package/sdk/companies.js +16 -2
  17. package/sdk/companies.js.map +1 -1
  18. package/sdk/models/operations/index.d.ts +1 -0
  19. package/sdk/models/operations/index.d.ts.map +1 -1
  20. package/sdk/models/operations/index.js +1 -0
  21. package/sdk/models/operations/index.js.map +1 -1
  22. package/sdk/models/operations/replacecompany.d.ts +35 -0
  23. package/sdk/models/operations/replacecompany.d.ts.map +1 -0
  24. package/sdk/models/operations/replacecompany.js +71 -0
  25. package/sdk/models/operations/replacecompany.js.map +1 -0
  26. package/sdk/models/operations/updatecompany.d.ts +2 -2
  27. package/sdk/models/operations/updatecompany.d.ts.map +1 -1
  28. package/sdk/models/operations/updatecompany.js +4 -4
  29. package/sdk/models/operations/updatecompany.js.map +1 -1
  30. package/sdk/models/shared/accountingbalancesheet.d.ts +2 -2
  31. package/sdk/models/shared/accountingbalancesheet.d.ts.map +1 -1
  32. package/sdk/models/shared/accountingbalancesheet.js +2 -2
  33. package/sdk/models/shared/accountingbalancesheet.js.map +1 -1
  34. package/sdk/models/shared/accountingcashflowstatement.d.ts +2 -2
  35. package/sdk/models/shared/accountingcashflowstatement.d.ts.map +1 -1
  36. package/sdk/models/shared/accountingcashflowstatement.js +2 -2
  37. package/sdk/models/shared/accountingcashflowstatement.js.map +1 -1
  38. package/sdk/models/shared/accountingprofitandlossreport.d.ts +2 -2
  39. package/sdk/models/shared/accountingprofitandlossreport.d.ts.map +1 -1
  40. package/sdk/models/shared/accountingprofitandlossreport.js +2 -2
  41. package/sdk/models/shared/accountingprofitandlossreport.js.map +1 -1
  42. package/sdk/models/shared/companyupdaterequest.d.ts +46 -0
  43. package/sdk/models/shared/companyupdaterequest.d.ts.map +1 -0
  44. package/sdk/models/shared/companyupdaterequest.js +63 -0
  45. package/sdk/models/shared/companyupdaterequest.js.map +1 -0
  46. package/sdk/models/shared/index.d.ts +1 -0
  47. package/sdk/models/shared/index.d.ts.map +1 -1
  48. package/sdk/models/shared/index.js +1 -0
  49. package/sdk/models/shared/index.js.map +1 -1
  50. package/src/funcs/companiesReplace.ts +158 -0
  51. package/src/funcs/companiesUpdate.ts +5 -4
  52. package/src/lib/config.ts +3 -3
  53. package/src/sdk/companies.ts +24 -2
  54. package/src/sdk/models/operations/index.ts +1 -0
  55. package/src/sdk/models/operations/replacecompany.ts +83 -0
  56. package/src/sdk/models/operations/updatecompany.ts +6 -6
  57. package/src/sdk/models/shared/accountingbalancesheet.ts +4 -4
  58. package/src/sdk/models/shared/accountingcashflowstatement.ts +4 -4
  59. package/src/sdk/models/shared/accountingprofitandlossreport.ts +4 -4
  60. package/src/sdk/models/shared/companyupdaterequest.ts +83 -0
  61. package/src/sdk/models/shared/index.ts +1 -0
@@ -0,0 +1,158 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CodatLendingCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { safeParse } from "../lib/schemas.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../sdk/models/errors/httpclienterrors.js";
19
+ import * as errors from "../sdk/models/errors/index.js";
20
+ import { SDKError } from "../sdk/models/errors/sdkerror.js";
21
+ import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js";
22
+ import * as operations from "../sdk/models/operations/index.js";
23
+ import * as shared from "../sdk/models/shared/index.js";
24
+ import { Result } from "../sdk/types/fp.js";
25
+
26
+ /**
27
+ * Replace company
28
+ *
29
+ * @remarks
30
+ * Use the *Replace company* endpoint to replace the existing name, description, and tags of the company. Calling the endpoint will replace existing values even if new values haven't been defined in the payload.
31
+ *
32
+ * A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data.
33
+ * Each company can have multiple [connections](https://docs.codat.io/lending-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.
34
+ */
35
+ export async function companiesReplace(
36
+ client: CodatLendingCore,
37
+ request: operations.ReplaceCompanyRequest,
38
+ options?: RequestOptions,
39
+ ): Promise<
40
+ Result<
41
+ shared.Company,
42
+ | errors.ErrorMessage
43
+ | SDKError
44
+ | SDKValidationError
45
+ | UnexpectedClientError
46
+ | InvalidRequestError
47
+ | RequestAbortedError
48
+ | RequestTimeoutError
49
+ | ConnectionError
50
+ >
51
+ > {
52
+ const parsed = safeParse(
53
+ request,
54
+ (value) => operations.ReplaceCompanyRequest$outboundSchema.parse(value),
55
+ "Input validation failed",
56
+ );
57
+ if (!parsed.ok) {
58
+ return parsed;
59
+ }
60
+ const payload = parsed.value;
61
+ const body = encodeJSON("body", payload.CompanyRequestBody, {
62
+ explode: true,
63
+ });
64
+
65
+ const pathParams = {
66
+ companyId: encodeSimple("companyId", payload.companyId, {
67
+ explode: false,
68
+ charEncoding: "percent",
69
+ }),
70
+ };
71
+
72
+ const path = pathToFunc("/companies/{companyId}")(pathParams);
73
+
74
+ const headers = new Headers({
75
+ "Content-Type": "application/json",
76
+ Accept: "application/json",
77
+ });
78
+
79
+ const secConfig = await extractSecurity(client._options.authHeader);
80
+ const securityInput = secConfig == null ? {} : { authHeader: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ operationID: "replace-company",
85
+ oAuth2Scopes: [],
86
+
87
+ resolvedSecurity: requestSecurity,
88
+
89
+ securitySource: client._options.authHeader,
90
+ retryConfig: options?.retries
91
+ || client._options.retryConfig
92
+ || {
93
+ strategy: "backoff",
94
+ backoff: {
95
+ initialInterval: 500,
96
+ maxInterval: 60000,
97
+ exponent: 1.5,
98
+ maxElapsedTime: 3600000,
99
+ },
100
+ retryConnectionErrors: true,
101
+ }
102
+ || { strategy: "none" },
103
+ retryCodes: options?.retryCodes || ["408", "429", "5XX"],
104
+ };
105
+
106
+ const requestRes = client._createRequest(context, {
107
+ security: requestSecurity,
108
+ method: "PUT",
109
+ baseURL: options?.serverURL,
110
+ path: path,
111
+ headers: headers,
112
+ body: body,
113
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
114
+ }, options);
115
+ if (!requestRes.ok) {
116
+ return requestRes;
117
+ }
118
+ const req = requestRes.value;
119
+
120
+ const doResult = await client._do(req, {
121
+ context,
122
+ errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"],
123
+ retryConfig: context.retryConfig,
124
+ retryCodes: context.retryCodes,
125
+ });
126
+ if (!doResult.ok) {
127
+ return doResult;
128
+ }
129
+ const response = doResult.value;
130
+
131
+ const responseFields = {
132
+ HttpMeta: { Response: response, Request: req },
133
+ };
134
+
135
+ const [result] = await M.match<
136
+ shared.Company,
137
+ | errors.ErrorMessage
138
+ | SDKError
139
+ | SDKValidationError
140
+ | UnexpectedClientError
141
+ | InvalidRequestError
142
+ | RequestAbortedError
143
+ | RequestTimeoutError
144
+ | ConnectionError
145
+ >(
146
+ M.json(200, shared.Company$inboundSchema),
147
+ M.jsonErr(
148
+ [401, 402, 403, 404, 429, 500, 503],
149
+ errors.ErrorMessage$inboundSchema,
150
+ ),
151
+ M.fail(["4XX", "5XX"]),
152
+ )(response, { extraFields: responseFields });
153
+ if (!result.ok) {
154
+ return result;
155
+ }
156
+
157
+ return result;
158
+ }
@@ -27,10 +27,11 @@ import { Result } from "../sdk/types/fp.js";
27
27
  * Update company
28
28
  *
29
29
  * @remarks
30
- * Use the *Update company* endpoint to update both the name and description of the company.
30
+ * Use the *Update company* endpoint to update the name, description, or tags of the company.
31
+ *
32
+ * The *Update company* endpoint doesn't have any required fields. If any of the fields provided are `null` or not provided, they won't be included in the update.
31
33
  *
32
34
  * A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data.
33
- * Each company can have multiple [connections](https://docs.codat.io/lending-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.
34
35
  */
35
36
  export async function companiesUpdate(
36
37
  client: CodatLendingCore,
@@ -58,7 +59,7 @@ export async function companiesUpdate(
58
59
  return parsed;
59
60
  }
60
61
  const payload = parsed.value;
61
- const body = encodeJSON("body", payload.CompanyRequestBody, {
62
+ const body = encodeJSON("body", payload.CompanyUpdateRequest, {
62
63
  explode: true,
63
64
  });
64
65
 
@@ -105,7 +106,7 @@ export async function companiesUpdate(
105
106
 
106
107
  const requestRes = client._createRequest(context, {
107
108
  security: requestSecurity,
108
- method: "PUT",
109
+ method: "PATCH",
109
110
  baseURL: options?.serverURL,
110
111
  path: path,
111
112
  headers: headers,
package/src/lib/config.ts CHANGED
@@ -57,7 +57,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
57
57
  export const SDK_METADATA = {
58
58
  language: "typescript",
59
59
  openapiDocVersion: "3.0.0",
60
- sdkVersion: "7.1.0",
61
- genVersion: "2.486.1",
62
- userAgent: "speakeasy-sdk/typescript 7.1.0 2.486.1 3.0.0 @codat/lending",
60
+ sdkVersion: "7.2.0",
61
+ genVersion: "2.492.3",
62
+ userAgent: "speakeasy-sdk/typescript 7.2.0 2.492.3 3.0.0 @codat/lending",
63
63
  } as const;
@@ -6,6 +6,7 @@ import { companiesCreate } from "../funcs/companiesCreate.js";
6
6
  import { companiesDelete } from "../funcs/companiesDelete.js";
7
7
  import { companiesGet } from "../funcs/companiesGet.js";
8
8
  import { companiesList } from "../funcs/companiesList.js";
9
+ import { companiesReplace } from "../funcs/companiesReplace.js";
9
10
  import { companiesUpdate } from "../funcs/companiesUpdate.js";
10
11
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
11
12
  import * as operations from "./models/operations/index.js";
@@ -69,14 +70,35 @@ export class Companies extends ClientSDK {
69
70
  }
70
71
 
71
72
  /**
72
- * Update company
73
+ * Replace company
73
74
  *
74
75
  * @remarks
75
- * Use the *Update company* endpoint to update both the name and description of the company.
76
+ * Use the *Replace company* endpoint to replace the existing name, description, and tags of the company. Calling the endpoint will replace existing values even if new values haven't been defined in the payload.
76
77
  *
77
78
  * A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data.
78
79
  * Each company can have multiple [connections](https://docs.codat.io/lending-api#/schemas/Connection) to different data sources, such as one connection to Xero for accounting data, two connections to Plaid for two bank accounts, and a connection to Zettle for POS data.
79
80
  */
81
+ async replace(
82
+ request: operations.ReplaceCompanyRequest,
83
+ options?: RequestOptions,
84
+ ): Promise<shared.Company> {
85
+ return unwrapAsync(companiesReplace(
86
+ this,
87
+ request,
88
+ options,
89
+ ));
90
+ }
91
+
92
+ /**
93
+ * Update company
94
+ *
95
+ * @remarks
96
+ * Use the *Update company* endpoint to update the name, description, or tags of the company.
97
+ *
98
+ * The *Update company* endpoint doesn't have any required fields. If any of the fields provided are `null` or not provided, they won't be included in the update.
99
+ *
100
+ * A [company](https://docs.codat.io/lending-api#/schemas/Company) represents a business sharing access to their data.
101
+ */
80
102
  async update(
81
103
  request: operations.UpdateCompanyRequest,
82
104
  options?: RequestOptions,
@@ -144,6 +144,7 @@ export * from "./listreconciledinvoices.js";
144
144
  export * from "./listreports.js";
145
145
  export * from "./refreshalldatatypes.js";
146
146
  export * from "./refreshdatatype.js";
147
+ export * from "./replacecompany.js";
147
148
  export * from "./setbankstatementuploadconfiguration.js";
148
149
  export * from "./startbankstatementuploadsession.js";
149
150
  export * from "./unlinkconnection.js";
@@ -0,0 +1,83 @@
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 * as shared from "../shared/index.js";
11
+
12
+ export type ReplaceCompanyRequest = {
13
+ /**
14
+ * Unique identifier for a company.
15
+ */
16
+ companyId: string;
17
+ companyRequestBody?: shared.CompanyRequestBody | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export const ReplaceCompanyRequest$inboundSchema: z.ZodType<
22
+ ReplaceCompanyRequest,
23
+ z.ZodTypeDef,
24
+ unknown
25
+ > = z.object({
26
+ companyId: z.string(),
27
+ CompanyRequestBody: shared.CompanyRequestBody$inboundSchema.optional(),
28
+ }).transform((v) => {
29
+ return remap$(v, {
30
+ "CompanyRequestBody": "companyRequestBody",
31
+ });
32
+ });
33
+
34
+ /** @internal */
35
+ export type ReplaceCompanyRequest$Outbound = {
36
+ companyId: string;
37
+ CompanyRequestBody?: shared.CompanyRequestBody$Outbound | undefined;
38
+ };
39
+
40
+ /** @internal */
41
+ export const ReplaceCompanyRequest$outboundSchema: z.ZodType<
42
+ ReplaceCompanyRequest$Outbound,
43
+ z.ZodTypeDef,
44
+ ReplaceCompanyRequest
45
+ > = z.object({
46
+ companyId: z.string(),
47
+ companyRequestBody: shared.CompanyRequestBody$outboundSchema.optional(),
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ companyRequestBody: "CompanyRequestBody",
51
+ });
52
+ });
53
+
54
+ /**
55
+ * @internal
56
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
57
+ */
58
+ export namespace ReplaceCompanyRequest$ {
59
+ /** @deprecated use `ReplaceCompanyRequest$inboundSchema` instead. */
60
+ export const inboundSchema = ReplaceCompanyRequest$inboundSchema;
61
+ /** @deprecated use `ReplaceCompanyRequest$outboundSchema` instead. */
62
+ export const outboundSchema = ReplaceCompanyRequest$outboundSchema;
63
+ /** @deprecated use `ReplaceCompanyRequest$Outbound` instead. */
64
+ export type Outbound = ReplaceCompanyRequest$Outbound;
65
+ }
66
+
67
+ export function replaceCompanyRequestToJSON(
68
+ replaceCompanyRequest: ReplaceCompanyRequest,
69
+ ): string {
70
+ return JSON.stringify(
71
+ ReplaceCompanyRequest$outboundSchema.parse(replaceCompanyRequest),
72
+ );
73
+ }
74
+
75
+ export function replaceCompanyRequestFromJSON(
76
+ jsonString: string,
77
+ ): SafeParseResult<ReplaceCompanyRequest, SDKValidationError> {
78
+ return safeParse(
79
+ jsonString,
80
+ (x) => ReplaceCompanyRequest$inboundSchema.parse(JSON.parse(x)),
81
+ `Failed to parse 'ReplaceCompanyRequest' from JSON`,
82
+ );
83
+ }
@@ -14,7 +14,7 @@ export type UpdateCompanyRequest = {
14
14
  * Unique identifier for a company.
15
15
  */
16
16
  companyId: string;
17
- companyRequestBody?: shared.CompanyRequestBody | undefined;
17
+ companyUpdateRequest?: shared.CompanyUpdateRequest | undefined;
18
18
  };
19
19
 
20
20
  /** @internal */
@@ -24,17 +24,17 @@ export const UpdateCompanyRequest$inboundSchema: z.ZodType<
24
24
  unknown
25
25
  > = z.object({
26
26
  companyId: z.string(),
27
- CompanyRequestBody: shared.CompanyRequestBody$inboundSchema.optional(),
27
+ CompanyUpdateRequest: shared.CompanyUpdateRequest$inboundSchema.optional(),
28
28
  }).transform((v) => {
29
29
  return remap$(v, {
30
- "CompanyRequestBody": "companyRequestBody",
30
+ "CompanyUpdateRequest": "companyUpdateRequest",
31
31
  });
32
32
  });
33
33
 
34
34
  /** @internal */
35
35
  export type UpdateCompanyRequest$Outbound = {
36
36
  companyId: string;
37
- CompanyRequestBody?: shared.CompanyRequestBody$Outbound | undefined;
37
+ CompanyUpdateRequest?: shared.CompanyUpdateRequest$Outbound | undefined;
38
38
  };
39
39
 
40
40
  /** @internal */
@@ -44,10 +44,10 @@ export const UpdateCompanyRequest$outboundSchema: z.ZodType<
44
44
  UpdateCompanyRequest
45
45
  > = z.object({
46
46
  companyId: z.string(),
47
- companyRequestBody: shared.CompanyRequestBody$outboundSchema.optional(),
47
+ companyUpdateRequest: shared.CompanyUpdateRequest$outboundSchema.optional(),
48
48
  }).transform((v) => {
49
49
  return remap$(v, {
50
- companyRequestBody: "CompanyRequestBody",
50
+ companyUpdateRequest: "CompanyUpdateRequest",
51
51
  });
52
52
  });
53
53
 
@@ -45,7 +45,7 @@ export type AccountingBalanceSheet = {
45
45
  *
46
46
  * There are only a very small number of edge cases where this currency code is returned by the Codat system.
47
47
  */
48
- currency: string;
48
+ currency?: string | undefined;
49
49
  /**
50
50
  * An array of balance sheet reports.
51
51
  */
@@ -102,7 +102,7 @@ export const AccountingBalanceSheet$inboundSchema: z.ZodType<
102
102
  z.ZodTypeDef,
103
103
  unknown
104
104
  > = z.object({
105
- currency: z.string(),
105
+ currency: z.string().optional(),
106
106
  reports: z.array(BalanceSheet$inboundSchema),
107
107
  mostRecentAvailableMonth: z.string().optional(),
108
108
  earliestAvailableMonth: z.string().optional(),
@@ -110,7 +110,7 @@ export const AccountingBalanceSheet$inboundSchema: z.ZodType<
110
110
 
111
111
  /** @internal */
112
112
  export type AccountingBalanceSheet$Outbound = {
113
- currency: string;
113
+ currency?: string | undefined;
114
114
  reports: Array<BalanceSheet$Outbound>;
115
115
  mostRecentAvailableMonth?: string | undefined;
116
116
  earliestAvailableMonth?: string | undefined;
@@ -122,7 +122,7 @@ export const AccountingBalanceSheet$outboundSchema: z.ZodType<
122
122
  z.ZodTypeDef,
123
123
  AccountingBalanceSheet
124
124
  > = z.object({
125
- currency: z.string(),
125
+ currency: z.string().optional(),
126
126
  reports: z.array(BalanceSheet$outboundSchema),
127
127
  mostRecentAvailableMonth: z.string().optional(),
128
128
  earliestAvailableMonth: z.string().optional(),
@@ -62,7 +62,7 @@ export type AccountingCashFlowStatement = {
62
62
  *
63
63
  * There are only a very small number of edge cases where this currency code is returned by the Codat system.
64
64
  */
65
- currency: string;
65
+ currency?: string | undefined;
66
66
  /**
67
67
  * In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example:
68
68
  *
@@ -118,7 +118,7 @@ export const AccountingCashFlowStatement$inboundSchema: z.ZodType<
118
118
  reports: z.array(CashFlowStatement$inboundSchema),
119
119
  reportBasis: ReportBasis$inboundSchema,
120
120
  reportInput: ReportInput$inboundSchema,
121
- currency: z.string(),
121
+ currency: z.string().optional(),
122
122
  mostRecentAvailableMonth: z.string().optional(),
123
123
  earliestAvailableMonth: z.string().optional(),
124
124
  });
@@ -128,7 +128,7 @@ export type AccountingCashFlowStatement$Outbound = {
128
128
  reports: Array<CashFlowStatement$Outbound>;
129
129
  reportBasis: string;
130
130
  reportInput: string;
131
- currency: string;
131
+ currency?: string | undefined;
132
132
  mostRecentAvailableMonth?: string | undefined;
133
133
  earliestAvailableMonth?: string | undefined;
134
134
  };
@@ -142,7 +142,7 @@ export const AccountingCashFlowStatement$outboundSchema: z.ZodType<
142
142
  reports: z.array(CashFlowStatement$outboundSchema),
143
143
  reportBasis: ReportBasis$outboundSchema,
144
144
  reportInput: ReportInput$outboundSchema,
145
- currency: z.string(),
145
+ currency: z.string().optional(),
146
146
  mostRecentAvailableMonth: z.string().optional(),
147
147
  earliestAvailableMonth: z.string().optional(),
148
148
  });
@@ -53,7 +53,7 @@ export type AccountingProfitAndLossReport = {
53
53
  /**
54
54
  * Base currency of the company in which the profit and loss report is presented.
55
55
  */
56
- currency: string;
56
+ currency?: string | undefined;
57
57
  /**
58
58
  * In Codat's data model, dates and times are represented using the <a class="external" href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO 8601 standard</a>. Date and time fields are formatted as strings; for example:
59
59
  *
@@ -108,7 +108,7 @@ export const AccountingProfitAndLossReport$inboundSchema: z.ZodType<
108
108
  > = z.object({
109
109
  reports: z.array(ProfitAndLossReport$inboundSchema),
110
110
  reportBasis: ReportBasis$inboundSchema,
111
- currency: z.string(),
111
+ currency: z.string().optional(),
112
112
  mostRecentAvailableMonth: z.string().optional(),
113
113
  earliestAvailableMonth: z.string().optional(),
114
114
  });
@@ -117,7 +117,7 @@ export const AccountingProfitAndLossReport$inboundSchema: z.ZodType<
117
117
  export type AccountingProfitAndLossReport$Outbound = {
118
118
  reports: Array<ProfitAndLossReport$Outbound>;
119
119
  reportBasis: string;
120
- currency: string;
120
+ currency?: string | undefined;
121
121
  mostRecentAvailableMonth?: string | undefined;
122
122
  earliestAvailableMonth?: string | undefined;
123
123
  };
@@ -130,7 +130,7 @@ export const AccountingProfitAndLossReport$outboundSchema: z.ZodType<
130
130
  > = z.object({
131
131
  reports: z.array(ProfitAndLossReport$outboundSchema),
132
132
  reportBasis: ReportBasis$outboundSchema,
133
- currency: z.string(),
133
+ currency: z.string().optional(),
134
134
  mostRecentAvailableMonth: z.string().optional(),
135
135
  earliestAvailableMonth: z.string().optional(),
136
136
  });
@@ -0,0 +1,83 @@
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 CompanyUpdateRequest = {
11
+ /**
12
+ * Name of company being connected.
13
+ */
14
+ name?: string | undefined;
15
+ /**
16
+ * Additional information about the company. This can be used to store foreign IDs, references, etc.
17
+ */
18
+ description?: string | undefined;
19
+ /**
20
+ * A collection of user-defined key-value pairs that store custom metadata against the company.
21
+ */
22
+ tags?: { [k: string]: string } | undefined;
23
+ };
24
+
25
+ /** @internal */
26
+ export const CompanyUpdateRequest$inboundSchema: z.ZodType<
27
+ CompanyUpdateRequest,
28
+ z.ZodTypeDef,
29
+ unknown
30
+ > = z.object({
31
+ name: z.string().optional(),
32
+ description: z.string().optional(),
33
+ tags: z.record(z.string()).optional(),
34
+ });
35
+
36
+ /** @internal */
37
+ export type CompanyUpdateRequest$Outbound = {
38
+ name?: string | undefined;
39
+ description?: string | undefined;
40
+ tags?: { [k: string]: string } | undefined;
41
+ };
42
+
43
+ /** @internal */
44
+ export const CompanyUpdateRequest$outboundSchema: z.ZodType<
45
+ CompanyUpdateRequest$Outbound,
46
+ z.ZodTypeDef,
47
+ CompanyUpdateRequest
48
+ > = z.object({
49
+ name: z.string().optional(),
50
+ description: z.string().optional(),
51
+ tags: z.record(z.string()).optional(),
52
+ });
53
+
54
+ /**
55
+ * @internal
56
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
57
+ */
58
+ export namespace CompanyUpdateRequest$ {
59
+ /** @deprecated use `CompanyUpdateRequest$inboundSchema` instead. */
60
+ export const inboundSchema = CompanyUpdateRequest$inboundSchema;
61
+ /** @deprecated use `CompanyUpdateRequest$outboundSchema` instead. */
62
+ export const outboundSchema = CompanyUpdateRequest$outboundSchema;
63
+ /** @deprecated use `CompanyUpdateRequest$Outbound` instead. */
64
+ export type Outbound = CompanyUpdateRequest$Outbound;
65
+ }
66
+
67
+ export function companyUpdateRequestToJSON(
68
+ companyUpdateRequest: CompanyUpdateRequest,
69
+ ): string {
70
+ return JSON.stringify(
71
+ CompanyUpdateRequest$outboundSchema.parse(companyUpdateRequest),
72
+ );
73
+ }
74
+
75
+ export function companyUpdateRequestFromJSON(
76
+ jsonString: string,
77
+ ): SafeParseResult<CompanyUpdateRequest, SDKValidationError> {
78
+ return safeParse(
79
+ jsonString,
80
+ (x) => CompanyUpdateRequest$inboundSchema.parse(JSON.parse(x)),
81
+ `Failed to parse 'CompanyUpdateRequest' from JSON`,
82
+ );
83
+ }
@@ -147,6 +147,7 @@ export * from "./companies.js";
147
147
  export * from "./company.js";
148
148
  export * from "./companyreference.js";
149
149
  export * from "./companyrequestbody.js";
150
+ export * from "./companyupdaterequest.js";
150
151
  export * from "./connection.js";
151
152
  export * from "./connections.js";
152
153
  export * from "./contact.js";