Documentation
¶
Index ¶
- func DetailsHandler[Item SonolusItem](handler SonolusService[Item]) gin.HandlerFunc
- func GetEmptyItem[ItemType SonolusItem](name string) (item ItemType, description string, err error)
- func GetEmptyList[ItemType SonolusItem](page int, queryMap map[string]string) (pageCount int, items []ItemType)
- func GetEmptyRecommend[ItemType SonolusItem](name string) (items []ItemType)
- func GetItem[ItemType SonolusItem](name string) (item ItemType, description string, err error)
- func GetList[ItemType SonolusItem](page int, queryMap map[string]string) (pageCount int, items []ItemType)
- func InfoHandler[Item SonolusItem](handler SonolusService[Item]) gin.HandlerFunc
- func ListHandler[Item SonolusItem](handler SonolusService[Item]) gin.HandlerFunc
- func ServerInfoHandler(server *Server) gin.HandlerFunc
- func SonolusVersionHandler(ctx *gin.Context)
- type Background
- type Configuration
- type Effect
- type Engine
- type Handlers
- type ItemDetail
- type ItemInfo
- type ItemList
- type ItemSection
- type Level
- type Particle
- type Playlist
- type Post
- type Replay
- type RouterGroups
- type SRL
- type Server
- type ServerForm
- type ServerInfo
- type ServerInfoButtonType
- type ServerInfoFilePath
- type ServerOption
- type ServerSelectOption
- type ServerSliderOption
- type ServerTextOption
- type ServerToggleOption
- type Skin
- type SonolusCategory
- type SonolusItem
- type SonolusItemBase
- type SonolusService
- type Tag
- type UseItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetailsHandler ¶
func DetailsHandler[Item SonolusItem](handler SonolusService[Item]) gin.HandlerFunc
func GetEmptyItem ¶
func GetEmptyItem[ItemType SonolusItem](name string) (item ItemType, description string, err error)
func GetEmptyList ¶
func GetEmptyList[ItemType SonolusItem](page int, queryMap map[string]string) (pageCount int, items []ItemType)
func GetEmptyRecommend ¶
func GetEmptyRecommend[ItemType SonolusItem](name string) (items []ItemType)
func GetItem ¶
func GetItem[ItemType SonolusItem](name string) (item ItemType, description string, err error)
func GetList ¶
func GetList[ItemType SonolusItem](page int, queryMap map[string]string) (pageCount int, items []ItemType)
func InfoHandler ¶
func InfoHandler[Item SonolusItem](handler SonolusService[Item]) gin.HandlerFunc
func ListHandler ¶
func ListHandler[Item SonolusItem](handler SonolusService[Item]) gin.HandlerFunc
func SonolusVersionHandler ¶
Types ¶
type Background ¶
type Background struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Image SRL `json:"image"`
Configuration SRL `json:"configuration"`
}
func (Background) GetCategory ¶
func (item Background) GetCategory() SonolusCategory
func (Background) GetName ¶
func (item Background) GetName() string
type Configuration ¶
type Configuration struct {
Options []any `json:"options"` // Not Certain here
}
type Effect ¶
type Effect struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Audio SRL `json:"audio"`
}
func (Effect) GetCategory ¶
func (item Effect) GetCategory() SonolusCategory
type Engine ¶
type Engine struct {
SonolusItemBase
Skin Skin `json:"skin"`
Background Background `json:"background"`
Effect Effect `json:"effect"`
Particle Particle `json:"particle"`
Thumbnail SRL `json:"thumbnail"`
PlayData SRL `json:"playData"`
WatchData SRL `json:"watchData"`
PreviewData SRL `json:"previewData"`
TutorialData SRL `json:"tutorialData"`
Rom *SRL `json:"rom,omitempty"`
Configuration SRL `json:"configuration"`
}
func (Engine) GetCategory ¶
func (item Engine) GetCategory() SonolusCategory
type Handlers ¶
type Handlers struct {
Posts SonolusService[Post]
Playlist SonolusService[Playlist]
Levels SonolusService[Level]
Skins SonolusService[Skin]
Backgrounds SonolusService[Background]
Effects SonolusService[Effect]
Particles SonolusService[Particle]
Engines SonolusService[Engine]
Replay SonolusService[Replay]
}
type ItemDetail ¶
type ItemDetail[ItemType SonolusItem] struct { Item ItemType `json:"item"` Description string `json:"description"` HasCommunity bool `json:"hasCommunity"` Leaderboards []interface{} `json:"leaderboards"` Actions []interface{} `json:"actions"` Sections []ItemSection[ItemType] `json:"sections"` }
type ItemInfo ¶
type ItemInfo[ItemType SonolusItem] struct { Banner SRL `json:"banner"` Sections []ItemSection[ItemType] `json:"sections"` Searches []ServerForm `json:"searches"` }
type ItemList ¶
type ItemList[ItemType SonolusItem] struct { PageCount int `json:"pageCount"` Items []ItemType `json:"items"` Searches []ServerForm `json:"searches"` }
type ItemSection ¶
type ItemSection[ItemType SonolusItem] struct { Title string `json:"title"` Items []ItemType `json:"items"` ItemType string `json:"itemType"` Icon string `json:"icon,omitempty"` }
type Level ¶
type Level struct {
Name string `json:"name"`
Source string `json:"source"`
Version int `json:"version"`
Rating int `json:"rating"`
Title string `json:"title"`
Artists string `json:"artists"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Engine Engine `json:"engine"`
UseSkin UseItem[Skin] `json:"useSkin"`
UseBackground UseItem[Background] `json:"useBackground"`
UseEffect UseItem[Effect] `json:"useEffect"`
UseParticle UseItem[Particle] `json:"useParticle"`
Cover SRL `json:"cover"`
Bgm SRL `json:"bgm"`
Preview *SRL `json:"preview,omitempty"`
Data SRL `json:"data"`
}
func (Level) GetCategory ¶
func (item Level) GetCategory() SonolusCategory
type Particle ¶
type Particle struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Texture SRL `json:"texture"`
}
func (Particle) GetCategory ¶
func (item Particle) GetCategory() SonolusCategory
type Playlist ¶
type Playlist struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Levels []Level `json:"levels"`
Thumbnail SRL `json:"thumbnail"`
}
func (Playlist) GetCategory ¶
func (item Playlist) GetCategory() SonolusCategory
type Post ¶
type Post struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
Time string `json:"time"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Thumbnail SRL `json:"thumbnail"`
}
func (Post) GetCategory ¶
func (item Post) GetCategory() SonolusCategory
type Replay ¶
type Replay struct {
Name string `json:"name"`
Source string `json:"source,omitempty"`
Version int `json:"version"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Author string `json:"author"`
Tags []Tag `json:"tags"`
Levels []Level `json:"levels"`
Data SRL `json:"data"`
Thumbnail SRL `json:"thumbnail"`
}
func (Replay) GetCategory ¶
func (item Replay) GetCategory() SonolusCategory
type RouterGroups ¶
type RouterGroups struct {
Sonolus *gin.RouterGroup
Posts *gin.RouterGroup
Playlist *gin.RouterGroup
Levels *gin.RouterGroup
Skins *gin.RouterGroup
Backgrounds *gin.RouterGroup
Effects *gin.RouterGroup
Particles *gin.RouterGroup
Engines *gin.RouterGroup
Replays *gin.RouterGroup
}
type Server ¶
type Server struct {
RepoDir string
ServerName string
ServerBanner SRL
ServerInfo ServerInfoFilePath
Handlers Handlers
RouterGroups RouterGroups
}
func DefaultConfig ¶
func DefaultConfig() *Server
func (*Server) LoadHandlers ¶
type ServerForm ¶
type ServerForm struct {
Type string `json:"type"`
Title string `json:"title"`
Icon string `json:"icon,omitempty"`
Description string `json:"description,omitempty"`
Help string `json:"help,omitempty"`
RequireConfirmation bool `json:"requireConfirmation"`
Options []ServerOption `json:"options"`
}
func GetEmptySearch ¶
func GetEmptySearch() (search []ServerForm)
type ServerInfo ¶
type ServerInfo struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
HasAuthentication bool `json:"hasAuthentication"`
HasMultiplayer bool `json:"hasMultiplayer"`
Buttons []ServerInfoButtonType `json:"buttons"`
Banner SRL `json:"banner"`
Configuration Configuration `json:"configuration"`
}
type ServerInfoButtonType ¶
type ServerInfoButtonType struct {
Type string `json:"type"`
}
type ServerInfoFilePath ¶
type ServerInfoFilePath struct {
Posts string
Playlist string
Levels string
Skins string
Backgrounds string
Effects string
Particles string
Engines string
Replays string
}
var InfoFilePath *ServerInfoFilePath
type ServerOption ¶
type ServerSelectOption ¶
type ServerSelectOption struct {
Query string `json:"query"`
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required"`
Type string `json:"type"`
Def int `json:"def"`
Values []string `json:"values,omitempty"`
}
func NewServerSelectOption ¶
func (ServerSelectOption) GetQuery ¶
func (o ServerSelectOption) GetQuery() string
func (ServerSelectOption) GetValueStr ¶
func (o ServerSelectOption) GetValueStr(queryResult string) string
type ServerSliderOption ¶
type ServerSliderOption struct {
Query string `json:"query"`
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required"`
Type string `json:"type"`
Def float64 `json:"def"`
Min float64 `json:"min"`
Max float64 `json:"max"`
Step float64 `json:"step"`
Unit string `json:"unit"`
}
func NewServerSliderOption ¶
func (ServerSliderOption) GetQuery ¶
func (o ServerSliderOption) GetQuery() string
func (ServerSliderOption) GetValueStr ¶
func (o ServerSliderOption) GetValueStr(queryResult string) string
type ServerTextOption ¶
type ServerTextOption struct {
Query string `json:"query"`
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required"`
Type string `json:"type"`
Def string `json:"def"`
PlaceHolder string `json:"placeHolder"`
Limit int `json:"limit"`
Shortcuts []string `json:"shortcuts"`
}
func NewServerTextOption ¶
func (ServerTextOption) GetQuery ¶
func (o ServerTextOption) GetQuery() string
func (ServerTextOption) GetValueStr ¶
func (o ServerTextOption) GetValueStr(queryResult string) string
type ServerToggleOption ¶
type ServerToggleOption struct {
Query string `json:"query"`
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required"`
Type string `json:"type"`
Def int `json:"def"`
}
func NewServerToggleOption ¶
func (ServerToggleOption) GetQuery ¶
func (o ServerToggleOption) GetQuery() string
func (ServerToggleOption) GetValueStr ¶
func (o ServerToggleOption) GetValueStr(queryResult string) string
type Skin ¶
type Skin struct {
SonolusItemBase
Thumbnail SRL `json:"thumbnail"`
Data SRL `json:"data"`
Texture SRL `json:"texture"`
}
func (Skin) GetCategory ¶
func (item Skin) GetCategory() SonolusCategory
type SonolusCategory ¶
type SonolusCategory int
const ( CategoryPostItem SonolusCategory = iota CategoryPlaylist CategoryLevels CategorySkins CategoryBackgrounds CategoryEffect CategoryParticle CategoryEngine CategoryReplayItem TotalCategoryCnt )
type SonolusItem ¶
type SonolusItemBase ¶
type SonolusService ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.