DirectionsResponse

@Serializable
data class DirectionsResponse(val code: String, val routes: List<DirectionsRoute>, val message: String? = null, val waypoints: List<DirectionsWaypoint>? = null, val uuid: String? = null)

This is the root Mapbox Directions API response. Inside this class are several nested classes chained together to make up a similar structure to the original APIs JSON response.

Since

1.0.0

See also

Constructors

Link copied to clipboard
constructor(code: String, routes: List<DirectionsRoute>, message: String? = null, waypoints: List<DirectionsWaypoint>? = null, uuid: String? = null)

Types

Link copied to clipboard
class Builder(code: String, routes: List<DirectionsRoute>)

Builder class for creating DirectionsResponse instances.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

String indicating the state of the response. This is a separate code than the HTTP status code. On normal valid responses, the value will be Ok. The possible responses are listed below:

Link copied to clipboard
val message: String? = null

Optionally shows up in a directions response if an error or something unexpected occurred.

Link copied to clipboard

List containing all the different route options. It's ordered by descending recommendation rank. In other words, object 0 in the List is the highest recommended route. if you don't setAlternatives to true (default is false) in your builder this should always be a List of size 1. At most this will return 2 DirectionsRoute objects.

Link copied to clipboard
val uuid: String? = null

A universally unique identifier (UUID) for identifying and executing a similar specific route in the future.

Link copied to clipboard

List of DirectionsWaypoint objects. Each waypoint is an input coordinate snapped to the road and path network. The waypoint appear in the list in the order of the input coordinates.

Functions

Link copied to clipboard

Creates a builder initialized with the current values of the DirectionsResponse instance.

Link copied to clipboard
fun toJson(): String