@maesn/typescript-sdk 0.6.3 → 0.6.5

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-create-booking-proposal-async.d.ts +11 -0
  3. package/esm/funcs/accounting-create-booking-proposal-async.d.ts.map +1 -0
  4. package/esm/funcs/accounting-create-booking-proposal-async.js +111 -0
  5. package/esm/funcs/accounting-create-booking-proposal-async.js.map +1 -0
  6. package/esm/funcs/accounting-get-document-types.js +3 -0
  7. package/esm/funcs/accounting-get-document-types.js.map +1 -1
  8. package/esm/lib/config.d.ts +2 -2
  9. package/esm/lib/config.js +2 -2
  10. package/esm/models/booking-proposal-response-dto-v2.d.ts +1 -0
  11. package/esm/models/booking-proposal-response-dto-v2.d.ts.map +1 -1
  12. package/esm/models/booking-proposal-response-dto-v2.js +1 -0
  13. package/esm/models/booking-proposal-response-dto-v2.js.map +1 -1
  14. package/esm/models/create-booking-proposal-request-dto-v2.d.ts +2 -0
  15. package/esm/models/create-booking-proposal-request-dto-v2.d.ts.map +1 -1
  16. package/esm/models/create-booking-proposal-request-dto-v2.js +1 -0
  17. package/esm/models/create-booking-proposal-request-dto-v2.js.map +1 -1
  18. package/esm/models/operations/create-booking-proposal-async.d.ts +122 -0
  19. package/esm/models/operations/create-booking-proposal-async.d.ts.map +1 -0
  20. package/esm/models/operations/create-booking-proposal-async.js +96 -0
  21. package/esm/models/operations/create-booking-proposal-async.js.map +1 -0
  22. package/esm/models/operations/get-document-types.d.ts +20 -0
  23. package/esm/models/operations/get-document-types.d.ts.map +1 -1
  24. package/esm/models/operations/get-document-types.js +12 -0
  25. package/esm/models/operations/get-document-types.js.map +1 -1
  26. package/esm/models/operations/index.d.ts +1 -0
  27. package/esm/models/operations/index.d.ts.map +1 -1
  28. package/esm/models/operations/index.js +1 -0
  29. package/esm/models/operations/index.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-create-booking-proposal-async.ts +233 -0
  37. package/src/funcs/accounting-get-document-types.ts +3 -0
  38. package/src/lib/config.ts +2 -2
  39. package/src/models/booking-proposal-response-dto-v2.ts +2 -0
  40. package/src/models/create-booking-proposal-request-dto-v2.ts +3 -0
  41. package/src/models/operations/create-booking-proposal-async.ts +327 -0
  42. package/src/models/operations/get-document-types.ts +27 -0
  43. package/src/models/operations/index.ts +1 -0
  44. package/src/sdk/accounting.ts +12 -0
