import { Contracts } from "ts-extractor" ; import { MarkdownBuilder , MarkdownGenerator as md } from "@simplrjs/markdown" ; import { SupportedApiItemKindType , PluginResult , PluginOptions } from "../contracts/plugin" ; import { GeneratorHelpers } from "../generator-helpers" ; import { BasePlugin } from "../abstractions/base-plugin" ; import { ApiIndex } from "../api-items/definitions/api-index" ; export class ApiIndexPlugin extends BasePlugin < Contracts . ApiIndexDto > { public SupportedApiDefinitionKind ( ) { return [ GeneratorHelpers . ApiDefinitionKind . Index ] ; } public Render ( options , apiItem ) { const serializedApiItem = new ApiIndex ( options . ExtractedData , apiItem , options . Reference ) ; const pluginResult = { ... GeneratorHelpers . GetDefaultPluginResultData ( ) , ApiItem : apiItem , Reference : options . Reference } ; const parameter = serializedApiItem . Parameter ; const parameterTypeString = parameter . Type . ToInlineText ( this . RenderReferences ( options . ExtractedData , pluginResult . UsedReferences ) ) ; const typeString = serializedApiItem . Type . ToInlineText ( this . RenderReferences ( options . ExtractedData , pluginResult . UsedReferences ) ) ; pluginResult . Result = new MarkdownBuilder ( ) . Code ( serializedApiItem . ToText ( ) , GeneratorHelpers . DEFAULT_CODE_OPTIONS ) . EmptyLine ( ) . UnorderedList ( [ `${ md . Italic ( "Parameter" ) } ${ md . InlineCode ( parameter . Name ) } - ${ parameterTypeString }` , `${ md . Italic ( "Type" ) } ${ typeString }` ] ) . GetOutput ( ) ; return pluginResult ; } }