-
Notifications
You must be signed in to change notification settings - Fork 2
Home
To get started with the SDK you have to import the package:
import "https://github.com/route4me/route4me-go-sdk"
After doing so, you can execute go get ./...
to download the source code.
The root package name is route4me
.
The first step to start using Route4Me Go SDK is to create a client.
The default demo API Key 11111111111111111111111111111111 only permits you to test and optimize routes using a predefined list of lat/lng coordinates.
client := &route4me.NewClient("11111111111111111111111111111111")
client := &route4me.NewClientWithOptions("11111111111111111111111111111111", time.Minute*10, route4me.BaseURL)
The client does nothing on it's own, you will need it to construct Services which are mentioned below.
SDK is divided into sub-packages, where each subpackage is a service. Each service is responsible for controlling different part of Route4Me infrastructure.
You will probably rely on the routing
service most of the time, it allows you to work with Optimizations and Routes.
Let's create a Service instance.
import (
"github.com/route4me/route4me-go-sdk"
"github.com/route4me/route4me-go-sdk/routing"
)
func main() {
client := route4me.NewClient("11111111111111111111")
service := &routing.Service{Client: client}
//do something with the service
}
Most of the time any function associated with the Service takes *Query instance as a parameter.
For instance: routing.GetRoute(*RouteQuery)
You can read more about each service by clicking appropriate links in the sidebar.
Look at _test.go files, they contain basic use-case examples for specific services.
- 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