/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; export type Repo = { createdAt: Date; description: string; /** * Opaque, stable repository id (the canonical key; not a user label). */ id: string; /** * The repository name (URL label). */ name: string; /** * The organization URL slug the repository belongs to. */ org: string; }; /** @internal */ export const Repo$inboundSchema: z.ZodType = z .object({ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), description: z.string(), id: z.string(), name: z.string(), org: z.string(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", }); }); /** @internal */ export type Repo$Outbound = { created_at: string; description: string; id: string; name: string; org: string; }; /** @internal */ export const Repo$outboundSchema: z.ZodType = z.object({ createdAt: z.date().transform(v => v.toISOString()), description: z.string(), id: z.string(), name: z.string(), org: z.string(), }).transform((v) => { return remap$(v, { createdAt: "created_at", }); }); export function repoToJSON(repo: Repo): string { return JSON.stringify(Repo$outboundSchema.parse(repo)); } export function repoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Repo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Repo' from JSON`, ); }