Documentation
¶
Index ¶
- Constants
- func New(apiFilesDir string, opts ...Option) (string, error)
- func NewV2(opts ...Option) (string, error)
- func WithAuthentication(authentication string) func(*Options)
- func WithBaseFileName(baseFileName string) func(*Options)
- func WithBaseServerURL(baseServerURL string) func(*Options)
- func WithCDN(cdn string) func(*Options)
- func WithDarkMode() func(*Options)
- func WithDefaultFonts() func(*Options)
- func WithEditable() func(*Options)
- func WithForceDarkMode() func(*Options)
- func WithHiddenClients(hiddenClients ...string) func(*Options)
- func WithHideAllClients() func(*Options)
- func WithHideDarkModeToggle() func(*Options)
- func WithHideDownloadButton() func(*Options)
- func WithHideModels() func(*Options)
- func WithKeyValue(key string, value any) func(MetaData)
- func WithLayout(layout Layout) func(*Options)
- func WithMetaDataOpts(metadataOpts ...MetaOption) func(*Options)
- func WithOverrideCSS(overrideCSS string) func(*Options)
- func WithPathRouting(pathRouting string) func(*Options)
- func WithProxy(proxy string) func(*Options)
- func WithSearchHotKey(searchHotKey string) func(*Options)
- func WithServers(servers ...Server) func(*Options)
- func WithSidebarVisibility(visible bool) func(*Options)
- func WithSpecDir(specDir string) func(*Options)
- func WithSpecModifier(handler SpecModifier) func(*Options)
- func WithSpecURL(specURL string) func(*Options)
- func WithTheme(theme Theme) func(*Options)
- func WithTitle(title string) func(MetaData)
- type Layout
- type MetaData
- type MetaOption
- type Option
- type Options
- type Server
- type SpecModifier
- type Theme
Constants ¶
const DefaultCDN = "https://cdn.jsdelivr.net/npm/@scalar/api-reference"
DefaultCDN default CDN for api-reference
Variables ¶
This section is empty.
Functions ¶
func WithAuthentication ¶
WithAuthentication sets the authentication method for the Scalar UI
func WithBaseFileName ¶
WithBaseFileName sets the base file name for the Scalar UI
func WithBaseServerURL ¶
WithBaseServerURL sets the base server URL for the Scalar UI
func WithDefaultFonts ¶
func WithDefaultFonts() func(*Options)
WithDefaultFonts sets the default fonts usage for the Scalar UI
func WithEditable ¶
func WithEditable() func(*Options)
WithEditable sets the editable state for the Scalar UI
func WithForceDarkMode ¶ added in v0.5.0
func WithForceDarkMode() func(*Options)
WithForceDarkMode makes it always this state no matter what
func WithHiddenClients ¶
WithHiddenClients hide the set clients
func WithHideAllClients ¶ added in v0.6.0
func WithHideAllClients() func(*Options)
WithHideAllClients sets the hidden clients for the Scalar UI
func WithHideDarkModeToggle ¶ added in v0.5.0
func WithHideDarkModeToggle() func(*Options)
WithHideDarkModeToggle hides the dark mode toggle button
func WithHideDownloadButton ¶
func WithHideDownloadButton() func(*Options)
WithHideDownloadButton hide to download OpenAPI spec button
func WithHideModels ¶
func WithHideModels() func(*Options)
WithHideModels sets the models visibility for the Scalar UI
func WithKeyValue ¶ added in v0.5.0
WithKeyValue add metadata with key and value
func WithLayout ¶
WithLayout sets the layout for the Scalar UI
func WithMetaDataOpts ¶ added in v0.5.0
func WithMetaDataOpts(metadataOpts ...MetaOption) func(*Options)
WithMetaDataOpts add metadata
func WithOverrideCSS ¶
WithOverrideCSS sets the override CSS for the Scalar UI
func WithPathRouting ¶
WithPathRouting sets the path routing for the Scalar UI
func WithSearchHotKey ¶
WithSearchHotKey sets the search hot key for the Scalar UI
func WithServers ¶ added in v0.5.0
WithServers servers to override the openapi spec servers
func WithSidebarVisibility ¶
WithSidebarVisibility sets the sidebar visibility for the Scalar UI
func WithSpecDir ¶ added in v0.6.0
WithSpecDir read spec from directory
func WithSpecModifier ¶ added in v0.0.6
func WithSpecModifier(handler SpecModifier) func(*Options)
WithSpecModifier allows to modify the spec before rendering
func WithSpecURL ¶ added in v0.6.0
WithSpecURL set the spec URL in the doc
Types ¶
type MetaOption ¶ added in v0.5.0
type MetaOption func(MetaData)
type Options ¶
type Options struct { Configurations map[string]any OverrideCSS string BaseFileName string CDN string SpecModifier SpecModifier SpecDirectory string SpecURL string }
func (*Options) GetSpecScript ¶ added in v0.6.0
GetSpecScript prepare and return spec script
type SpecModifier ¶ added in v0.0.6
SpecModifier is a function that can be used to override the spec
type Theme ¶
type Theme string
Theme as a type based on string for theme identification
const ( ThemeDefault Theme = "default" ThemeAlternate Theme = "alternate" ThemeMoon Theme = "moon" ThemePurple Theme = "purple" ThemeSolarized Theme = "solarized" ThemeBluePlanet Theme = "bluePlanet" ThemeDeepSpace Theme = "deepSpace" ThemeSaturn Theme = "saturn" ThemeKepler Theme = "kepler" ThemeMars Theme = "mars" ThemeNone Theme = "none" ThemeNil Theme = "" )