/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: afc53ca12453 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Document, Document$inboundSchema, Document$Outbound, Document$outboundSchema, } from "./document.js"; import { Person, Person$inboundSchema, Person$Outbound, Person$outboundSchema, } from "./person.js"; /** * Search endpoint will only fill out numDays ago since that's all we need to display shared badge; docmetadata endpoint will fill out all the fields so that we can display shared badge tooltip */ export type Share = { /** * The number of days that has passed since the share happened */ numDaysAgo: number; sharer?: Person | undefined; sharingDocument?: Document | undefined; }; /** @internal */ export const Share$inboundSchema: z.ZodType = z .object({ numDaysAgo: z.number().int(), sharer: z.lazy(() => Person$inboundSchema).optional(), sharingDocument: z.lazy(() => Document$inboundSchema).optional(), }); /** @internal */ export type Share$Outbound = { numDaysAgo: number; sharer?: Person$Outbound | undefined; sharingDocument?: Document$Outbound | undefined; }; /** @internal */ export const Share$outboundSchema: z.ZodType< Share$Outbound, z.ZodTypeDef, Share > = z.object({ numDaysAgo: z.number().int(), sharer: z.lazy(() => Person$outboundSchema).optional(), sharingDocument: z.lazy(() => Document$outboundSchema).optional(), }); export function shareToJSON(share: Share): string { return JSON.stringify(Share$outboundSchema.parse(share)); } export function shareFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Share$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Share' from JSON`, ); }