From 25ff32d958b96bea641006d792697eeb01af5ef1 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Tue, 4 Oct 2022 12:45:15 -0700 Subject: [PATCH] getChildDevices api endpoint --- api/handlers/api.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/api/handlers/api.go b/api/handlers/api.go index 9739e1b..f3e518c 100644 --- a/api/handlers/api.go +++ b/api/handlers/api.go @@ -36,12 +36,13 @@ func (a *App) New() *mux.Router { apiCreate := r.PathPrefix("/api/v1").Subrouter() - apiCreate.Handle("/cow/{cow_id}", api.Middleware(http.HandlerFunc(cow.CowByIDHandler))).Methods("GET") // By Object ID not Cow Name - apiCreate.Handle("/cows", api.Middleware(http.HandlerFunc(cow.CowHandler))).Methods("GET") // Returns all cows - apiCreate.Handle("/cows", api.Middleware(http.HandlerFunc(cow.CowHandlerQuery))).Methods("POST") // Returns list of cows based of name query - apiCreate.Handle("/cows/new", api.Middleware(http.HandlerFunc(cow.NewCowHandler))).Methods("POST") // Create new cow - apiCreate.Handle("/cows/update/{cow_id}", api.Middleware(http.HandlerFunc(cow.UpdateCowHandler))).Methods("POST") // Update Cow by Object ID - apiCreate.Handle("/cows/add/{cow_id}", api.Middleware(http.HandlerFunc(cow.AddDeviceHandler))).Methods("POST") // Add Device to cow device list + apiCreate.Handle("/cow/{cow_id}", api.Middleware(http.HandlerFunc(cow.CowByIDHandler))).Methods("GET") // By Object ID not Cow Name + apiCreate.Handle("/cows", api.Middleware(http.HandlerFunc(cow.CowHandler))).Methods("GET") // Returns all cows + apiCreate.Handle("/cows", api.Middleware(http.HandlerFunc(cow.CowHandlerQuery))).Methods("POST") // Returns list of cows based of name query + apiCreate.Handle("/cows/new", api.Middleware(http.HandlerFunc(cow.NewCowHandler))).Methods("POST") // Create new cow + apiCreate.Handle("/cows/update/{cow_id}", api.Middleware(http.HandlerFunc(cow.UpdateCowHandler))).Methods("POST") // Update Cow by Object ID + apiCreate.Handle("/cows/add/{cow_id}", api.Middleware(http.HandlerFunc(cow.AddDeviceHandler))).Methods("POST") // Add Device to cow device list + apiCreate.Handle("/cows/getChildDevices", api.Middleware(http.HandlerFunc(device.GetChildDevices))).Methods("POST") // Get Child Devices with a given cow obj apiCreate.Handle("/device/{device_id}", api.Middleware(http.HandlerFunc(device.DeviceByIDHandler))).Methods("GET") // By Object ID not Device Name apiCreate.Handle("/devices", api.Middleware(http.HandlerFunc(device.DeviceHandler))).Methods("GET") // Returns all devices