@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>
113 lines (97 loc) • 2.9 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { ClosedEnum } from "../types/enums.js";
export const RequestBodyAction = {
Refund: "refund",
} as const;
export type RequestBodyAction = ClosedEnum<typeof RequestBodyAction>;
export type UpdateInvoiceRequestBody1 = {
action: RequestBodyAction;
/**
* Refund reason.
*/
reason: string;
/**
* The total amount to be refunded. Must be less than or equal to the total amount of the invoice.
*/
total: string;
};
export type UpdateInvoiceRequestBody = UpdateInvoiceRequestBody1;
export type UpdateInvoiceRequest = {
integrationConfigurationId: string;
invoiceId: string;
requestBody: UpdateInvoiceRequestBody1;
};
/** @internal */
export const RequestBodyAction$outboundSchema: z.ZodNativeEnum<
typeof RequestBodyAction
> = z.nativeEnum(RequestBodyAction);
/** @internal */
export type UpdateInvoiceRequestBody1$Outbound = {
action: string;
reason: string;
total: string;
};
/** @internal */
export const UpdateInvoiceRequestBody1$outboundSchema: z.ZodType<
UpdateInvoiceRequestBody1$Outbound,
z.ZodTypeDef,
UpdateInvoiceRequestBody1
> = z.object({
action: RequestBodyAction$outboundSchema,
reason: z.string(),
total: z.string(),
});
export function updateInvoiceRequestBody1ToJSON(
updateInvoiceRequestBody1: UpdateInvoiceRequestBody1,
): string {
return JSON.stringify(
UpdateInvoiceRequestBody1$outboundSchema.parse(updateInvoiceRequestBody1),
);
}
/** @internal */
export type UpdateInvoiceRequestBody$Outbound =
UpdateInvoiceRequestBody1$Outbound;
/** @internal */
export const UpdateInvoiceRequestBody$outboundSchema: z.ZodType<
UpdateInvoiceRequestBody$Outbound,
z.ZodTypeDef,
UpdateInvoiceRequestBody
> = z.lazy(() => UpdateInvoiceRequestBody1$outboundSchema);
export function updateInvoiceRequestBodyToJSON(
updateInvoiceRequestBody: UpdateInvoiceRequestBody,
): string {
return JSON.stringify(
UpdateInvoiceRequestBody$outboundSchema.parse(updateInvoiceRequestBody),
);
}
/** @internal */
export type UpdateInvoiceRequest$Outbound = {
integrationConfigurationId: string;
invoiceId: string;
RequestBody: UpdateInvoiceRequestBody1$Outbound;
};
/** @internal */
export const UpdateInvoiceRequest$outboundSchema: z.ZodType<
UpdateInvoiceRequest$Outbound,
z.ZodTypeDef,
UpdateInvoiceRequest
> = z.object({
integrationConfigurationId: z.string(),
invoiceId: z.string(),
requestBody: z.lazy(() => UpdateInvoiceRequestBody1$outboundSchema),
}).transform((v) => {
return remap$(v, {
requestBody: "RequestBody",
});
});
export function updateInvoiceRequestToJSON(
updateInvoiceRequest: UpdateInvoiceRequest,
): string {
return JSON.stringify(
UpdateInvoiceRequest$outboundSchema.parse(updateInvoiceRequest),
);
}