package handlers import ( "net/http" "otaupdate/controllers" "otaupdate/services" "github.com/fiskerinc/cloud-services/pkg/common" "github.com/gorilla/schema" ) // @deprecated // HandleSubscriptionFeatureGet godoc // @Summary Get update manifest // @Description Get update manifest by id // @Accept json // @Produce json // @Param Authorization header string false "Bearer " // @Param Api-Key header string false "" // @Param id query string false "Subscription feature id" // @Success 200 {object} common.SubscriptionFeature // @Failure 400 {object} common.JSONError "Bad request" // @Failure 401 {object} common.JSONError "Unauthorized" // @Failure 503 {object} common.JSONError "Service unavailable" // @Router /subscriptionfeature [get] func HandleSubscriptionFeatureGet(w http.ResponseWriter, r *http.Request) { subscriptionFeatureGet.Handle(w, r) } var subscriptionFeatureGet = controllers.NewGetModel(&subscriptionFeatureGetModelHelper{}) type subscriptionFeatureGetModelHelper struct { SubscriptionFeatureHelper } func (h *subscriptionFeatureGetModelHelper) ParseGetModelParams(r *http.Request) interface{} { decoder := schema.NewDecoder() model := common.SubscriptionFeature{} decoder.SetAliasTag("json") decoder.Decode(&model, r.URL.Query()) return &model } func (h *subscriptionFeatureGetModelHelper) QueryLoad(model interface{}) error { return services.GetDB().GetSubFeatures().Load(model.(*common.SubscriptionFeature)) }