Loading go-apps/meep-loc-serv/server/api_location.go +3 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,9 @@ func ZoneSubListGET(w http.ResponseWriter, r *http.Request) { func ZoneSubPOST(w http.ResponseWriter, r *http.Request) { zoneSubPOST(w, r) } func ZoneSubGET(w http.ResponseWriter, r *http.Request) { zoneSubGET(w, r) } func ZonalTrafficSubPOST(w http.ResponseWriter, r *http.Request) { zonalTrafficSubPost(w, r) Loading go-apps/meep-loc-serv/server/loc-serv.go +40 −0 Original line number Diff line number Diff line Loading @@ -3785,6 +3785,46 @@ func zonalTrafficSubGet(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, string(jsonResponse)) } func zoneSubGET(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) var response interface{} jsonZonalTrafficSub, _ := rc.JSONGetEntry(baseKey+typeZonalSubscription+":"+vars["subscriptionId"], ".") if jsonZonalTrafficSub != "" { var jsonZoneSub ZoneLocationEventSubscription if err := json.Unmarshal([]byte(jsonZonalTrafficSub), &jsonZoneSub); err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } response = InlineZoneLocationEventSubscription{ZoneLocationEventSubscription: &jsonZoneSub} } else { var statusSub ZoneStatusSubscription jsonZoneStatusSub, _ := rc.JSONGetEntry(baseKey+typeZoneStatusSubscription+":"+vars["subscriptionId"], ".") if jsonZoneStatusSub == "" { w.WriteHeader(http.StatusNotFound) return } if err := json.Unmarshal([]byte(jsonZoneStatusSub), &statusSub); err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } response = InlineZoneStatusSubscription{ZoneStatusSubscription: &statusSub} } jsonResponse, err := json.Marshal(response) if err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) fmt.Fprint(w, string(jsonResponse)) } func zoneSubPOST(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") var response InlineZoneStatusSubscription Loading go-apps/meep-loc-serv/server/routers.go +7 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,13 @@ var routes = Routes{ ZoneSubPOST, }, Route{ "ZoneSubGET", strings.ToUpper("Post"), "/location/v2/subscriptions/zones/{subscriptionId}", ZoneSubGET, }, Route{ "ZonalTrafficSubPOST", strings.ToUpper("Post"), Loading Loading
go-apps/meep-loc-serv/server/api_location.go +3 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,9 @@ func ZoneSubListGET(w http.ResponseWriter, r *http.Request) { func ZoneSubPOST(w http.ResponseWriter, r *http.Request) { zoneSubPOST(w, r) } func ZoneSubGET(w http.ResponseWriter, r *http.Request) { zoneSubGET(w, r) } func ZonalTrafficSubPOST(w http.ResponseWriter, r *http.Request) { zonalTrafficSubPost(w, r) Loading
go-apps/meep-loc-serv/server/loc-serv.go +40 −0 Original line number Diff line number Diff line Loading @@ -3785,6 +3785,46 @@ func zonalTrafficSubGet(w http.ResponseWriter, r *http.Request) { fmt.Fprint(w, string(jsonResponse)) } func zoneSubGET(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) var response interface{} jsonZonalTrafficSub, _ := rc.JSONGetEntry(baseKey+typeZonalSubscription+":"+vars["subscriptionId"], ".") if jsonZonalTrafficSub != "" { var jsonZoneSub ZoneLocationEventSubscription if err := json.Unmarshal([]byte(jsonZonalTrafficSub), &jsonZoneSub); err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } response = InlineZoneLocationEventSubscription{ZoneLocationEventSubscription: &jsonZoneSub} } else { var statusSub ZoneStatusSubscription jsonZoneStatusSub, _ := rc.JSONGetEntry(baseKey+typeZoneStatusSubscription+":"+vars["subscriptionId"], ".") if jsonZoneStatusSub == "" { w.WriteHeader(http.StatusNotFound) return } if err := json.Unmarshal([]byte(jsonZoneStatusSub), &statusSub); err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } response = InlineZoneStatusSubscription{ZoneStatusSubscription: &statusSub} } jsonResponse, err := json.Marshal(response) if err != nil { log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) fmt.Fprint(w, string(jsonResponse)) } func zoneSubPOST(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") var response InlineZoneStatusSubscription Loading
go-apps/meep-loc-serv/server/routers.go +7 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,13 @@ var routes = Routes{ ZoneSubPOST, }, Route{ "ZoneSubGET", strings.ToUpper("Post"), "/location/v2/subscriptions/zones/{subscriptionId}", ZoneSubGET, }, Route{ "ZonalTrafficSubPOST", strings.ToUpper("Post"), Loading