/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { smartUnion } from "../../types/smartUnion.js"; import { BenefitDownloadablesCreateProperties, BenefitDownloadablesCreateProperties$Outbound, BenefitDownloadablesCreateProperties$outboundSchema, } from "./benefitdownloadablescreateproperties.js"; export type BenefitDownloadablesUpdateMetadata = | string | number | number | boolean; export type BenefitDownloadablesUpdate = { /** * Key-value object allowing you to store additional information. * * @remarks * * The key must be a string with a maximum length of **40 characters**. * The value must be either: * * * A string with a maximum length of **500 characters** * * An integer * * A floating-point number * * A boolean * * You can store up to **50 key-value pairs**. */ metadata?: { [k: string]: string | number | number | boolean } | undefined; /** * The description of the benefit. Will be displayed on products having this benefit. */ description?: string | null | undefined; type: "downloadables"; properties?: BenefitDownloadablesCreateProperties | null | undefined; }; /** @internal */ export type BenefitDownloadablesUpdateMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const BenefitDownloadablesUpdateMetadata$outboundSchema: z.ZodMiniType< BenefitDownloadablesUpdateMetadata$Outbound, BenefitDownloadablesUpdateMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function benefitDownloadablesUpdateMetadataToJSON( benefitDownloadablesUpdateMetadata: BenefitDownloadablesUpdateMetadata, ): string { return JSON.stringify( BenefitDownloadablesUpdateMetadata$outboundSchema.parse( benefitDownloadablesUpdateMetadata, ), ); } /** @internal */ export type BenefitDownloadablesUpdate$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; description?: string | null | undefined; type: "downloadables"; properties?: BenefitDownloadablesCreateProperties$Outbound | null | undefined; }; /** @internal */ export const BenefitDownloadablesUpdate$outboundSchema: z.ZodMiniType< BenefitDownloadablesUpdate$Outbound, BenefitDownloadablesUpdate > = z.object({ metadata: z.optional( z.record( z.string(), smartUnion([z.string(), z.int(), z.number(), z.boolean()]), ), ), description: z.optional(z.nullable(z.string())), type: z.literal("downloadables"), properties: z.optional( z.nullable(BenefitDownloadablesCreateProperties$outboundSchema), ), }); export function benefitDownloadablesUpdateToJSON( benefitDownloadablesUpdate: BenefitDownloadablesUpdate, ): string { return JSON.stringify( BenefitDownloadablesUpdate$outboundSchema.parse(benefitDownloadablesUpdate), ); }