@vercel/sdk
Version:
<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>
91 lines • 3.51 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import * as types from "../types/primitives.js";
/**
* Invoice state.
*/
export const GetInvoiceState = {
Draft: "draft",
Invoiced: "invoiced",
Notpaid: "notpaid",
Overdue: "overdue",
Paid: "paid",
Pending: "pending",
RefundRequested: "refund_requested",
Refunded: "refunded",
Scheduled: "scheduled",
};
/** @internal */
export const GetInvoiceRequest$outboundSchema = z.object({
integrationConfigurationId: z.string(),
invoiceId: z.string(),
});
export function getInvoiceRequestToJSON(getInvoiceRequest) {
return JSON.stringify(GetInvoiceRequest$outboundSchema.parse(getInvoiceRequest));
}
/** @internal */
export const GetInvoiceState$inboundSchema = z.nativeEnum(GetInvoiceState);
/** @internal */
export const GetInvoicePeriod$inboundSchema = z.object({
start: types.string(),
end: types.string(),
});
export function getInvoicePeriodFromJSON(jsonString) {
return safeParse(jsonString, (x) => GetInvoicePeriod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetInvoicePeriod' from JSON`);
}
/** @internal */
export const GetInvoiceItems$inboundSchema = z.object({
billingPlanId: types.string(),
resourceId: types.optional(types.string()),
start: types.optional(types.string()),
end: types.optional(types.string()),
name: types.string(),
details: types.optional(types.string()),
price: types.string(),
quantity: types.number(),
units: types.string(),
total: types.string(),
});
export function getInvoiceItemsFromJSON(jsonString) {
return safeParse(jsonString, (x) => GetInvoiceItems$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetInvoiceItems' from JSON`);
}
/** @internal */
export const GetInvoiceDiscounts$inboundSchema = z.object({
billingPlanId: types.string(),
resourceId: types.optional(types.string()),
start: types.optional(types.string()),
end: types.optional(types.string()),
name: types.string(),
details: types.optional(types.string()),
amount: types.string(),
});
export function getInvoiceDiscountsFromJSON(jsonString) {
return safeParse(jsonString, (x) => GetInvoiceDiscounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetInvoiceDiscounts' from JSON`);
}
/** @internal */
export const GetInvoiceResponseBody$inboundSchema = z.object({
test: types.optional(types.boolean()),
invoiceId: types.string(),
externalId: types.optional(types.string()),
state: GetInvoiceState$inboundSchema,
invoiceNumber: types.optional(types.string()),
invoiceDate: types.string(),
period: z.lazy(() => GetInvoicePeriod$inboundSchema),
paidAt: types.optional(types.string()),
refundedAt: types.optional(types.string()),
memo: types.optional(types.string()),
items: z.array(z.lazy(() => GetInvoiceItems$inboundSchema)),
discounts: types.optional(z.array(z.lazy(() => GetInvoiceDiscounts$inboundSchema))),
total: types.string(),
refundReason: types.optional(types.string()),
refundTotal: types.optional(types.string()),
created: types.string(),
updated: types.string(),
});
export function getInvoiceResponseBodyFromJSON(jsonString) {
return safeParse(jsonString, (x) => GetInvoiceResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetInvoiceResponseBody' from JSON`);
}
//# sourceMappingURL=getinvoiceop.js.map