/* * 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 { BenefitGitHubRepositorySubscriber, BenefitGitHubRepositorySubscriber$inboundSchema, } from "./benefitgithubrepositorysubscriber.js"; import { BenefitGrantError, BenefitGrantError$inboundSchema, } from "./benefitgranterror.js"; import { BenefitGrantGitHubRepositoryProperties, BenefitGrantGitHubRepositoryProperties$inboundSchema, } from "./benefitgrantgithubrepositoryproperties.js"; import { CustomerPortalCustomer, CustomerPortalCustomer$inboundSchema, } from "./customerportalcustomer.js"; export type CustomerBenefitGrantGitHubRepository = { /** * Creation timestamp of the object. */ createdAt: Date; /** * Last modification timestamp of the object. */ modifiedAt: Date | null; /** * The ID of the object. */ id: string; grantedAt: Date | null; revokedAt: Date | null; customerId: string; memberId?: string | null | undefined; benefitId: string; subscriptionId: string | null; orderId: string | null; isGranted: boolean; isRevoked: boolean; error?: BenefitGrantError | null | undefined; customer: CustomerPortalCustomer; benefit: BenefitGitHubRepositorySubscriber; properties: BenefitGrantGitHubRepositoryProperties; }; /** @internal */ export const CustomerBenefitGrantGitHubRepository$inboundSchema: z.ZodMiniType< CustomerBenefitGrantGitHubRepository, unknown > = z.pipe( z.object({ 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))), ), id: z.string(), granted_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), revoked_at: z.nullable( z.pipe(z.iso.datetime({ offset: true }), z.transform(v => new Date(v))), ), customer_id: z.string(), member_id: z.optional(z.nullable(z.string())), benefit_id: z.string(), subscription_id: z.nullable(z.string()), order_id: z.nullable(z.string()), is_granted: z.boolean(), is_revoked: z.boolean(), error: z.optional(z.nullable(BenefitGrantError$inboundSchema)), customer: CustomerPortalCustomer$inboundSchema, benefit: BenefitGitHubRepositorySubscriber$inboundSchema, properties: BenefitGrantGitHubRepositoryProperties$inboundSchema, }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "granted_at": "grantedAt", "revoked_at": "revokedAt", "customer_id": "customerId", "member_id": "memberId", "benefit_id": "benefitId", "subscription_id": "subscriptionId", "order_id": "orderId", "is_granted": "isGranted", "is_revoked": "isRevoked", }); }), ); export function customerBenefitGrantGitHubRepositoryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerBenefitGrantGitHubRepository$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerBenefitGrantGitHubRepository' from JSON`, ); }