Exemplo n.º 1
0
//Get receivers of a certain contact type
func GetReceiversByContactType(rw http.ResponseWriter, req *http.Request, params martini.Params, enc encoding.Encoder) string {
	var err error
	var ctype contact.ContactType
	var crs contact.ContactReceivers

	if ctype.ID, err = strconv.Atoi(params["id"]); err != nil {
		apierror.GenerateError("Trouble getting contact type ID", err, rw, req)
	}
	crs, err = ctype.GetReceivers()
	if err != nil {
		apierror.GenerateError("Trouble getting receivers for contact type", err, rw, req)
	}
	return encoding.Must(enc.Encode(crs))
}