new Pathfinder(url, applicationIdentifier, userCredentials)
Represents a pathfinder application. This object can be used
to query cluster data or request commodity transit.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | WebSocket url to the Pathfinder service |
applicationIdentifier |
string | The application identifier for your Pathfinder application |
userCredentials |
string | Unique key from google id toolkit TODO figure out exactly what this is |
- Source:
Methods
close()
Closes the Pathfinder service's WebSocket
- Source:
createCluster(callback)
Creates a cluster.
Parameters:
Name | Type | Description |
---|---|---|
callback |
Pathfinder~createClusterCallback | The callback that handles the response |
- Source:
createCommodity(startLat, startLong, endLat, endLong, param, status, clusterId, callback)
Creates a commodity
Parameters:
Name | Type | Description |
---|---|---|
startLat |
number | The starting latitude of the commodity |
startLong |
number | The starting longitude of the commodity |
endLat |
number | The ending latitude of the commodity |
endLong |
number | The ending longitude of the commodity |
param |
number | The capacity taken up by the commodity |
status |
string | The status of the commodity |
clusterId |
number | The cluster the commodity will be created under |
callback |
Pathfinder~createCommodityCallback | The callback that handles the response |
- Source:
createTransport(latitude, longitude, capacity, status, clusterId, callback)
Creates a transport.
Parameters:
Name | Type | Description |
---|---|---|
latitude |
number | The current latitude of the transport |
longitude |
number | The current longitude of the transport |
capacity |
number | The capacity of the transport |
status |
string | The status of the transport |
clusterId |
number | The cluster the transport will be created under |
callback |
Pathfinder~createTransportCallback | The callback that handles the response |
- Source:
deleteCluster(id, callback)
Deletes a cluster with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the cluster to be deleted |
callback |
Pathfinder~deleteClusterCallback | The callback that handles the response |
- Source:
deleteCommodity(id, callback)
Deletes a commodity with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the commodity to be deleted |
callback |
Pathfinder~deleteCommodityCallback | The callback that handles the response |
- Source:
deleteTransport(id, callback)
Deletes a transport with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the transport to be deleted |
callback |
Pathfinder~deleteTransportCallback | The callback that handles the response |
- Source:
getCluster(id, callback)
Gets a cluster with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
The id of the cluster to retrieve | |
callback |
Pathfinder~getClusterCallback | The callback that handles the response |
- Source:
getCommodity(id, callback)
Gets a commodity with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
The id of the commodity to retrieve | |
callback |
Pathfinder~getCommodityCallback | The callback that handles the response |
- Source:
getDefaultClusterId(callback)
Gets the default cluster id for the specific application.
Parameters:
Name | Type | Description |
---|---|---|
callback |
Pathfinder~getDefaultClusterIdCallback | A callback that handles the response |
- Source:
getTransport(id, callback)
Gets a transport with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
The id of the transport to retrieve | |
callback |
Pathfinder~getTransportCallback | The callback that handles the response |
- Source:
routeCluster(id, callback)
Gets the routes for a cluster with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the cluster to get the routes for |
callback |
Pathfinder~routeClusterCallback | The callback that handles the response |
- Source:
routeCommodity(id, callback)
Gets the route for a commodity with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the commodity to get the route for |
callback |
Pathfinder~routeCommodityCallback | The callback that handles the response |
- Source:
routeTransport(id, callback)
Gets the route for a transport with the specified id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the transport to get the route for |
callback |
Pathfinder~routeTransportCallback | The callback that handles the response |
- Source:
updateCommodity(startLat, startLong, endLat, endLong, param, status, id, callback)
Updates a commodity. Use null for any parameter that should not change.
Parameters:
Name | Type | Description |
---|---|---|
startLat |
number | The starting latitude of the commodity |
startLong |
number | The starting longitude of the commodity |
endLat |
number | The ending latitude of the commodity |
endLong |
number | The ending longitude of the commodity |
param |
number | The capacity taken up by the commodity |
status |
string | The status of the commodity |
id |
number | The id of the commodity to be updated |
callback |
Pathfinder~updateCommodityCallback | The callback that handles the response |
- Source:
updateTransport(lat, long, capacity, status, id, callback)
Updates a transport. Use null for any parameter that should not be updated.
Parameters:
Name | Type | Description |
---|---|---|
lat |
number | The current latitude of the transport |
long |
number | The current longitude of the transport |
capacity |
number | The capacity of the transport |
status |
string | The status of the transport |
id |
number | The id of the transport to be updated |
callback |
Pathfinder~updateTransportCallback | The callback that handles the response |
- Source:
Type Definitions
createClusterCallback(cluster)
This callback is called after the createCluster function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
cluster |
PFCluster | The newly created cluster |
- Source:
createCommodityCallback(commodity)
This callback is called after the createCommodity function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
commodity |
PFCommodity | The newly created commodity |
- Source:
createTransportCallback(transport)
This callback is called after the createTransport function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
transport |
PFTransport | The newly created transport |
- Source:
deleteClusterCallback(cluster)
This callback is called after the deleteCluster function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
cluster |
PFCluster | The deleted cluster |
- Source:
deleteCommodityCallback(cluster)
This callback is called after the deleteCommodity function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
cluster |
PFCommodity | The deleted commodity |
- Source:
deleteTransportCallback(transport)
This callback is called after the deleteTransport function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
transport |
PFTransport | The deleted transport |
- Source:
getClusterCallback(cluster)
This callback is called after the getCluster function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
cluster |
PFCluster | The cluster received |
- Source:
getCommodityCallback(commodity)
This callback is called after the getCommodity function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
commodity |
PFCommodity | The commodity received |
- Source:
getDefaultClusterIdCallback(clusterId)
This callback is called after the getDefaultClusterId function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
clusterId |
number | The default cluster id |
- Source:
getTransportCallback(transport)
This callback is called after the getTransport function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
transport |
PFTransport | The transport received |
- Source:
routeClusterCallback(routes)
This callback is called after the routeCluster function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
routes |
object | The routes received |
- Source:
routeCommodityCallback(route)
This callback is called after the routeCommodity function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
route |
object | The route received |
- Source:
routeTransportCallback(route)
This callback is called after the routeTransport function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
route |
object | The route received |
- Source:
updateCommodityCallback(commodity)
This callback is called after the updateCommodity function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
commodity |
PFCommodity | The updated commodity |
- Source:
updateTransportCallback(transport)
This callback is called after the updateTransport function receives a response.
Parameters:
Name | Type | Description |
---|---|---|
transport |
PFTransport | The updated transport |
- Source: