@maesn/typescript-sdk 0.8.16 → 0.8.18

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 (44) hide show
  1. package/README.md +2 -0
  2. package/esm/funcs/accounting-get-journal-entries.js +1 -0
  3. package/esm/funcs/accounting-get-journal-entries.js.map +1 -1
  4. package/esm/funcs/accounting-patch-journal-entry.d.ts +11 -0
  5. package/esm/funcs/accounting-patch-journal-entry.d.ts.map +1 -0
  6. package/esm/funcs/accounting-patch-journal-entry.js +109 -0
  7. package/esm/funcs/accounting-patch-journal-entry.js.map +1 -0
  8. package/esm/lib/config.d.ts +2 -2
  9. package/esm/lib/config.js +2 -2
  10. package/esm/models/create-payment-request-dto.d.ts +8 -0
  11. package/esm/models/create-payment-request-dto.d.ts.map +1 -1
  12. package/esm/models/create-payment-request-dto.js +5 -0
  13. package/esm/models/create-payment-request-dto.js.map +1 -1
  14. package/esm/models/operations/get-journal-entries.d.ts +5 -0
  15. package/esm/models/operations/get-journal-entries.d.ts.map +1 -1
  16. package/esm/models/operations/get-journal-entries.js +1 -0
  17. package/esm/models/operations/get-journal-entries.js.map +1 -1
  18. package/esm/models/operations/index.d.ts +1 -0
  19. package/esm/models/operations/index.d.ts.map +1 -1
  20. package/esm/models/operations/index.js +1 -0
  21. package/esm/models/operations/index.js.map +1 -1
  22. package/esm/models/operations/patch-journal-entry.d.ts +96 -0
  23. package/esm/models/operations/patch-journal-entry.d.ts.map +1 -0
  24. package/esm/models/operations/patch-journal-entry.js +83 -0
  25. package/esm/models/operations/patch-journal-entry.js.map +1 -0
  26. package/esm/models/payment-response-dto.d.ts +5 -0
  27. package/esm/models/payment-response-dto.d.ts.map +1 -1
  28. package/esm/models/payment-response-dto.js +5 -0
  29. package/esm/models/payment-response-dto.js.map +1 -1
  30. package/esm/sdk/accounting.d.ts +1 -0
  31. package/esm/sdk/accounting.d.ts.map +1 -1
  32. package/esm/sdk/accounting.js +4 -0
  33. package/esm/sdk/accounting.js.map +1 -1
  34. package/jsr.json +1 -1
  35. package/package.json +1 -1
  36. package/src/funcs/accounting-get-journal-entries.ts +1 -0
  37. package/src/funcs/accounting-patch-journal-entry.ts +226 -0
  38. package/src/lib/config.ts +2 -2
  39. package/src/models/create-payment-request-dto.ts +11 -0
  40. package/src/models/operations/get-journal-entries.ts +6 -0
  41. package/src/models/operations/index.ts +1 -0
  42. package/src/models/operations/patch-journal-entry.ts +259 -0
  43. package/src/models/payment-response-dto.ts +8 -0
  44. package/src/sdk/accounting.ts +12 -0
