/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Request to cancel an existing credit */ export type CancelCreditRequestCreate = { /** * The name of the credit to cancel */ name: string; /** * The optional reason about why the credit is being canceled */ reason?: string | undefined; }; /** @internal */ export const CancelCreditRequestCreate$inboundSchema: z.ZodType< CancelCreditRequestCreate, z.ZodTypeDef, unknown > = z.object({ name: z.string(), reason: z.string().optional(), }); /** @internal */ export type CancelCreditRequestCreate$Outbound = { name: string; reason?: string | undefined; }; /** @internal */ export const CancelCreditRequestCreate$outboundSchema: z.ZodType< CancelCreditRequestCreate$Outbound, z.ZodTypeDef, CancelCreditRequestCreate > = z.object({ name: z.string(), reason: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CancelCreditRequestCreate$ { /** @deprecated use `CancelCreditRequestCreate$inboundSchema` instead. */ export const inboundSchema = CancelCreditRequestCreate$inboundSchema; /** @deprecated use `CancelCreditRequestCreate$outboundSchema` instead. */ export const outboundSchema = CancelCreditRequestCreate$outboundSchema; /** @deprecated use `CancelCreditRequestCreate$Outbound` instead. */ export type Outbound = CancelCreditRequestCreate$Outbound; } export function cancelCreditRequestCreateToJSON( cancelCreditRequestCreate: CancelCreditRequestCreate, ): string { return JSON.stringify( CancelCreditRequestCreate$outboundSchema.parse(cancelCreditRequestCreate), ); } export function cancelCreditRequestCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CancelCreditRequestCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CancelCreditRequestCreate' from JSON`, ); }