@maesn/typescript-sdk 0.8.2 → 0.8.4

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 +4 -0
  2. package/esm/funcs/accounting-create-credit-note.d.ts +11 -0
  3. package/esm/funcs/accounting-create-credit-note.d.ts.map +1 -0
  4. package/esm/funcs/accounting-create-credit-note.js +71 -0
  5. package/esm/funcs/accounting-create-credit-note.js.map +1 -0
  6. package/esm/funcs/accounting-get-journal-entries-async.d.ts +11 -0
  7. package/esm/funcs/accounting-get-journal-entries-async.d.ts.map +1 -0
  8. package/esm/funcs/accounting-get-journal-entries-async.js +85 -0
  9. package/esm/funcs/accounting-get-journal-entries-async.js.map +1 -0
  10. package/esm/lib/config.d.ts +3 -3
  11. package/esm/lib/config.js +3 -3
  12. package/esm/models/create-credit-note-line-item-request-dto.d.ts +54 -0
  13. package/esm/models/create-credit-note-line-item-request-dto.d.ts.map +1 -0
  14. package/esm/models/create-credit-note-line-item-request-dto.js +36 -0
  15. package/esm/models/create-credit-note-line-item-request-dto.js.map +1 -0
  16. package/esm/models/create-credit-note-request-dto.d.ts +96 -0
  17. package/esm/models/create-credit-note-request-dto.d.ts.map +1 -0
  18. package/esm/models/create-credit-note-request-dto.js +77 -0
  19. package/esm/models/create-credit-note-request-dto.js.map +1 -0
  20. package/esm/models/credit-note-lines-dto.d.ts +11 -0
  21. package/esm/models/credit-note-lines-dto.d.ts.map +1 -1
  22. package/esm/models/credit-note-lines-dto.js +9 -0
  23. package/esm/models/credit-note-lines-dto.js.map +1 -1
  24. package/esm/models/credit-note-response-dto.d.ts +21 -0
  25. package/esm/models/credit-note-response-dto.d.ts.map +1 -1
  26. package/esm/models/credit-note-response-dto.js +20 -0
  27. package/esm/models/credit-note-response-dto.js.map +1 -1
  28. package/esm/models/index.d.ts +2 -0
  29. package/esm/models/index.d.ts.map +1 -1
  30. package/esm/models/index.js +2 -0
  31. package/esm/models/index.js.map +1 -1
  32. package/esm/models/operations/create-credit-note.d.ts +65 -0
  33. package/esm/models/operations/create-credit-note.d.ts.map +1 -0
  34. package/esm/models/operations/create-credit-note.js +55 -0
  35. package/esm/models/operations/create-credit-note.js.map +1 -0
  36. package/esm/models/operations/get-journal-entries-async.d.ts +73 -0
  37. package/esm/models/operations/get-journal-entries-async.d.ts.map +1 -0
  38. package/esm/models/operations/get-journal-entries-async.js +56 -0
  39. package/esm/models/operations/get-journal-entries-async.js.map +1 -0
  40. package/esm/models/operations/index.d.ts +2 -0
  41. package/esm/models/operations/index.d.ts.map +1 -1
  42. package/esm/models/operations/index.js +2 -0
  43. package/esm/models/operations/index.js.map +1 -1
  44. package/esm/sdk/accounting.d.ts +2 -0
  45. package/esm/sdk/accounting.d.ts.map +1 -1
  46. package/esm/sdk/accounting.js +8 -0
  47. package/esm/sdk/accounting.js.map +1 -1
  48. package/jsr.json +1 -1
  49. package/package.json +1 -1
  50. package/src/funcs/accounting-create-credit-note.ts +162 -0
  51. package/src/funcs/accounting-get-journal-entries-async.ts +180 -0
  52. package/src/lib/config.ts +3 -3
  53. package/src/models/create-credit-note-line-item-request-dto.ts +97 -0
  54. package/src/models/create-credit-note-request-dto.ts +158 -0
  55. package/src/models/credit-note-lines-dto.ts +16 -0
  56. package/src/models/credit-note-response-dto.ts +28 -0
  57. package/src/models/index.ts +2 -0
  58. package/src/models/operations/create-credit-note.ts +175 -0
  59. package/src/models/operations/get-journal-entries-async.ts +190 -0
  60. package/src/models/operations/index.ts +2 -0
  61. package/src/sdk/accounting.ts +24 -0