@@ -0,0 +1,259 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
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 * 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 PatchJournalEntryGlobals = {
14
+ apiKey?: string | undefined;
15
+ accountKey?: string | undefined;
16
+ };
17
+
18
+ export type PatchJournalEntryFile = {
19
+ fileName: string;
20
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
21
+ };
22
+
23
+ export type PatchJournalEntryRequestBody = {
24
+ files?: Array<PatchJournalEntryFile> | undefined;
25
+ journalEntry?: models.CreateJournalEntryRequestDto | undefined;
26
+ };
27
+
28
+ export type PatchJournalEntryRequest = {
29
+ journalEntryId: string;
30
+ /**
31
+ * ID of the company (required for multi-company target systems)
32
+ */
33
+ companyId?: string | undefined;
34
+ /**
35
+ * API key
36
+ */
37
+ apiKey?: string | undefined;
38
+ /**
39
+ * Account key
40
+ */
41
+ accountKey?: string | undefined;
42
+ body: PatchJournalEntryRequestBody;
43
+ };
44
+
45
+ export type PatchJournalEntryPagination = {
46
+ total: number;
47
+ perPage: number;
48
+ currentPage: number;
49
+ totalPages: number;
50
+ };
51
+
52
+ export type PatchJournalEntryMeta = {
53
+ warnings?: Array<string> | null | undefined;
54
+ pagination?: PatchJournalEntryPagination | null | undefined;
55
+ };
56
+
57
+ export type PatchJournalEntryErrors = {};
58
+
59
+ export type PatchJournalEntryRawData = {};
60
+
61
+ /**
62
+ * Journal entry updated successfully
63
+ */
64
+ export type PatchJournalEntryResponse = {
65
+ meta?: PatchJournalEntryMeta | null | undefined;
66
+ data: models.JournalEntryResponseDto;
67
+ errors: PatchJournalEntryErrors | null;
68
+ rawData: PatchJournalEntryRawData | null;
69
+ };
70
+
71
+ /** @internal */
72
+ export type PatchJournalEntryFile$Outbound = {
73
+ fileName: string;
74
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
75
+ };
76
+
77
+ /** @internal */
78
+ export const PatchJournalEntryFile$outboundSchema: z.ZodMiniType<
79
+ PatchJournalEntryFile$Outbound,
80
+ PatchJournalEntryFile
81
+ > = z.object({
82
+ fileName: z.string(),
83
+ content: z.union([
84
+ z.custom<ReadableStream<Uint8Array>>(x => x instanceof ReadableStream),
85
+ z.custom<Blob>(x => x instanceof Blob),
86
+ z.custom<ArrayBuffer>(x => x instanceof ArrayBuffer),
87
+ z.custom<Uint8Array>(x => x instanceof Uint8Array),
88
+ ]),
89
+ });
90
+
91
+ export function patchJournalEntryFileToJSON(
92
+ patchJournalEntryFile: PatchJournalEntryFile,
93
+ ): string {
94
+ return JSON.stringify(
95
+ PatchJournalEntryFile$outboundSchema.parse(patchJournalEntryFile),
96
+ );
97
+ }
98
+
99
+ /** @internal */
100
+ export type PatchJournalEntryRequestBody$Outbound = {
101
+ files?: Array<PatchJournalEntryFile$Outbound> | undefined;
102
+ journal_entry?: models.CreateJournalEntryRequestDto$Outbound | undefined;
103
+ };
104
+
105
+ /** @internal */
106
+ export const PatchJournalEntryRequestBody$outboundSchema: z.ZodMiniType<
107
+ PatchJournalEntryRequestBody$Outbound,
108
+ PatchJournalEntryRequestBody
109
+ > = z.pipe(
110
+ z.object({
111
+ files: z.optional(
112
+ z.array(z.lazy(() => PatchJournalEntryFile$outboundSchema)),
113
+ ),
114
+ journalEntry: z.optional(
115
+ models.CreateJournalEntryRequestDto$outboundSchema,
116
+ ),
117
+ }),
118
+ z.transform((v) => {
119
+ return remap$(v, {
120
+ journalEntry: "journal_entry",
121
+ });
122
+ }),
123
+ );
124
+
125
+ export function patchJournalEntryRequestBodyToJSON(
126
+ patchJournalEntryRequestBody: PatchJournalEntryRequestBody,
127
+ ): string {
128
+ return JSON.stringify(
129
+ PatchJournalEntryRequestBody$outboundSchema.parse(
130
+ patchJournalEntryRequestBody,
131
+ ),
132
+ );
133
+ }
134
+
135
+ /** @internal */
136
+ export type PatchJournalEntryRequest$Outbound = {
137
+ journalEntryId: string;
138
+ companyId?: string | undefined;
139
+ apiKey?: string | undefined;
140
+ accountKey?: string | undefined;
141
+ body: PatchJournalEntryRequestBody$Outbound;
142
+ };
143
+
144
+ /** @internal */
145
+ export const PatchJournalEntryRequest$outboundSchema: z.ZodMiniType<
146
+ PatchJournalEntryRequest$Outbound,
147
+ PatchJournalEntryRequest
148
+ > = z.object({
149
+ journalEntryId: z.string(),
150
+ companyId: z.optional(z.string()),
151
+ apiKey: z.optional(z.string()),
152
+ accountKey: z.optional(z.string()),
153
+ body: z.lazy(() => PatchJournalEntryRequestBody$outboundSchema),
154
+ });
155
+
156
+ export function patchJournalEntryRequestToJSON(
157
+ patchJournalEntryRequest: PatchJournalEntryRequest,
158
+ ): string {
159
+ return JSON.stringify(
160
+ PatchJournalEntryRequest$outboundSchema.parse(patchJournalEntryRequest),
161
+ );
162
+ }
163
+
164
+ /** @internal */
165
+ export const PatchJournalEntryPagination$inboundSchema: z.ZodMiniType<
166
+ PatchJournalEntryPagination,
167
+ unknown
168
+ > = z.object({
169
+ total: types.number(),
170
+ perPage: types.number(),
171
+ currentPage: types.number(),
172
+ totalPages: types.number(),
173
+ });
174
+
175
+ export function patchJournalEntryPaginationFromJSON(
176
+ jsonString: string,
177
+ ): SafeParseResult<PatchJournalEntryPagination, SDKValidationError> {
178
+ return safeParse(
179
+ jsonString,
180
+ (x) => PatchJournalEntryPagination$inboundSchema.parse(JSON.parse(x)),
181
+ `Failed to parse 'PatchJournalEntryPagination' from JSON`,
182
+ );
183
+ }
184
+
185
+ /** @internal */
186
+ export const PatchJournalEntryMeta$inboundSchema: z.ZodMiniType<
187
+ PatchJournalEntryMeta,
188
+ unknown
189
+ > = z.object({
190
+ warnings: z.optional(z.nullable(z.array(types.string()))),
191
+ pagination: z.optional(
192
+ z.nullable(z.lazy(() => PatchJournalEntryPagination$inboundSchema)),
193
+ ),
194
+ });
195
+
196
+ export function patchJournalEntryMetaFromJSON(
197
+ jsonString: string,
198
+ ): SafeParseResult<PatchJournalEntryMeta, SDKValidationError> {
199
+ return safeParse(
200
+ jsonString,
201
+ (x) => PatchJournalEntryMeta$inboundSchema.parse(JSON.parse(x)),
202
+ `Failed to parse 'PatchJournalEntryMeta' from JSON`,
203
+ );
204
+ }
205
+
206
+ /** @internal */
207
+ export const PatchJournalEntryErrors$inboundSchema: z.ZodMiniType<
208
+ PatchJournalEntryErrors,
209
+ unknown
210
+ > = z.object({});
211
+
212
+ export function patchJournalEntryErrorsFromJSON(
213
+ jsonString: string,
214
+ ): SafeParseResult<PatchJournalEntryErrors, SDKValidationError> {
215
+ return safeParse(
216
+ jsonString,
217
+ (x) => PatchJournalEntryErrors$inboundSchema.parse(JSON.parse(x)),
218
+ `Failed to parse 'PatchJournalEntryErrors' from JSON`,
219
+ );
220
+ }
221
+
222
+ /** @internal */
223
+ export const PatchJournalEntryRawData$inboundSchema: z.ZodMiniType<
224
+ PatchJournalEntryRawData,
225
+ unknown
226
+ > = z.object({});
227
+
228
+ export function patchJournalEntryRawDataFromJSON(
229
+ jsonString: string,
230
+ ): SafeParseResult<PatchJournalEntryRawData, SDKValidationError> {
231
+ return safeParse(
232
+ jsonString,
233
+ (x) => PatchJournalEntryRawData$inboundSchema.parse(JSON.parse(x)),
234
+ `Failed to parse 'PatchJournalEntryRawData' from JSON`,
235
+ );
236
+ }
237
+
238
+ /** @internal */
239
+ export const PatchJournalEntryResponse$inboundSchema: z.ZodMiniType<
240
+ PatchJournalEntryResponse,
241
+ unknown
242
+ > = z.object({
243
+ meta: z.optional(
244
+ z.nullable(z.lazy(() => PatchJournalEntryMeta$inboundSchema)),
245
+ ),
246
+ data: models.JournalEntryResponseDto$inboundSchema,
247
+ errors: types.nullable(z.lazy(() => PatchJournalEntryErrors$inboundSchema)),
248
+ rawData: types.nullable(z.lazy(() => PatchJournalEntryRawData$inboundSchema)),
249
+ });
250
+
251
+ export function patchJournalEntryResponseFromJSON(
252
+ jsonString: string,
253
+ ): SafeParseResult<PatchJournalEntryResponse, SDKValidationError> {
254
+ return safeParse(
255
+ jsonString,
256
+ (x) => PatchJournalEntryResponse$inboundSchema.parse(JSON.parse(x)),
257
+ `Failed to parse 'PatchJournalEntryResponse' from JSON`,
258
+ );
259
+ }
@@ -14,6 +14,8 @@ export const PaymentResponseDtoDocumentType = {
14
14
  Invoice: "INVOICE",
15
15
  Bill: "BILL",
16
16
  BookingProposal: "BOOKING_PROPOSAL",
17
+ InvoiceBookingProposal: "INVOICE_BOOKING_PROPOSAL",
18
+ BillBookingProposal: "BILL_BOOKING_PROPOSAL",
17
19
  } as const;
