@paygentic/sdk 0.8.6 → 0.8.7
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 +1 -1
- package/dist/commonjs/funcs/invoicesV2Get.js +1 -0
- package/dist/commonjs/funcs/invoicesV2Get.js.map +1 -1
- package/dist/commonjs/funcs/invoicesV2GetLineItems.js +2 -0
- package/dist/commonjs/funcs/invoicesV2GetLineItems.js.map +1 -1
- package/dist/commonjs/funcs/invoicesV2ListLineItems.js +2 -0
- package/dist/commonjs/funcs/invoicesV2ListLineItems.js.map +1 -1
- package/dist/commonjs/funcs/itemsCreateItem.js +2 -2
- package/dist/commonjs/funcs/itemsCreateItem.js.map +1 -1
- package/dist/commonjs/funcs/itemsDeleteItem.d.ts +1 -1
- package/dist/commonjs/funcs/itemsDeleteItem.d.ts.map +1 -1
- package/dist/commonjs/funcs/itemsDeleteItem.js +2 -2
- package/dist/commonjs/funcs/itemsDeleteItem.js.map +1 -1
- package/dist/commonjs/funcs/itemsListItems.js +2 -0
- package/dist/commonjs/funcs/itemsListItems.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/billablemetric.d.ts +4 -0
- package/dist/commonjs/models/billablemetric.d.ts.map +1 -1
- package/dist/commonjs/models/billablemetric.js +1 -0
- package/dist/commonjs/models/billablemetric.js.map +1 -1
- package/dist/commonjs/models/createmanuallineitemrequest.d.ts +5 -0
- package/dist/commonjs/models/createmanuallineitemrequest.d.ts.map +1 -1
- package/dist/commonjs/models/createmanuallineitemrequest.js +1 -0
- package/dist/commonjs/models/createmanuallineitemrequest.js.map +1 -1
- package/dist/commonjs/models/fee.d.ts +4 -0
- package/dist/commonjs/models/fee.d.ts.map +1 -1
- package/dist/commonjs/models/fee.js +1 -0
- package/dist/commonjs/models/fee.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +1 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +1 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoice.d.ts +7 -2
- package/dist/commonjs/models/invoice.d.ts.map +1 -1
- package/dist/commonjs/models/invoice.js +2 -0
- package/dist/commonjs/models/invoice.js.map +1 -1
- package/dist/commonjs/models/invoicelineitem.d.ts +8 -0
- package/dist/commonjs/models/invoicelineitem.d.ts.map +1 -1
- package/dist/commonjs/models/invoicelineitem.js +2 -0
- package/dist/commonjs/models/invoicelineitem.js.map +1 -1
- package/dist/commonjs/models/invoicelineitemsresponse.d.ts +5 -0
- package/dist/commonjs/models/invoicelineitemsresponse.d.ts.map +1 -1
- package/dist/commonjs/models/invoicelineitemsresponse.js +2 -0
- package/dist/commonjs/models/invoicelineitemsresponse.js.map +1 -1
- package/dist/commonjs/models/item.d.ts +11 -0
- package/dist/commonjs/models/item.d.ts.map +1 -1
- package/dist/commonjs/models/item.js +2 -0
- package/dist/commonjs/models/item.js.map +1 -1
- package/dist/commonjs/models/lineitem.d.ts +8 -4
- package/dist/commonjs/models/lineitem.d.ts.map +1 -1
- package/dist/commonjs/models/lineitem.js +2 -1
- package/dist/commonjs/models/lineitem.js.map +1 -1
- package/dist/commonjs/models/lineitemsresponse.d.ts +5 -0
- package/dist/commonjs/models/lineitemsresponse.d.ts.map +1 -1
- package/dist/commonjs/models/lineitemsresponse.js +2 -0
- package/dist/commonjs/models/lineitemsresponse.js.map +1 -1
- package/dist/commonjs/models/mintplanversionrequest.d.ts +1 -1
- package/dist/commonjs/models/operations/createbillablemetric.d.ts +7 -2
- package/dist/commonjs/models/operations/createbillablemetric.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createbillablemetric.js +2 -1
- package/dist/commonjs/models/operations/createbillablemetric.js.map +1 -1
- package/dist/commonjs/models/operations/createfee.d.ts +7 -2
- package/dist/commonjs/models/operations/createfee.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createfee.js +2 -1
- package/dist/commonjs/models/operations/createfee.js.map +1 -1
- package/dist/commonjs/models/operations/createitem.d.ts +5 -0
- package/dist/commonjs/models/operations/createitem.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createitem.js +1 -0
- package/dist/commonjs/models/operations/createitem.js.map +1 -1
- package/dist/commonjs/models/operations/createsubscription.d.ts +6 -2
- package/dist/commonjs/models/operations/createsubscription.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createsubscription.js.map +1 -1
- package/dist/commonjs/models/operations/getinvoice.d.ts +6 -1
- package/dist/commonjs/models/operations/getinvoice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getinvoice.js +1 -0
- package/dist/commonjs/models/operations/getinvoice.js.map +1 -1
- package/dist/commonjs/models/operations/getinvoicelineitems.d.ts +10 -0
- package/dist/commonjs/models/operations/getinvoicelineitems.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getinvoicelineitems.js +2 -0
- package/dist/commonjs/models/operations/getinvoicelineitems.js.map +1 -1
- package/dist/commonjs/models/operations/listitems.d.ts +10 -0
- package/dist/commonjs/models/operations/listitems.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listitems.js +2 -0
- package/dist/commonjs/models/operations/listitems.js.map +1 -1
- package/dist/commonjs/models/operations/listlineitems.d.ts +10 -0
- package/dist/commonjs/models/operations/listlineitems.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listlineitems.js +2 -0
- package/dist/commonjs/models/operations/listlineitems.js.map +1 -1
- package/dist/commonjs/models/operations/updatebillablemetric.d.ts +5 -0
- package/dist/commonjs/models/operations/updatebillablemetric.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatebillablemetric.js +1 -0
- package/dist/commonjs/models/operations/updatebillablemetric.js.map +1 -1
- package/dist/commonjs/models/operations/updatefee.d.ts +5 -0
- package/dist/commonjs/models/operations/updatefee.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatefee.js +1 -0
- package/dist/commonjs/models/operations/updatefee.js.map +1 -1
- package/dist/commonjs/models/operations/updateitem.d.ts +10 -0
- package/dist/commonjs/models/operations/updateitem.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateitem.js +2 -0
- package/dist/commonjs/models/operations/updateitem.js.map +1 -1
- package/dist/commonjs/models/operations/updatesubscription.d.ts +3 -1
- package/dist/commonjs/models/operations/updatesubscription.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatesubscription.js.map +1 -1
- package/dist/commonjs/models/resolveditem.d.ts +33 -0
- package/dist/commonjs/models/resolveditem.d.ts.map +1 -0
- package/dist/commonjs/models/resolveditem.js +55 -0
- package/dist/commonjs/models/resolveditem.js.map +1 -0
- package/dist/commonjs/models/subscription.d.ts +9 -3
- package/dist/commonjs/models/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/subscription.js.map +1 -1
- package/dist/esm/funcs/invoicesV2Get.js +1 -0
- package/dist/esm/funcs/invoicesV2Get.js.map +1 -1
- package/dist/esm/funcs/invoicesV2GetLineItems.js +2 -0
- package/dist/esm/funcs/invoicesV2GetLineItems.js.map +1 -1
- package/dist/esm/funcs/invoicesV2ListLineItems.js +2 -0
- package/dist/esm/funcs/invoicesV2ListLineItems.js.map +1 -1
- package/dist/esm/funcs/itemsCreateItem.js +2 -2
- package/dist/esm/funcs/itemsCreateItem.js.map +1 -1
- package/dist/esm/funcs/itemsDeleteItem.d.ts +1 -1
- package/dist/esm/funcs/itemsDeleteItem.d.ts.map +1 -1
- package/dist/esm/funcs/itemsDeleteItem.js +2 -2
- package/dist/esm/funcs/itemsDeleteItem.js.map +1 -1
- package/dist/esm/funcs/itemsListItems.js +2 -0
- package/dist/esm/funcs/itemsListItems.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/billablemetric.d.ts +4 -0
- package/dist/esm/models/billablemetric.d.ts.map +1 -1
- package/dist/esm/models/billablemetric.js +1 -0
- package/dist/esm/models/billablemetric.js.map +1 -1
- package/dist/esm/models/createmanuallineitemrequest.d.ts +5 -0
- package/dist/esm/models/createmanuallineitemrequest.d.ts.map +1 -1
- package/dist/esm/models/createmanuallineitemrequest.js +1 -0
- package/dist/esm/models/createmanuallineitemrequest.js.map +1 -1
- package/dist/esm/models/fee.d.ts +4 -0
- package/dist/esm/models/fee.d.ts.map +1 -1
- package/dist/esm/models/fee.js +1 -0
- package/dist/esm/models/fee.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoice.d.ts +7 -2
- package/dist/esm/models/invoice.d.ts.map +1 -1
- package/dist/esm/models/invoice.js +2 -0
- package/dist/esm/models/invoice.js.map +1 -1
- package/dist/esm/models/invoicelineitem.d.ts +8 -0
- package/dist/esm/models/invoicelineitem.d.ts.map +1 -1
- package/dist/esm/models/invoicelineitem.js +2 -0
- package/dist/esm/models/invoicelineitem.js.map +1 -1
- package/dist/esm/models/invoicelineitemsresponse.d.ts +5 -0
- package/dist/esm/models/invoicelineitemsresponse.d.ts.map +1 -1
- package/dist/esm/models/invoicelineitemsresponse.js +2 -0
- package/dist/esm/models/invoicelineitemsresponse.js.map +1 -1
- package/dist/esm/models/item.d.ts +11 -0
- package/dist/esm/models/item.d.ts.map +1 -1
- package/dist/esm/models/item.js +2 -0
- package/dist/esm/models/item.js.map +1 -1
- package/dist/esm/models/lineitem.d.ts +8 -4
- package/dist/esm/models/lineitem.d.ts.map +1 -1
- package/dist/esm/models/lineitem.js +2 -1
- package/dist/esm/models/lineitem.js.map +1 -1
- package/dist/esm/models/lineitemsresponse.d.ts +5 -0
- package/dist/esm/models/lineitemsresponse.d.ts.map +1 -1
- package/dist/esm/models/lineitemsresponse.js +2 -0
- package/dist/esm/models/lineitemsresponse.js.map +1 -1
- package/dist/esm/models/mintplanversionrequest.d.ts +1 -1
- package/dist/esm/models/operations/createbillablemetric.d.ts +7 -2
- package/dist/esm/models/operations/createbillablemetric.d.ts.map +1 -1
- package/dist/esm/models/operations/createbillablemetric.js +2 -1
- package/dist/esm/models/operations/createbillablemetric.js.map +1 -1
- package/dist/esm/models/operations/createfee.d.ts +7 -2
- package/dist/esm/models/operations/createfee.d.ts.map +1 -1
- package/dist/esm/models/operations/createfee.js +2 -1
- package/dist/esm/models/operations/createfee.js.map +1 -1
- package/dist/esm/models/operations/createitem.d.ts +5 -0
- package/dist/esm/models/operations/createitem.d.ts.map +1 -1
- package/dist/esm/models/operations/createitem.js +1 -0
- package/dist/esm/models/operations/createitem.js.map +1 -1
- package/dist/esm/models/operations/createsubscription.d.ts +6 -2
- package/dist/esm/models/operations/createsubscription.d.ts.map +1 -1
- package/dist/esm/models/operations/createsubscription.js.map +1 -1
- package/dist/esm/models/operations/getinvoice.d.ts +6 -1
- package/dist/esm/models/operations/getinvoice.d.ts.map +1 -1
- package/dist/esm/models/operations/getinvoice.js +1 -0
- package/dist/esm/models/operations/getinvoice.js.map +1 -1
- package/dist/esm/models/operations/getinvoicelineitems.d.ts +10 -0
- package/dist/esm/models/operations/getinvoicelineitems.d.ts.map +1 -1
- package/dist/esm/models/operations/getinvoicelineitems.js +2 -0
- package/dist/esm/models/operations/getinvoicelineitems.js.map +1 -1
- package/dist/esm/models/operations/listitems.d.ts +10 -0
- package/dist/esm/models/operations/listitems.d.ts.map +1 -1
- package/dist/esm/models/operations/listitems.js +2 -0
- package/dist/esm/models/operations/listitems.js.map +1 -1
- package/dist/esm/models/operations/listlineitems.d.ts +10 -0
- package/dist/esm/models/operations/listlineitems.d.ts.map +1 -1
- package/dist/esm/models/operations/listlineitems.js +2 -0
- package/dist/esm/models/operations/listlineitems.js.map +1 -1
- package/dist/esm/models/operations/updatebillablemetric.d.ts +5 -0
- package/dist/esm/models/operations/updatebillablemetric.d.ts.map +1 -1
- package/dist/esm/models/operations/updatebillablemetric.js +1 -0
- package/dist/esm/models/operations/updatebillablemetric.js.map +1 -1
- package/dist/esm/models/operations/updatefee.d.ts +5 -0
- package/dist/esm/models/operations/updatefee.d.ts.map +1 -1
- package/dist/esm/models/operations/updatefee.js +1 -0
- package/dist/esm/models/operations/updatefee.js.map +1 -1
- package/dist/esm/models/operations/updateitem.d.ts +10 -0
- package/dist/esm/models/operations/updateitem.d.ts.map +1 -1
- package/dist/esm/models/operations/updateitem.js +2 -0
- package/dist/esm/models/operations/updateitem.js.map +1 -1
- package/dist/esm/models/operations/updatesubscription.d.ts +3 -1
- package/dist/esm/models/operations/updatesubscription.d.ts.map +1 -1
- package/dist/esm/models/operations/updatesubscription.js.map +1 -1
- package/dist/esm/models/resolveditem.d.ts +33 -0
- package/dist/esm/models/resolveditem.d.ts.map +1 -0
- package/dist/esm/models/resolveditem.js +18 -0
- package/dist/esm/models/resolveditem.js.map +1 -0
- package/dist/esm/models/subscription.d.ts +9 -3
- package/dist/esm/models/subscription.d.ts.map +1 -1
- package/dist/esm/models/subscription.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/invoicesV2Get.ts +1 -0
- package/src/funcs/invoicesV2GetLineItems.ts +2 -0
- package/src/funcs/invoicesV2ListLineItems.ts +2 -0
- package/src/funcs/itemsCreateItem.ts +2 -2
- package/src/funcs/itemsDeleteItem.ts +5 -1
- package/src/funcs/itemsListItems.ts +2 -0
- package/src/lib/config.ts +2 -2
- package/src/models/billablemetric.ts +5 -0
- package/src/models/createmanuallineitemrequest.ts +6 -0
- package/src/models/fee.ts +5 -0
- package/src/models/index.ts +1 -0
- package/src/models/invoice.ts +8 -2
- package/src/models/invoicelineitem.ts +10 -0
- package/src/models/invoicelineitemsresponse.ts +6 -0
- package/src/models/item.ts +15 -0
- package/src/models/lineitem.ts +9 -4
- package/src/models/lineitemsresponse.ts +6 -0
- package/src/models/mintplanversionrequest.ts +1 -1
- package/src/models/operations/createbillablemetric.ts +9 -3
- package/src/models/operations/createfee.ts +9 -3
- package/src/models/operations/createitem.ts +6 -0
- package/src/models/operations/createsubscription.ts +6 -2
- package/src/models/operations/getinvoice.ts +7 -1
- package/src/models/operations/getinvoicelineitems.ts +12 -0
- package/src/models/operations/listitems.ts +12 -0
- package/src/models/operations/listlineitems.ts +12 -0
- package/src/models/operations/updatebillablemetric.ts +6 -0
- package/src/models/operations/updatefee.ts +6 -0
- package/src/models/operations/updateitem.ts +12 -0
- package/src/models/operations/updatesubscription.ts +3 -1
- package/src/models/resolveditem.ts +63 -0
- package/src/models/subscription.ts +9 -3
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
InvoiceLineItem,
|
|
11
11
|
InvoiceLineItem$inboundSchema,
|
|
12
12
|
} from "./invoicelineitem.js";
|
|
13
|
+
import { ResolvedItem, ResolvedItem$inboundSchema } from "./resolveditem.js";
|
|
13
14
|
|
|
14
15
|
export type InvoiceLineItemsResponse = {
|
|
15
16
|
/**
|
|
@@ -20,6 +21,10 @@ export type InvoiceLineItemsResponse = {
|
|
|
20
21
|
* Array of line items for this page
|
|
21
22
|
*/
|
|
22
23
|
lineItems: Array<InvoiceLineItem>;
|
|
24
|
+
/**
|
|
25
|
+
* Items the returned lines were tagged with, each appearing once, ordered by id. Only present when expand=items is requested. Scoped to the lines in THIS response, not the whole invoice — combine the collections across pages for an invoice-wide set. Join a line to its entry via the line's itemId. A line whose itemId has no entry here is a data-integrity fault — the tag points at an item that no longer resolves for this merchant. It is not the same as an untagged line and must not be counted as unmapped; report it.
|
|
26
|
+
*/
|
|
27
|
+
items?: Array<ResolvedItem> | undefined;
|
|
23
28
|
/**
|
|
24
29
|
* Token for fetching the next page, null if no more pages
|
|
25
30
|
*/
|
|
@@ -38,6 +43,7 @@ export const InvoiceLineItemsResponse$inboundSchema: z.ZodType<
|
|
|
38
43
|
> = z.object({
|
|
39
44
|
invoiceId: z.string(),
|
|
40
45
|
lineItems: z.array(InvoiceLineItem$inboundSchema),
|
|
46
|
+
items: z.array(ResolvedItem$inboundSchema).optional(),
|
|
41
47
|
nextPageToken: z.nullable(z.string()).optional(),
|
|
42
48
|
totalCount: z.number().int(),
|
|
43
49
|
});
|
package/src/models/item.ts
CHANGED
|
@@ -18,12 +18,23 @@ export const ItemObject = {
|
|
|
18
18
|
export type ItemObject = ClosedEnum<typeof ItemObject>;
|
|
19
19
|
|
|
20
20
|
export type Item = {
|
|
21
|
+
/**
|
|
22
|
+
* Unique identifier for an item
|
|
23
|
+
*/
|
|
21
24
|
id: string;
|
|
22
25
|
object: ItemObject;
|
|
23
26
|
merchantId: string;
|
|
24
27
|
name: string;
|
|
25
28
|
metadata: { [k: string]: any };
|
|
26
29
|
externalReferences: Array<ExternalReference>;
|
|
30
|
+
/**
|
|
31
|
+
* The product this item belongs to.
|
|
32
|
+
*/
|
|
33
|
+
catalogId: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* When this item was retired from the catalog. Null while active.
|
|
36
|
+
*/
|
|
37
|
+
archivedAt: Date | null;
|
|
27
38
|
createdAt: Date;
|
|
28
39
|
updatedAt: Date;
|
|
29
40
|
};
|
|
@@ -41,6 +52,10 @@ export const Item$inboundSchema: z.ZodType<Item, z.ZodTypeDef, unknown> = z
|
|
|
41
52
|
name: z.string(),
|
|
42
53
|
metadata: z.record(z.any()),
|
|
43
54
|
externalReferences: z.array(ExternalReference$inboundSchema),
|
|
55
|
+
catalogId: z.nullable(z.string()),
|
|
56
|
+
archivedAt: z.nullable(
|
|
57
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
58
|
+
),
|
|
44
59
|
createdAt: z.string().datetime({ offset: true }).transform(v =>
|
|
45
60
|
new Date(v)
|
|
46
61
|
),
|
package/src/models/lineitem.ts
CHANGED
|
@@ -35,14 +35,14 @@ export const LineItemStatus = {
|
|
|
35
35
|
export type LineItemStatus = ClosedEnum<typeof LineItemStatus>;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Payment term for fee items. Null for metered/manual lines
|
|
38
|
+
* Payment term for fee items. Null for metered/manual lines. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
39
39
|
*/
|
|
40
40
|
export const LineItemPaymentTerm = {
|
|
41
41
|
InAdvance: "in_advance",
|
|
42
42
|
InArrears: "in_arrears",
|
|
43
43
|
} as const;
|
|
44
44
|
/**
|
|
45
|
-
* Payment term for fee items. Null for metered/manual lines
|
|
45
|
+
* Payment term for fee items. Null for metered/manual lines. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
46
46
|
*/
|
|
47
47
|
export type LineItemPaymentTerm = ClosedEnum<typeof LineItemPaymentTerm>;
|
|
48
48
|
|
|
@@ -60,9 +60,13 @@ export type LineItem = {
|
|
|
60
60
|
*/
|
|
61
61
|
customerId: string;
|
|
62
62
|
/**
|
|
63
|
-
* The price
|
|
63
|
+
* The price this line was generated from, or `null` when the line has no originating charge. With `itemId` it says whether a missing tag is fixable: `priceId` set and `itemId` null means the charge was simply untagged, which tagging it and restamping resolves; both null means the line records a grant-credit purchase, which is deferred revenue and is never tagged. Any measure of outstanding mapping work must exclude the latter or it can never reach zero.
|
|
64
64
|
*/
|
|
65
65
|
priceId?: string | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Item the line's charge was tagged with, recorded when the line was generated and not re-resolved on read. `null` means the charge carried no tag at that moment, the line predates item stamping, or the line has no originating charge (a grant-credit purchase) — it is an expected value, not an error. Use `priceId` to tell those cases apart.
|
|
68
|
+
*/
|
|
69
|
+
itemId?: string | null | undefined;
|
|
66
70
|
/**
|
|
67
71
|
* The invoice ID if this item has been invoiced
|
|
68
72
|
*/
|
|
@@ -116,7 +120,7 @@ export type LineItem = {
|
|
|
116
120
|
*/
|
|
117
121
|
meteredQuantity?: string | null | undefined;
|
|
118
122
|
/**
|
|
119
|
-
* Payment term for fee items. Null for metered/manual lines
|
|
123
|
+
* Payment term for fee items. Null for metered/manual lines. `null` is listed in the enum as well as via `nullable` because OpenAPI 3.0 validators check the enum independently — `nullable: true` alone does not admit it, and createLineItem (which always returns null here) was emitting a schema-violating body.
|
|
120
124
|
*/
|
|
121
125
|
paymentTerm?: LineItemPaymentTerm | null | undefined;
|
|
122
126
|
/**
|
|
@@ -173,6 +177,7 @@ export const LineItem$inboundSchema: z.ZodType<
|
|
|
173
177
|
subscriptionId: z.string(),
|
|
174
178
|
customerId: z.string(),
|
|
175
179
|
priceId: z.nullable(z.string()).optional(),
|
|
180
|
+
itemId: z.nullable(z.string()).optional(),
|
|
176
181
|
invoiceId: z.nullable(z.string()).optional(),
|
|
177
182
|
type: LineItemType$inboundSchema,
|
|
178
183
|
status: LineItemStatus$inboundSchema,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
LineItemsSummary,
|
|
13
13
|
LineItemsSummary$inboundSchema,
|
|
14
14
|
} from "./lineitemssummary.js";
|
|
15
|
+
import { ResolvedItem, ResolvedItem$inboundSchema } from "./resolveditem.js";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* The object type
|
|
@@ -35,6 +36,10 @@ export type LineItemsResponse = {
|
|
|
35
36
|
* Array of line items
|
|
36
37
|
*/
|
|
37
38
|
data: Array<LineItem>;
|
|
39
|
+
/**
|
|
40
|
+
* Items the returned lines were tagged with, each appearing once, ordered by id. Only present when expand=items is requested. Scoped to the lines in THIS response, not to any invoice as a whole — combine the collections across pages for a complete set. Join a line to its entry via the line's itemId. A line whose itemId has no entry here is a data-integrity fault — the tag points at an item that no longer resolves for this merchant. It is not the same as an untagged line and must not be counted as unmapped; report it.
|
|
41
|
+
*/
|
|
42
|
+
items?: Array<ResolvedItem> | undefined;
|
|
38
43
|
/**
|
|
39
44
|
* Total number of matching line items
|
|
40
45
|
*/
|
|
@@ -55,6 +60,7 @@ export const LineItemsResponse$inboundSchema: z.ZodType<
|
|
|
55
60
|
> = z.object({
|
|
56
61
|
object: LineItemsResponseObject$inboundSchema,
|
|
57
62
|
data: z.array(LineItem$inboundSchema),
|
|
63
|
+
items: z.array(ResolvedItem$inboundSchema).optional(),
|
|
58
64
|
totalCount: z.number().int(),
|
|
59
65
|
summary: LineItemsSummary$inboundSchema,
|
|
60
66
|
});
|
|
@@ -16,7 +16,7 @@ export type ReplacePrice = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* A reference-by-id price diff applied to the prices of the plan's current version. Every id references an existing price created via POST /prices; inline price definitions are not accepted.
|
|
19
|
+
* A reference-by-id price diff applied to the prices of the plan's current version. Every id references an existing price created via POST /prices; inline price definitions are not accepted. A mint must carry at least one price change, so an empty body is rejected. A version must carry at least one price, so a diff that would leave none is rejected.
|
|
20
20
|
*/
|
|
21
21
|
export type MintPlanVersionRequest = {
|
|
22
22
|
/**
|
|
@@ -44,7 +44,11 @@ export type CreateBillableMetricRequest = {
|
|
|
44
44
|
/**
|
|
45
45
|
* Unique identifier for a product
|
|
46
46
|
*/
|
|
47
|
-
productId
|
|
47
|
+
productId?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Unique identifier for an item
|
|
50
|
+
*/
|
|
51
|
+
itemId?: string | undefined;
|
|
48
52
|
/**
|
|
49
53
|
* Measurement unit used when aggregating this metric's values. Common examples: 'tokens', 'GB', 'calls', 'images', 'hours', 'TB', 'queries', 'requests'
|
|
50
54
|
*/
|
|
@@ -78,7 +82,8 @@ export type CreateBillableMetricRequest$Outbound = {
|
|
|
78
82
|
description: string;
|
|
79
83
|
merchantId: string;
|
|
80
84
|
name: string;
|
|
81
|
-
productId
|
|
85
|
+
productId?: string | undefined;
|
|
86
|
+
itemId?: string | undefined;
|
|
82
87
|
unit: string;
|
|
83
88
|
eventType?: string | undefined;
|
|
84
89
|
valueProperty?: string | undefined;
|
|
@@ -96,7 +101,8 @@ export const CreateBillableMetricRequest$outboundSchema: z.ZodType<
|
|
|
96
101
|
description: z.string(),
|
|
97
102
|
merchantId: z.string(),
|
|
98
103
|
name: z.string(),
|
|
99
|
-
productId: z.string(),
|
|
104
|
+
productId: z.string().optional(),
|
|
105
|
+
itemId: z.string().optional(),
|
|
100
106
|
unit: z.string(),
|
|
101
107
|
eventType: z.string().optional(),
|
|
102
108
|
valueProperty: z.string().optional(),
|
|
@@ -20,7 +20,11 @@ export type CreateFeeRequest = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Unique identifier for a product
|
|
22
22
|
*/
|
|
23
|
-
productId
|
|
23
|
+
productId?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Unique identifier for an item
|
|
26
|
+
*/
|
|
27
|
+
itemId?: string | undefined;
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
/** @internal */
|
|
@@ -28,7 +32,8 @@ export type CreateFeeRequest$Outbound = {
|
|
|
28
32
|
name: string;
|
|
29
33
|
description: string;
|
|
30
34
|
merchantId: string;
|
|
31
|
-
productId
|
|
35
|
+
productId?: string | undefined;
|
|
36
|
+
itemId?: string | undefined;
|
|
32
37
|
};
|
|
33
38
|
|
|
34
39
|
/** @internal */
|
|
@@ -40,7 +45,8 @@ export const CreateFeeRequest$outboundSchema: z.ZodType<
|
|
|
40
45
|
name: z.string(),
|
|
41
46
|
description: z.string(),
|
|
42
47
|
merchantId: z.string(),
|
|
43
|
-
productId: z.string(),
|
|
48
|
+
productId: z.string().optional(),
|
|
49
|
+
itemId: z.string().optional(),
|
|
44
50
|
});
|
|
45
51
|
|
|
46
52
|
export function createFeeRequestToJSON(
|
|
@@ -10,6 +10,10 @@ export type CreateItemRequest = {
|
|
|
10
10
|
* Canonical sellable name for the Item
|
|
11
11
|
*/
|
|
12
12
|
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier for a product
|
|
15
|
+
*/
|
|
16
|
+
catalogId?: string | undefined;
|
|
13
17
|
/**
|
|
14
18
|
* Optional key-value metadata
|
|
15
19
|
*/
|
|
@@ -20,6 +24,7 @@ export type CreateItemRequest = {
|
|
|
20
24
|
export type CreateItemRequest$Outbound = {
|
|
21
25
|
merchantId: string;
|
|
22
26
|
name: string;
|
|
27
|
+
catalogId?: string | undefined;
|
|
23
28
|
metadata?: { [k: string]: any } | undefined;
|
|
24
29
|
};
|
|
25
30
|
|
|
@@ -31,6 +36,7 @@ export const CreateItemRequest$outboundSchema: z.ZodType<
|
|
|
31
36
|
> = z.object({
|
|
32
37
|
merchantId: z.string(),
|
|
33
38
|
name: z.string(),
|
|
39
|
+
catalogId: z.string().optional(),
|
|
34
40
|
metadata: z.record(z.any()).optional(),
|
|
35
41
|
});
|
|
36
42
|
|
|
@@ -78,11 +78,15 @@ export type CreateSubscriptionRequest = {
|
|
|
78
78
|
*/
|
|
79
79
|
planId: string;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Deprecated. This field is ignored and has no effect.
|
|
82
|
+
*
|
|
83
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
82
84
|
*/
|
|
83
85
|
prefundAmount?: string | undefined;
|
|
84
86
|
/**
|
|
85
|
-
*
|
|
87
|
+
* Deprecated. This field is ignored and has no effect.
|
|
88
|
+
*
|
|
89
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
86
90
|
*/
|
|
87
91
|
minimumAccountBalance?: string | undefined;
|
|
88
92
|
/**
|
|
@@ -10,7 +10,7 @@ export type GetInvoiceRequest = {
|
|
|
10
10
|
*/
|
|
11
11
|
id: string;
|
|
12
12
|
/**
|
|
13
|
-
* Comma-separated list of fields to expand.
|
|
13
|
+
* Comma-separated list of fields to expand. Supports: lineItems, items. `items` resolves each returned line's item and its external accounting codes into an `items` collection inside the lineItems block; because those ids come from the lines, requesting `items` also expands `lineItems` on its default paging.
|
|
14
14
|
*/
|
|
15
15
|
expand?: string | undefined;
|
|
16
16
|
/**
|
|
@@ -21,6 +21,10 @@ export type GetInvoiceRequest = {
|
|
|
21
21
|
* Opaque pagination token for line items when expand=lineItems, taken from a previous response's nextPageToken. Do not construct or parse this value.
|
|
22
22
|
*/
|
|
23
23
|
lineItemsPageToken?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Narrows which external references are returned per item when expand=items. Matched exactly against the provider stored on the reference (e.g. accountsiq); there is no allowlist of known providers, but the value must satisfy the same format every stored provider does, so a malformed one is rejected rather than answered with an empty result that reads as "nothing is mapped". It never removes lines or items: an item with no reference for this provider comes back with an empty list, so unmapped SKUs stay visible. Ignored when the items expansion is not requested.
|
|
26
|
+
*/
|
|
27
|
+
provider?: string | undefined;
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
/** @internal */
|
|
@@ -29,6 +33,7 @@ export type GetInvoiceRequest$Outbound = {
|
|
|
29
33
|
expand?: string | undefined;
|
|
30
34
|
lineItemsLimit: number;
|
|
31
35
|
lineItemsPageToken?: string | undefined;
|
|
36
|
+
provider?: string | undefined;
|
|
32
37
|
};
|
|
33
38
|
|
|
34
39
|
/** @internal */
|
|
@@ -41,6 +46,7 @@ export const GetInvoiceRequest$outboundSchema: z.ZodType<
|
|
|
41
46
|
expand: z.string().optional(),
|
|
42
47
|
lineItemsLimit: z.number().int().default(100),
|
|
43
48
|
lineItemsPageToken: z.string().optional(),
|
|
49
|
+
provider: z.string().optional(),
|
|
44
50
|
});
|
|
45
51
|
|
|
46
52
|
export function getInvoiceRequestToJSON(
|
|
@@ -17,6 +17,14 @@ export type GetInvoiceLineItemsRequest = {
|
|
|
17
17
|
* Opaque pagination token to fetch the next page of results, taken from a previous response's nextPageToken. Do not construct or parse this value.
|
|
18
18
|
*/
|
|
19
19
|
pageToken?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Comma-separated list of fields to expand. Supports: items — resolves each returned line's item and that item's external accounting codes into an `items` collection, so a line can be translated to a GL/SKU code without a second call.
|
|
22
|
+
*/
|
|
23
|
+
expand?: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Narrows which external references are returned per item when expand=items. Matched exactly against the provider stored on the reference (e.g. accountsiq); there is no allowlist of known providers, but the value must satisfy the same format every stored provider does, so a malformed one is rejected rather than answered with an empty result that reads as "nothing is mapped". It never removes lines or items: an item with no reference for this provider comes back with an empty list, so unmapped SKUs stay visible. Ignored when the items expansion is not requested.
|
|
26
|
+
*/
|
|
27
|
+
provider?: string | undefined;
|
|
20
28
|
};
|
|
21
29
|
|
|
22
30
|
/** @internal */
|
|
@@ -24,6 +32,8 @@ export type GetInvoiceLineItemsRequest$Outbound = {
|
|
|
24
32
|
id: string;
|
|
25
33
|
limit: number;
|
|
26
34
|
pageToken?: string | undefined;
|
|
35
|
+
expand?: string | undefined;
|
|
36
|
+
provider?: string | undefined;
|
|
27
37
|
};
|
|
28
38
|
|
|
29
39
|
/** @internal */
|
|
@@ -35,6 +45,8 @@ export const GetInvoiceLineItemsRequest$outboundSchema: z.ZodType<
|
|
|
35
45
|
id: z.string(),
|
|
36
46
|
limit: z.number().int().default(100),
|
|
37
47
|
pageToken: z.string().optional(),
|
|
48
|
+
expand: z.string().optional(),
|
|
49
|
+
provider: z.string().optional(),
|
|
38
50
|
});
|
|
39
51
|
|
|
40
52
|
export function getInvoiceLineItemsRequestToJSON(
|
|
@@ -13,6 +13,10 @@ export type ListItemsRequest = {
|
|
|
13
13
|
* Filter items by merchant organization id
|
|
14
14
|
*/
|
|
15
15
|
merchantId?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Filter items by the product they are filed under
|
|
18
|
+
*/
|
|
19
|
+
catalogId?: string | undefined;
|
|
16
20
|
/**
|
|
17
21
|
* Provider whose external code to resolve (e.g. `salesforce`, `netsuite`). Must be supplied together with `externalId`.
|
|
18
22
|
*/
|
|
@@ -29,6 +33,10 @@ export type ListItemsRequest = {
|
|
|
29
33
|
* Zero-based offset for pagination. In resolution mode this paginates the de-duplicated resolved Item set.
|
|
30
34
|
*/
|
|
31
35
|
offset?: number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Include archived items in the results. By default, archived items are omitted. This is ignored when resolving by `provider` and `externalId`, which always returns the matching item regardless of archived status.
|
|
38
|
+
*/
|
|
39
|
+
includeArchived?: boolean | undefined;
|
|
32
40
|
};
|
|
33
41
|
|
|
34
42
|
/**
|
|
@@ -45,10 +53,12 @@ export type ListItemsResponse = {
|
|
|
45
53
|
/** @internal */
|
|
46
54
|
export type ListItemsRequest$Outbound = {
|
|
47
55
|
merchantId?: string | undefined;
|
|
56
|
+
catalogId?: string | undefined;
|
|
48
57
|
provider?: string | undefined;
|
|
49
58
|
externalId?: string | undefined;
|
|
50
59
|
limit: number;
|
|
51
60
|
offset: number;
|
|
61
|
+
includeArchived: boolean;
|
|
52
62
|
};
|
|
53
63
|
|
|
54
64
|
/** @internal */
|
|
@@ -58,10 +68,12 @@ export const ListItemsRequest$outboundSchema: z.ZodType<
|
|
|
58
68
|
ListItemsRequest
|
|
59
69
|
> = z.object({
|
|
60
70
|
merchantId: z.string().optional(),
|
|
71
|
+
catalogId: z.string().optional(),
|
|
61
72
|
provider: z.string().optional(),
|
|
62
73
|
externalId: z.string().optional(),
|
|
63
74
|
limit: z.number().int().default(50),
|
|
64
75
|
offset: z.number().int().default(0),
|
|
76
|
+
includeArchived: z.boolean().default(false),
|
|
65
77
|
});
|
|
66
78
|
|
|
67
79
|
export function listItemsRequestToJSON(
|
|
@@ -30,6 +30,14 @@ export type ListLineItemsRequest = {
|
|
|
30
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
31
|
*/
|
|
32
32
|
invoiceId?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Comma-separated list of fields to expand. Supports: items — resolves each returned line's item and that item's external accounting codes into an `items` collection, so a line can be translated to a GL/SKU code without a second call.
|
|
35
|
+
*/
|
|
36
|
+
expand?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Narrows which external references are returned per item when expand=items. Matched exactly against the provider stored on the reference (e.g. accountsiq); there is no allowlist of known providers, but the value must satisfy the same format every stored provider does, so a malformed one is rejected rather than answered with an empty result that reads as "nothing is mapped". It never removes lines or items: an item with no reference for this provider comes back with an empty list, so unmapped SKUs stay visible. Ignored when the items expansion is not requested.
|
|
39
|
+
*/
|
|
40
|
+
provider?: string | undefined;
|
|
33
41
|
/**
|
|
34
42
|
* Maximum number of line items to return
|
|
35
43
|
*/
|
|
@@ -50,6 +58,8 @@ export type ListLineItemsRequest$Outbound = {
|
|
|
50
58
|
subscriptionId?: string | undefined;
|
|
51
59
|
status?: string | undefined;
|
|
52
60
|
invoiceId?: string | undefined;
|
|
61
|
+
expand?: string | undefined;
|
|
62
|
+
provider?: string | undefined;
|
|
53
63
|
limit: number;
|
|
54
64
|
offset: number;
|
|
55
65
|
};
|
|
@@ -63,6 +73,8 @@ export const ListLineItemsRequest$outboundSchema: z.ZodType<
|
|
|
63
73
|
subscriptionId: z.string().optional(),
|
|
64
74
|
status: ListLineItemsStatus$outboundSchema.optional(),
|
|
65
75
|
invoiceId: z.string().optional(),
|
|
76
|
+
expand: z.string().optional(),
|
|
77
|
+
provider: z.string().optional(),
|
|
66
78
|
limit: z.number().int().default(100),
|
|
67
79
|
offset: z.number().int().default(0),
|
|
68
80
|
});
|
|
@@ -18,6 +18,10 @@ export type UpdateBillableMetricRequestBody = {
|
|
|
18
18
|
* Updated measurement unit. Common examples: 'tokens', 'GB', 'requests', 'items', 'hours'
|
|
19
19
|
*/
|
|
20
20
|
unit?: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Optional item tag, used to map this metric's invoice lines to an external accounting/tax identity. Send a new id to re-tag — `productId` is re-derived from that item's catalog, and an archived item is rejected. Send `null` to untag.
|
|
23
|
+
*/
|
|
24
|
+
itemId?: string | null | undefined;
|
|
21
25
|
/**
|
|
22
26
|
* CloudEvents type for meter routing.
|
|
23
27
|
*/
|
|
@@ -46,6 +50,7 @@ export type UpdateBillableMetricRequestBody$Outbound = {
|
|
|
46
50
|
description?: string | undefined;
|
|
47
51
|
name?: string | undefined;
|
|
48
52
|
unit?: string | undefined;
|
|
53
|
+
itemId?: string | null | undefined;
|
|
49
54
|
eventType?: string | null | undefined;
|
|
50
55
|
valueProperty?: string | null | undefined;
|
|
51
56
|
groupBy?: { [k: string]: string } | null | undefined;
|
|
@@ -61,6 +66,7 @@ export const UpdateBillableMetricRequestBody$outboundSchema: z.ZodType<
|
|
|
61
66
|
description: z.string().optional(),
|
|
62
67
|
name: z.string().optional(),
|
|
63
68
|
unit: z.string().optional(),
|
|
69
|
+
itemId: z.nullable(z.string()).optional(),
|
|
64
70
|
eventType: z.nullable(z.string()).optional(),
|
|
65
71
|
valueProperty: z.nullable(z.string()).optional(),
|
|
66
72
|
groupBy: z.nullable(z.record(z.string())).optional(),
|
|
@@ -14,6 +14,10 @@ export type UpdateFeeRequestBody = {
|
|
|
14
14
|
* Updated label for the fee.
|
|
15
15
|
*/
|
|
16
16
|
name?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Optional item tag, used to map this fee's invoice lines to an external accounting/tax identity. Send a new id to re-tag — `productId` is re-derived from that item's catalog, and an archived item is rejected. Send `null` to untag.
|
|
19
|
+
*/
|
|
20
|
+
itemId?: string | null | undefined;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
export type UpdateFeeRequest = {
|
|
@@ -28,6 +32,7 @@ export type UpdateFeeRequest = {
|
|
|
28
32
|
export type UpdateFeeRequestBody$Outbound = {
|
|
29
33
|
description?: string | undefined;
|
|
30
34
|
name?: string | undefined;
|
|
35
|
+
itemId?: string | null | undefined;
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
/** @internal */
|
|
@@ -38,6 +43,7 @@ export const UpdateFeeRequestBody$outboundSchema: z.ZodType<
|
|
|
38
43
|
> = z.object({
|
|
39
44
|
description: z.string().optional(),
|
|
40
45
|
name: z.string().optional(),
|
|
46
|
+
itemId: z.nullable(z.string()).optional(),
|
|
41
47
|
});
|
|
42
48
|
|
|
43
49
|
export function updateFeeRequestBodyToJSON(
|
|
@@ -7,6 +7,14 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
|
|
8
8
|
export type UpdateItemRequestBody = {
|
|
9
9
|
name?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The product this item belongs to.
|
|
12
|
+
*/
|
|
13
|
+
catalogId?: string | null | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Set to true to retire this item from your catalog, or false to restore it. Archived items remain readable and continue to resolve on historical invoices.
|
|
16
|
+
*/
|
|
17
|
+
archived?: boolean | undefined;
|
|
10
18
|
metadata?: { [k: string]: any } | undefined;
|
|
11
19
|
};
|
|
12
20
|
|
|
@@ -21,6 +29,8 @@ export type UpdateItemRequest = {
|
|
|
21
29
|
/** @internal */
|
|
22
30
|
export type UpdateItemRequestBody$Outbound = {
|
|
23
31
|
name?: string | undefined;
|
|
32
|
+
catalogId?: string | null | undefined;
|
|
33
|
+
archived?: boolean | undefined;
|
|
24
34
|
metadata?: { [k: string]: any } | undefined;
|
|
25
35
|
};
|
|
26
36
|
|
|
@@ -31,6 +41,8 @@ export const UpdateItemRequestBody$outboundSchema: z.ZodType<
|
|
|
31
41
|
UpdateItemRequestBody
|
|
32
42
|
> = z.object({
|
|
33
43
|
name: z.string().optional(),
|
|
44
|
+
catalogId: z.nullable(z.string()).optional(),
|
|
45
|
+
archived: z.boolean().optional(),
|
|
34
46
|
metadata: z.record(z.any()).optional(),
|
|
35
47
|
});
|
|
36
48
|
|
|
@@ -38,7 +38,9 @@ export type UpdateSubscriptionRequestBody = {
|
|
|
38
38
|
*/
|
|
39
39
|
taxExempt?: boolean | undefined;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Deprecated. This field is ignored and has no effect.
|
|
42
|
+
*
|
|
43
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
42
44
|
*/
|
|
43
45
|
minimumAccountBalance?: string | undefined;
|
|
44
46
|
/**
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
import {
|
|
10
|
+
ExternalReference,
|
|
11
|
+
ExternalReference$inboundSchema,
|
|
12
|
+
} from "./externalreference.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An item a line was tagged with, together with its external accounting/tax codes. Deliberately narrower than the /v0/items Item resource: it carries what is needed to translate a line into a GL/SKU code, not the full record.
|
|
16
|
+
*/
|
|
17
|
+
export type ResolvedItem = {
|
|
18
|
+
/**
|
|
19
|
+
* Unique identifier for an item
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* Human-readable item name
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* The product this item belongs to, for grouping lines by product
|
|
28
|
+
*/
|
|
29
|
+
catalogId: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* When this item was retired from the catalog. Archived items still resolve here — invoices that already reference them have to keep resolving — but cannot be tagged onto new pricing. Null while active.
|
|
32
|
+
*/
|
|
33
|
+
archivedAt: Date | null;
|
|
34
|
+
/**
|
|
35
|
+
* The item's external codes, narrowed to the requested provider when one is given. An empty list means the item is not yet mapped for that provider — an actionable state, not an error. More than one may be returned for a single provider, and more than one of those may carry `isPrimary: true`: the uniqueness constraint runs the other way round (an external id is the primary reference of at most one item per merchant), so it does not reduce an item's references to one per provider. Entries are ordered newest first, tie-broken by id, so the order is stable across reads — but a consumer that needs exactly one code must choose deliberately rather than assume there is only one.
|
|
36
|
+
*/
|
|
37
|
+
externalReferences: Array<ExternalReference>;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const ResolvedItem$inboundSchema: z.ZodType<
|
|
42
|
+
ResolvedItem,
|
|
43
|
+
z.ZodTypeDef,
|
|
44
|
+
unknown
|
|
45
|
+
> = z.object({
|
|
46
|
+
id: z.string(),
|
|
47
|
+
name: z.string(),
|
|
48
|
+
catalogId: z.nullable(z.string()),
|
|
49
|
+
archivedAt: z.nullable(
|
|
50
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
51
|
+
),
|
|
52
|
+
externalReferences: z.array(ExternalReference$inboundSchema),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export function resolvedItemFromJSON(
|
|
56
|
+
jsonString: string,
|
|
57
|
+
): SafeParseResult<ResolvedItem, SDKValidationError> {
|
|
58
|
+
return safeParse(
|
|
59
|
+
jsonString,
|
|
60
|
+
(x) => ResolvedItem$inboundSchema.parse(JSON.parse(x)),
|
|
61
|
+
`Failed to parse 'ResolvedItem' from JSON`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -174,11 +174,15 @@ export type Subscription = {
|
|
|
174
174
|
*/
|
|
175
175
|
versionNumber?: number | undefined;
|
|
176
176
|
/**
|
|
177
|
-
*
|
|
177
|
+
* Deprecated. Legacy-only, not populated for new subscriptions.
|
|
178
|
+
*
|
|
179
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
178
180
|
*/
|
|
179
181
|
prefundAmount?: string | undefined;
|
|
180
182
|
/**
|
|
181
|
-
*
|
|
183
|
+
* Deprecated. Legacy-only, not populated for new subscriptions.
|
|
184
|
+
*
|
|
185
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
182
186
|
*/
|
|
183
187
|
minimumAccountBalance?: string | undefined;
|
|
184
188
|
startedAt: Date;
|
|
@@ -198,7 +202,9 @@ export type Subscription = {
|
|
|
198
202
|
testClockId?: string | undefined;
|
|
199
203
|
updatedAt: Date;
|
|
200
204
|
/**
|
|
201
|
-
*
|
|
205
|
+
* Deprecated. Legacy-only, not populated for new subscriptions.
|
|
206
|
+
*
|
|
207
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
202
208
|
*/
|
|
203
209
|
walletId?: string | undefined;
|
|
204
210
|
/**
|