/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 36b1e6344f05 */ 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"; import { IconConfig, IconConfig$inboundSchema, IconConfig$Outbound, IconConfig$outboundSchema, } from "./iconconfig.js"; export const Scope = { AppCard: "APP_CARD", AutocompleteExactMatch: "AUTOCOMPLETE_EXACT_MATCH", AutocompleteFuzzyMatch: "AUTOCOMPLETE_FUZZY_MATCH", AutocompleteZeroQuery: "AUTOCOMPLETE_ZERO_QUERY", NewTabPage: "NEW_TAB_PAGE", } as const; export type Scope = OpenEnum; /** * An action for a specific datasource that will show up in autocomplete and app card, e.g. "Create new issue" for jira. */ export type Quicklink = { /** * Full action name. Used in autocomplete. */ name?: string | undefined; /** * Shortened name. Used in app cards. */ shortName?: string | undefined; /** * The URL of the action. */ url?: string | undefined; /** * Defines how to render an icon */ iconConfig?: IconConfig | undefined; /** * Unique identifier of this quicklink */ id?: string | undefined; /** * The scopes for which this quicklink is applicable */ scopes?: Array | undefined; }; /** @internal */ export const Scope$inboundSchema: z.ZodType = openEnums.inboundSchema(Scope); /** @internal */ export const Scope$outboundSchema: z.ZodType = openEnums.outboundSchema(Scope); /** @internal */ export const Quicklink$inboundSchema: z.ZodType< Quicklink, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), shortName: z.string().optional(), url: z.string().optional(), iconConfig: IconConfig$inboundSchema.optional(), id: z.string().optional(), scopes: z.array(Scope$inboundSchema).optional(), }); /** @internal */ export type Quicklink$Outbound = { name?: string | undefined; shortName?: string | undefined; url?: string | undefined; iconConfig?: IconConfig$Outbound | undefined; id?: string | undefined; scopes?: Array | undefined; }; /** @internal */ export const Quicklink$outboundSchema: z.ZodType< Quicklink$Outbound, z.ZodTypeDef, Quicklink > = z.object({ name: z.string().optional(), shortName: z.string().optional(), url: z.string().optional(), iconConfig: IconConfig$outboundSchema.optional(), id: z.string().optional(), scopes: z.array(Scope$outboundSchema).optional(), }); export function quicklinkToJSON(quicklink: Quicklink): string { return JSON.stringify(Quicklink$outboundSchema.parse(quicklink)); } export function quicklinkFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Quicklink$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Quicklink' from JSON`, ); }