/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 54106f2c2edd */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const IconType = { Collection: "COLLECTION", Custom: "CUSTOM", Datasource: "DATASOURCE", DatasourceInstance: "DATASOURCE_INSTANCE", Favicon: "FAVICON", FileType: "FILE_TYPE", GeneratedBackground: "GENERATED_BACKGROUND", Glyph: "GLYPH", MimeType: "MIME_TYPE", NoIcon: "NO_ICON", Person: "PERSON", Reactions: "REACTIONS", Url: "URL", } as const; export type IconType = OpenEnum; /** * Defines how to render an icon */ export type IconConfig = { generatedBackgroundColorKey?: string | undefined; backgroundColor?: string | undefined; color?: string | undefined; key?: string | undefined; iconType?: IconType | undefined; /** * Whether the icon should be masked based on current theme. */ masked?: boolean | undefined; /** * The name of the icon if applicable, e.g. the glyph name for `IconType.GLYPH` icons. */ name?: string | undefined; /** * The URL to an image to be displayed if applicable, e.g. the URL for `iconType.URL` icons. */ url?: string | undefined; }; /** @internal */ export const IconType$inboundSchema: z.ZodType< IconType, z.ZodTypeDef, unknown > = openEnums.inboundSchema(IconType); /** @internal */ export const IconType$outboundSchema: z.ZodType< string, z.ZodTypeDef, IconType > = openEnums.outboundSchema(IconType); /** @internal */ export const IconConfig$inboundSchema: z.ZodType< IconConfig, z.ZodTypeDef, unknown > = z.object({ generatedBackgroundColorKey: z.string().optional(), backgroundColor: z.string().optional(), color: z.string().optional(), key: z.string().optional(), iconType: IconType$inboundSchema.optional(), masked: z.boolean().optional(), name: z.string().optional(), url: z.string().optional(), }); /** @internal */ export type IconConfig$Outbound = { generatedBackgroundColorKey?: string | undefined; backgroundColor?: string | undefined; color?: string | undefined; key?: string | undefined; iconType?: string | undefined; masked?: boolean | undefined; name?: string | undefined; url?: string | undefined; }; /** @internal */ export const IconConfig$outboundSchema: z.ZodType< IconConfig$Outbound, z.ZodTypeDef, IconConfig > = z.object({ generatedBackgroundColorKey: z.string().optional(), backgroundColor: z.string().optional(), color: z.string().optional(), key: z.string().optional(), iconType: IconType$outboundSchema.optional(), masked: z.boolean().optional(), name: z.string().optional(), url: z.string().optional(), }); export function iconConfigToJSON(iconConfig: IconConfig): string { return JSON.stringify(IconConfig$outboundSchema.parse(iconConfig)); } export function iconConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IconConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IconConfig' from JSON`, ); }