18
20
  export type PaymentResponseDtoDocumentType = ClosedEnum<
19
21
  typeof PaymentResponseDtoDocumentType
@@ -23,10 +25,13 @@ export type PaymentResponseDto = {
23
25
  id: string | null;
24
26
  currency: string | null;
25
27
  createdDate: string | null;
28
+ description: string | null;
26
29
  documentType: PaymentResponseDtoDocumentType | null;
27
30
  exchangeRate: number | null;
31
+ journalId: string | null;
28
32
  journalCode: string | null;
29
33
  updatedDate: string | null;
34
+ paymentDate: string | null;
30
35
  paymentType: string | null;
31
36
  paymentLines: Array<PaymentLine> | null;
32
37
  };
@@ -44,10 +49,13 @@ export const PaymentResponseDto$inboundSchema: z.ZodMiniType<
44
49
  id: types.nullable(types.string()),
45
50
  currency: types.nullable(types.string()),
46
51
  createdDate: types.nullable(types.string()),
52
+ description: types.nullable(types.string()),
47
53
  documentType: types.nullable(PaymentResponseDtoDocumentType$inboundSchema),
48
54
  exchangeRate: types.nullable(types.number()),
55
+ journalId: types.nullable(types.string()),
49
56
  journalCode: types.nullable(types.string()),
