/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BenefitGitHubRepositorySubscriberProperties, BenefitGitHubRepositorySubscriberProperties$inboundSchema, } from "./benefitgithubrepositorysubscriberproperties.js"; import { BenefitSubscriberOrganization, BenefitSubscriberOrganization$inboundSchema, } from "./benefitsubscriberorganization.js"; import { MetadataOutputType, MetadataOutputType$inboundSchema, } from "./metadataoutputtype.js"; export type BenefitGitHubRepositorySubscriber = { /** * The ID of the benefit. */ id: string; /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; type: "github_repository"; /** * The description of the benefit. */ description: string; /** * Whether the benefit is selectable when creating a product. */ selectable: boolean; /** * Whether the benefit is deletable. */ deletable: boolean; /** * Whether the benefit is deleted. */ isDeleted: boolean; /** * The ID of the organization owning the benefit. */ organizationId: string; metadata: { [k: string]: MetadataOutputType }; organization: BenefitSubscriberOrganization; /** * Properties available to subscribers for a benefit of type `github_repository`. */ properties: BenefitGitHubRepositorySubscriberProperties; }; /** @internal */ export const BenefitGitHubRepositorySubscriber$inboundSchema: z.ZodMiniType< BenefitGitHubRepositorySubscriber, unknown > = z.pipe( z.object({ id: z.string(), created_at: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), modified_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), type: z.literal("github_repository"), description: z.string(), selectable: z.boolean(), deletable: z.boolean(), is_deleted: z.boolean(), organization_id: z.string(), metadata: z.record(z.string(), MetadataOutputType$inboundSchema), organization: BenefitSubscriberOrganization$inboundSchema, properties: BenefitGitHubRepositorySubscriberProperties$inboundSchema, }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "is_deleted": "isDeleted", "organization_id": "organizationId", }); }), ); export function benefitGitHubRepositorySubscriberFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BenefitGitHubRepositorySubscriber$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BenefitGitHubRepositorySubscriber' from JSON`, ); }