Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions libjava/lib/src/main/java/com/mapbox/services/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@

public class Constants {

/**
* Package version
*/
public final static String MAPBOX_JAVA_VERSION = "2.0.0-SNAPSHOT";

/**
* User agent for HTTP requests
*/
public final static String HEADER_USER_AGENT =
String.format(Locale.US, "MapboxJava/%s", MAPBOX_JAVA_VERSION);

/**
* Base URL for all API calls, not hardcoded to enable testing
*/
public final static String BASE_API_URL = "https://api.mapbox.com";

/**
* Constants for polyline encoding/decoding
*/
public final static int GOOGLE_PRECISION = 5;
public final static int OSRM_PRECISION_V4 = 6;
public final static int OSRM_PRECISION_V5 = 5;

/**
* Default user for services
*/
public final static String MAPBOX_USER = "mapbox";

/**
* Mapbox default styles
* https://www.mapbox.com/developers/api/styles/
*/
public final static String MAPBOX_STYLE_STREETS = "streets-v9";
public final static String MAPBOX_STYLE_LIGHT = "light-v9";
public final static String MAPBOX_STYLE_DARK = "dark-v9";
public final static String MAPBOX_STYLE_OUTDOORS = "outdoors-v9";
public final static String MAPBOX_STYLE_SATELLITE = "satellite-v9";
public final static String MAPBOX_STYLE_SATELLITE_HYBRID = "satellite-streets-v9";
/**
* Package version
*/
public static final String MAPBOX_JAVA_VERSION = "2.0.0-SNAPSHOT";

/**
* User agent for HTTP requests
*/
public static final String HEADER_USER_AGENT =
String.format(Locale.US, "MapboxJava/%s", MAPBOX_JAVA_VERSION);

/**
* Base URL for all API calls, not hardcoded to enable testing
*/
public static final String BASE_API_URL = "https://api.mapbox.com";

/**
* Constants for polyline encoding/decoding
*/
public static final int GOOGLE_PRECISION = 5;
public static final int OSRM_PRECISION_V4 = 6;
public static final int OSRM_PRECISION_V5 = 5;

/**
* Default user for services
*/
public static final String MAPBOX_USER = "mapbox";

/**
* Mapbox default styles
* https://www.mapbox.com/developers/api/styles/
*/
public static final String MAPBOX_STYLE_STREETS = "streets-v9";
public static final String MAPBOX_STYLE_LIGHT = "light-v9";
public static final String MAPBOX_STYLE_DARK = "dark-v9";
public static final String MAPBOX_STYLE_OUTDOORS = "outdoors-v9";
public static final String MAPBOX_STYLE_SATELLITE = "satellite-v9";
public static final String MAPBOX_STYLE_SATELLITE_HYBRID = "satellite-streets-v9";

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,98 +8,98 @@
*/
public final class DirectionsCriteria {

/**
* For car and motorcycle routing. This profile shows the fastest routes by preferring
* high-speed roads like highways.
*
* @since 1.0.0
*/
public static final String PROFILE_DRIVING = "mapbox.driving";
/**
* For car and motorcycle routing. This profile shows the fastest routes by preferring
* high-speed roads like highways.
*
* @since 1.0.0
*/
public static final String PROFILE_DRIVING = "mapbox.driving";

/**
* For pedestrian and hiking routing. This profile shows the shortest path by using sidewalks
* and trails.
*
* @since 1.0.0
*/
public static final String PROFILE_WALKING = "mapbox.walking";
/**
* For pedestrian and hiking routing. This profile shows the shortest path by using sidewalks
* and trails.
*
* @since 1.0.0
*/
public static final String PROFILE_WALKING = "mapbox.walking";

/**
* For bicycle routing. This profile shows routes that are short and safe for cyclist, avoiding
* highways and preferring streets with bike lanes.
*
* @since 1.0.0
*/
public static final String PROFILE_CYCLING = "mapbox.cycling";
/**
* For bicycle routing. This profile shows routes that are short and safe for cyclist, avoiding
* highways and preferring streets with bike lanes.
*
* @since 1.0.0
*/
public static final String PROFILE_CYCLING = "mapbox.cycling";

/**
* Format to return route instructions will be text.
*
* @since 1.0.0
*/
public static final String INSTRUCTIONS_TEXT = "text";
/**
* Format to return route instructions will be text.
*
* @since 1.0.0
*/
public static final String INSTRUCTIONS_TEXT = "text";

/**
* Format to return route instructions will be html.
*
* @since 1.0.0
*/
public static final String INSTRUCTIONS_HTML = "html";
/**
* Format to return route instructions will be html.
*
* @since 1.0.0
*/
public static final String INSTRUCTIONS_HTML = "html";

/**
* Format to return route geometry will be geojson.
*
* @since 1.0.0
*/
public static final String GEOMETRY_GEOJSON = "geojson";
/**
* Format to return route geometry will be geojson.
*
* @since 1.0.0
*/
public static final String GEOMETRY_GEOJSON = "geojson";

/**
* Format to return route geometry will be encoded polyline.
*
* @since 1.0.0
*/
public static final String GEOMETRY_POLYLINE = "polyline";
/**
* Format to return route geometry will be encoded polyline.
*
* @since 1.0.0
*/
public static final String GEOMETRY_POLYLINE = "polyline";

/**
* Use false to omit geometry from response.
*
* @since 1.0.0
*/
public static final String GEOMETRY_FALSE = "false";
/**
* Use false to omit geometry from response.
*
* @since 1.0.0
*/
public static final String GEOMETRY_FALSE = "false";

/**
* Normal case
*
* @since 1.0.0
*/
public final static String RESPONSE_OK = "Ok";
/**
* Normal case
*
* @since 1.0.0
*/
public static final String RESPONSE_OK = "Ok";

/**
* The input did not produce any matches. Features will be an empty array.
*
* @since 1.0.0
*/
public final static String RESPONSE_NO_MATCH = "NoMatch";
/**
* The input did not produce any matches. Features will be an empty array.
*
* @since 1.0.0
*/
public static final String RESPONSE_NO_MATCH = "NoMatch";

/**
* There are more than 100 points in the request.
*
* @since 1.0.0
*/
public final static String RESPONSE_TOO_MANY_COORDINATES = "TooManyCoordinates";
/**
* There are more than 100 points in the request.
*
* @since 1.0.0
*/
public static final String RESPONSE_TOO_MANY_COORDINATES = "TooManyCoordinates";

/**
* message will hold an explanation of the invalid input.
*
* @since 1.0.0
*/
public final static String RESPONSE_INVALID_INPUT = "InvalidInput";
/**
* message will hold an explanation of the invalid input.
*
* @since 1.0.0
*/
public static final String RESPONSE_INVALID_INPUT = "InvalidInput";

/**
* Profile should be mapbox.driving, mapbox.walking, or mapbox.cycling.
*
* @since 1.0.0
*/
public final static String RESPONSE_PROFILE_NOT_FOUND = "ProfileNotFound";
/**
* Profile should be mapbox.driving, mapbox.walking, or mapbox.cycling.
*
* @since 1.0.0
*/
public static final String RESPONSE_PROFILE_NOT_FOUND = "ProfileNotFound";

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@
*/
public interface DirectionsService {

/**
* Call-based interface
*
* @param userAgent The user.
* @param profile The profile directions should use.
* @param waypoints The waypoints the route should follow.
* @param accessToken Mapbox access token.
* @param alternatives Define whether you want to recieve more then one route.
* @param instructions Define if you'd like to recieve route instructions.
* @param geometry Route geometry.
* @param steps Define if you'd like the route steps.
* @return A retrofit Call object
* @since 1.0.0
*/
@GET("v4/directions/{profile}/{waypoints}.json")
Call<DirectionsResponse> getCall(
@Header("User-Agent") String userAgent,
@Path("profile") String profile,
@Path("waypoints") String waypoints,
@Query("access_token") String accessToken,
@Query("alternatives") Boolean alternatives,
@Query("instructions") String instructions,
@Query("geometry") String geometry,
@Query("steps") Boolean steps
);
/**
* Call-based interface
*
* @param userAgent The user.
* @param profile The profile directions should use.
* @param waypoints The waypoints the route should follow.
* @param accessToken Mapbox access token.
* @param alternatives Define whether you want to recieve more then one route.
* @param instructions Define if you'd like to recieve route instructions.
* @param geometry Route geometry.
* @param steps Define if you'd like the route steps.
* @return A retrofit Call object
* @since 1.0.0
*/
@GET("v4/directions/{profile}/{waypoints}.json")
Call<DirectionsResponse> getCall(
@Header("User-Agent") String userAgent,
@Path("profile") String profile,
@Path("waypoints") String waypoints,
@Query("access_token") String accessToken,
@Query("alternatives") Boolean alternatives,
@Query("instructions") String instructions,
@Query("geometry") String geometry,
@Query("steps") Boolean steps
);
}
Loading