@@ -0,0 +1,327 @@
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 CreateBookingProposalAsyncGlobals = {
14
+ apiKey?: string | undefined;
15
+ accountKey?: string | undefined;
16
+ };
17
+
18
+ export type CreateBookingProposalAsyncFile = {
19
+ fileName: string;
20
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
21
+ };
22
+
23
+ export const CreateBookingProposalAsyncBookingType = {
24
+ Invoice: "INVOICE",
25
+ Bill: "BILL",
26
+ CreditNote: "CREDIT_NOTE",
27
+ VendorCredit: "VENDOR_CREDIT",
28
+ } as const;
29
+ export type CreateBookingProposalAsyncBookingType = ClosedEnum<
30
+ typeof CreateBookingProposalAsyncBookingType
31
+ >;
32
+
33
+ export type CreateBookingProposalAsyncFolderManagement = {
34
+ category?: string | undefined;
35
+ folder?: string | undefined;
36
+ register?: string | undefined;
37
+ };
38
+
39
+ export type CreateBookingProposalAsyncRequestBody = {
40
+ files?: Array<CreateBookingProposalAsyncFile> | undefined;
41
+ bookingType?: CreateBookingProposalAsyncBookingType | undefined;
42
+ bookingProposal?: models.CreateBookingProposalRequestDtoV2 | undefined;
43
+ folderManagement?: CreateBookingProposalAsyncFolderManagement | undefined;
44
+ };
45
+
46
+ export type CreateBookingProposalAsyncRequest = {
47
+ /**
48
+ * ID of the company (required for multi-company target systems)
49
+ */
50
+ companyId?: string | undefined;
51
+ /**
52
+ * API key
53
+ */
54
+ apiKey?: string | undefined;
55
+ /**
56
+ * Account key
57
+ */
58
+ accountKey?: string | undefined;
59
+ body: CreateBookingProposalAsyncRequestBody;
60
+ };
61
+
62
+ export type CreateBookingProposalAsyncPagination = {
63
+ total: number;
64
+ perPage: number;
65
+ currentPage: number;
66
+ totalPages: number;
67
+ };
68
+
69
+ export type CreateBookingProposalAsyncMeta = {
70
+ warnings?: Array<string> | null | undefined;
71
+ pagination?: CreateBookingProposalAsyncPagination | null | undefined;
72
+ };
73
+
74
+ export type CreateBookingProposalAsyncErrors = {};
75
+
76
+ export type CreateBookingProposalAsyncRawData = {};
77
+
78
+ /**
79
+ * Booking proposal queued successfully. Processed asynchronously and returns 202 with taskId.
80
+ */
81
+ export type CreateBookingProposalAsyncResponse = {
82
+ meta?: CreateBookingProposalAsyncMeta | null | undefined;
83
+ data: models.TaskIdResponseDto;
84
+ errors: CreateBookingProposalAsyncErrors | null;
85
+ rawData: CreateBookingProposalAsyncRawData | null;
86
+ };
87
+
88
+ /** @internal */
89
+ export type CreateBookingProposalAsyncFile$Outbound = {
90
+ fileName: string;
91
+ content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
92
+ };
93
+
94
+ /** @internal */
95
+ export const CreateBookingProposalAsyncFile$outboundSchema: z.ZodMiniType<
96
+ CreateBookingProposalAsyncFile$Outbound,
97
+ CreateBookingProposalAsyncFile
98
+ > = z.object({
99
+ fileName: z.string(),
100
+ content: z.union([
101
+ z.custom<ReadableStream<Uint8Array>>(x => x instanceof ReadableStream),
102
+ z.custom<Blob>(x => x instanceof Blob),
103
+ z.custom<ArrayBuffer>(x => x instanceof ArrayBuffer),
104
+ z.custom<Uint8Array>(x => x instanceof Uint8Array),
105
+ ]),
106
+ });
107
+
108
+ export function createBookingProposalAsyncFileToJSON(
109
+ createBookingProposalAsyncFile: CreateBookingProposalAsyncFile,
110
+ ): string {
111
+ return JSON.stringify(
112
+ CreateBookingProposalAsyncFile$outboundSchema.parse(
113
+ createBookingProposalAsyncFile,
114
+ ),
115
+ );
116
+ }
117
+
118
+ /** @internal */
119
+ export const CreateBookingProposalAsyncBookingType$outboundSchema:
120
+ z.ZodMiniEnum<typeof CreateBookingProposalAsyncBookingType> = z.enum(
121
+ CreateBookingProposalAsyncBookingType,
122
+ );
123
+
124
+ /** @internal */
125
+ export type CreateBookingProposalAsyncFolderManagement$Outbound = {
126
+ category?: string | undefined;
127
+ folder?: string | undefined;
128
+ register?: string | undefined;
129
+ };
130
+
131
+ /** @internal */
132
+ export const CreateBookingProposalAsyncFolderManagement$outboundSchema:
133
+ z.ZodMiniType<
134
+ CreateBookingProposalAsyncFolderManagement$Outbound,
135
+ CreateBookingProposalAsyncFolderManagement
136
+ > = z.object({
137
+ category: z.optional(z.string()),
138
+ folder: z.optional(z.string()),
139
+ register: z.optional(z.string()),
140
+ });
141
+
142
+ export function createBookingProposalAsyncFolderManagementToJSON(
143
+ createBookingProposalAsyncFolderManagement:
144
+ CreateBookingProposalAsyncFolderManagement,
145
+ ): string {
146
+ return JSON.stringify(
147
+ CreateBookingProposalAsyncFolderManagement$outboundSchema.parse(
148
+ createBookingProposalAsyncFolderManagement,
149
+ ),
150
+ );
151
+ }
152
+
153
+ /** @internal */
154
+ export type CreateBookingProposalAsyncRequestBody$Outbound = {
155
+ files?: Array<CreateBookingProposalAsyncFile$Outbound> | undefined;
156
+ bookingType?: string | undefined;
157
+ bookingProposal?:
158
+ | models.CreateBookingProposalRequestDtoV2$Outbound
159
+ | undefined;
160
+ folderManagement?:
161
+ | CreateBookingProposalAsyncFolderManagement$Outbound
162
+ | undefined;
163
+ };
164
+
165
+ /** @internal */
166
+ export const CreateBookingProposalAsyncRequestBody$outboundSchema:
167
+ z.ZodMiniType<
168
+ CreateBookingProposalAsyncRequestBody$Outbound,
169
+ CreateBookingProposalAsyncRequestBody
170
+ > = z.object({
171
+ files: z.optional(
172
+ z.array(z.lazy(() => CreateBookingProposalAsyncFile$outboundSchema)),
173
+ ),
174
+ bookingType: z.optional(
175
+ CreateBookingProposalAsyncBookingType$outboundSchema,
176
+ ),
177
+ bookingProposal: z.optional(
178
+ models.CreateBookingProposalRequestDtoV2$outboundSchema,
179
+ ),
180
+ folderManagement: z.optional(
181
+ z.lazy(() => CreateBookingProposalAsyncFolderManagement$outboundSchema),
182
+ ),
183
+ });
184
+
185
+ export function createBookingProposalAsyncRequestBodyToJSON(
186
+ createBookingProposalAsyncRequestBody: CreateBookingProposalAsyncRequestBody,
187
+ ): string {
188
+ return JSON.stringify(
189
+ CreateBookingProposalAsyncRequestBody$outboundSchema.parse(
190
+ createBookingProposalAsyncRequestBody,
191
+ ),
192
+ );
193
+ }
194
+
195
+ /** @internal */
196
+ export type CreateBookingProposalAsyncRequest$Outbound = {
197
+ companyId?: string | undefined;
198
+ apiKey?: string | undefined;
199
+ accountKey?: string | undefined;
200
+ body: CreateBookingProposalAsyncRequestBody$Outbound;
201
+ };
202
+
203
+ /** @internal */
204
+ export const CreateBookingProposalAsyncRequest$outboundSchema: z.ZodMiniType<
205
+ CreateBookingProposalAsyncRequest$Outbound,
206
+ CreateBookingProposalAsyncRequest
207
+ > = z.object({
208
+ companyId: z.optional(z.string()),
209
+ apiKey: z.optional(z.string()),
210
+ accountKey: z.optional(z.string()),
211
+ body: z.lazy(() => CreateBookingProposalAsyncRequestBody$outboundSchema),
212
+ });
213
+
214
+ export function createBookingProposalAsyncRequestToJSON(
215
+ createBookingProposalAsyncRequest: CreateBookingProposalAsyncRequest,
216
+ ): string {
217
+ return JSON.stringify(
218
+ CreateBookingProposalAsyncRequest$outboundSchema.parse(
219
+ createBookingProposalAsyncRequest,
220
+ ),
221
+ );
222
+ }
223
+
224
+ /** @internal */
225
+ export const CreateBookingProposalAsyncPagination$inboundSchema: z.ZodMiniType<
226
+ CreateBookingProposalAsyncPagination,
227
+ unknown
228
+ > = z.object({
229
+ total: types.number(),
230
+ perPage: types.number(),
231
+ currentPage: types.number(),
232
+ totalPages: types.number(),
233
+ });
234
+
235
+ export function createBookingProposalAsyncPaginationFromJSON(
236
+ jsonString: string,
237
+ ): SafeParseResult<CreateBookingProposalAsyncPagination, SDKValidationError> {
238
+ return safeParse(
239
+ jsonString,
240
+ (x) =>
241
+ CreateBookingProposalAsyncPagination$inboundSchema.parse(JSON.parse(x)),
242
+ `Failed to parse 'CreateBookingProposalAsyncPagination' from JSON`,
243
+ );
244
+ }
245
+
246
+ /** @internal */
247
+ export const CreateBookingProposalAsyncMeta$inboundSchema: z.ZodMiniType<
248
+ CreateBookingProposalAsyncMeta,
249
+ unknown
250
+ > = z.object({
251
+ warnings: z.optional(z.nullable(z.array(types.string()))),
252
+ pagination: z.optional(
253
+ z.nullable(
254
+ z.lazy(() => CreateBookingProposalAsyncPagination$inboundSchema),
255
+ ),
256
+ ),
257
+ });
258
+
259
+ export function createBookingProposalAsyncMetaFromJSON(
260
+ jsonString: string,
261
+ ): SafeParseResult<CreateBookingProposalAsyncMeta, SDKValidationError> {
262
+ return safeParse(
263
+ jsonString,
264
+ (x) => CreateBookingProposalAsyncMeta$inboundSchema.parse(JSON.parse(x)),
265
+ `Failed to parse 'CreateBookingProposalAsyncMeta' from JSON`,
266
+ );
267
+ }
268
+
269
+ /** @internal */
270
+ export const CreateBookingProposalAsyncErrors$inboundSchema: z.ZodMiniType<
271
+ CreateBookingProposalAsyncErrors,
272
+ unknown
273
+ > = z.object({});
274
+
275
+ export function createBookingProposalAsyncErrorsFromJSON(
276
+ jsonString: string,
277
+ ): SafeParseResult<CreateBookingProposalAsyncErrors, SDKValidationError> {
278
+ return safeParse(
279
+ jsonString,
280
+ (x) => CreateBookingProposalAsyncErrors$inboundSchema.parse(JSON.parse(x)),
281
+ `Failed to parse 'CreateBookingProposalAsyncErrors' from JSON`,
282
+ );
283
+ }
284
+
285
+ /** @internal */
286
+ export const CreateBookingProposalAsyncRawData$inboundSchema: z.ZodMiniType<
287
+ CreateBookingProposalAsyncRawData,
288
+ unknown
289
+ > = z.object({});
290
+
291
+ export function createBookingProposalAsyncRawDataFromJSON(
292
+ jsonString: string,
293
+ ): SafeParseResult<CreateBookingProposalAsyncRawData, SDKValidationError> {
294
+ return safeParse(
295
+ jsonString,
296
+ (x) => CreateBookingProposalAsyncRawData$inboundSchema.parse(JSON.parse(x)),
297
+ `Failed to parse 'CreateBookingProposalAsyncRawData' from JSON`,
298
+ );
299
+ }
300
+
301
+ /** @internal */
302
+ export const CreateBookingProposalAsyncResponse$inboundSchema: z.ZodMiniType<
303
+ CreateBookingProposalAsyncResponse,
304
+ unknown
305
+ > = z.object({
306
+ meta: z.optional(
307
+ z.nullable(z.lazy(() => CreateBookingProposalAsyncMeta$inboundSchema)),
308
+ ),
309
+ data: models.TaskIdResponseDto$inboundSchema,
310
+ errors: types.nullable(
311
+ z.lazy(() => CreateBookingProposalAsyncErrors$inboundSchema),
312
+ ),
313
+ rawData: types.nullable(
314
+ z.lazy(() => CreateBookingProposalAsyncRawData$inboundSchema),
315
+ ),
316
+ });
317
+
318
+ export function createBookingProposalAsyncResponseFromJSON(
319
+ jsonString: string,
320
+ ): SafeParseResult<CreateBookingProposalAsyncResponse, SDKValidationError> {
321
+ return safeParse(
322
+ jsonString,
323
+ (x) =>
324
+ CreateBookingProposalAsyncResponse$inboundSchema.parse(JSON.parse(x)),
325
+ `Failed to parse 'CreateBookingProposalAsyncResponse' from JSON`,
326
+ );
327
+ }
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as z from "zod/v4-mini";
6
6
  import { safeParse } from "../../lib/schemas.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
