mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 18:44:26 +00:00
Commit from m3o/m3o action
This commit is contained in:
@@ -4,6 +4,42 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/location/api](
|
||||
|
||||
Endpoints:
|
||||
|
||||
## Save
|
||||
|
||||
Save an entity's current position
|
||||
|
||||
|
||||
[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save)
|
||||
|
||||
```go
|
||||
package example
|
||||
|
||||
import(
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.m3o.com/location"
|
||||
)
|
||||
|
||||
// Save an entity's current position
|
||||
func SaveAnEntity() {
|
||||
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
|
||||
rsp, err := locationService.Save(&location.SaveRequest{
|
||||
Entity: &location.Entity{
|
||||
Id: "1",
|
||||
Location: &location.Point{
|
||||
Latitude: 51.511061,
|
||||
Longitude: -0.120022,
|
||||
Timestamp: 1622802761,
|
||||
},
|
||||
Type: "bike",
|
||||
},
|
||||
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
|
||||
}
|
||||
```
|
||||
## Read
|
||||
|
||||
Read an entity by its ID
|
||||
@@ -66,39 +102,3 @@ Type: "bike",
|
||||
|
||||
}
|
||||
```
|
||||
## Save
|
||||
|
||||
Save an entity's current position
|
||||
|
||||
|
||||
[https://m3o.com/location/api#Save](https://m3o.com/location/api#Save)
|
||||
|
||||
```go
|
||||
package example
|
||||
|
||||
import(
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.m3o.com/location"
|
||||
)
|
||||
|
||||
// Save an entity's current position
|
||||
func SaveAnEntity() {
|
||||
locationService := location.NewLocationService(os.Getenv("M3O_API_TOKEN"))
|
||||
rsp, err := locationService.Save(&location.SaveRequest{
|
||||
Entity: &location.Entity{
|
||||
Id: "1",
|
||||
Location: &location.Point{
|
||||
Latitude: 51.511061,
|
||||
Longitude: -0.120022,
|
||||
Timestamp: 1622802761,
|
||||
},
|
||||
Type: "bike",
|
||||
},
|
||||
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user