mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-14 09:13:28 +00:00
added first succefull post request method on postGeoObject endpoint
This commit is contained in:
@@ -7,32 +7,35 @@ func armatak_service_ManageAPI_getHelp() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func armatak_service_ManageGeoObject_postGeoObject(args []string) (string, error) {
|
func armatak_service_ManageGeoObject_postGeoObject(args []string) (string, error) {
|
||||||
longitude, longitudeError := strconv.ParseFloat(args[1], 32)
|
sanitazeArgs(args)
|
||||||
|
|
||||||
if longitudeError != nil {
|
latitude, latitudeError := strconv.ParseFloat(args[1], 32)
|
||||||
return "", longitudeError
|
|
||||||
}
|
|
||||||
|
|
||||||
latitude, latitudeError := strconv.ParseFloat(args[2], 32)
|
|
||||||
|
|
||||||
if latitudeError != nil {
|
if latitudeError != nil {
|
||||||
return "", latitudeError
|
return "", latitudeError
|
||||||
}
|
}
|
||||||
|
|
||||||
bearing, bearingError := strconv.Atoi(args[3])
|
longitude, longitudeError := strconv.ParseFloat(args[2], 32)
|
||||||
|
|
||||||
|
if longitudeError != nil {
|
||||||
|
return "", longitudeError
|
||||||
|
}
|
||||||
|
|
||||||
|
bearing, bearingError := strconv.ParseFloat(args[4], 32)
|
||||||
|
|
||||||
if bearingError != nil {
|
if bearingError != nil {
|
||||||
return "", bearingError
|
return "", bearingError
|
||||||
}
|
}
|
||||||
|
|
||||||
payload := GeoObject{
|
payload := GeoObject{
|
||||||
UID: args[0],
|
Longitude: longitude,
|
||||||
Longitude: float32(longitude),
|
Latitude: latitude,
|
||||||
Latitude: float32(latitude),
|
Attitude: args[3],
|
||||||
Attitude: "friendly",
|
Bearing: int(bearing),
|
||||||
Bearing: bearing,
|
GeoObject: args[5],
|
||||||
GeoObject: args[4],
|
How: "nonCoT",
|
||||||
Name: args[5],
|
Name: args[6],
|
||||||
|
Timeout: 600,
|
||||||
}
|
}
|
||||||
|
|
||||||
return postRequest("http://localhost:3000/ManageGeoObject/postGeoObject", payload)
|
return postRequest("http://localhost:3000/ManageGeoObject/postGeoObject", payload)
|
||||||
|
|||||||
Reference in New Issue
Block a user