-
Notifications
You must be signed in to change notification settings - Fork 2
Activity Service
Activity service let's you fetch events associated routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
}
In order to fetch activities of a specific route you need to know it's route-id
.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{RouteID:"route-id"})
if err != nil {
t.Error(err)
}
//do something with activities, it's []Activity
}
In order to fetch activities of a specific route you need to know it's route-id
. To fetch activities that happened after specific timestamp Start
parameter has to be applied to activity.Query
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(
&activity.Query{
RouteID:"route-id",
Start: 1495238400, //Start is a timestamp
}
}
if err != nil {
t.Error(err)
}
//do something with activities, it's []Activity
}
This example demonstrates how to permanently store a specific message directly to the activity feed. For example, this can be used for one or two-way chat.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
err := service.Log("Message", "ROUTE_ID")
if err != nil {
// handle error
}
// success!
}
GET area added activities.
Area refers to a geographic territory, which can be added as a territory or as an avoidance zone for route planning
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.AreaAdded})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET area removed activities.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.AreaRemoved})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET area updated activities.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.AreaUpdated})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination deleted activities.
Destination refers to a point on a route or address, it is where the driver should drive the vehicle. It has sequence numbers within the route
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.DeleteDestination})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination out of sequence activities (events).
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.DestinationOutSequence})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET driver arrived early activities (events).
Driver refers to a person who is assigned to a vehicle by the user to drive that vehicle on routes defined by that user
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.DriverArrivedEarly})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET driver arrived late activities (events).
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.DriverArrivedLate})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET driver arrived on time activities (events).
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.DriverArrivedOnTime})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET geofence entered activities (events).
A geo-fence is a virtual perimeter for a real-world geographic area. A geo-fence could be a radius around a store or point location, or a geo-fence can be a predefined set of boundaries, like school attendance zones or neighborhood boundaries. Geo-fencing allows a user to set up triggers so when a device enters (or exits) the boundaries defined by that user, a text message or email alert is sent.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.GeofenceEntered})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET geofence left activities (events).
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.GeofenceLeft})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination inserted activities (events) from a certain route.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.InsertDestination, RouteID: "5C15E83A4BE005BCD1537955D28D51D7"})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination inserted activities (events) from all routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.InsertDestination})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination marked as departed activities (events) from a certain route.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.MarkDestinationDeparted, RouteID: "5C15E83A4BE005BCD1537955D28D51D7"})
if err != nil {
// handle error
}
}
GET destination marked as departed activities (events) from all routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.MarkDestinationDeparted})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination marked as visited activities (events) from all routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.MarkDestinationVisited})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET member created activities (events).
Member refers to a registered user of Route4Me's API who has their own programming environment in our system (access to API endpoints, routes, address books, etc.)
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.MemberCreated})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET member deleted activities (events).
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.MemberDeleted})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET member modified activities (events).
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.MemberModified})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination moved to other route activities (events) from all routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.MoveDestination})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET note inserted activities (events) from a certain route.
Note refers to a text attached to a certain route or address
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.NoteInsert, RouteID: "5C15E83A4BE005BCD1537955D28D51D7"})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET note inserted activities (events) from all routes
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.NoteInsert})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET route deleted activities (events) from all routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.RouteDelete})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET route optimized activities (events) from all routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.RouteOptimized})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET route owner changed activities (events) from a certain route
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.RouteOptimized, RouteID: "5C15E83A4BE005BCD1537955D28D51D7"})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET destination updated activities (events) from all routes.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.UpdateDestinations})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
GET all messages send activities
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{Type: service.UserMessage})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
The example refers to the process of getting all recorded activities associated not only with a specific Route4Me account, but also with other users of a member’s team.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/activity"
)
func main() {
client := route4me.NewClient("your-api-key")
service := &activity.Service{Client: client}
activities, err := service.Get(&activity.Query{
Team: true,
RouteID: "06B655F27E0D6A74BD37F6F9758E4D2E",
})
if err != nil {
// handle error
}
// do something with activities, it's []Activity
}
You can look at service's test file for more implementation details.
- Activity
- Addressbook
- Routing
- Single Driver Route 10 Stops
- Single Driver Round Trip
- Single Depot Multiple Driver No Time Windows
- Single Depot Multiple Driver Time Windows
- Multiple Depot Multiple Driver
- Multiple Depot Multiple Driver With Time Windows
- Multiple Depot Multiple Driver With Time Windows (24 Stops)
- Tracking
- Geocoding
- Users
- Territories
- Orders
- Vehicles
- Telematics