@@ -0,0 +1,190 @@
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
+ import * as models from "../index.js";
11
+
12
+ export type GetJournalEntriesAsyncGlobals = {
13
+ apiKey?: string | undefined;
14
+ accountKey?: string | undefined;
15
+ };
16
+
17
+ export type GetJournalEntriesAsyncRequest = {
18
+ /**
19
+ * Environment name (required for multi-environment systems such as Business Central)
20
+ */
21
+ environmentName?: string | undefined;
22
+ /**
23
+ * ID of the company (required for multi-company target systems)
24
+ */
25
+ companyId?: string | undefined;
26
+ /**
27
+ * API key
28
+ */
29
+ apiKey?: string | undefined;
30
+ /**
31
+ * Account key
32
+ */
33
+ accountKey?: string | undefined;
34
+ };
35
+
36
+ export type GetJournalEntriesAsyncPagination = {
37
+ total: number;
38
+ perPage: number;
39
+ currentPage: number;
40
+ totalPages: number;
41
+ };
42
+
43
+ export type GetJournalEntriesAsyncMeta = {
44
+ warnings?: Array<string> | null | undefined;
45
+ pagination?: GetJournalEntriesAsyncPagination | null | undefined;
46
+ };
47
+
48
+ export type GetJournalEntriesAsyncErrors = {};
49
+
50
+ export type GetJournalEntriesAsyncRawData = {};
51
+
52
+ /**
53
+ * Journal entries fetch queued successfully. Processed asynchronously and returns 202 with taskId.
54
+ */
55
+ export type GetJournalEntriesAsyncResponse = {
56
+ meta?: GetJournalEntriesAsyncMeta | null | undefined;
57
+ data: models.TaskIdResponseDto;
58
+ errors: GetJournalEntriesAsyncErrors | null;
59
+ rawData: GetJournalEntriesAsyncRawData | null;
60
+ };
61
+
62
+ /** @internal */
63
+ export type GetJournalEntriesAsyncRequest$Outbound = {
64
+ environmentName?: string | undefined;
65
+ companyId?: string | undefined;
66
+ apiKey?: string | undefined;
67
+ accountKey?: string | undefined;
68
+ };
69
+
70
+ /** @internal */
71
+ export const GetJournalEntriesAsyncRequest$outboundSchema: z.ZodMiniType<
72
+ GetJournalEntriesAsyncRequest$Outbound,
73
+ GetJournalEntriesAsyncRequest
74
+ > = z.object({
75
+ environmentName: z.optional(z.string()),
76
+ companyId: z.optional(z.string()),
77
+ apiKey: z.optional(z.string()),
78
+ accountKey: z.optional(z.string()),
79
+ });
80
+
81
+ export function getJournalEntriesAsyncRequestToJSON(
82
+ getJournalEntriesAsyncRequest: GetJournalEntriesAsyncRequest,
83
+ ): string {
84
+ return JSON.stringify(
85
+ GetJournalEntriesAsyncRequest$outboundSchema.parse(
86
+ getJournalEntriesAsyncRequest,
87
+ ),
88
+ );
89
+ }
90
+
91
+ /** @internal */
92
+ export const GetJournalEntriesAsyncPagination$inboundSchema: z.ZodMiniType<
93
+ GetJournalEntriesAsyncPagination,
94
+ unknown
95
+ > = z.object({
96
+ total: types.number(),
97
+ perPage: types.number(),
98
+ currentPage: types.number(),
99
+ totalPages: types.number(),
100
+ });
101
+
102
+ export function getJournalEntriesAsyncPaginationFromJSON(
103
+ jsonString: string,
104
+ ): SafeParseResult<GetJournalEntriesAsyncPagination, SDKValidationError> {
105
+ return safeParse(
106
+ jsonString,
107
+ (x) => GetJournalEntriesAsyncPagination$inboundSchema.parse(JSON.parse(x)),
108
+ `Failed to parse 'GetJournalEntriesAsyncPagination' from JSON`,
109
+ );
110
+ }
111
+
112
+ /** @internal */
113
+ export const GetJournalEntriesAsyncMeta$inboundSchema: z.ZodMiniType<
114
+ GetJournalEntriesAsyncMeta,
115
+ unknown
116
+ > = z.object({
117
+ warnings: z.optional(z.nullable(z.array(types.string()))),
118
+ pagination: z.optional(
119
+ z.nullable(z.lazy(() => GetJournalEntriesAsyncPagination$inboundSchema)),
120
+ ),
121
+ });
122
+
123
+ export function getJournalEntriesAsyncMetaFromJSON(
124
+ jsonString: string,
125
+ ): SafeParseResult<GetJournalEntriesAsyncMeta, SDKValidationError> {
126
+ return safeParse(
127
+ jsonString,
128
+ (x) => GetJournalEntriesAsyncMeta$inboundSchema.parse(JSON.parse(x)),
129
+ `Failed to parse 'GetJournalEntriesAsyncMeta' from JSON`,
130
+ );
131
+ }
132
+
133
+ /** @internal */
134
+ export const GetJournalEntriesAsyncErrors$inboundSchema: z.ZodMiniType<
135
+ GetJournalEntriesAsyncErrors,
136
+ unknown
137
+ > = z.object({});
138
+
139
+ export function getJournalEntriesAsyncErrorsFromJSON(
140
+ jsonString: string,
141
+ ): SafeParseResult<GetJournalEntriesAsyncErrors, SDKValidationError> {
142
+ return safeParse(
143
+ jsonString,
144
+ (x) => GetJournalEntriesAsyncErrors$inboundSchema.parse(JSON.parse(x)),
145
+ `Failed to parse 'GetJournalEntriesAsyncErrors' from JSON`,
146
+ );
147
+ }
148
+
149
+ /** @internal */
150
+ export const GetJournalEntriesAsyncRawData$inboundSchema: z.ZodMiniType<
151
+ GetJournalEntriesAsyncRawData,
152
+ unknown
153
+ > = z.object({});
154
+
155
+ export function getJournalEntriesAsyncRawDataFromJSON(
156
+ jsonString: string,
157
+ ): SafeParseResult<GetJournalEntriesAsyncRawData, SDKValidationError> {
158
+ return safeParse(
159
+ jsonString,
160
+ (x) => GetJournalEntriesAsyncRawData$inboundSchema.parse(JSON.parse(x)),
161
+ `Failed to parse 'GetJournalEntriesAsyncRawData' from JSON`,
162
+ );
163
+ }
164
+
165
+ /** @internal */
166
+ export const GetJournalEntriesAsyncResponse$inboundSchema: z.ZodMiniType<
167
+ GetJournalEntriesAsyncResponse,
168
+ unknown
169
+ > = z.object({
170
+ meta: z.optional(
171
+ z.nullable(z.lazy(() => GetJournalEntriesAsyncMeta$inboundSchema)),
172
+ ),
173
+ data: models.TaskIdResponseDto$inboundSchema,
174
+ errors: types.nullable(
175
+ z.lazy(() => GetJournalEntriesAsyncErrors$inboundSchema),
176
+ ),
177
+ rawData: types.nullable(
178
+ z.lazy(() => GetJournalEntriesAsyncRawData$inboundSchema),
179
+ ),
180
+ });
181
+
182
+ export function getJournalEntriesAsyncResponseFromJSON(
183
+ jsonString: string,
184
+ ): SafeParseResult<GetJournalEntriesAsyncResponse, SDKValidationError> {
185
+ return safeParse(
186
+ jsonString,
187
+ (x) => GetJournalEntriesAsyncResponse$inboundSchema.parse(JSON.parse(x)),
188
+ `Failed to parse 'GetJournalEntriesAsyncResponse' from JSON`,
189
+ );
190
+ }
@@ -16,6 +16,7 @@ export * from "./create-contact-v2.js";
16
16
  export * from "./create-contact.js";
