/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { smartUnion } from "../../types/smartUnion.js"; import { BenefitGitHubRepositoryCreateProperties, BenefitGitHubRepositoryCreateProperties$Outbound, BenefitGitHubRepositoryCreateProperties$outboundSchema, } from "./benefitgithubrepositorycreateproperties.js"; export type BenefitGitHubRepositoryCreateMetadata = | string | number | number | boolean; export type BenefitGitHubRepositoryCreate = { /** * 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; type: "github_repository"; /** * The description of the benefit. Will be displayed on products having this benefit. */ description: string; /** * The ID of the organization owning the benefit. **Required unless you use an organization token.** */ organizationId?: string | null | undefined; /** * Properties to create a benefit of type `github_repository`. */ properties: BenefitGitHubRepositoryCreateProperties; }; /** @internal */ export type BenefitGitHubRepositoryCreateMetadata$Outbound = | string | number | number | boolean; /** @internal */ export const BenefitGitHubRepositoryCreateMetadata$outboundSchema: z.ZodMiniType< BenefitGitHubRepositoryCreateMetadata$Outbound, BenefitGitHubRepositoryCreateMetadata > = smartUnion([z.string(), z.int(), z.number(), z.boolean()]); export function benefitGitHubRepositoryCreateMetadataToJSON( benefitGitHubRepositoryCreateMetadata: BenefitGitHubRepositoryCreateMetadata, ): string { return JSON.stringify( BenefitGitHubRepositoryCreateMetadata$outboundSchema.parse( benefitGitHubRepositoryCreateMetadata, ), ); } /** @internal */ export type BenefitGitHubRepositoryCreate$Outbound = { metadata?: { [k: string]: string | number | number | boolean } | undefined; type: "github_repository"; description: string; organization_id?: string | null | undefined; properties: BenefitGitHubRepositoryCreateProperties$Outbound; }; /** @internal */ export const BenefitGitHubRepositoryCreate$outboundSchema: z.ZodMiniType< BenefitGitHubRepositoryCreate$Outbound, BenefitGitHubRepositoryCreate > = z.pipe( z.object({ metadata: z.optional( z.record( z.string(), smartUnion([z.string(), z.int(), z.number(), z.boolean()]), ), ), type: z.literal("github_repository"), description: z.string(), organizationId: z.optional(z.nullable(z.string())), properties: BenefitGitHubRepositoryCreateProperties$outboundSchema, }), z.transform((v) => { return remap$(v, { organizationId: "organization_id", }); }), ); export function benefitGitHubRepositoryCreateToJSON( benefitGitHubRepositoryCreate: BenefitGitHubRepositoryCreate, ): string { return JSON.stringify( BenefitGitHubRepositoryCreate$outboundSchema.parse( benefitGitHubRepositoryCreate, ), ); }