server/admin/api_theme.go

26 lines
442 B
Go
Raw Normal View History

2016-01-07 19:47:07 +00:00
package main
import (
"strconv"
)
var ApiThemesRouting = map[string]DispatchFunction{
"GET": listTheme,
}
func listTheme(args []string, body []byte) (interface{}, error) {
if len(args) == 1 {
// List given theme
if tid, err := strconv.Atoi(string(args[0])); err != nil {
return nil, err
} else {
return GetTheme(tid)
}
} else if len(args) == 0 {
// List all themes
return GetThemes()
} else {
return nil, nil
}
}