17
17
  export * from "./create-contacts-v1.js";
18
18
  export * from "./create-contacts.js";
19
+ export * from "./create-credit-note.js";
19
20
  export * from "./create-customer.js";
20
21
  export * from "./create-end-user-account.js";
21
22
  export * from "./create-event-subscriptions.js";
@@ -90,6 +91,7 @@ export * from "./get-invoice.js";
90
91
  export * from "./get-invoices.js";
91
92
  export * from "./get-item.js";
92
93
  export * from "./get-items.js";
94
+ export * from "./get-journal-entries-async.js";
93
95
  export * from "./get-journal-entries.js";
94
96
  export * from "./get-journal-entry-attachment-by-id.js";
95
97
  export * from "./get-journal-entry-attachments.js";
@@ -11,6 +11,7 @@ import { accountingCreateBookingProposal } from "../funcs/accounting-create-book
11
11
  import { accountingCreateContact } from "../funcs/accounting-create-contact.js";
12
12
  import { accountingCreateContactsV1 } from "../funcs/accounting-create-contacts-v1.js";
13
13
  import { accountingCreateContacts } from "../funcs/accounting-create-contacts.js";
14
+ import { accountingCreateCreditNote } from "../funcs/accounting-create-credit-note.js";
14
15
  import { accountingCreateCustomer } from "../funcs/accounting-create-customer.js";
