@maesn/typescript-sdk 0.8.2 → 0.8.3
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.
- package/README.md +2 -0
- package/esm/funcs/accounting-create-credit-note.d.ts +11 -0
- package/esm/funcs/accounting-create-credit-note.d.ts.map +1 -0
- package/esm/funcs/accounting-create-credit-note.js +71 -0
- package/esm/funcs/accounting-create-credit-note.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/models/create-credit-note-line-item-request-dto.d.ts +54 -0
- package/esm/models/create-credit-note-line-item-request-dto.d.ts.map +1 -0
- package/esm/models/create-credit-note-line-item-request-dto.js +36 -0
- package/esm/models/create-credit-note-line-item-request-dto.js.map +1 -0
- package/esm/models/create-credit-note-request-dto.d.ts +96 -0
- package/esm/models/create-credit-note-request-dto.d.ts.map +1 -0
- package/esm/models/create-credit-note-request-dto.js +77 -0
- package/esm/models/create-credit-note-request-dto.js.map +1 -0
- package/esm/models/credit-note-lines-dto.d.ts +11 -0
- package/esm/models/credit-note-lines-dto.d.ts.map +1 -1
- package/esm/models/credit-note-lines-dto.js +9 -0
- package/esm/models/credit-note-lines-dto.js.map +1 -1
- package/esm/models/credit-note-response-dto.d.ts +21 -0
- package/esm/models/credit-note-response-dto.d.ts.map +1 -1
- package/esm/models/credit-note-response-dto.js +20 -0
- package/esm/models/credit-note-response-dto.js.map +1 -1
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.d.ts.map +1 -1
- package/esm/models/index.js +2 -0
- package/esm/models/index.js.map +1 -1
- package/esm/models/operations/create-credit-note.d.ts +65 -0
- package/esm/models/operations/create-credit-note.d.ts.map +1 -0
- package/esm/models/operations/create-credit-note.js +55 -0
- package/esm/models/operations/create-credit-note.js.map +1 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +1 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/sdk/accounting.d.ts +1 -0
- package/esm/sdk/accounting.d.ts.map +1 -1
- package/esm/sdk/accounting.js +4 -0
- package/esm/sdk/accounting.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/accounting-create-credit-note.ts +162 -0
- package/src/lib/config.ts +3 -3
- package/src/models/create-credit-note-line-item-request-dto.ts +97 -0
- package/src/models/create-credit-note-request-dto.ts +158 -0
- package/src/models/credit-note-lines-dto.ts +16 -0
- package/src/models/credit-note-response-dto.ts +28 -0
- package/src/models/index.ts +2 -0
- package/src/models/operations/create-credit-note.ts +175 -0
- package/src/models/operations/index.ts +1 -0
- package/src/sdk/accounting.ts +12 -0
package/src/lib/config.ts
CHANGED
|
@@ -51,7 +51,7 @@ 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.
|
|
55
|
-
genVersion: "2.
|
|
56
|
-
userAgent: "speakeasy-sdk/typescript 0.8.
|
|
54
|
+
sdkVersion: "0.8.3",
|
|
55
|
+
genVersion: "2.907.0",
|
|
56
|
+
userAgent: "speakeasy-sdk/typescript 0.8.3 2.907.0 1.0 @maesn/typescript-sdk",
|
|
57
57
|
} as const;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const CreateCreditNoteLineItemRequestDtoType = {
|
|
9
|
+
ServiceItem: "SERVICE_ITEM",
|
|
10
|
+
Material: "MATERIAL",
|
|
11
|
+
Custom: "CUSTOM",
|
|
12
|
+
Text: "TEXT",
|
|
13
|
+
} as const;
|
|
14
|
+
export type CreateCreditNoteLineItemRequestDtoType = ClosedEnum<
|
|
15
|
+
typeof CreateCreditNoteLineItemRequestDtoType
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export type CreateCreditNoteLineItemRequestDto = {
|
|
19
|
+
id?: string | undefined;
|
|
20
|
+
description?: string | undefined;
|
|
21
|
+
itemId?: string | undefined;
|
|
22
|
+
itemName?: string | undefined;
|
|
23
|
+
quantity?: number | undefined;
|
|
24
|
+
taxCode?: string | undefined;
|
|
25
|
+
taxRatePercentage?: number | undefined;
|
|
26
|
+
totalDiscountAmount?: number | undefined;
|
|
27
|
+
totalDiscountPercentage?: number | undefined;
|
|
28
|
+
totalGrossAmount?: number | undefined;
|
|
29
|
+
totalNetAmount?: number | undefined;
|
|
30
|
+
totalTaxAmount?: number | undefined;
|
|
31
|
+
type?: CreateCreditNoteLineItemRequestDtoType | undefined;
|
|
32
|
+
unitAmount?: number | undefined;
|
|
33
|
+
unitDiscountAmount?: number | undefined;
|
|
34
|
+
unitDiscountPercentage?: number | undefined;
|
|
35
|
+
unitName?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const CreateCreditNoteLineItemRequestDtoType$outboundSchema:
|
|
40
|
+
z.ZodMiniEnum<typeof CreateCreditNoteLineItemRequestDtoType> = z.enum(
|
|
41
|
+
CreateCreditNoteLineItemRequestDtoType,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export type CreateCreditNoteLineItemRequestDto$Outbound = {
|
|
46
|
+
id?: string | undefined;
|
|
47
|
+
description?: string | undefined;
|
|
48
|
+
itemId?: string | undefined;
|
|
49
|
+
itemName?: string | undefined;
|
|
50
|
+
quantity?: number | undefined;
|
|
51
|
+
taxCode?: string | undefined;
|
|
52
|
+
taxRatePercentage?: number | undefined;
|
|
53
|
+
totalDiscountAmount?: number | undefined;
|
|
54
|
+
totalDiscountPercentage?: number | undefined;
|
|
55
|
+
totalGrossAmount?: number | undefined;
|
|
56
|
+
totalNetAmount?: number | undefined;
|
|
57
|
+
totalTaxAmount?: number | undefined;
|
|
58
|
+
type?: string | undefined;
|
|
59
|
+
unitAmount?: number | undefined;
|
|
60
|
+
unitDiscountAmount?: number | undefined;
|
|
61
|
+
unitDiscountPercentage?: number | undefined;
|
|
62
|
+
unitName?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const CreateCreditNoteLineItemRequestDto$outboundSchema: z.ZodMiniType<
|
|
67
|
+
CreateCreditNoteLineItemRequestDto$Outbound,
|
|
68
|
+
CreateCreditNoteLineItemRequestDto
|
|
69
|
+
> = z.object({
|
|
70
|
+
id: z.optional(z.string()),
|
|
71
|
+
description: z.optional(z.string()),
|
|
72
|
+
itemId: z.optional(z.string()),
|
|
73
|
+
itemName: z.optional(z.string()),
|
|
74
|
+
quantity: z.optional(z.number()),
|
|
75
|
+
taxCode: z.optional(z.string()),
|
|
76
|
+
taxRatePercentage: z.optional(z.number()),
|
|
77
|
+
totalDiscountAmount: z.optional(z.number()),
|
|
78
|
+
totalDiscountPercentage: z.optional(z.number()),
|
|
79
|
+
totalGrossAmount: z.optional(z.number()),
|
|
80
|
+
totalNetAmount: z.optional(z.number()),
|
|
81
|
+
totalTaxAmount: z.optional(z.number()),
|
|
82
|
+
type: z.optional(CreateCreditNoteLineItemRequestDtoType$outboundSchema),
|
|
83
|
+
unitAmount: z.optional(z.number()),
|
|
84
|
+
unitDiscountAmount: z.optional(z.number()),
|
|
85
|
+
unitDiscountPercentage: z.optional(z.number()),
|
|
86
|
+
unitName: z.optional(z.string()),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export function createCreditNoteLineItemRequestDtoToJSON(
|
|
90
|
+
createCreditNoteLineItemRequestDto: CreateCreditNoteLineItemRequestDto,
|
|
91
|
+
): string {
|
|
92
|
+
return JSON.stringify(
|
|
93
|
+
CreateCreditNoteLineItemRequestDto$outboundSchema.parse(
|
|
94
|
+
createCreditNoteLineItemRequestDto,
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
7
|
+
import {
|
|
8
|
+
CreateAddress,
|
|
9
|
+
CreateAddress$Outbound,
|
|
10
|
+
CreateAddress$outboundSchema,
|
|
11
|
+
} from "./create-address.js";
|
|
12
|
+
import {
|
|
13
|
+
CreateCreditNoteLineItemRequestDto,
|
|
14
|
+
CreateCreditNoteLineItemRequestDto$Outbound,
|
|
15
|
+
CreateCreditNoteLineItemRequestDto$outboundSchema,
|
|
16
|
+
} from "./create-credit-note-line-item-request-dto.js";
|
|
17
|
+
|
|
18
|
+
export const CreateCreditNoteRequestDtoPaymentStatus = {
|
|
19
|
+
NoOpenItem: "NO_OPEN_ITEM",
|
|
20
|
+
Pending: "PENDING",
|
|
21
|
+
PartlyPaid: "PARTLY_PAID",
|
|
22
|
+
Paid: "PAID",
|
|
23
|
+
Debited: "DEBITED",
|
|
24
|
+
CreditNoteCleared: "CREDIT_NOTE_CLEARED",
|
|
25
|
+
ClearedWithCreditNote: "CLEARED_WITH_CREDIT_NOTE",
|
|
26
|
+
BadDebt: "BAD_DEBT",
|
|
27
|
+
PartialCancellation: "PARTIAL_CANCELLATION",
|
|
28
|
+
Canceled: "CANCELED",
|
|
29
|
+
Unknown: "UNKNOWN",
|
|
30
|
+
} as const;
|
|
31
|
+
export type CreateCreditNoteRequestDtoPaymentStatus = ClosedEnum<
|
|
32
|
+
typeof CreateCreditNoteRequestDtoPaymentStatus
|
|
33
|
+
>;
|
|
34
|
+
|
|
35
|
+
export const CreateCreditNoteRequestDtoStatus = {
|
|
36
|
+
Draft: "DRAFT",
|
|
37
|
+
Corrective: "CORRECTIVE",
|
|
38
|
+
Submitted: "SUBMITTED",
|
|
39
|
+
DocumentCreated: "DOCUMENT_CREATED",
|
|
40
|
+
Open: "OPEN",
|
|
41
|
+
PartiallyPaid: "PARTIALLY_PAID",
|
|
42
|
+
Paid: "PAID",
|
|
43
|
+
PartiallyOverdue: "PARTIALLY_OVERDUE",
|
|
44
|
+
Overdue: "OVERDUE",
|
|
45
|
+
Voided: "VOIDED",
|
|
46
|
+
} as const;
|
|
47
|
+
export type CreateCreditNoteRequestDtoStatus = ClosedEnum<
|
|
48
|
+
typeof CreateCreditNoteRequestDtoStatus
|
|
49
|
+
>;
|
|
50
|
+
|
|
51
|
+
export const CreateCreditNoteRequestDtoTaxRule = {
|
|
52
|
+
Net: "NET",
|
|
53
|
+
Taxfree: "TAXFREE",
|
|
54
|
+
IntracommunityGoods: "INTRACOMMUNITY_GOODS",
|
|
55
|
+
IntracommunityService: "INTRACOMMUNITY_SERVICE",
|
|
56
|
+
ExportService: "EXPORT_SERVICE",
|
|
57
|
+
ExportGoods: "EXPORT_GOODS",
|
|
58
|
+
ReverseCharge: "REVERSE_CHARGE",
|
|
59
|
+
Gross: "GROSS",
|
|
60
|
+
ConstructionService: "CONSTRUCTION_SERVICE",
|
|
61
|
+
PhotovoltaicEquipment: "PHOTOVOLTAIC_EQUIPMENT",
|
|
62
|
+
SmallBusinessExemption: "SMALL_BUSINESS_EXEMPTION",
|
|
63
|
+
NonDomesticService: "NON_DOMESTIC_SERVICE",
|
|
64
|
+
OssGoods: "OSS_GOODS",
|
|
65
|
+
OssElectronicServices: "OSS_ELECTRONIC_SERVICES",
|
|
66
|
+
OssServices: "OSS_SERVICES",
|
|
67
|
+
} as const;
|
|
68
|
+
export type CreateCreditNoteRequestDtoTaxRule = ClosedEnum<
|
|
69
|
+
typeof CreateCreditNoteRequestDtoTaxRule
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
export type CreateCreditNoteRequestDto = {
|
|
73
|
+
addresses?: Array<CreateAddress> | undefined;
|
|
74
|
+
contactId?: string | undefined;
|
|
75
|
+
creditNoteDate: string;
|
|
76
|
+
creditNoteLines: Array<CreateCreditNoteLineItemRequestDto>;
|
|
77
|
+
creditNoteNumber?: string | undefined;
|
|
78
|
+
currency?: string | undefined;
|
|
79
|
+
paymentStatus?: CreateCreditNoteRequestDtoPaymentStatus | undefined;
|
|
80
|
+
paymentTermId?: string | undefined;
|
|
81
|
+
reference?: string | undefined;
|
|
82
|
+
status?: CreateCreditNoteRequestDtoStatus | undefined;
|
|
83
|
+
taxRule?: CreateCreditNoteRequestDtoTaxRule | undefined;
|
|
84
|
+
totalDiscountAmount?: number | undefined;
|
|
85
|
+
totalDiscountPercentage?: number | undefined;
|
|
86
|
+
totalGrossAmount?: number | undefined;
|
|
87
|
+
totalNetAmount?: number | undefined;
|
|
88
|
+
totalTaxAmount?: number | undefined;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** @internal */
|
|
92
|
+
export const CreateCreditNoteRequestDtoPaymentStatus$outboundSchema:
|
|
93
|
+
z.ZodMiniEnum<typeof CreateCreditNoteRequestDtoPaymentStatus> = z.enum(
|
|
94
|
+
CreateCreditNoteRequestDtoPaymentStatus,
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
/** @internal */
|
|
98
|
+
export const CreateCreditNoteRequestDtoStatus$outboundSchema: z.ZodMiniEnum<
|
|
99
|
+
typeof CreateCreditNoteRequestDtoStatus
|
|
100
|
+
> = z.enum(CreateCreditNoteRequestDtoStatus);
|
|
101
|
+
|
|
102
|
+
/** @internal */
|
|
103
|
+
export const CreateCreditNoteRequestDtoTaxRule$outboundSchema: z.ZodMiniEnum<
|
|
104
|
+
typeof CreateCreditNoteRequestDtoTaxRule
|
|
105
|
+
> = z.enum(CreateCreditNoteRequestDtoTaxRule);
|
|
106
|
+
|
|
107
|
+
/** @internal */
|
|
108
|
+
export type CreateCreditNoteRequestDto$Outbound = {
|
|
109
|
+
addresses?: Array<CreateAddress$Outbound> | undefined;
|
|
110
|
+
contactId?: string | undefined;
|
|
111
|
+
creditNoteDate: string;
|
|
112
|
+
creditNoteLines: Array<CreateCreditNoteLineItemRequestDto$Outbound>;
|
|
113
|
+
creditNoteNumber?: string | undefined;
|
|
114
|
+
currency?: string | undefined;
|
|
115
|
+
paymentStatus?: string | undefined;
|
|
116
|
+
paymentTermId?: string | undefined;
|
|
117
|
+
reference?: string | undefined;
|
|
118
|
+
status?: string | undefined;
|
|
119
|
+
taxRule?: string | undefined;
|
|
120
|
+
totalDiscountAmount?: number | undefined;
|
|
121
|
+
totalDiscountPercentage?: number | undefined;
|
|
122
|
+
totalGrossAmount?: number | undefined;
|
|
123
|
+
totalNetAmount?: number | undefined;
|
|
124
|
+
totalTaxAmount?: number | undefined;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** @internal */
|
|
128
|
+
export const CreateCreditNoteRequestDto$outboundSchema: z.ZodMiniType<
|
|
129
|
+
CreateCreditNoteRequestDto$Outbound,
|
|
130
|
+
CreateCreditNoteRequestDto
|
|
131
|
+
> = z.object({
|
|
132
|
+
addresses: z.optional(z.array(CreateAddress$outboundSchema)),
|
|
133
|
+
contactId: z.optional(z.string()),
|
|
134
|
+
creditNoteDate: z.string(),
|
|
135
|
+
creditNoteLines: z.array(CreateCreditNoteLineItemRequestDto$outboundSchema),
|
|
136
|
+
creditNoteNumber: z.optional(z.string()),
|
|
137
|
+
currency: z.optional(z.string()),
|
|
138
|
+
paymentStatus: z.optional(
|
|
139
|
+
CreateCreditNoteRequestDtoPaymentStatus$outboundSchema,
|
|
140
|
+
),
|
|
141
|
+
paymentTermId: z.optional(z.string()),
|
|
142
|
+
reference: z.optional(z.string()),
|
|
143
|
+
status: z.optional(CreateCreditNoteRequestDtoStatus$outboundSchema),
|
|
144
|
+
taxRule: z.optional(CreateCreditNoteRequestDtoTaxRule$outboundSchema),
|
|
145
|
+
totalDiscountAmount: z.optional(z.number()),
|
|
146
|
+
totalDiscountPercentage: z.optional(z.number()),
|
|
147
|
+
totalGrossAmount: z.optional(z.number()),
|
|
148
|
+
totalNetAmount: z.optional(z.number()),
|
|
149
|
+
totalTaxAmount: z.optional(z.number()),
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
export function createCreditNoteRequestDtoToJSON(
|
|
153
|
+
createCreditNoteRequestDto: CreateCreditNoteRequestDto,
|
|
154
|
+
): string {
|
|
155
|
+
return JSON.stringify(
|
|
156
|
+
CreateCreditNoteRequestDto$outboundSchema.parse(createCreditNoteRequestDto),
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -4,10 +4,19 @@
|
|
|
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";
|
|
10
11
|
|
|
12
|
+
export const CreditNoteLinesDtoType = {
|
|
13
|
+
ServiceItem: "SERVICE_ITEM",
|
|
14
|
+
Material: "MATERIAL",
|
|
15
|
+
Custom: "CUSTOM",
|
|
16
|
+
Text: "TEXT",
|
|
17
|
+
} as const;
|
|
18
|
+
export type CreditNoteLinesDtoType = ClosedEnum<typeof CreditNoteLinesDtoType>;
|
|
19
|
+
|
|
11
20
|
export type CreditNoteLinesDto = {
|
|
12
21
|
id: string | null;
|
|
13
22
|
createdDate: string | null;
|
|
@@ -22,6 +31,7 @@ export type CreditNoteLinesDto = {
|
|
|
22
31
|
totalGrossAmount: number | null;
|
|
23
32
|
totalNetAmount: number | null;
|
|
24
33
|
totalTaxAmount: number | null;
|
|
34
|
+
type: CreditNoteLinesDtoType | null;
|
|
25
35
|
unitAmount: number | null;
|
|
26
36
|
unitDiscountAmount: number | null;
|
|
27
37
|
unitDiscountPercentage: number | null;
|
|
@@ -29,6 +39,11 @@ export type CreditNoteLinesDto = {
|
|
|
29
39
|
updatedDate: string | null;
|
|
30
40
|
};
|
|
31
41
|
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const CreditNoteLinesDtoType$inboundSchema: z.ZodMiniEnum<
|
|
44
|
+
typeof CreditNoteLinesDtoType
|
|
45
|
+
> = z.enum(CreditNoteLinesDtoType);
|
|
46
|
+
|
|
32
47
|
/** @internal */
|
|
33
48
|
export const CreditNoteLinesDto$inboundSchema: z.ZodMiniType<
|
|
34
49
|
CreditNoteLinesDto,
|
|
@@ -47,6 +62,7 @@ export const CreditNoteLinesDto$inboundSchema: z.ZodMiniType<
|
|
|
47
62
|
totalGrossAmount: types.nullable(types.number()),
|
|
48
63
|
totalNetAmount: types.nullable(types.number()),
|
|
49
64
|
totalTaxAmount: types.nullable(types.number()),
|
|
65
|
+
type: types.nullable(CreditNoteLinesDtoType$inboundSchema),
|
|
50
66
|
unitAmount: types.nullable(types.number()),
|
|
51
67
|
unitDiscountAmount: types.nullable(types.number()),
|
|
52
68
|
unitDiscountPercentage: types.nullable(types.number()),
|
|
@@ -47,6 +47,27 @@ export type CreditNoteResponseDtoStatus = ClosedEnum<
|
|
|
47
47
|
typeof CreditNoteResponseDtoStatus
|
|
48
48
|
>;
|
|
49
49
|
|
|
50
|
+
export const CreditNoteResponseDtoTaxRule = {
|
|
51
|
+
Net: "NET",
|
|
52
|
+
Taxfree: "TAXFREE",
|
|
53
|
+
IntracommunityGoods: "INTRACOMMUNITY_GOODS",
|
|
54
|
+
IntracommunityService: "INTRACOMMUNITY_SERVICE",
|
|
55
|
+
ExportService: "EXPORT_SERVICE",
|
|
56
|
+
ExportGoods: "EXPORT_GOODS",
|
|
57
|
+
ReverseCharge: "REVERSE_CHARGE",
|
|
58
|
+
Gross: "GROSS",
|
|
59
|
+
ConstructionService: "CONSTRUCTION_SERVICE",
|
|
60
|
+
PhotovoltaicEquipment: "PHOTOVOLTAIC_EQUIPMENT",
|
|
61
|
+
SmallBusinessExemption: "SMALL_BUSINESS_EXEMPTION",
|
|
62
|
+
NonDomesticService: "NON_DOMESTIC_SERVICE",
|
|
63
|
+
OssGoods: "OSS_GOODS",
|
|
64
|
+
OssElectronicServices: "OSS_ELECTRONIC_SERVICES",
|
|
65
|
+
OssServices: "OSS_SERVICES",
|
|
66
|
+
} as const;
|
|
67
|
+
export type CreditNoteResponseDtoTaxRule = ClosedEnum<
|
|
68
|
+
typeof CreditNoteResponseDtoTaxRule
|
|
69
|
+
>;
|
|
70
|
+
|
|
50
71
|
export type CreditNoteResponseDto = {
|
|
51
72
|
id: string | null;
|
|
52
73
|
addresses: Array<Address> | null;
|
|
@@ -60,6 +81,7 @@ export type CreditNoteResponseDto = {
|
|
|
60
81
|
paymentTermId: string | null;
|
|
61
82
|
reference: string | null;
|
|
62
83
|
status: CreditNoteResponseDtoStatus | null;
|
|
84
|
+
taxRule: CreditNoteResponseDtoTaxRule | null;
|
|
63
85
|
totalDiscountAmount: number | null;
|
|
64
86
|
totalDiscountPercentage: number | null;
|
|
65
87
|
totalGrossAmount: number | null;
|
|
@@ -78,6 +100,11 @@ export const CreditNoteResponseDtoStatus$inboundSchema: z.ZodMiniEnum<
|
|
|
78
100
|
typeof CreditNoteResponseDtoStatus
|
|
79
101
|
> = z.enum(CreditNoteResponseDtoStatus);
|
|
80
102
|
|
|
103
|
+
/** @internal */
|
|
104
|
+
export const CreditNoteResponseDtoTaxRule$inboundSchema: z.ZodMiniEnum<
|
|
105
|
+
typeof CreditNoteResponseDtoTaxRule
|
|
106
|
+
> = z.enum(CreditNoteResponseDtoTaxRule);
|
|
107
|
+
|
|
81
108
|
/** @internal */
|
|
82
109
|
export const CreditNoteResponseDto$inboundSchema: z.ZodMiniType<
|
|
83
110
|
CreditNoteResponseDto,
|
|
@@ -97,6 +124,7 @@ export const CreditNoteResponseDto$inboundSchema: z.ZodMiniType<
|
|
|
97
124
|
paymentTermId: types.nullable(types.string()),
|
|
98
125
|
reference: types.nullable(types.string()),
|
|
99
126
|
status: types.nullable(CreditNoteResponseDtoStatus$inboundSchema),
|
|
127
|
+
taxRule: types.nullable(CreditNoteResponseDtoTaxRule$inboundSchema),
|
|
100
128
|
totalDiscountAmount: types.nullable(types.number()),
|
|
101
129
|
totalDiscountPercentage: types.nullable(types.number()),
|
|
102
130
|
totalGrossAmount: types.nullable(types.number()),
|
package/src/models/index.ts
CHANGED
|
@@ -51,6 +51,8 @@ export * from "./create-contact-person-dto-v2.js";
|
|
|
51
51
|
export * from "./create-contact-person.js";
|
|
52
52
|
export * from "./create-contact-request-dto-v2.js";
|
|
53
53
|
export * from "./create-contact-request-dto.js";
|
|
54
|
+
export * from "./create-credit-note-line-item-request-dto.js";
|
|
55
|
+
export * from "./create-credit-note-request-dto.js";
|
|
54
56
|
export * from "./create-email-address.js";
|
|
55
57
|
export * from "./create-end-user-request-dto.js";
|
|
56
58
|
export * from "./create-event-subscription-request-dto.js";
|
|
@@ -0,0 +1,175 @@
|
|
|
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 CreateCreditNoteGlobals = {
|
|
13
|
+
apiKey?: string | undefined;
|
|
14
|
+
accountKey?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type CreateCreditNoteRequest = {
|
|
18
|
+
/**
|
|
19
|
+
* API key
|
|
20
|
+
*/
|
|
21
|
+
apiKey?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Account key
|
|
24
|
+
*/
|
|
25
|
+
accountKey?: string | undefined;
|
|
26
|
+
body: models.CreateCreditNoteRequestDto;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type CreateCreditNotePagination = {
|
|
30
|
+
total: number;
|
|
31
|
+
perPage: number;
|
|
32
|
+
currentPage: number;
|
|
33
|
+
totalPages: number;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type CreateCreditNoteMeta = {
|
|
37
|
+
warnings?: Array<string> | null | undefined;
|
|
38
|
+
pagination?: CreateCreditNotePagination | null | undefined;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type CreateCreditNoteErrors = {};
|
|
42
|
+
|
|
43
|
+
export type CreateCreditNoteRawData = {};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Credit note created successfully
|
|
47
|
+
*/
|
|
48
|
+
export type CreateCreditNoteResponse = {
|
|
49
|
+
meta?: CreateCreditNoteMeta | null | undefined;
|
|
50
|
+
data: models.CreditNoteResponseDto;
|
|
51
|
+
errors: CreateCreditNoteErrors | null;
|
|
52
|
+
rawData: CreateCreditNoteRawData | null;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** @internal */
|
|
56
|
+
export type CreateCreditNoteRequest$Outbound = {
|
|
57
|
+
apiKey?: string | undefined;
|
|
58
|
+
accountKey?: string | undefined;
|
|
59
|
+
body: models.CreateCreditNoteRequestDto$Outbound;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
export const CreateCreditNoteRequest$outboundSchema: z.ZodMiniType<
|
|
64
|
+
CreateCreditNoteRequest$Outbound,
|
|
65
|
+
CreateCreditNoteRequest
|
|
66
|
+
> = z.object({
|
|
67
|
+
apiKey: z.optional(z.string()),
|
|
68
|
+
accountKey: z.optional(z.string()),
|
|
69
|
+
body: models.CreateCreditNoteRequestDto$outboundSchema,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export function createCreditNoteRequestToJSON(
|
|
73
|
+
createCreditNoteRequest: CreateCreditNoteRequest,
|
|
74
|
+
): string {
|
|
75
|
+
return JSON.stringify(
|
|
76
|
+
CreateCreditNoteRequest$outboundSchema.parse(createCreditNoteRequest),
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** @internal */
|
|
81
|
+
export const CreateCreditNotePagination$inboundSchema: z.ZodMiniType<
|
|
82
|
+
CreateCreditNotePagination,
|
|
83
|
+
unknown
|
|
84
|
+
> = z.object({
|
|
85
|
+
total: types.number(),
|
|
86
|
+
perPage: types.number(),
|
|
87
|
+
currentPage: types.number(),
|
|
88
|
+
totalPages: types.number(),
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export function createCreditNotePaginationFromJSON(
|
|
92
|
+
jsonString: string,
|
|
93
|
+
): SafeParseResult<CreateCreditNotePagination, SDKValidationError> {
|
|
94
|
+
return safeParse(
|
|
95
|
+
jsonString,
|
|
96
|
+
(x) => CreateCreditNotePagination$inboundSchema.parse(JSON.parse(x)),
|
|
97
|
+
`Failed to parse 'CreateCreditNotePagination' from JSON`,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** @internal */
|
|
102
|
+
export const CreateCreditNoteMeta$inboundSchema: z.ZodMiniType<
|
|
103
|
+
CreateCreditNoteMeta,
|
|
104
|
+
unknown
|
|
105
|
+
> = z.object({
|
|
106
|
+
warnings: z.optional(z.nullable(z.array(types.string()))),
|
|
107
|
+
pagination: z.optional(
|
|
108
|
+
z.nullable(z.lazy(() => CreateCreditNotePagination$inboundSchema)),
|
|
109
|
+
),
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export function createCreditNoteMetaFromJSON(
|
|
113
|
+
jsonString: string,
|
|
114
|
+
): SafeParseResult<CreateCreditNoteMeta, SDKValidationError> {
|
|
115
|
+
return safeParse(
|
|
116
|
+
jsonString,
|
|
117
|
+
(x) => CreateCreditNoteMeta$inboundSchema.parse(JSON.parse(x)),
|
|
118
|
+
`Failed to parse 'CreateCreditNoteMeta' from JSON`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** @internal */
|
|
123
|
+
export const CreateCreditNoteErrors$inboundSchema: z.ZodMiniType<
|
|
124
|
+
CreateCreditNoteErrors,
|
|
125
|
+
unknown
|
|
126
|
+
> = z.object({});
|
|
127
|
+
|
|
128
|
+
export function createCreditNoteErrorsFromJSON(
|
|
129
|
+
jsonString: string,
|
|
130
|
+
): SafeParseResult<CreateCreditNoteErrors, SDKValidationError> {
|
|
131
|
+
return safeParse(
|
|
132
|
+
jsonString,
|
|
133
|
+
(x) => CreateCreditNoteErrors$inboundSchema.parse(JSON.parse(x)),
|
|
134
|
+
`Failed to parse 'CreateCreditNoteErrors' from JSON`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** @internal */
|
|
139
|
+
export const CreateCreditNoteRawData$inboundSchema: z.ZodMiniType<
|
|
140
|
+
CreateCreditNoteRawData,
|
|
141
|
+
unknown
|
|
142
|
+
> = z.object({});
|
|
143
|
+
|
|
144
|
+
export function createCreditNoteRawDataFromJSON(
|
|
145
|
+
jsonString: string,
|
|
146
|
+
): SafeParseResult<CreateCreditNoteRawData, SDKValidationError> {
|
|
147
|
+
return safeParse(
|
|
148
|
+
jsonString,
|
|
149
|
+
(x) => CreateCreditNoteRawData$inboundSchema.parse(JSON.parse(x)),
|
|
150
|
+
`Failed to parse 'CreateCreditNoteRawData' from JSON`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** @internal */
|
|
155
|
+
export const CreateCreditNoteResponse$inboundSchema: z.ZodMiniType<
|
|
156
|
+
CreateCreditNoteResponse,
|
|
157
|
+
unknown
|
|
158
|
+
> = z.object({
|
|
159
|
+
meta: z.optional(
|
|
160
|
+
z.nullable(z.lazy(() => CreateCreditNoteMeta$inboundSchema)),
|
|
161
|
+
),
|
|
162
|
+
data: models.CreditNoteResponseDto$inboundSchema,
|
|
163
|
+
errors: types.nullable(z.lazy(() => CreateCreditNoteErrors$inboundSchema)),
|
|
164
|
+
rawData: types.nullable(z.lazy(() => CreateCreditNoteRawData$inboundSchema)),
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export function createCreditNoteResponseFromJSON(
|
|
168
|
+
jsonString: string,
|
|
169
|
+
): SafeParseResult<CreateCreditNoteResponse, SDKValidationError> {
|
|
170
|
+
return safeParse(
|
|
171
|
+
jsonString,
|
|
172
|
+
(x) => CreateCreditNoteResponse$inboundSchema.parse(JSON.parse(x)),
|
|
173
|
+
`Failed to parse 'CreateCreditNoteResponse' from JSON`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
@@ -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";
|
package/src/sdk/accounting.ts
CHANGED
|
@@ -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";
|
|
@@ -1321,6 +1322,17 @@ export class Accounting extends ClientSDK {
|
|
|
1321
1322
|
));
|
|
1322
1323
|
}
|
|
1323
1324
|
|
|
1325
|
+
async createCreditNote(
|
|
1326
|
+
request: operations.CreateCreditNoteRequest,
|
|
1327
|
+
options?: RequestOptions,
|
|
1328
|
+
): Promise<operations.CreateCreditNoteResponse> {
|
|
1329
|
+
return unwrapAsync(accountingCreateCreditNote(
|
|
1330
|
+
this,
|
|
1331
|
+
request,
|
|
1332
|
+
options,
|
|
1333
|
+
));
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1324
1336
|
async getCreditNote(
|
|
1325
1337
|
request: operations.GetCreditNoteRequest,
|
|
1326
1338
|
options?: RequestOptions,
|