/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { smartUnion } from "../../types/smartUnion.js"; import { BenefitGitHubRepositoryCreateProperties, BenefitGitHubRepositoryCreateProperties$Outbound, BenefitGitHubRepositoryCreateProperties$outboundSchema, } from "./benefitgithubrepositorycreateproperties.js"; export type BenefitGitHubRepositoryUpdateMetadata = | string | number | number | boolean; export type BenefitGitHubRepositoryUpdate = { /** * 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: "github_repository"; properties?: BenefitGitHubRepositoryCreateProperties | null | undefined; }; /** @internal */ export type BenefitGitHubRepositoryUpdateMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const BenefitGitHubRepositoryUpdateMetadata$outboundSchema: z.ZodMiniType< BenefitGitHubRepositoryUpdateMetadata$Outbound, BenefitGitHubRepositoryUpdateMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function benefitGitHubRepositoryUpdateMetadataToJSON( benefitGitHubRepositoryUpdateMetadata: BenefitGitHubRepositoryUpdateMetadata, ): string { return JSON.stringify( BenefitGitHubRepositoryUpdateMetadata$outboundSchema.parse( benefitGitHubRepositoryUpdateMetadata, ), ); } /** @internal */ export type BenefitGitHubRepositoryUpdate$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; description?: string | null | undefined; type: "github_repository"; properties?: | BenefitGitHubRepositoryCreateProperties$Outbound | null | undefined; }; /** @internal */ export const BenefitGitHubRepositoryUpdate$outboundSchema: z.ZodMiniType< BenefitGitHubRepositoryUpdate$Outbound, BenefitGitHubRepositoryUpdate > = 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("github_repository"), properties: z.optional( z.nullable(BenefitGitHubRepositoryCreateProperties$outboundSchema), ), }); export function benefitGitHubRepositoryUpdateToJSON( benefitGitHubRepositoryUpdate: BenefitGitHubRepositoryUpdate, ): string { return JSON.stringify( BenefitGitHubRepositoryUpdate$outboundSchema.parse( benefitGitHubRepositoryUpdate, ), ); }