/* * 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 * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const BenefitGrantGitHubRepositoryPropertiesPermission = { Pull: "pull", Triage: "triage", Push: "push", Maintain: "maintain", Admin: "admin", } as const; export type BenefitGrantGitHubRepositoryPropertiesPermission = OpenEnum< typeof BenefitGrantGitHubRepositoryPropertiesPermission >; export type BenefitGrantGitHubRepositoryProperties = { accountId?: string | null | undefined; repositoryOwner?: string | undefined; repositoryName?: string | undefined; permission?: BenefitGrantGitHubRepositoryPropertiesPermission | undefined; grantedAccountId?: string | undefined; }; /** @internal */ export const BenefitGrantGitHubRepositoryPropertiesPermission$inboundSchema: z.ZodMiniType = openEnums.inboundSchema(BenefitGrantGitHubRepositoryPropertiesPermission); /** @internal */ export const BenefitGrantGitHubRepositoryPropertiesPermission$outboundSchema: z.ZodMiniType = openEnums.outboundSchema(BenefitGrantGitHubRepositoryPropertiesPermission); /** @internal */ export const BenefitGrantGitHubRepositoryProperties$inboundSchema: z.ZodMiniType = z.pipe( z.object({ account_id: z.optional(z.nullable(z.string())), repository_owner: z.optional(z.string()), repository_name: z.optional(z.string()), permission: z.optional( BenefitGrantGitHubRepositoryPropertiesPermission$inboundSchema, ), granted_account_id: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { "account_id": "accountId", "repository_owner": "repositoryOwner", "repository_name": "repositoryName", "granted_account_id": "grantedAccountId", }); }), ); /** @internal */ export type BenefitGrantGitHubRepositoryProperties$Outbound = { account_id?: string | null | undefined; repository_owner?: string | undefined; repository_name?: string | undefined; permission?: string | undefined; granted_account_id?: string | undefined; }; /** @internal */ export const BenefitGrantGitHubRepositoryProperties$outboundSchema: z.ZodMiniType< BenefitGrantGitHubRepositoryProperties$Outbound, BenefitGrantGitHubRepositoryProperties > = z.pipe( z.object({ accountId: z.optional(z.nullable(z.string())), repositoryOwner: z.optional(z.string()), repositoryName: z.optional(z.string()), permission: z.optional( BenefitGrantGitHubRepositoryPropertiesPermission$outboundSchema, ), grantedAccountId: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { accountId: "account_id", repositoryOwner: "repository_owner", repositoryName: "repository_name", grantedAccountId: "granted_account_id", }); }), ); export function benefitGrantGitHubRepositoryPropertiesToJSON( benefitGrantGitHubRepositoryProperties: BenefitGrantGitHubRepositoryProperties, ): string { return JSON.stringify( BenefitGrantGitHubRepositoryProperties$outboundSchema.parse( benefitGrantGitHubRepositoryProperties, ), ); } export function benefitGrantGitHubRepositoryPropertiesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BenefitGrantGitHubRepositoryProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BenefitGrantGitHubRepositoryProperties' from JSON`, ); }