/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 47faae0fec45 */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { ClosedEnum, OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Announcement, Announcement$inboundSchema } from "./announcement.js"; import { AppResult, AppResult$inboundSchema } from "./appresult.js"; import { CalendarEvent, CalendarEvent$inboundSchema } from "./calendarevent.js"; import { ChatSuggestion, ChatSuggestion$inboundSchema, } from "./chatsuggestion.js"; import { Collection, Collection$inboundSchema } from "./collection.js"; import { CollectionItem, CollectionItem$inboundSchema, } from "./collectionitem.js"; import { CountInfo, CountInfo$inboundSchema } from "./countinfo.js"; import { Digest, Digest$inboundSchema } from "./digest.js"; import { DisplayableListItemUIConfig, DisplayableListItemUIConfig$inboundSchema, } from "./displayablelistitemuiconfig.js"; import { Document, Document$inboundSchema } from "./document.js"; import { Person, Person$inboundSchema } from "./person.js"; import { PromptTemplateResult, PromptTemplateResult$inboundSchema, } from "./prompttemplateresult.js"; import { Thumbnail, Thumbnail$inboundSchema } from "./thumbnail.js"; import { UserActivity, UserActivity$inboundSchema } from "./useractivity.js"; import { WorkflowResult, WorkflowResult$inboundSchema, } from "./workflowresult.js"; /** * defines how to render this particular displayable list card */ export const Format = { List: "LIST", } as const; /** * defines how to render this particular displayable list card */ export type Format = ClosedEnum; export type UiConfig = { /** * defines how to render this particular displayable list card */ format?: Format | undefined; /** * UI configurations for each item of the list */ additionalFlags?: DisplayableListItemUIConfig | undefined; }; /** * Type of the justification. */ export const JustificationType = { FrequentlyAccessed: "FREQUENTLY_ACCESSED", RecentlyAccessed: "RECENTLY_ACCESSED", TrendingDocument: "TRENDING_DOCUMENT", VerificationReminder: "VERIFICATION_REMINDER", SuggestedDocument: "SUGGESTED_DOCUMENT", EmptyStateSuggestion: "EMPTY_STATE_SUGGESTION", FrecencyScored: "FRECENCY_SCORED", ServerGenerated: "SERVER_GENERATED", UseCase: "USE_CASE", UpdateSinceLastView: "UPDATE_SINCE_LAST_VIEW", RecentlyStarted: "RECENTLY_STARTED", Event: "EVENT", UserMention: "USER_MENTION", Announcement: "ANNOUNCEMENT", ExternalAnnouncement: "EXTERNAL_ANNOUNCEMENT", PopularityBasedTrending: "POPULARITY_BASED_TRENDING", CompanyResource: "COMPANY_RESOURCE", EventDocumentFromContent: "EVENT_DOCUMENT_FROM_CONTENT", EventDocumentFromSearch: "EVENT_DOCUMENT_FROM_SEARCH", VisitAffinityScored: "VISIT_AFFINITY_SCORED", SuggestedApp: "SUGGESTED_APP", SuggestedPerson: "SUGGESTED_PERSON", ActivityHighlight: "ACTIVITY_HIGHLIGHT", SavedSearch: "SAVED_SEARCH", SuggestedChannel: "SUGGESTED_CHANNEL", PeopleCelebrations: "PEOPLE_CELEBRATIONS", SocialLink: "SOCIAL_LINK", ZeroStateChatSuggestion: "ZERO_STATE_CHAT_SUGGESTION", ZeroStateChatToolSuggestion: "ZERO_STATE_CHAT_TOOL_SUGGESTION", ZeroStatePromptTemplateSuggestion: "ZERO_STATE_PROMPT_TEMPLATE_SUGGESTION", ZeroStateStaticWorkflowSuggestion: "ZERO_STATE_STATIC_WORKFLOW_SUGGESTION", ZeroStateAgentSuggestion: "ZERO_STATE_AGENT_SUGGESTION", PersonalizedChatSuggestion: "PERSONALIZED_CHAT_SUGGESTION", DailyDigest: "DAILY_DIGEST", Task: "TASK", PlanMyDay: "PLAN_MY_DAY", EndMyDay: "END_MY_DAY", StarterKitExtension: "STARTER_KIT_EXTENSION", StarterKitOrgChart: "STARTER_KIT_ORG_CHART", StarterKitAddDoc: "STARTER_KIT_ADD_DOC", MeetingRecap: "MEETING_RECAP", ActiveDiscussion: "ACTIVE_DISCUSSION", MidDayCatchUp: "MID_DAY_CATCH_UP", QuerySuggestion: "QUERY_SUGGESTION", WeeklyMeetings: "WEEKLY_MEETINGS", FollowUp: "FOLLOW_UP", MilestoneTimelineCheck: "MILESTONE_TIMELINE_CHECK", ProjectDiscussionDigest: "PROJECT_DISCUSSION_DIGEST", ProjectNextStep: "PROJECT_NEXT_STEP", } as const; /** * Type of the justification. */ export type JustificationType = OpenEnum; export type FeedEntry = { /** * optional ID associated with a single feed entry (displayable_list_id) */ entryId?: string | undefined; /** * Title for the result. Can be document title, event title and so on. */ title: string; thumbnail?: Thumbnail | undefined; createdBy?: Person | undefined; uiConfig?: UiConfig | undefined; /** * Type of the justification. */ justificationType?: JustificationType | undefined; /** * Server side generated justification string if server provides one. */ justification?: string | undefined; /** * An opaque token that represents this particular feed entry in this particular response. To be used for /feedback reporting. */ trackingToken?: string | undefined; /** * View URL for the entry if based on links that are not documents in Glean. */ viewUrl?: string | undefined; document?: Document | undefined; event?: CalendarEvent | undefined; announcement?: Announcement | undefined; digest?: Digest | undefined; collection?: Collection | undefined; collectionItem?: CollectionItem | undefined; person?: Person | undefined; app?: AppResult | undefined; chatSuggestion?: ChatSuggestion | undefined; promptTemplate?: PromptTemplateResult | undefined; workflow?: WorkflowResult | undefined; /** * List of activity where each activity has user, action, timestamp. */ activities?: Array | undefined; documentVisitorCount?: CountInfo | undefined; }; /** @internal */ export const Format$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Format); /** @internal */ export const UiConfig$inboundSchema: z.ZodType< UiConfig, z.ZodTypeDef, unknown > = z.object({ format: Format$inboundSchema.optional(), additionalFlags: DisplayableListItemUIConfig$inboundSchema.optional(), }); export function uiConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UiConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UiConfig' from JSON`, ); } /** @internal */ export const JustificationType$inboundSchema: z.ZodType< JustificationType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(JustificationType); /** @internal */ export const FeedEntry$inboundSchema: z.ZodType< FeedEntry, z.ZodTypeDef, unknown > = z.object({ entryId: z.string().optional(), title: z.string(), thumbnail: Thumbnail$inboundSchema.optional(), createdBy: Person$inboundSchema.optional(), uiConfig: z.lazy(() => UiConfig$inboundSchema).optional(), justificationType: JustificationType$inboundSchema.optional(), justification: z.string().optional(), trackingToken: z.string().optional(), viewUrl: z.string().optional(), document: Document$inboundSchema.optional(), event: CalendarEvent$inboundSchema.optional(), announcement: Announcement$inboundSchema.optional(), digest: Digest$inboundSchema.optional(), collection: Collection$inboundSchema.optional(), collectionItem: CollectionItem$inboundSchema.optional(), person: Person$inboundSchema.optional(), app: AppResult$inboundSchema.optional(), chatSuggestion: ChatSuggestion$inboundSchema.optional(), promptTemplate: PromptTemplateResult$inboundSchema.optional(), workflow: WorkflowResult$inboundSchema.optional(), activities: z.array(UserActivity$inboundSchema).optional(), documentVisitorCount: CountInfo$inboundSchema.optional(), }); export function feedEntryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FeedEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FeedEntry' from JSON`, ); }