15
16
  import { accountingCreateEventSubscriptions } from "../funcs/accounting-create-event-subscriptions.js";
16
17
  import { accountingCreateExpenseAsync } from "../funcs/accounting-create-expense-async.js";
@@ -68,6 +69,7 @@ import { accountingGetInvoice } from "../funcs/accounting-get-invoice.js";
68
69
  import { accountingGetInvoices } from "../funcs/accounting-get-invoices.js";
69
70
  import { accountingGetItem } from "../funcs/accounting-get-item.js";
70
71
  import { accountingGetItems } from "../funcs/accounting-get-items.js";
72
+ import { accountingGetJournalEntriesAsync } from "../funcs/accounting-get-journal-entries-async.js";
71
73
  import { accountingGetJournalEntries } from "../funcs/accounting-get-journal-entries.js";
72
74
  import { accountingGetJournalEntryAttachmentById } from "../funcs/accounting-get-journal-entry-attachment-by-id.js";
73
75
  import { accountingGetJournalEntryAttachments } from "../funcs/accounting-get-journal-entry-attachments.js";
@@ -628,6 +630,17 @@ export class Accounting extends ClientSDK {
628
630
  ));
629
631
  }
630
632
 
633
+ async getJournalEntriesAsync(
634
+ request?: operations.GetJournalEntriesAsyncRequest | undefined,
635
+ options?: RequestOptions,
636
+ ): Promise<operations.GetJournalEntriesAsyncResponse> {
637
+ return unwrapAsync(accountingGetJournalEntriesAsync(
638
+ this,
639
+ request,
640
+ options,
641
+ ));
642
+ }
643
+
631
644
  async getJournalEntry(
632
645
  request: operations.GetJournalEntryRequest,
633
646
  options?: RequestOptions,
@@ -1321,6 +1334,17 @@ export class Accounting extends ClientSDK {
1321
1334
  ));
1322
1335
  }
1323
1336
 
1337
+ async createCreditNote(
1338
+ request: operations.CreateCreditNoteRequest,
1339
+ options?: RequestOptions,
1340
+ ): Promise<operations.CreateCreditNoteResponse> {
1341
+ return unwrapAsync(accountingCreateCreditNote(
1342
+ this,
1343
+ request,
1344
+ options,
1345
+ ));
1346
+ }
1347
+
1324
1348
  async getCreditNote(
1325
1349
  request: operations.GetCreditNoteRequest,
1326
1350
  options?: RequestOptions,