50
57
  updatedDate: types.nullable(types.string()),
58
+ paymentDate: types.nullable(types.string()),
51
59
  paymentType: types.nullable(types.string()),
52
60
  paymentLines: types.nullable(z.array(PaymentLine$inboundSchema)),
53
61
  });
@@ -113,6 +113,7 @@ import { accountingPatchContact } from "../funcs/accounting-patch-contact.js";
113
113
  import { accountingPatchCustomers } from "../funcs/accounting-patch-customers.js";
114
114
  import { accountingPatchInvoice } from "../funcs/accounting-patch-invoice.js";
115
115
  import { accountingPatchItem } from "../funcs/accounting-patch-item.js";
116
+ import { accountingPatchJournalEntry } from "../funcs/accounting-patch-journal-entry.js";
116
117
  import { accountingPatchLineItem } from "../funcs/accounting-patch-line-item.js";
117
118
  import { accountingPatchSupplier } from "../funcs/accounting-patch-supplier.js";
118
119
  import { accountingPostFileAsync } from "../funcs/accounting-post-file-async.js";
@@ -714,6 +715,17 @@ export class Accounting extends ClientSDK {
714
715
  ));
715
716
  }
716
717
 
718
+ async patchJournalEntry(
719
+ request: operations.PatchJournalEntryRequest,
720
+ options?: RequestOptions,
721
+ ): Promise<operations.PatchJournalEntryResponse> {
722
+ return unwrapAsync(accountingPatchJournalEntry(
723
+ this,
724
+ request,
725
+ options,
726
+ ));
727
+ }
728
+
717
729
  async createJournalEntries(
718
730
  request: operations.CreateJournalEntriesRequest,
719
731
  options?: RequestOptions,