@paygentic/sdk 0.6.15 → 0.6.17
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 +7 -3
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.d.ts +18 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.js +118 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.js.map +1 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.d.ts +19 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.js +126 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/createmanuallineitemrequest.d.ts +65 -0
- package/dist/commonjs/models/createmanuallineitemrequest.d.ts.map +1 -0
- package/dist/commonjs/models/createmanuallineitemrequest.js +59 -0
- package/dist/commonjs/models/createmanuallineitemrequest.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +4 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoicelineitem.d.ts +4 -4
- package/dist/commonjs/models/invoicelineitem.d.ts.map +1 -1
- package/dist/commonjs/models/invoicelineitem.js +4 -4
- package/dist/commonjs/models/invoicelineitem.js.map +1 -1
- package/dist/commonjs/models/lineitem.d.ts +146 -0
- package/dist/commonjs/models/lineitem.d.ts.map +1 -0
- package/dist/commonjs/models/lineitem.js +101 -0
- package/dist/commonjs/models/lineitem.js.map +1 -0
- package/dist/commonjs/models/lineitemsresponse.d.ts +37 -0
- package/dist/commonjs/models/lineitemsresponse.d.ts.map +1 -0
- package/dist/commonjs/models/lineitemsresponse.js +63 -0
- package/dist/commonjs/models/lineitemsresponse.js.map +1 -0
- package/dist/commonjs/models/lineitemssummary.d.ts +21 -0
- package/dist/commonjs/models/lineitemssummary.d.ts.map +1 -0
- package/dist/commonjs/models/lineitemssummary.js +52 -0
- package/dist/commonjs/models/lineitemssummary.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listlineitems.d.ts +49 -0
- package/dist/commonjs/models/operations/listlineitems.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listlineitems.js +62 -0
- package/dist/commonjs/models/operations/listlineitems.js.map +1 -0
- package/dist/commonjs/models/payment.d.ts +4 -4
- package/dist/commonjs/models/payment.d.ts.map +1 -1
- package/dist/commonjs/models/payment.js +6 -6
- package/dist/commonjs/models/payment.js.map +1 -1
- package/dist/commonjs/sdk/invoicesv2.d.ts +14 -0
- package/dist/commonjs/sdk/invoicesv2.d.ts.map +1 -1
- package/dist/commonjs/sdk/invoicesv2.js +20 -0
- package/dist/commonjs/sdk/invoicesv2.js.map +1 -1
- package/dist/esm/funcs/invoicesV2CreateLineItem.d.ts +18 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.js +82 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.js.map +1 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.d.ts +19 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.js +90 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/createmanuallineitemrequest.d.ts +65 -0
- package/dist/esm/models/createmanuallineitemrequest.d.ts.map +1 -0
- package/dist/esm/models/createmanuallineitemrequest.js +22 -0
- package/dist/esm/models/createmanuallineitemrequest.js.map +1 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoicelineitem.d.ts +4 -4
- package/dist/esm/models/invoicelineitem.d.ts.map +1 -1
- package/dist/esm/models/invoicelineitem.js +3 -3
- package/dist/esm/models/invoicelineitem.js.map +1 -1
- package/dist/esm/models/lineitem.d.ts +146 -0
- package/dist/esm/models/lineitem.d.ts.map +1 -0
- package/dist/esm/models/lineitem.js +64 -0
- package/dist/esm/models/lineitem.js.map +1 -0
- package/dist/esm/models/lineitemsresponse.d.ts +37 -0
- package/dist/esm/models/lineitemsresponse.d.ts.map +1 -0
- package/dist/esm/models/lineitemsresponse.js +26 -0
- package/dist/esm/models/lineitemsresponse.js.map +1 -0
- package/dist/esm/models/lineitemssummary.d.ts +21 -0
- package/dist/esm/models/lineitemssummary.d.ts.map +1 -0
- package/dist/esm/models/lineitemssummary.js +15 -0
- package/dist/esm/models/lineitemssummary.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listlineitems.d.ts +49 -0
- package/dist/esm/models/operations/listlineitems.d.ts.map +1 -0
- package/dist/esm/models/operations/listlineitems.js +25 -0
- package/dist/esm/models/operations/listlineitems.js.map +1 -0
- package/dist/esm/models/payment.d.ts +4 -4
- package/dist/esm/models/payment.d.ts.map +1 -1
- package/dist/esm/models/payment.js +4 -4
- package/dist/esm/models/payment.js.map +1 -1
- package/dist/esm/sdk/invoicesv2.d.ts +14 -0
- package/dist/esm/sdk/invoicesv2.d.ts.map +1 -1
- package/dist/esm/sdk/invoicesv2.js +20 -0
- package/dist/esm/sdk/invoicesv2.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/invoicesV2CreateLineItem.ts +174 -0
- package/src/funcs/invoicesV2ListLineItems.ts +184 -0
- package/src/lib/config.ts +3 -3
- package/src/models/createmanuallineitemrequest.ts +96 -0
- package/src/models/index.ts +4 -0
- package/src/models/invoicelineitem.ts +9 -6
- package/src/models/lineitem.ts +205 -0
- package/src/models/lineitemsresponse.ts +70 -0
- package/src/models/lineitemssummary.ts +44 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listlineitems.ts +76 -0
- package/src/models/payment.ts +9 -9
- package/src/sdk/invoicesv2.ts +36 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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 { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The type of line item
|
|
13
|
+
*/
|
|
14
|
+
export const LineItemType = {
|
|
15
|
+
Fee: "fee",
|
|
16
|
+
Metered: "metered",
|
|
17
|
+
Manual: "manual",
|
|
18
|
+
} as const;
|
|
19
|
+
/**
|
|
20
|
+
* The type of line item
|
|
21
|
+
*/
|
|
22
|
+
export type LineItemType = ClosedEnum<typeof LineItemType>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Whether this item is pending or already on an invoice
|
|
26
|
+
*/
|
|
27
|
+
export const LineItemStatus = {
|
|
28
|
+
Pending: "pending",
|
|
29
|
+
Invoiced: "invoiced",
|
|
30
|
+
} as const;
|
|
31
|
+
/**
|
|
32
|
+
* Whether this item is pending or already on an invoice
|
|
33
|
+
*/
|
|
34
|
+
export type LineItemStatus = ClosedEnum<typeof LineItemStatus>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Payment term for fee items. Null for metered/manual lines
|
|
38
|
+
*/
|
|
39
|
+
export const LineItemPaymentTerm = {
|
|
40
|
+
InAdvance: "in_advance",
|
|
41
|
+
InArrears: "in_arrears",
|
|
42
|
+
} as const;
|
|
43
|
+
/**
|
|
44
|
+
* Payment term for fee items. Null for metered/manual lines
|
|
45
|
+
*/
|
|
46
|
+
export type LineItemPaymentTerm = ClosedEnum<typeof LineItemPaymentTerm>;
|
|
47
|
+
|
|
48
|
+
export type LineItem = {
|
|
49
|
+
/**
|
|
50
|
+
* The line item ID
|
|
51
|
+
*/
|
|
52
|
+
id: string;
|
|
53
|
+
/**
|
|
54
|
+
* The subscription this line item belongs to
|
|
55
|
+
*/
|
|
56
|
+
subscriptionId: string;
|
|
57
|
+
/**
|
|
58
|
+
* The price ID associated with this line item
|
|
59
|
+
*/
|
|
60
|
+
priceId?: string | null | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The invoice ID if this item has been invoiced
|
|
63
|
+
*/
|
|
64
|
+
invoiceId?: string | null | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The type of line item
|
|
67
|
+
*/
|
|
68
|
+
type: LineItemType;
|
|
69
|
+
/**
|
|
70
|
+
* Whether this item is pending or already on an invoice
|
|
71
|
+
*/
|
|
72
|
+
status: LineItemStatus;
|
|
73
|
+
/**
|
|
74
|
+
* Human-readable label shown on the invoice
|
|
75
|
+
*/
|
|
76
|
+
displayName: string;
|
|
77
|
+
/**
|
|
78
|
+
* Optional longer description
|
|
79
|
+
*/
|
|
80
|
+
description?: string | null | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* ISO 4217 currency code (e.g., USD)
|
|
83
|
+
*/
|
|
84
|
+
currency: string;
|
|
85
|
+
/**
|
|
86
|
+
* Start of the billing period (inclusive)
|
|
87
|
+
*/
|
|
88
|
+
periodStart: Date;
|
|
89
|
+
/**
|
|
90
|
+
* End of the billing period (exclusive)
|
|
91
|
+
*/
|
|
92
|
+
periodEnd: Date;
|
|
93
|
+
/**
|
|
94
|
+
* When this line item should be collected into an invoice
|
|
95
|
+
*/
|
|
96
|
+
invoiceAt: Date;
|
|
97
|
+
/**
|
|
98
|
+
* When metered quantity was last computed
|
|
99
|
+
*/
|
|
100
|
+
calculatedAt?: Date | null | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Units sold. Null for metered lines until invoice close
|
|
103
|
+
*/
|
|
104
|
+
quantity?: string | null | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Price per unit in invoice currency
|
|
107
|
+
*/
|
|
108
|
+
unitPrice: string;
|
|
109
|
+
/**
|
|
110
|
+
* Raw metered usage. Null for fee/manual lines
|
|
111
|
+
*/
|
|
112
|
+
meteredQuantity?: string | null | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Payment term for fee items. Null for metered/manual lines
|
|
115
|
+
*/
|
|
116
|
+
paymentTerm?: LineItemPaymentTerm | null | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* quantity x unitPrice, before discounts and taxes. Defaults to '0.00' when not yet calculated
|
|
119
|
+
*/
|
|
120
|
+
subtotal?: string | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Total tax amount for this line item in decimal format. Null until invoice calculation is complete
|
|
123
|
+
*/
|
|
124
|
+
taxesTotal?: string | null | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Final total after discounts and taxes. Defaults to '0.00' when not yet calculated
|
|
127
|
+
*/
|
|
128
|
+
total?: string | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* When the line item was created
|
|
131
|
+
*/
|
|
132
|
+
createdAt: Date;
|
|
133
|
+
/**
|
|
134
|
+
* When the line item was last updated
|
|
135
|
+
*/
|
|
136
|
+
updatedAt: Date;
|
|
137
|
+
/**
|
|
138
|
+
* Real-time estimated metered usage quantity. Only present for type=metered items during an active billing period. Null for fee/manual items or when estimation is unavailable.
|
|
139
|
+
*/
|
|
140
|
+
estimatedMeteredQuantity?: string | null | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Real-time estimated subtotal based on current metered usage. Only present for type=metered items during an active billing period. Null for fee/manual items or when estimation is unavailable.
|
|
143
|
+
*/
|
|
144
|
+
estimatedSubtotal?: string | null | undefined;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/** @internal */
|
|
148
|
+
export const LineItemType$inboundSchema: z.ZodNativeEnum<typeof LineItemType> =
|
|
149
|
+
z.nativeEnum(LineItemType);
|
|
150
|
+
|
|
151
|
+
/** @internal */
|
|
152
|
+
export const LineItemStatus$inboundSchema: z.ZodNativeEnum<
|
|
153
|
+
typeof LineItemStatus
|
|
154
|
+
> = z.nativeEnum(LineItemStatus);
|
|
155
|
+
|
|
156
|
+
/** @internal */
|
|
157
|
+
export const LineItemPaymentTerm$inboundSchema: z.ZodNativeEnum<
|
|
158
|
+
typeof LineItemPaymentTerm
|
|
159
|
+
> = z.nativeEnum(LineItemPaymentTerm);
|
|
160
|
+
|
|
161
|
+
/** @internal */
|
|
162
|
+
export const LineItem$inboundSchema: z.ZodType<
|
|
163
|
+
LineItem,
|
|
164
|
+
z.ZodTypeDef,
|
|
165
|
+
unknown
|
|
166
|
+
> = z.object({
|
|
167
|
+
id: z.string(),
|
|
168
|
+
subscriptionId: z.string(),
|
|
169
|
+
priceId: z.nullable(z.string()).optional(),
|
|
170
|
+
invoiceId: z.nullable(z.string()).optional(),
|
|
171
|
+
type: LineItemType$inboundSchema,
|
|
172
|
+
status: LineItemStatus$inboundSchema,
|
|
173
|
+
displayName: z.string(),
|
|
174
|
+
description: z.nullable(z.string()).optional(),
|
|
175
|
+
currency: z.string(),
|
|
176
|
+
periodStart: z.string().datetime({ offset: true }).transform(v =>
|
|
177
|
+
new Date(v)
|
|
178
|
+
),
|
|
179
|
+
periodEnd: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
180
|
+
invoiceAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
181
|
+
calculatedAt: z.nullable(
|
|
182
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
183
|
+
).optional(),
|
|
184
|
+
quantity: z.nullable(z.string()).optional(),
|
|
185
|
+
unitPrice: z.string(),
|
|
186
|
+
meteredQuantity: z.nullable(z.string()).optional(),
|
|
187
|
+
paymentTerm: z.nullable(LineItemPaymentTerm$inboundSchema).optional(),
|
|
188
|
+
subtotal: z.string().optional(),
|
|
189
|
+
taxesTotal: z.nullable(z.string()).optional(),
|
|
190
|
+
total: z.string().optional(),
|
|
191
|
+
createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
192
|
+
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
193
|
+
estimatedMeteredQuantity: z.nullable(z.string()).optional(),
|
|
194
|
+
estimatedSubtotal: z.nullable(z.string()).optional(),
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export function lineItemFromJSON(
|
|
198
|
+
jsonString: string,
|
|
199
|
+
): SafeParseResult<LineItem, SDKValidationError> {
|
|
200
|
+
return safeParse(
|
|
201
|
+
jsonString,
|
|
202
|
+
(x) => LineItem$inboundSchema.parse(JSON.parse(x)),
|
|
203
|
+
`Failed to parse 'LineItem' from JSON`,
|
|
204
|
+
);
|
|
205
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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 { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
import { LineItem, LineItem$inboundSchema } from "./lineitem.js";
|
|
11
|
+
import {
|
|
12
|
+
LineItemsSummary,
|
|
13
|
+
LineItemsSummary$inboundSchema,
|
|
14
|
+
} from "./lineitemssummary.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The object type
|
|
18
|
+
*/
|
|
19
|
+
export const LineItemsResponseObject = {
|
|
20
|
+
List: "list",
|
|
21
|
+
} as const;
|
|
22
|
+
/**
|
|
23
|
+
* The object type
|
|
24
|
+
*/
|
|
25
|
+
export type LineItemsResponseObject = ClosedEnum<
|
|
26
|
+
typeof LineItemsResponseObject
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export type LineItemsResponse = {
|
|
30
|
+
/**
|
|
31
|
+
* The object type
|
|
32
|
+
*/
|
|
33
|
+
object: LineItemsResponseObject;
|
|
34
|
+
/**
|
|
35
|
+
* Array of line items
|
|
36
|
+
*/
|
|
37
|
+
data: Array<LineItem>;
|
|
38
|
+
/**
|
|
39
|
+
* Total number of matching line items
|
|
40
|
+
*/
|
|
41
|
+
totalCount: number;
|
|
42
|
+
summary: LineItemsSummary;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const LineItemsResponseObject$inboundSchema: z.ZodNativeEnum<
|
|
47
|
+
typeof LineItemsResponseObject
|
|
48
|
+
> = z.nativeEnum(LineItemsResponseObject);
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const LineItemsResponse$inboundSchema: z.ZodType<
|
|
52
|
+
LineItemsResponse,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
unknown
|
|
55
|
+
> = z.object({
|
|
56
|
+
object: LineItemsResponseObject$inboundSchema,
|
|
57
|
+
data: z.array(LineItem$inboundSchema),
|
|
58
|
+
totalCount: z.number().int(),
|
|
59
|
+
summary: LineItemsSummary$inboundSchema,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export function lineItemsResponseFromJSON(
|
|
63
|
+
jsonString: string,
|
|
64
|
+
): SafeParseResult<LineItemsResponse, SDKValidationError> {
|
|
65
|
+
return safeParse(
|
|
66
|
+
jsonString,
|
|
67
|
+
(x) => LineItemsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
68
|
+
`Failed to parse 'LineItemsResponse' from JSON`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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 LineItemsSummary = {
|
|
11
|
+
/**
|
|
12
|
+
* Sum of fee items with known subtotals in decimal format
|
|
13
|
+
*/
|
|
14
|
+
feeSubtotal: string;
|
|
15
|
+
/**
|
|
16
|
+
* Sum of estimated metered amounts in decimal format
|
|
17
|
+
*/
|
|
18
|
+
meteredEstimatedSubtotal: string;
|
|
19
|
+
/**
|
|
20
|
+
* ISO 4217 currency code
|
|
21
|
+
*/
|
|
22
|
+
currency: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const LineItemsSummary$inboundSchema: z.ZodType<
|
|
27
|
+
LineItemsSummary,
|
|
28
|
+
z.ZodTypeDef,
|
|
29
|
+
unknown
|
|
30
|
+
> = z.object({
|
|
31
|
+
feeSubtotal: z.string(),
|
|
32
|
+
meteredEstimatedSubtotal: z.string(),
|
|
33
|
+
currency: z.string(),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export function lineItemsSummaryFromJSON(
|
|
37
|
+
jsonString: string,
|
|
38
|
+
): SafeParseResult<LineItemsSummary, SDKValidationError> {
|
|
39
|
+
return safeParse(
|
|
40
|
+
jsonString,
|
|
41
|
+
(x) => LineItemsSummary$inboundSchema.parse(JSON.parse(x)),
|
|
42
|
+
`Failed to parse 'LineItemsSummary' from JSON`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -55,6 +55,7 @@ export * from "./listentitlements.js";
|
|
|
55
55
|
export * from "./listfeatures.js";
|
|
56
56
|
export * from "./listfees.js";
|
|
57
57
|
export * from "./listinvoices.js";
|
|
58
|
+
export * from "./listlineitems.js";
|
|
58
59
|
export * from "./listpayments.js";
|
|
59
60
|
export * from "./listplans.js";
|
|
60
61
|
export * from "./listprices.js";
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Filter by line item status. 'pending' returns items not yet on an invoice, 'invoiced' returns items already assigned to an invoice. Omit to return both. Cannot be combined with invoiceId — when filtering by invoice ID all statuses are returned.
|
|
10
|
+
*/
|
|
11
|
+
export const ListLineItemsStatus = {
|
|
12
|
+
Pending: "pending",
|
|
13
|
+
Invoiced: "invoiced",
|
|
14
|
+
} as const;
|
|
15
|
+
/**
|
|
16
|
+
* Filter by line item status. 'pending' returns items not yet on an invoice, 'invoiced' returns items already assigned to an invoice. Omit to return both. Cannot be combined with invoiceId — when filtering by invoice ID all statuses are returned.
|
|
17
|
+
*/
|
|
18
|
+
export type ListLineItemsStatus = ClosedEnum<typeof ListLineItemsStatus>;
|
|
19
|
+
|
|
20
|
+
export type ListLineItemsRequest = {
|
|
21
|
+
/**
|
|
22
|
+
* Filter by subscription ID. At least one of subscriptionId or invoiceId must be provided.
|
|
23
|
+
*/
|
|
24
|
+
subscriptionId?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Filter by line item status. 'pending' returns items not yet on an invoice, 'invoiced' returns items already assigned to an invoice. Omit to return both. Cannot be combined with invoiceId — when filtering by invoice ID all statuses are returned.
|
|
27
|
+
*/
|
|
28
|
+
status?: ListLineItemsStatus | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Filter by invoice ID. When provided without subscriptionId, returns all line items for that invoice. At least one of subscriptionId or invoiceId must be provided.
|
|
31
|
+
*/
|
|
32
|
+
invoiceId?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum number of line items to return
|
|
35
|
+
*/
|
|
36
|
+
limit?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Number of line items to skip for pagination
|
|
39
|
+
*/
|
|
40
|
+
offset?: number | undefined;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const ListLineItemsStatus$outboundSchema: z.ZodNativeEnum<
|
|
45
|
+
typeof ListLineItemsStatus
|
|
46
|
+
> = z.nativeEnum(ListLineItemsStatus);
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
export type ListLineItemsRequest$Outbound = {
|
|
50
|
+
subscriptionId?: string | undefined;
|
|
51
|
+
status?: string | undefined;
|
|
52
|
+
invoiceId?: string | undefined;
|
|
53
|
+
limit: number;
|
|
54
|
+
offset: number;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export const ListLineItemsRequest$outboundSchema: z.ZodType<
|
|
59
|
+
ListLineItemsRequest$Outbound,
|
|
60
|
+
z.ZodTypeDef,
|
|
61
|
+
ListLineItemsRequest
|
|
62
|
+
> = z.object({
|
|
63
|
+
subscriptionId: z.string().optional(),
|
|
64
|
+
status: ListLineItemsStatus$outboundSchema.optional(),
|
|
65
|
+
invoiceId: z.string().optional(),
|
|
66
|
+
limit: z.number().int().default(100),
|
|
67
|
+
offset: z.number().int().default(0),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export function listLineItemsRequestToJSON(
|
|
71
|
+
listLineItemsRequest: ListLineItemsRequest,
|
|
72
|
+
): string {
|
|
73
|
+
return JSON.stringify(
|
|
74
|
+
ListLineItemsRequest$outboundSchema.parse(listLineItemsRequest),
|
|
75
|
+
);
|
|
76
|
+
}
|
package/src/models/payment.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const PaymentObject = {
|
|
|
13
13
|
} as const;
|
|
14
14
|
export type PaymentObject = ClosedEnum<typeof PaymentObject>;
|
|
15
15
|
|
|
16
|
-
export type
|
|
16
|
+
export type PaymentLineItem = {
|
|
17
17
|
description?: string | undefined;
|
|
18
18
|
amount?: string | undefined;
|
|
19
19
|
quantity?: number | undefined;
|
|
@@ -71,7 +71,7 @@ export type Payment = {
|
|
|
71
71
|
/**
|
|
72
72
|
* Breakdown of what the customer is being charged for.
|
|
73
73
|
*/
|
|
74
|
-
lineItems?: Array<
|
|
74
|
+
lineItems?: Array<PaymentLineItem> | undefined;
|
|
75
75
|
/**
|
|
76
76
|
* Current status of the payment.
|
|
77
77
|
*/
|
|
@@ -92,8 +92,8 @@ export const PaymentObject$inboundSchema: z.ZodNativeEnum<
|
|
|
92
92
|
> = z.nativeEnum(PaymentObject);
|
|
93
93
|
|
|
94
94
|
/** @internal */
|
|
95
|
-
export const
|
|
96
|
-
|
|
95
|
+
export const PaymentLineItem$inboundSchema: z.ZodType<
|
|
96
|
+
PaymentLineItem,
|
|
97
97
|
z.ZodTypeDef,
|
|
98
98
|
unknown
|
|
99
99
|
> = z.object({
|
|
@@ -102,13 +102,13 @@ export const LineItem$inboundSchema: z.ZodType<
|
|
|
102
102
|
quantity: z.number().int().optional(),
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
export function
|
|
105
|
+
export function paymentLineItemFromJSON(
|
|
106
106
|
jsonString: string,
|
|
107
|
-
): SafeParseResult<
|
|
107
|
+
): SafeParseResult<PaymentLineItem, SDKValidationError> {
|
|
108
108
|
return safeParse(
|
|
109
109
|
jsonString,
|
|
110
|
-
(x) =>
|
|
111
|
-
`Failed to parse '
|
|
110
|
+
(x) => PaymentLineItem$inboundSchema.parse(JSON.parse(x)),
|
|
111
|
+
`Failed to parse 'PaymentLineItem' from JSON`,
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -129,7 +129,7 @@ export const Payment$inboundSchema: z.ZodType<Payment, z.ZodTypeDef, unknown> =
|
|
|
129
129
|
idempotencyKey: z.string().optional(),
|
|
130
130
|
reference: z.string().optional(),
|
|
131
131
|
metadata: z.record(z.string()).optional(),
|
|
132
|
-
lineItems: z.array(z.lazy(() =>
|
|
132
|
+
lineItems: z.array(z.lazy(() => PaymentLineItem$inboundSchema)).optional(),
|
|
133
133
|
status: PaymentStatus$inboundSchema,
|
|
134
134
|
expiresAt: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
135
135
|
.optional(),
|
package/src/sdk/invoicesv2.ts
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { invoicesV2CreateLineItem } from "../funcs/invoicesV2CreateLineItem.js";
|
|
5
6
|
import { invoicesV2Get } from "../funcs/invoicesV2Get.js";
|
|
6
7
|
import { invoicesV2GetLineItems } from "../funcs/invoicesV2GetLineItems.js";
|
|
7
8
|
import { invoicesV2List } from "../funcs/invoicesV2List.js";
|
|
9
|
+
import { invoicesV2ListLineItems } from "../funcs/invoicesV2ListLineItems.js";
|
|
8
10
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
9
11
|
import * as models from "../models/index.js";
|
|
10
12
|
import * as operations from "../models/operations/index.js";
|
|
@@ -28,6 +30,40 @@ export class InvoicesV2 extends ClientSDK {
|
|
|
28
30
|
));
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
* List Line Items
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* List pending and invoiced line items for a subscription from the billing database. Returns exact fee amounts and estimated metered charges.
|
|
38
|
+
*/
|
|
39
|
+
async listLineItems(
|
|
40
|
+
request?: operations.ListLineItemsRequest | undefined,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): Promise<models.LineItemsResponse> {
|
|
43
|
+
return unwrapAsync(invoicesV2ListLineItems(
|
|
44
|
+
this,
|
|
45
|
+
request,
|
|
46
|
+
options,
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create Manual Line Item
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Create a manual line item for a billing v1 subscription. Manual line items are ad-hoc charges or credits that flow through the same collection pipeline as auto-generated items. Exactly one of subscriptionId or invoiceId must be provided.
|
|
55
|
+
*/
|
|
56
|
+
async createLineItem(
|
|
57
|
+
request: models.CreateManualLineItemRequest,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<models.LineItem> {
|
|
60
|
+
return unwrapAsync(invoicesV2CreateLineItem(
|
|
61
|
+
this,
|
|
62
|
+
request,
|
|
63
|
+
options,
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
31
67
|
/**
|
|
32
68
|
* Get
|
|
33
69
|
*
|