func (ctl *controller) updateGroup(c web.C, w http.ResponseWriter, r *http.Request) { group := api.Group{} if err := json.NewDecoder(r.Body).Decode(&group); err != nil { logger.Error("updateGroup", "error", err) http.Error(w, http.StatusText(400), 400) return } group.ID = c.URLParams["group_id"] group.ApplicationID = c.URLParams["app_id"] err := ctl.api.UpdateGroup(&group) switch err { case nil: default: logger.Error("updateGroup", "error", err, "group", group) http.Error(w, http.StatusText(400), 400) return } groupJSON, err := ctl.api.GetGroupJSON(group.ID) if err != nil { logger.Error("updateGroup", "error", err, "groupID", group.ID) http.Error(w, http.StatusText(400), 400) return } w.Write(groupJSON) }
func joinGrp(w http.ResponseWriter, r *http.Request) { grp := api.Group{} grp.JoinGrp(w, r) }
func addgrp(w http.ResponseWriter, r *http.Request) { grp := api.Group{} grp.AddGrp(w, r) }
func mems(w http.ResponseWriter, r *http.Request) { grp := api.Group{} grp.Mems(w, r) }
func mygrp(w http.ResponseWriter, r *http.Request) { grp := api.Group{} grp.MyGrp(w, r) }