/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c6c02bf5b716 */ 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 { CountInfo, CountInfo$inboundSchema, CountInfo$Outbound, CountInfo$outboundSchema, } from "./countinfo.js"; import { Reaction, Reaction$inboundSchema, Reaction$Outbound, Reaction$outboundSchema, } from "./reaction.js"; import { Share, Share$inboundSchema, Share$Outbound, Share$outboundSchema, } from "./share.js"; export type DocumentInteractions = { /** * The count of comments (thread replies in the case of slack). */ numComments?: number | undefined; /** * The count of reactions on the document. */ numReactions?: number | undefined; /** * To be deprecated in favor of reacts. A (potentially non-exhaustive) list of reactions for the document. * * @deprecated field: Deprecated on 2026-02-05, removal scheduled for 2026-10-15: Use reacts instead. */ reactions?: Array | undefined; reacts?: Array | undefined; /** * Describes instances of someone posting a link to this document in one of our indexed datasources. */ shares?: Array | undefined; visitorCount?: CountInfo | undefined; }; /** @internal */ export const DocumentInteractions$inboundSchema: z.ZodType< DocumentInteractions, z.ZodTypeDef, unknown > = z.object({ numComments: z.number().int().optional(), numReactions: z.number().int().optional(), reactions: z.array(z.string()).optional(), reacts: z.array(z.lazy(() => Reaction$inboundSchema)).optional(), shares: z.array(z.lazy(() => Share$inboundSchema)).optional(), visitorCount: CountInfo$inboundSchema.optional(), }); /** @internal */ export type DocumentInteractions$Outbound = { numComments?: number | undefined; numReactions?: number | undefined; reactions?: Array | undefined; reacts?: Array | undefined; shares?: Array | undefined; visitorCount?: CountInfo$Outbound | undefined; }; /** @internal */ export const DocumentInteractions$outboundSchema: z.ZodType< DocumentInteractions$Outbound, z.ZodTypeDef, DocumentInteractions > = z.object({ numComments: z.number().int().optional(), numReactions: z.number().int().optional(), reactions: z.array(z.string()).optional(), reacts: z.array(z.lazy(() => Reaction$outboundSchema)).optional(), shares: z.array(z.lazy(() => Share$outboundSchema)).optional(), visitorCount: CountInfo$outboundSchema.optional(), }); export function documentInteractionsToJSON( documentInteractions: DocumentInteractions, ): string { return JSON.stringify( DocumentInteractions$outboundSchema.parse(documentInteractions), ); } export function documentInteractionsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DocumentInteractions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DocumentInteractions' from JSON`, ); }