func TemplatesHandler() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		vars := mux.Vars(r)
		class, ok := vars["class"]
		if !ok {
			w.WriteHeader(http.StatusBadRequest)
			return
		}

		type template = struct {
			Name   string `json:"name"`
			Sample string `json:"template"`
		}

		res := make([]template, 0)
		for _, conf := range test.ConfigTemplates(class) {
			typedSample := fmt.Sprintf("type: %s\n%s", conf.Type, conf.Sample)
			t := template{
				Name:   conf.Name,
				Sample: typedSample,
			}
			res = append(res, t)
		}

		jsonResponse(w, r, res)
	}
}
// TemplatesHandler returns current charge mode
TemplatesHandler returns current charge mode
// TemplatesHandler returns current charge mode
func TemplatesHandler() http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		vars := mux.Vars(r)
		class, ok := vars["class"]
		if !ok {
			w.WriteHeader(http.StatusBadRequest)
			return
		}
		type template = struct {
			Name   string `json:"name"`
			Sample string `json:"template"`
		}
		res := make([]template, 0)
		for _, conf := range test.ConfigTemplates(class) {
			typedSample := fmt.Sprintf("type: %s\n%s", conf.Type, conf.Sample)
			t := template{
				Name:   conf.Name,
				Sample: typedSample,
			}
			res = append(res, t)
		}
		jsonResponse(w, r, res)
	}
}
func TemplatesHandler ( ) http . HandlerFunc { return func ( w http . ResponseWriter , r * http . Request ) { vars := mux . Vars ( r ) class , ok := vars [ " " ] if ! ok { w . WriteHeader ( http . StatusBadRequest ) return } type template = struct { Name string `json:"name"` Sample string `json:"template"` } res := make ( [ ] template , 0 ) for _ , conf := range test . ConfigTemplates ( class ) { typedSample := fmt . Sprintf ( " \n " , conf . Type , conf . Sample ) t := template { Name : conf . Name , Sample : typedSample , } res = append ( res , t ) } jsonResponse ( w , r , res ) } }
TemplatesHandler returns current charge mode
TemplatesHandler returns current charge mode