import { ArcadeApiConstant, SchemaApiFunction } from '.'; import { BundleType, ProfileType, SchemaValueType } from './common'; import { SqlApiFunction } from './sql'; import { ArcadeApiFunction } from './arcade'; /** * Definition for a schema category */ export interface SchemaCategory { title: string; description: string[] | string; page: string; hideSummaryList?: boolean; } export interface GenericSchemaItemBase { /** * The name of the function or constant. Must start with a capital letter. * @pattern ^[A-Z]+[a-zA-Z0-9.]*$ */ name: string; /** * A nice description for the constant or function. It can leverage Github Flavored Markdown formatting. */ description: string[] | string; /** * Version string. Format x.y. * @pattern ^1\.\d+$ */ sinceVersion?: string; /** * Indicates if the item should not be documented. */ disableDocumentation?: boolean; /** * The profiles the constant or the function belongs to. */ profiles?: Profile[]; /** * The bundle the constant or the function belongs to. */ bundle: Bundle; /** * The relative path to an image to illustate the constant or the function. */ image?: string; /** * The code that will be injected in the classic editor. Must start with a capital letter and match the name of the funtion or constant. * @pattern ^[A-Z]+.*$ */ snippet: string; /** * The collection of examples */ examples?: SchemaExample[]; /** * A collection of links to resources */ resourceLinks?: SchemaResourceLink[]; } /** * Describes an Api Constant */ export interface BaseSchemaApiConstant extends GenericSchemaItemBase { /** * For constant, the property is mandatory and always true */ isConstant: true; } export type SchemaReturnValue = SchemaReturnDefinition | ValueType | ValueType[]; /** * Describes an Api Function. */ export interface BaseSchemaApiFunction extends GenericSchemaItemBase { /** * For function this property is optional and always false. */ isConstant?: boolean; /** * The set of function parameters. */ parameters?: SchemaProperty[]; /** * The type of data returned by the function. */ returnValue?: SchemaReturnValue; } /** * Describes the properties for the type Property */ export interface SchemaProperty { /** * The name of the property. * @pattern ^([a-z]+[a-zA-Z0-9_]*|\[.*\])$ */ name: string; /** * The data type of the property value. If the property supports more than one type then use an array. */ type: ValueType | ValueType[]; /** * The description for the property. */ description: string[] | string; /** * Indicates if the property is optional. */ optional?: boolean; /** * The properties if the type is Dictionary. */ properties?: SchemaProperty[]; } /** * Describes the type fo data returned by a function. */ export interface SchemaReturnDefinition { /** * The data type of the value returned. */ type: T; /** * A description for for the value returned. */ description?: string[] | string; /** * The properties if the type returned is a Dictionary */ properties?: SchemaProperty[]; } /** * Describes an example */ export interface SchemaExample { /** * A description for the example. */ description?: string[] | string; /** * Either a single line string or an array of strings. */ code: string[] | string; } /** * Describes a link to additional resources */ export interface SchemaResourceLink { /** * The text used to describe the resource link. */ linkText: string; /** * The url to the resource. */ url: string; } /** * Definition for simple item */ export type SingularApiItem = ArcadeApiConstant | ArcadeApiFunction | SqlApiFunction; /** * Definition for a constant or a function. * An Api Item can be either a constant, a function, or an array of functions */ export type BaseSchemaApiItem = LanguageApiFunction | LanguageApiFunction[] | (LanguageApiConstant extends undefined ? never : LanguageApiConstant);