@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
|
@@ -6,13 +6,7 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
6
6
|
export const SubscriptionObject = {
|
|
7
7
|
Subscription: "subscription",
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
* Payment status
|
|
11
|
-
*/
|
|
12
|
-
export const StatusPending = {
|
|
13
|
-
Pending: "pending",
|
|
14
|
-
};
|
|
15
|
-
export const SubscriptionStatus = {
|
|
9
|
+
export const SubscriptionStatusEnum = {
|
|
16
10
|
PendingPayment: "pending_payment",
|
|
17
11
|
Active: "active",
|
|
18
12
|
Terminated: "terminated",
|
|
@@ -20,6 +14,15 @@ export const SubscriptionStatus = {
|
|
|
20
14
|
/** @internal */
|
|
21
15
|
export const SubscriptionObject$inboundSchema = z.nativeEnum(SubscriptionObject);
|
|
22
16
|
/** @internal */
|
|
17
|
+
export const PaymentPaid$inboundSchema = z.object({
|
|
18
|
+
invoiceId: z.string(),
|
|
19
|
+
amount: z.string(),
|
|
20
|
+
status: z.literal("paid"),
|
|
21
|
+
});
|
|
22
|
+
export function paymentPaidFromJSON(jsonString) {
|
|
23
|
+
return safeParse(jsonString, (x) => PaymentPaid$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentPaid' from JSON`);
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
23
26
|
export const Breakdown$inboundSchema = z.object({
|
|
24
27
|
upfrontCharges: z.string(),
|
|
25
28
|
walletCharge: z.string(),
|
|
@@ -28,21 +31,27 @@ export function breakdownFromJSON(jsonString) {
|
|
|
28
31
|
return safeParse(jsonString, (x) => Breakdown$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Breakdown' from JSON`);
|
|
29
32
|
}
|
|
30
33
|
/** @internal */
|
|
31
|
-
export const
|
|
32
|
-
/** @internal */
|
|
33
|
-
export const SubscriptionPayment$inboundSchema = z.object({
|
|
34
|
+
export const PaymentPending$inboundSchema = z.object({
|
|
34
35
|
amount: z.string(),
|
|
35
36
|
breakdown: z.lazy(() => Breakdown$inboundSchema),
|
|
36
37
|
checkoutUrl: z.string(),
|
|
37
38
|
invoiceId: z.string().optional(),
|
|
38
39
|
paymentSessionId: z.string(),
|
|
39
|
-
status:
|
|
40
|
+
status: z.literal("pending"),
|
|
40
41
|
});
|
|
41
|
-
export function
|
|
42
|
-
return safeParse(jsonString, (x) =>
|
|
42
|
+
export function paymentPendingFromJSON(jsonString) {
|
|
43
|
+
return safeParse(jsonString, (x) => PaymentPending$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentPending' from JSON`);
|
|
44
|
+
}
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const PaymentUnion$inboundSchema = z.union([
|
|
47
|
+
z.lazy(() => PaymentPending$inboundSchema),
|
|
48
|
+
z.lazy(() => PaymentPaid$inboundSchema),
|
|
49
|
+
]);
|
|
50
|
+
export function paymentUnionFromJSON(jsonString) {
|
|
51
|
+
return safeParse(jsonString, (x) => PaymentUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PaymentUnion' from JSON`);
|
|
43
52
|
}
|
|
44
53
|
/** @internal */
|
|
45
|
-
export const
|
|
54
|
+
export const SubscriptionStatusEnum$inboundSchema = z.nativeEnum(SubscriptionStatusEnum);
|
|
46
55
|
/** @internal */
|
|
47
56
|
export const Subscription$inboundSchema = z.object({
|
|
48
57
|
id: z.string(),
|
|
@@ -55,12 +64,15 @@ export const Subscription$inboundSchema = z.object({
|
|
|
55
64
|
estimatedTaxRate: z.number().optional(),
|
|
56
65
|
taxExempt: z.boolean().default(false),
|
|
57
66
|
name: z.string(),
|
|
58
|
-
payment: z.
|
|
67
|
+
payment: z.union([
|
|
68
|
+
z.lazy(() => PaymentPending$inboundSchema),
|
|
69
|
+
z.lazy(() => PaymentPaid$inboundSchema),
|
|
70
|
+
]).optional(),
|
|
59
71
|
planId: z.string(),
|
|
60
72
|
prefundAmount: z.string().optional(),
|
|
61
73
|
minimumAccountBalance: z.string().optional(),
|
|
62
74
|
startedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
63
|
-
status:
|
|
75
|
+
status: SubscriptionStatusEnum$inboundSchema,
|
|
64
76
|
terminatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)).optional(),
|
|
65
77
|
terminatedBy: z.string().optional(),
|
|
66
78
|
terminationReason: z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../../src/models/subscription.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,cAAc;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../../src/models/subscription.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,cAAc;CACpB,CAAC;AAmEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,cAAc,EAAE,iBAAiB;IACjC,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;CAChB,CAAC;AAiEX,gBAAgB;AAChB,MAAM,CAAC,MAAM,gCAAgC,GAEzC,CAAC,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAErC,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAIlC,CAAC,CAAC,MAAM,CAAC;IACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;CAC1B,CAAC,CAAC;AAEH,MAAM,UAAU,mBAAmB,CACjC,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACrD,yCAAyC,CAC1C,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAIhC,CAAC,CAAC,MAAM,CAAC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AC;AAEH,MAAM,UAAU,oBAAoB,CAClC,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACtD,0CAA0C,CAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -9,6 +9,20 @@ export declare class InvoicesV2 extends ClientSDK {
|
|
|
9
9
|
* List invoices with optional filters. Platform users can use nextActionAt=ready to get invoices ready for processing.
|
|
10
10
|
*/
|
|
11
11
|
list(request?: operations.ListInvoicesRequest | undefined, options?: RequestOptions): Promise<operations.ListInvoicesResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* List Line Items
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* List pending and invoiced line items for a subscription from the billing database. Returns exact fee amounts and estimated metered charges.
|
|
17
|
+
*/
|
|
18
|
+
listLineItems(request?: operations.ListLineItemsRequest | undefined, options?: RequestOptions): Promise<models.LineItemsResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Create Manual Line Item
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* 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.
|
|
24
|
+
*/
|
|
25
|
+
createLineItem(request: operations.CreateLineItemRequest, options?: RequestOptions): Promise<models.LineItem>;
|
|
12
26
|
/**
|
|
13
27
|
* Get
|
|
14
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoicesv2.d.ts","sourceRoot":"","sources":["../../../src/sdk/invoicesv2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invoicesv2.d.ts","sourceRoot":"","sources":["../../../src/sdk/invoicesv2.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,UAAW,SAAQ,SAAS;IACvC;;;;;OAKG;IACG,IAAI,CACR,OAAO,CAAC,EAAE,UAAU,CAAC,mBAAmB,GAAG,SAAS,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC;IAQ3C;;;;;OAKG;IACG,aAAa,CACjB,OAAO,CAAC,EAAE,UAAU,CAAC,oBAAoB,GAAG,SAAS,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;IAQpC;;;;;OAKG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,CAAC,qBAAqB,EACzC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IAQ3B;;;;;OAKG;IACG,GAAG,CACP,OAAO,EAAE,UAAU,CAAC,iBAAiB,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;IAQ1B;;;;;OAKG;IACG,YAAY,CAChB,OAAO,EAAE,UAAU,CAAC,0BAA0B,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAC;CAO5C"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
+
import { invoicesV2CreateLineItem } from "../funcs/invoicesV2CreateLineItem.js";
|
|
4
5
|
import { invoicesV2Get } from "../funcs/invoicesV2Get.js";
|
|
5
6
|
import { invoicesV2GetLineItems } from "../funcs/invoicesV2GetLineItems.js";
|
|
6
7
|
import { invoicesV2List } from "../funcs/invoicesV2List.js";
|
|
8
|
+
import { invoicesV2ListLineItems } from "../funcs/invoicesV2ListLineItems.js";
|
|
7
9
|
import { ClientSDK } from "../lib/sdks.js";
|
|
8
10
|
import { unwrapAsync } from "../types/fp.js";
|
|
9
11
|
export class InvoicesV2 extends ClientSDK {
|
|
@@ -16,6 +18,24 @@ export class InvoicesV2 extends ClientSDK {
|
|
|
16
18
|
async list(request, options) {
|
|
17
19
|
return unwrapAsync(invoicesV2List(this, request, options));
|
|
18
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* List Line Items
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* List pending and invoiced line items for a subscription from the billing database. Returns exact fee amounts and estimated metered charges.
|
|
26
|
+
*/
|
|
27
|
+
async listLineItems(request, options) {
|
|
28
|
+
return unwrapAsync(invoicesV2ListLineItems(this, request, options));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create Manual Line Item
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* 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.
|
|
35
|
+
*/
|
|
36
|
+
async createLineItem(request, options) {
|
|
37
|
+
return unwrapAsync(invoicesV2CreateLineItem(this, request, options));
|
|
38
|
+
}
|
|
19
39
|
/**
|
|
20
40
|
* Get
|
|
21
41
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoicesv2.js","sourceRoot":"","sources":["../../../src/sdk/invoicesv2.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,OAA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AAwB;QAExB,OAAO,WAAW,CAAC,uBAAuB,CACxC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAClB,OAAyC,EACzC,OAAwB;QAExB,OAAO,WAAW,CAAC,wBAAwB,CACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,OAAqC,EACrC,OAAwB;QAExB,OAAO,WAAW,CAAC,aAAa,CAC9B,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAChB,OAA8C,EAC9C,OAAwB;QAExB,OAAO,WAAW,CAAC,sBAAsB,CACvC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PaygenticCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { PaygenticError } from "../models/errors/paygenticerror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as models from "../models/index.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Create Manual Line Item
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* 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.
|
|
34
|
+
*/
|
|
35
|
+
export function invoicesV2CreateLineItem(
|
|
36
|
+
client: PaygenticCore,
|
|
37
|
+
request: operations.CreateLineItemRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
models.LineItem,
|
|
42
|
+
| errors.BadRequest
|
|
43
|
+
| errors.ErrorT
|
|
44
|
+
| PaygenticError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: PaygenticCore,
|
|
63
|
+
request: operations.CreateLineItemRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
models.LineItem,
|
|
69
|
+
| errors.BadRequest
|
|
70
|
+
| errors.ErrorT
|
|
71
|
+
| PaygenticError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) => operations.CreateLineItemRequest$outboundSchema.parse(value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = encodeJSON("body", payload.CreateManualLineItemRequest, {
|
|
93
|
+
explode: true,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const path = pathToFunc("/v2/invoices/lineItems")();
|
|
97
|
+
|
|
98
|
+
const headers = new Headers(compactMap({
|
|
99
|
+
"Content-Type": "application/json",
|
|
100
|
+
Accept: "application/json",
|
|
101
|
+
"Idempotency-Key": encodeSimple(
|
|
102
|
+
"Idempotency-Key",
|
|
103
|
+
payload["Idempotency-Key"],
|
|
104
|
+
{ explode: false, charEncoding: "none" },
|
|
105
|
+
),
|
|
106
|
+
}));
|
|
107
|
+
|
|
108
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
109
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
110
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
111
|
+
|
|
112
|
+
const context = {
|
|
113
|
+
options: client._options,
|
|
114
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
115
|
+
operationID: "createLineItem",
|
|
116
|
+
oAuth2Scopes: null,
|
|
117
|
+
|
|
118
|
+
resolvedSecurity: requestSecurity,
|
|
119
|
+
|
|
120
|
+
securitySource: client._options.bearerAuth,
|
|
121
|
+
retryConfig: options?.retries
|
|
122
|
+
|| client._options.retryConfig
|
|
123
|
+
|| { strategy: "none" },
|
|
124
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const requestRes = client._createRequest(context, {
|
|
128
|
+
security: requestSecurity,
|
|
129
|
+
method: "POST",
|
|
130
|
+
baseURL: options?.serverURL,
|
|
131
|
+
path: path,
|
|
132
|
+
headers: headers,
|
|
133
|
+
body: body,
|
|
134
|
+
userAgent: client._options.userAgent,
|
|
135
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
136
|
+
}, options);
|
|
137
|
+
if (!requestRes.ok) {
|
|
138
|
+
return [requestRes, { status: "invalid" }];
|
|
139
|
+
}
|
|
140
|
+
const req = requestRes.value;
|
|
141
|
+
|
|
142
|
+
const doResult = await client._do(req, {
|
|
143
|
+
context,
|
|
144
|
+
errorCodes: ["400", "401", "403", "404", "409", "422", "4XX", "500", "5XX"],
|
|
145
|
+
retryConfig: context.retryConfig,
|
|
146
|
+
retryCodes: context.retryCodes,
|
|
147
|
+
});
|
|
148
|
+
if (!doResult.ok) {
|
|
149
|
+
return [doResult, { status: "request-error", request: req }];
|
|
150
|
+
}
|
|
151
|
+
const response = doResult.value;
|
|
152
|
+
|
|
153
|
+
const responseFields = {
|
|
154
|
+
HttpMeta: { Response: response, Request: req },
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const [result] = await M.match<
|
|
158
|
+
models.LineItem,
|
|
159
|
+
| errors.BadRequest
|
|
160
|
+
| errors.ErrorT
|
|
161
|
+
| PaygenticError
|
|
162
|
+
| ResponseValidationError
|
|
163
|
+
| ConnectionError
|
|
164
|
+
| RequestAbortedError
|
|
165
|
+
| RequestTimeoutError
|
|
166
|
+
| InvalidRequestError
|
|
167
|
+
| UnexpectedClientError
|
|
168
|
+
| SDKValidationError
|
|
169
|
+
>(
|
|
170
|
+
M.json([200, 201], models.LineItem$inboundSchema),
|
|
171
|
+
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
172
|
+
M.jsonErr([401, 403, 404, 409, 422], errors.ErrorT$inboundSchema),
|
|
173
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
174
|
+
M.fail("4XX"),
|
|
175
|
+
M.fail("5XX"),
|
|
176
|
+
)(response, req, { extraFields: responseFields });
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PaygenticCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { PaygenticError } from "../models/errors/paygenticerror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as models from "../models/index.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List Line Items
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* List pending and invoiced line items for a subscription from the billing database. Returns exact fee amounts and estimated metered charges.
|
|
34
|
+
*/
|
|
35
|
+
export function invoicesV2ListLineItems(
|
|
36
|
+
client: PaygenticCore,
|
|
37
|
+
request?: operations.ListLineItemsRequest | undefined,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
models.LineItemsResponse,
|
|
42
|
+
| errors.BadRequest
|
|
43
|
+
| errors.ErrorT
|
|
44
|
+
| PaygenticError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: PaygenticCore,
|
|
63
|
+
request?: operations.ListLineItemsRequest | undefined,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
models.LineItemsResponse,
|
|
69
|
+
| errors.BadRequest
|
|
70
|
+
| errors.ErrorT
|
|
71
|
+
| PaygenticError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) =>
|
|
86
|
+
operations.ListLineItemsRequest$outboundSchema.optional().parse(value),
|
|
87
|
+
"Input validation failed",
|
|
88
|
+
);
|
|
89
|
+
if (!parsed.ok) {
|
|
90
|
+
return [parsed, { status: "invalid" }];
|
|
91
|
+
}
|
|
92
|
+
const payload = parsed.value;
|
|
93
|
+
const body = null;
|
|
94
|
+
|
|
95
|
+
const path = pathToFunc("/v2/invoices/lineItems")();
|
|
96
|
+
|
|
97
|
+
const query = encodeFormQuery({
|
|
98
|
+
"invoiceId": payload?.invoiceId,
|
|
99
|
+
"limit": payload?.limit,
|
|
100
|
+
"offset": payload?.offset,
|
|
101
|
+
"status": payload?.status,
|
|
102
|
+
"subscriptionId": payload?.subscriptionId,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const headers = new Headers(compactMap({
|
|
106
|
+
Accept: "application/json",
|
|
107
|
+
}));
|
|
108
|
+
|
|
109
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
110
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
111
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
112
|
+
|
|
113
|
+
const context = {
|
|
114
|
+
options: client._options,
|
|
115
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
116
|
+
operationID: "listLineItems",
|
|
117
|
+
oAuth2Scopes: null,
|
|
118
|
+
|
|
119
|
+
resolvedSecurity: requestSecurity,
|
|
120
|
+
|
|
121
|
+
securitySource: client._options.bearerAuth,
|
|
122
|
+
retryConfig: options?.retries
|
|
123
|
+
|| client._options.retryConfig
|
|
124
|
+
|| { strategy: "none" },
|
|
125
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const requestRes = client._createRequest(context, {
|
|
129
|
+
security: requestSecurity,
|
|
130
|
+
method: "GET",
|
|
131
|
+
baseURL: options?.serverURL,
|
|
132
|
+
path: path,
|
|
133
|
+
headers: headers,
|
|
134
|
+
query: query,
|
|
135
|
+
body: body,
|
|
136
|
+
userAgent: client._options.userAgent,
|
|
137
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
138
|
+
}, options);
|
|
139
|
+
if (!requestRes.ok) {
|
|
140
|
+
return [requestRes, { status: "invalid" }];
|
|
141
|
+
}
|
|
142
|
+
const req = requestRes.value;
|
|
143
|
+
|
|
144
|
+
const doResult = await client._do(req, {
|
|
145
|
+
context,
|
|
146
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
147
|
+
retryConfig: context.retryConfig,
|
|
148
|
+
retryCodes: context.retryCodes,
|
|
149
|
+
});
|
|
150
|
+
if (!doResult.ok) {
|
|
151
|
+
return [doResult, { status: "request-error", request: req }];
|
|
152
|
+
}
|
|
153
|
+
const response = doResult.value;
|
|
154
|
+
|
|
155
|
+
const responseFields = {
|
|
156
|
+
HttpMeta: { Response: response, Request: req },
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const [result] = await M.match<
|
|
160
|
+
models.LineItemsResponse,
|
|
161
|
+
| errors.BadRequest
|
|
162
|
+
| errors.ErrorT
|
|
163
|
+
| PaygenticError
|
|
164
|
+
| ResponseValidationError
|
|
165
|
+
| ConnectionError
|
|
166
|
+
| RequestAbortedError
|
|
167
|
+
| RequestTimeoutError
|
|
168
|
+
| InvalidRequestError
|
|
169
|
+
| UnexpectedClientError
|
|
170
|
+
| SDKValidationError
|
|
171
|
+
>(
|
|
172
|
+
M.json(200, models.LineItemsResponse$inboundSchema),
|
|
173
|
+
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
174
|
+
M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
|
|
175
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
176
|
+
M.fail("4XX"),
|
|
177
|
+
M.fail("5XX"),
|
|
178
|
+
)(response, req, { extraFields: responseFields });
|
|
179
|
+
if (!result.ok) {
|
|
180
|
+
return [result, { status: "complete", request: req, response }];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return [result, { status: "complete", request: req, response }];
|
|
184
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -61,7 +61,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
61
61
|
export const SDK_METADATA = {
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.1.0",
|
|
64
|
-
sdkVersion: "0.6.
|
|
65
|
-
genVersion: "2.
|
|
66
|
-
userAgent: "speakeasy-sdk/typescript 0.6.
|
|
64
|
+
sdkVersion: "0.6.16",
|
|
65
|
+
genVersion: "2.856.1",
|
|
66
|
+
userAgent: "speakeasy-sdk/typescript 0.6.16 2.856.1 0.1.0 @paygentic/sdk",
|
|
67
67
|
} as const;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type CreateManualLineItemRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* The subscription ID. Exactly one of subscriptionId or invoiceId must be provided.
|
|
10
|
+
*/
|
|
11
|
+
subscriptionId?: string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The invoice ID to attach this item directly to. Exactly one of subscriptionId or invoiceId must be provided. The invoice must be in ACTIVE or CLOSING state.
|
|
14
|
+
*/
|
|
15
|
+
invoiceId?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Human-readable label shown on the invoice.
|
|
18
|
+
*/
|
|
19
|
+
displayName: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional longer description shown on the invoice.
|
|
22
|
+
*/
|
|
23
|
+
description?: string | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* ISO 4217 currency code (e.g., USD). Must match the subscription or invoice currency.
|
|
26
|
+
*/
|
|
27
|
+
currency: string;
|
|
28
|
+
/**
|
|
29
|
+
* Number of units.
|
|
30
|
+
*/
|
|
31
|
+
quantity: number;
|
|
32
|
+
/**
|
|
33
|
+
* Price per unit as a decimal amount (e.g., 29.99 for $29.99). Can be negative for credits or adjustments.
|
|
34
|
+
*/
|
|
35
|
+
unitPrice: number;
|
|
36
|
+
/**
|
|
37
|
+
* When to collect this item into an invoice. Defaults to now. Ignored when invoiceId is provided.
|
|
38
|
+
*/
|
|
39
|
+
invoiceAt?: Date | null | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Start of the billing period for display purposes. Defaults to now.
|
|
42
|
+
*/
|
|
43
|
+
periodStart?: Date | null | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* End of the billing period for display purposes. Defaults to now.
|
|
46
|
+
*/
|
|
47
|
+
periodEnd?: Date | null | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Optional caller-provided idempotency key. Auto-generated if not provided.
|
|
50
|
+
*/
|
|
51
|
+
idempotencyKey?: string | null | undefined;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
export type CreateManualLineItemRequest$Outbound = {
|
|
56
|
+
subscriptionId?: string | undefined;
|
|
57
|
+
invoiceId?: string | undefined;
|
|
58
|
+
displayName: string;
|
|
59
|
+
description?: string | null | undefined;
|
|
60
|
+
currency: string;
|
|
61
|
+
quantity: number;
|
|
62
|
+
unitPrice: number;
|
|
63
|
+
invoiceAt?: string | null | undefined;
|
|
64
|
+
periodStart?: string | null | undefined;
|
|
65
|
+
periodEnd?: string | null | undefined;
|
|
66
|
+
idempotencyKey?: string | null | undefined;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** @internal */
|
|
70
|
+
export const CreateManualLineItemRequest$outboundSchema: z.ZodType<
|
|
71
|
+
CreateManualLineItemRequest$Outbound,
|
|
72
|
+
z.ZodTypeDef,
|
|
73
|
+
CreateManualLineItemRequest
|
|
74
|
+
> = z.object({
|
|
75
|
+
subscriptionId: z.string().optional(),
|
|
76
|
+
invoiceId: z.string().optional(),
|
|
77
|
+
displayName: z.string(),
|
|
78
|
+
description: z.nullable(z.string()).optional(),
|
|
79
|
+
currency: z.string(),
|
|
80
|
+
quantity: z.number(),
|
|
81
|
+
unitPrice: z.number(),
|
|
82
|
+
invoiceAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
83
|
+
periodStart: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
84
|
+
periodEnd: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
85
|
+
idempotencyKey: z.nullable(z.string()).optional(),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export function createManualLineItemRequestToJSON(
|
|
89
|
+
createManualLineItemRequest: CreateManualLineItemRequest,
|
|
90
|
+
): string {
|
|
91
|
+
return JSON.stringify(
|
|
92
|
+
CreateManualLineItemRequest$outboundSchema.parse(
|
|
93
|
+
createManualLineItemRequest,
|
|
94
|
+
),
|
|
95
|
+
);
|
|
96
|
+
}
|