/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 1186651bc86b */ import * as z from "zod/v3"; import { ClosedEnum } from "../../types/enums.js"; import { FacetFilter, FacetFilter$Outbound, FacetFilter$outboundSchema, } from "./facetfilter.js"; import { StructuredText, StructuredText$Outbound, StructuredText$outboundSchema, } from "./structuredtext.js"; import { Thumbnail, Thumbnail$Outbound, Thumbnail$outboundSchema, } from "./thumbnail.js"; /** * This determines whether this is a Social Feed post or a regular announcement. */ export const UpdateAnnouncementRequestChannel = { Main: "MAIN", SocialFeed: "SOCIAL_FEED", } as const; /** * This determines whether this is a Social Feed post or a regular announcement. */ export type UpdateAnnouncementRequestChannel = ClosedEnum< typeof UpdateAnnouncementRequestChannel >; /** * This determines whether this is an external-link post or a regular announcement post. TEXT - Regular announcement that can contain rich text. LINK - Announcement that is linked to an external site. */ export const UpdateAnnouncementRequestPostType = { Text: "TEXT", Link: "LINK", } as const; /** * This determines whether this is an external-link post or a regular announcement post. TEXT - Regular announcement that can contain rich text. LINK - Announcement that is linked to an external site. */ export type UpdateAnnouncementRequestPostType = ClosedEnum< typeof UpdateAnnouncementRequestPostType >; export type UpdateAnnouncementRequest = { /** * The date and time at which the announcement becomes active. */ startTime: Date; /** * The date and time at which the announcement expires. */ endTime: Date; /** * The headline of the announcement. */ title: string; body?: StructuredText | undefined; /** * An emoji used to indicate the nature of the announcement. */ emoji?: string | undefined; thumbnail?: Thumbnail | undefined; banner?: Thumbnail | undefined; /** * Filters which restrict who should see the announcement. Values are taken from the corresponding filters in people search. */ audienceFilters?: Array | undefined; /** * The Glean Document ID of the source document this Announcement was created from (e.g. Slack thread). */ sourceDocumentId?: string | undefined; /** * Whether or not to hide an author attribution. */ hideAttribution?: boolean | undefined; /** * This determines whether this is a Social Feed post or a regular announcement. */ channel?: UpdateAnnouncementRequestChannel | undefined; /** * This determines whether this is an external-link post or a regular announcement post. TEXT - Regular announcement that can contain rich text. LINK - Announcement that is linked to an external site. */ postType?: UpdateAnnouncementRequestPostType | undefined; /** * Used by the Social Feed to pin posts to the front of the feed. */ isPrioritized?: boolean | undefined; /** * URL for viewing the announcement. It will be set to document URL for announcements from other datasources e.g. simpplr. Can only be written when channel="SOCIAL_FEED". */ viewUrl?: string | undefined; /** * The opaque id of the announcement. */ id: number; }; /** @internal */ export const UpdateAnnouncementRequestChannel$outboundSchema: z.ZodNativeEnum< typeof UpdateAnnouncementRequestChannel > = z.nativeEnum(UpdateAnnouncementRequestChannel); /** @internal */ export const UpdateAnnouncementRequestPostType$outboundSchema: z.ZodNativeEnum< typeof UpdateAnnouncementRequestPostType > = z.nativeEnum(UpdateAnnouncementRequestPostType); /** @internal */ export type UpdateAnnouncementRequest$Outbound = { startTime: string; endTime: string; title: string; body?: StructuredText$Outbound | undefined; emoji?: string | undefined; thumbnail?: Thumbnail$Outbound | undefined; banner?: Thumbnail$Outbound | undefined; audienceFilters?: Array | undefined; sourceDocumentId?: string | undefined; hideAttribution?: boolean | undefined; channel?: string | undefined; postType?: string | undefined; isPrioritized?: boolean | undefined; viewUrl?: string | undefined; id: number; }; /** @internal */ export const UpdateAnnouncementRequest$outboundSchema: z.ZodType< UpdateAnnouncementRequest$Outbound, z.ZodTypeDef, UpdateAnnouncementRequest > = z.object({ startTime: z.date().transform(v => v.toISOString()), endTime: z.date().transform(v => v.toISOString()), title: z.string(), body: StructuredText$outboundSchema.optional(), emoji: z.string().optional(), thumbnail: Thumbnail$outboundSchema.optional(), banner: Thumbnail$outboundSchema.optional(), audienceFilters: z.array(FacetFilter$outboundSchema).optional(), sourceDocumentId: z.string().optional(), hideAttribution: z.boolean().optional(), channel: UpdateAnnouncementRequestChannel$outboundSchema.optional(), postType: UpdateAnnouncementRequestPostType$outboundSchema.optional(), isPrioritized: z.boolean().optional(), viewUrl: z.string().optional(), id: z.number().int(), }); export function updateAnnouncementRequestToJSON( updateAnnouncementRequest: UpdateAnnouncementRequest, ): string { return JSON.stringify( UpdateAnnouncementRequest$outboundSchema.parse(updateAnnouncementRequest), ); }