7
8
  import { Result as SafeParseResult } from "../../types/fp.js";
8
9
  import * as types from "../../types/primitives.js";
9
10
  import { SDKValidationError } from "../errors/sdk-validation-error.js";
@@ -14,11 +15,26 @@ export type GetDocumentTypesGlobals = {
14
15
  accountKey?: string | undefined;
15
16
  };
16
17
 
18
+ export const GetDocumentTypesLimit = {
19
+ Five: 5,
20
+ Ten: 10,
21
+ Twenty: 20,
22
+ Fifty: 50,
23
+ OneHundred: 100,
24
+ } as const;
25
+ export type GetDocumentTypesLimit = ClosedEnum<typeof GetDocumentTypesLimit>;
26
+
17
27
  export type GetDocumentTypesRequest = {
28
+ page?: number | undefined;
29
+ limit?: GetDocumentTypesLimit | undefined;
18
30
  /**
19
31
  * ID of the company (required for multi-company target systems)
20
32
  */
21
33
  companyId?: string | undefined;
34
+ /**
35
+ * When true, returns the unprocessed response from the upstream target system
36
+ */
37
+ rawData?: boolean | undefined;
22
38
  /**
23
39
  * API key
24
40
  */
@@ -55,9 +71,17 @@ export type GetDocumentTypesResponse = {
55
71
  rawData: GetDocumentTypesRawData | null;
56
72
  };
57
73
 
74
+ /** @internal */
75
+ export const GetDocumentTypesLimit$outboundSchema: z.ZodMiniEnum<
76
+ typeof GetDocumentTypesLimit
77
+ > = z.enum(GetDocumentTypesLimit);
78
+
58
79
  /** @internal */
59
80
  export type GetDocumentTypesRequest$Outbound = {
81
+ page?: number | undefined;
82
+ limit?: number | undefined;
60
83
  companyId?: string | undefined;
84
+ rawData?: boolean | undefined;
61
85
  apiKey?: string | undefined;
62
86
  accountKey?: string | undefined;
63
87
  };
@@ -67,7 +91,10 @@ export const GetDocumentTypesRequest$outboundSchema: z.ZodMiniType<
67
91
  GetDocumentTypesRequest$Outbound,
68
92
  GetDocumentTypesRequest
69
93
  > = z.object({
94
+ page: z.optional(z.number()),
95
+ limit: z.optional(GetDocumentTypesLimit$outboundSchema),
70
96
  companyId: z.optional(z.string()),
97
+ rawData: z.optional(z.boolean()),
71
98
  apiKey: z.optional(z.string()),
72
99
  accountKey: z.optional(z.string()),
73
100
  });
@@ -9,6 +9,7 @@ export * from "./create-account.js";
9
9
  export * from "./create-bank-account.js";
10
10
  export * from "./create-bill-line-item.js";
11
11
  export * from "./create-bill.js";
12
+ export * from "./create-booking-proposal-async.js";
12
13
  export * from "./create-booking-proposal-v2.js";
13
14
  export * from "./create-booking-proposal.js";
14
15
  export * from "./create-contact-v2.js";
@@ -6,6 +6,7 @@ import { accountingCreateAccount } from "../funcs/accounting-create-account.js";
6
6
  import { accountingCreateBankAccount } from "../funcs/accounting-create-bank-account.js";
7
7
  import { accountingCreateBillLineItem } from "../funcs/accounting-create-bill-line-item.js";
8
8
  import { accountingCreateBill } from "../funcs/accounting-create-bill.js";
9
+ import { accountingCreateBookingProposalAsync } from "../funcs/accounting-create-booking-proposal-async.js";
9
10
  import { accountingCreateBookingProposal } from "../funcs/accounting-create-booking-proposal.js";
10
11
  import { accountingCreateContact } from "../funcs/accounting-create-contact.js";
11
12
  import { accountingCreateContactsV1 } from "../funcs/accounting-create-contacts-v1.js";
@@ -1363,4 +1364,15 @@ export class Accounting extends ClientSDK {
1363
1364
  options,
1364
1365
  ));
1365
1366
  }
1367
+
1368
+ async createBookingProposalAsync(
1369
+ request: operations.CreateBookingProposalAsyncRequest,
1370
+ options?: RequestOptions,
1371
+ ): Promise<operations.CreateBookingProposalAsyncResponse> {
1372
+ return unwrapAsync(accountingCreateBookingProposalAsync(
1373
+ this,
1374
+ request,
1375
+ options,
1376
+ ));
1377
+ }
1366
1378
  }