@paygentic/sdk 0.6.16 → 0.6.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.
- package/README.md +7 -3
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.d.ts +19 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.d.ts.map +1 -0
- package/dist/commonjs/funcs/invoicesV2CreateLineItem.js +122 -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/createlineitem.d.ts +18 -0
- package/dist/commonjs/models/operations/createlineitem.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createlineitem.js +57 -0
- package/dist/commonjs/models/operations/createlineitem.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -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/models/subscription.d.ts +39 -27
- package/dist/commonjs/models/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/subscription.js +32 -18
- package/dist/commonjs/models/subscription.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 +19 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.d.ts.map +1 -0
- package/dist/esm/funcs/invoicesV2CreateLineItem.js +86 -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/createlineitem.d.ts +18 -0
- package/dist/esm/models/operations/createlineitem.d.ts.map +1 -0
- package/dist/esm/models/operations/createlineitem.js +20 -0
- package/dist/esm/models/operations/createlineitem.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -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/models/subscription.d.ts +39 -27
- package/dist/esm/models/subscription.d.ts.map +1 -1
- package/dist/esm/models/subscription.js +28 -16
- package/dist/esm/models/subscription.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 +182 -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/createlineitem.ts +45 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/listlineitems.ts +76 -0
- package/src/models/payment.ts +9 -9
- package/src/models/subscription.ts +89 -41
- package/src/sdk/invoicesv2.ts +36 -0
package/src/models/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./billablemetric.js";
|
|
|
9
9
|
export * from "./booleanentitlementdetail.js";
|
|
10
10
|
export * from "./createdisputerequest.js";
|
|
11
11
|
export * from "./createentitlementrequest.js";
|
|
12
|
+
export * from "./createmanuallineitemrequest.js";
|
|
12
13
|
export * from "./createrulerequest.js";
|
|
13
14
|
export * from "./createusageeventrequest.js";
|
|
14
15
|
export * from "./customer.js";
|
|
@@ -26,6 +27,9 @@ export * from "./invoice.js";
|
|
|
26
27
|
export * from "./invoicelineitem.js";
|
|
27
28
|
export * from "./invoicelineitemsresponse.js";
|
|
28
29
|
export * from "./issueentitlementrequest.js";
|
|
30
|
+
export * from "./lineitem.js";
|
|
31
|
+
export * from "./lineitemsresponse.js";
|
|
32
|
+
export * from "./lineitemssummary.js";
|
|
29
33
|
export * from "./meteredentitlementdetail.js";
|
|
30
34
|
export * from "./offsetpagination.js";
|
|
31
35
|
export * from "./payment.js";
|
|
@@ -23,14 +23,16 @@ export type EventType = ClosedEnum<typeof EventType>;
|
|
|
23
23
|
/**
|
|
24
24
|
* Type of line item: 'charge' for regular billing, 'refund' for refunded items (amounts are negated)
|
|
25
25
|
*/
|
|
26
|
-
export const
|
|
26
|
+
export const InvoiceLineItemLineItemType = {
|
|
27
27
|
Charge: "charge",
|
|
28
28
|
Refund: "refund",
|
|
29
29
|
} as const;
|
|
30
30
|
/**
|
|
31
31
|
* Type of line item: 'charge' for regular billing, 'refund' for refunded items (amounts are negated)
|
|
32
32
|
*/
|
|
33
|
-
export type
|
|
33
|
+
export type InvoiceLineItemLineItemType = ClosedEnum<
|
|
34
|
+
typeof InvoiceLineItemLineItemType
|
|
35
|
+
>;
|
|
34
36
|
|
|
35
37
|
export type InvoiceLineItem = {
|
|
36
38
|
/**
|
|
@@ -56,7 +58,7 @@ export type InvoiceLineItem = {
|
|
|
56
58
|
/**
|
|
57
59
|
* Type of line item: 'charge' for regular billing, 'refund' for refunded items (amounts are negated)
|
|
58
60
|
*/
|
|
59
|
-
lineItemType:
|
|
61
|
+
lineItemType: InvoiceLineItemLineItemType;
|
|
60
62
|
/**
|
|
61
63
|
* The meter event ID (usage events only)
|
|
62
64
|
*/
|
|
@@ -104,8 +106,9 @@ export const EventType$inboundSchema: z.ZodNativeEnum<typeof EventType> = z
|
|
|
104
106
|
.nativeEnum(EventType);
|
|
105
107
|
|
|
106
108
|
/** @internal */
|
|
107
|
-
export const
|
|
108
|
-
|
|
109
|
+
export const InvoiceLineItemLineItemType$inboundSchema: z.ZodNativeEnum<
|
|
110
|
+
typeof InvoiceLineItemLineItemType
|
|
111
|
+
> = z.nativeEnum(InvoiceLineItemLineItemType);
|
|
109
112
|
|
|
110
113
|
/** @internal */
|
|
111
114
|
export const InvoiceLineItem$inboundSchema: z.ZodType<
|
|
@@ -118,7 +121,7 @@ export const InvoiceLineItem$inboundSchema: z.ZodType<
|
|
|
118
121
|
eventSourceId: z.string(),
|
|
119
122
|
billableMetricId: z.string(),
|
|
120
123
|
invoiceDisplayName: z.string(),
|
|
121
|
-
lineItemType:
|
|
124
|
+
lineItemType: InvoiceLineItemLineItemType$inboundSchema,
|
|
122
125
|
meterEventId: z.string(),
|
|
123
126
|
metricDescription: z.string(),
|
|
124
127
|
metricName: z.string(),
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
8
|
+
|
|
9
|
+
export type CreateLineItemRequest = {
|
|
10
|
+
/**
|
|
11
|
+
* Optional idempotency key. If provided, duplicate requests with the same key return the previously created item.
|
|
12
|
+
*/
|
|
13
|
+
idempotencyKey?: string | undefined;
|
|
14
|
+
createManualLineItemRequest: models.CreateManualLineItemRequest;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export type CreateLineItemRequest$Outbound = {
|
|
19
|
+
"Idempotency-Key"?: string | undefined;
|
|
20
|
+
CreateManualLineItemRequest: models.CreateManualLineItemRequest$Outbound;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const CreateLineItemRequest$outboundSchema: z.ZodType<
|
|
25
|
+
CreateLineItemRequest$Outbound,
|
|
26
|
+
z.ZodTypeDef,
|
|
27
|
+
CreateLineItemRequest
|
|
28
|
+
> = z.object({
|
|
29
|
+
idempotencyKey: z.string().optional(),
|
|
30
|
+
createManualLineItemRequest:
|
|
31
|
+
models.CreateManualLineItemRequest$outboundSchema,
|
|
32
|
+
}).transform((v) => {
|
|
33
|
+
return remap$(v, {
|
|
34
|
+
idempotencyKey: "Idempotency-Key",
|
|
35
|
+
createManualLineItemRequest: "CreateManualLineItemRequest",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export function createLineItemRequestToJSON(
|
|
40
|
+
createLineItemRequest: CreateLineItemRequest,
|
|
41
|
+
): string {
|
|
42
|
+
return JSON.stringify(
|
|
43
|
+
CreateLineItemRequest$outboundSchema.parse(createLineItemRequest),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -11,6 +11,7 @@ export * from "./createbillablemetric.js";
|
|
|
11
11
|
export * from "./createcustomer.js";
|
|
12
12
|
export * from "./createfeature.js";
|
|
13
13
|
export * from "./createfee.js";
|
|
14
|
+
export * from "./createlineitem.js";
|
|
14
15
|
export * from "./createpayment.js";
|
|
15
16
|
export * from "./createplan.js";
|
|
16
17
|
export * from "./createprice.js";
|
|
@@ -55,6 +56,7 @@ export * from "./listentitlements.js";
|
|
|
55
56
|
export * from "./listfeatures.js";
|
|
56
57
|
export * from "./listfees.js";
|
|
57
58
|
export * from "./listinvoices.js";
|
|
59
|
+
export * from "./listlineitems.js";
|
|
58
60
|
export * from "./listpayments.js";
|
|
59
61
|
export * from "./listplans.js";
|
|
60
62
|
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(),
|